From 5c6059fbd30365dbd036db556a38019fd7a84872 Mon Sep 17 00:00:00 2001 From: Alexander Bikadorov Date: Wed, 16 Nov 2016 16:39:40 +0100 Subject: FIXED: [ 372231 ] Added KDE's service actions again to right-click popup menu BUG: 372231 KFileItemActions::addServiceActionsTo() is not deprecated so we should continue using it like before. --- krusader/Panel/krpopupmenu.cpp | 22 ++++++++-------------- krusader/Panel/krpopupmenu.h | 2 +- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/krusader/Panel/krpopupmenu.cpp b/krusader/Panel/krpopupmenu.cpp index 7eac4a9..bfb33d1 100644 --- a/krusader/Panel/krpopupmenu.cpp +++ b/krusader/Panel/krpopupmenu.cpp @@ -63,9 +63,8 @@ void KrPopupMenu::run(const QPoint &pos, KrPanel *panel) /** * Copied from dolphin/src/dolphincontextmenu.cpp and modified to add only compress and extract submenus. */ -bool KrPopupMenu::addCompressAndExtractPluginActions() +void KrPopupMenu::addCompressAndExtractPluginActions() { - KFileItemListProperties props(_items); QVector jsonPlugins = KPluginLoader::findPlugins("kf5/kfileitemaction", @@ -81,8 +80,6 @@ bool KrPopupMenu::addCompressAndExtractPluginActions() addActions(abstractPlugin->actions(props, this)); } } - - return !jsonPlugins.isEmpty(); } KrPopupMenu::KrPopupMenu(KrPanel *thePanel, QWidget *parent) : QMenu(parent), panel(thePanel), empty(false), @@ -189,16 +186,13 @@ KrPopupMenu::KrPopupMenu(KrPanel *thePanel, QWidget *parent) : QMenu(parent), pa uAct->setText(i18n("User Actions")); // add compress and extract plugins (if available) - bool success = addCompressAndExtractPluginActions(); - - /* - * When KF 5.25 is adopted by all distros, we can remove these 2 lines (and corresponding code) - * because since KF 5.25 compress and extract submenus are standalone plugins. - */ - if (!success) { - fileItemActions.setItemListProperties(KFileItemListProperties(_items)); - fileItemActions.addServiceActionsTo(this); - } + addCompressAndExtractPluginActions(); + + // NOTE: design and usability problem here. Services disabled in kservicemenurc settings won't + // be added to the menu. But Krusader does not provide a way do change these settings (only + // Dolphin does). + fileItemActions.setItemListProperties(KFileItemListProperties(_items)); + fileItemActions.addServiceActionsTo(this); addSeparator(); diff --git a/krusader/Panel/krpopupmenu.h b/krusader/Panel/krpopupmenu.h index 2d16818..b20dcf8 100644 --- a/krusader/Panel/krpopupmenu.h +++ b/krusader/Panel/krpopupmenu.h @@ -44,7 +44,7 @@ protected: void performAction(int id); void addEmptyMenuEntries(); // adds the choices for a menu without selected items void addCreateNewMenu(); // adds a "create new" submenu - bool addCompressAndExtractPluginActions(); // adds various plugin actions + void addCompressAndExtractPluginActions(); // adds various plugin actions enum ID { OPEN_ID, -- cgit v0.11.2