Verified Commit 01a74949 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Fix context menu actions for KCMs

Needs systemsettings@c815c7a9

Currently the logic is very fragile and depends on the data being an url.
However the data of the match is an implementation detail and is in case of the KCM matches
a KPluginMetaData instance.

To avoid this issue the first url of the QueryMatch::urls() return value is checked.
This data is intended for mime-type/scheme related operations.

In the future we need an extra url for systemsettings & should consistently use the
urls of the query match. I will work on this before continuing to port the
plasma KCMs from KServiceTypeTrader.

BUG: 442522
parent 53cff6f1
......@@ -86,7 +86,11 @@ QVariant RunnerMatchesModel::data(const QModelIndex &index, int role) const
return actionList;
}
const QUrl dataUrl(match.data().toUrl());
QUrl dataUrl(match.data().toUrl());
if (dataUrl.isEmpty() && !match.urls().isEmpty()) {
// needed for systemsettigs runner
dataUrl = match.urls().constFirst();
}
if (dataUrl.scheme() != QLatin1String("applications")) {
return actionList;
}
......@@ -162,7 +166,11 @@ bool RunnerMatchesModel::trigger(int row, const QString &actionId, const QVarian
QObject *appletInterface = static_cast<RunnerModel *>(parent())->appletInterface();
const KService::Ptr service = KService::serviceByStorageId(match.data().toUrl().toString(QUrl::RemoveScheme));
KService::Ptr service = KService::serviceByStorageId(match.data().toUrl().toString(QUrl::RemoveScheme));
if (!service && !match.urls().isEmpty()) {
// needed for systemsettigs runner
service = KService::serviceByStorageId(match.urls().constFirst().toString(QUrl::RemoveScheme));
}
if (Kicker::handleAddLauncherAction(actionId, appletInterface, service)) {
return false; // We don't want to close Kicker, BUG: 390585
......
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