Commit f1e9fd1f authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

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


(cherry picked from commit f984425b)
parent 913c80eb
Pipeline #151585 passed with stage
in 10 minutes and 32 seconds
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment