Popupmenu: use KIO 5.27's new addPluginActionsTo method

REVIEW: 129085
This commit is contained in:
David Faure 2016-10-02 21:03:01 +02:00
parent 345e3e7a82
commit f54174f9f6
2 changed files with 10 additions and 4 deletions

View file

@ -34,6 +34,7 @@
#include <KIO/EmptyTrashJob> #include <KIO/EmptyTrashJob>
#include <KIO/JobUiDelegate> #include <KIO/JobUiDelegate>
#include <KIO/Paste> #include <KIO/Paste>
#include <kio_version.h>
#include <KJobWidgets> #include <KJobWidgets>
#include <KMimeTypeTrader> #include <KMimeTypeTrader>
#include <KNewFileMenu> #include <KNewFileMenu>
@ -283,7 +284,7 @@ void DolphinContextMenu::openItemContextMenu()
fileItemActions.setItemListProperties(selectedItemsProps); fileItemActions.setItemListProperties(selectedItemsProps);
addServiceActions(fileItemActions); addServiceActions(fileItemActions);
addFileItemPluginActions(); addFileItemPluginActions(fileItemActions);
addVersionControlPluginActions(); addVersionControlPluginActions();
@ -355,7 +356,7 @@ void DolphinContextMenu::openViewportContextMenu()
fileItemActions.setItemListProperties(baseUrlProperties); fileItemActions.setItemListProperties(baseUrlProperties);
addServiceActions(fileItemActions); addServiceActions(fileItemActions);
addFileItemPluginActions(); addFileItemPluginActions(fileItemActions);
addVersionControlPluginActions(); addVersionControlPluginActions();
@ -483,8 +484,12 @@ void DolphinContextMenu::addServiceActions(KFileItemActions& fileItemActions)
fileItemActions.addServiceActionsTo(this); fileItemActions.addServiceActionsTo(this);
} }
void DolphinContextMenu::addFileItemPluginActions() void DolphinContextMenu::addFileItemPluginActions(KFileItemActions& fileItemActions)
{ {
#if KIO_VERSION >= QT_VERSION_CHECK(5, 27, 0)
fileItemActions.addPluginActionsTo(this);
#else
Q_UNUSED(fileItemActions);
KFileItemListProperties props; KFileItemListProperties props;
if (m_selectedItems.isEmpty()) { if (m_selectedItems.isEmpty()) {
props.setItems(KFileItemList() << baseFileItem()); props.setItems(KFileItemList() << baseFileItem());
@ -550,6 +555,7 @@ void DolphinContextMenu::addFileItemPluginActions()
addedPlugins << jsonMetadata.pluginId(); addedPlugins << jsonMetadata.pluginId();
} }
} }
#endif
} }
void DolphinContextMenu::addVersionControlPluginActions() void DolphinContextMenu::addVersionControlPluginActions()

View file

@ -126,7 +126,7 @@ private:
/** /**
* Adds actions that are provided by a KFileItemActionPlugin. * Adds actions that are provided by a KFileItemActionPlugin.
*/ */
void addFileItemPluginActions(); void addFileItemPluginActions(KFileItemActions& fileItemActions);
/** /**
* Adds actions that are provided by a KVersionControlPlugin. * Adds actions that are provided by a KVersionControlPlugin.