Commit 4caa285c authored by David Faure's avatar David Faure

Add support for KAbstractFileItemActionPlugin. Requires kdelibs > 4.6.0.

parent edb8046f
......@@ -29,6 +29,7 @@
#include <kactioncollection.h>
#include <kdesktopfile.h>
#include <kfileitemactionplugin.h>
#include <kabstractfileitemactionplugin.h>
#include <kfileitemactions.h>
#include <kfileitemlistproperties.h>
#include <kfileplacesmodel.h>
......@@ -511,15 +512,17 @@ void DolphinContextMenu::addFileItemPluginActions()
continue;
}
// Old API (kdelibs-4.6.0 only)
KFileItemActionPlugin* plugin = service->createInstance<KFileItemActionPlugin>();
if (plugin == 0) {
continue;
if (plugin) {
plugin->setParent(m_popup);
m_popup->addActions(plugin->actions(props, m_mainWindow));
}
plugin->setParent(m_popup);
const QList<QAction*> actions = plugin->actions(props, m_mainWindow);
foreach (QAction* action, actions) {
m_popup->addAction(action);
// New API (kdelibs >= 4.6.1)
KAbstractFileItemActionPlugin* abstractPlugin = service->createInstance<KAbstractFileItemActionPlugin>();
if (abstractPlugin) {
abstractPlugin->setParent(m_popup);
m_popup->addActions(abstractPlugin->actions(props, m_mainWindow));
}
}
}
......
......@@ -25,6 +25,7 @@
#include "konq_copytomenu.h"
#include "kfileitemactions.h"
#include "kfileitemactionplugin.h"
#include "kabstractfileitemactionplugin.h"
#include "kpropertiesdialog.h"
#include "knewmenu.h"
#include "konq_operations.h"
......@@ -584,12 +585,18 @@ void KonqPopupMenuPrivate::addPlugins()
continue;
}
// Old API (kdelibs-4.6.0 only)
KFileItemActionPlugin* plugin = service->createInstance<KFileItemActionPlugin>();
if (!plugin) {
continue;
if (plugin) {
plugin->setParent(q);
q->addActions(plugin->actions(m_popupItemProperties, m_parentWidget));
}
// New API (kdelibs >= 4.6.1)
KAbstractFileItemActionPlugin* abstractPlugin = service->createInstance<KAbstractFileItemActionPlugin>();
if (abstractPlugin) {
abstractPlugin->setParent(q);
q->addActions(abstractPlugin->actions(m_popupItemProperties, m_parentWidget));
}
plugin->setParent(q);
q->addActions(plugin->actions(m_popupItemProperties, m_parentWidget));
}
}
}
......
Markdown is supported
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