applets/kicker: Skip creating KService for non-desktop files or folders

When creating a new KService, it will try to read the file as a desktop
file, but if the file is a large non-desktop file, it will hang for a
long time.

Verify the file is a desktop file, and if not, skip creating KService
and run the match directly.

BUG: 442970
FIXED-IN: 5.24.4
wilder-5.25
Fushan Wen 4 years ago
parent d09854cbc0
commit f984425b65
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA
  1. 42
      applets/kicker/plugin/runnermatchesmodel.cpp

@ -166,6 +166,28 @@ bool RunnerMatchesModel::trigger(int row, const QString &actionId, const QVarian
return false;
}
// BUG 442970: Skip creating KService if there is no actionId, or the action is from a runner.
if (actionId.isEmpty() || actionId == QLatin1String("runnerAction")) {
if (!actionId.isEmpty()) {
QObject *obj = argument.value<QObject *>();
if (!obj) {
return false;
}
QAction *action = qobject_cast<QAction *>(obj);
if (!action) {
return false;
}
match.setSelectedAction(action);
}
m_runnerManager->run(match);
return true;
}
QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface();
KService::Ptr service = KService::serviceByStorageId(match.data().toUrl().toString(QUrl::RemoveScheme));
@ -189,25 +211,7 @@ bool RunnerMatchesModel::trigger(int row, const QString &actionId, const QVarian
return Kicker::handleRecentDocumentAction(service, actionId, argument);
}
if (!actionId.isEmpty()) {
QObject *obj = argument.value<QObject *>();
if (!obj) {
return false;
}
QAction *action = qobject_cast<QAction *>(obj);
if (!action) {
return false;
}
match.setSelectedAction(action);
}
m_runnerManager->run(match);
return true;
return false;
}
void RunnerMatchesModel::setMatches(const QList<Plasma::QueryMatch> &matches)

Loading…
Cancel
Save