diff --git a/globalaccel.h b/globalaccel.h --- a/globalaccel.h +++ b/globalaccel.h @@ -18,14 +18,14 @@ #ifndef GLOBALACCEL_H #define GLOBALACCEL_H -#include +#include #include class GlobalAccel { public: - static QKeySequence getMenuEntryShortcut(const QString &storageId); - static void changeMenuEntryShortcut(const QString &storageId, const QKeySequence &shortcut); + static QKeySequence getMenuEntryShortcut(const KService::Ptr service); + static void changeMenuEntryShortcut(const KService::Ptr service, const QKeySequence &shortcut); }; #endif // GLOBALACCEL_H diff --git a/globalaccel.cpp b/globalaccel.cpp --- a/globalaccel.cpp +++ b/globalaccel.cpp @@ -26,9 +26,8 @@ #include #include -void GlobalAccel::changeMenuEntryShortcut(const QString &storageId, const QKeySequence &shortcut) +void GlobalAccel::changeMenuEntryShortcut(const KService::Ptr service, const QKeySequence &shortcut) { - const KService::Ptr service = KService::serviceByStorageId(storageId); const QString desktopFile = QStringLiteral("%1.desktop").arg(service->desktopEntryName()); if (!KGlobalAccel::isComponentActive(desktopFile)) { @@ -47,9 +46,8 @@ } -QKeySequence GlobalAccel::getMenuEntryShortcut(const QString &storageId) +QKeySequence GlobalAccel::getMenuEntryShortcut(const KService::Ptr service) { - const KService::Ptr service = KService::serviceByStorageId(storageId); const QString desktopFile = QStringLiteral("%1.desktop").arg(service->desktopEntryName()); const QList shortcut = KGlobalAccel::self()->globalShortcut(desktopFile, QStringLiteral("_launch")); if (!shortcut.isEmpty()) { diff --git a/kconf_update/globalaccel.cpp b/kconf_update/globalaccel.cpp --- a/kconf_update/globalaccel.cpp +++ b/kconf_update/globalaccel.cpp @@ -65,7 +65,7 @@ KGlobalAccel::self()->setShortcut(&action, {}); KGlobalAccel::self()->removeAllShortcuts(&action); if (!shortcut.isEmpty() && !shortcut[0].isEmpty()) { - GlobalAccel::changeMenuEntryShortcut(storageId, shortcut[0]); + GlobalAccel::changeMenuEntryShortcut(KService::serviceByStorageId(storageId), shortcut[0]); } khotkeysrc.deleteGroup(groupName); khotkeysrc.deleteGroup(groupName + QStringLiteral("Actions")); diff --git a/menuinfo.cpp b/menuinfo.cpp --- a/menuinfo.cpp +++ b/menuinfo.cpp @@ -181,7 +181,7 @@ for (QStringList::ConstIterator it = s_deletedApps->constBegin(); it != s_deletedApps->constEnd(); ++it) { // The shorcut is deleted if we set a empty sequence - GlobalAccel::changeMenuEntryShortcut(*it, QKeySequence()); + GlobalAccel::changeMenuEntryShortcut(KService::serviceByStorageId(*it), QKeySequence()); } delete s_deletedApps; s_deletedApps = nullptr; @@ -324,7 +324,7 @@ dirty = false; } if (shortcutDirty) { - GlobalAccel::changeMenuEntryShortcut(service->storageId(), shortCut); + GlobalAccel::changeMenuEntryShortcut(service, shortCut); shortcutDirty = false; } } @@ -364,7 +364,7 @@ { if (!shortcutLoaded) { shortcutLoaded = true; - shortCut = GlobalAccel::getMenuEntryShortcut(service->storageId()); + shortCut = GlobalAccel::getMenuEntryShortcut(service); } return shortCut; }