summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-22 05:55:37 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-22 05:55:37 (GMT)
commitf82a210808b4aaed9adcd545c03df7f944f4d6d6 (patch)
treed51b9c59e60e55ee63700b1562b5b5b011a3ccb6
parent0d4dd578ed9f318ce5b8d957f182746706ca606e (diff)
Move method to plugin directly
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/genericplugins/genericplugin.cpp16
-rw-r--r--src/genericplugins/genericplugin.h3
-rw-r--r--src/genericplugins/genericplugininterface.cpp29
-rw-r--r--src/genericplugins/genericplugininterface.h9
-rw-r--r--src/genericplugins/plugininterface.cpp5
6 files changed, 41 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4e0dd2..2c441d5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
include(ECMInstallIcons)
-set(PIM_VERSION "5.3.51")
+set(PIM_VERSION "5.3.52")
set(PIMCOMMON_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
diff --git a/src/genericplugins/genericplugin.cpp b/src/genericplugins/genericplugin.cpp
index badc112..04b94e5 100644
--- a/src/genericplugins/genericplugin.cpp
+++ b/src/genericplugins/genericplugin.cpp
@@ -30,3 +30,19 @@ GenericPlugin::~GenericPlugin()
}
+bool GenericPlugin::hasPopupMenuSupport() const
+{
+ return false;
+}
+
+bool GenericPlugin::hasToolBarSupport() const
+{
+ return false;
+}
+
+bool GenericPlugin::hasConfigureDialog() const
+{
+ return false;
+}
+
+
diff --git a/src/genericplugins/genericplugin.h b/src/genericplugins/genericplugin.h
index ea37e00..99a68de 100644
--- a/src/genericplugins/genericplugin.h
+++ b/src/genericplugins/genericplugin.h
@@ -32,6 +32,9 @@ public:
~GenericPlugin();
virtual PimCommon::GenericPluginInterface *createInterface(KActionCollection *ac, QWidget *parent = Q_NULLPTR) = 0;
+ virtual bool hasPopupMenuSupport() const;
+ virtual bool hasToolBarSupport() const;
+ virtual bool hasConfigureDialog() const;
};
}
#endif // GENERICPLUGIN_H
diff --git a/src/genericplugins/genericplugininterface.cpp b/src/genericplugins/genericplugininterface.cpp
index 8c1e890..887bd65 100644
--- a/src/genericplugins/genericplugininterface.cpp
+++ b/src/genericplugins/genericplugininterface.cpp
@@ -23,11 +23,13 @@ class PimCommon::GenericPluginInterfacePrivate
{
public:
GenericPluginInterfacePrivate()
- : parentWidget(Q_NULLPTR)
+ : plugin(Q_NULLPTR),
+ parentWidget(Q_NULLPTR)
{
}
ActionType actionType;
+ GenericPlugin *plugin;
QWidget *parentWidget;
};
@@ -63,6 +65,16 @@ ActionType GenericPluginInterface::actionType() const
return d->actionType;
}
+void GenericPluginInterface::setPlugin(GenericPlugin *plugin)
+{
+ d->plugin = plugin;
+}
+
+GenericPlugin *GenericPluginInterface::plugin() const
+{
+ return d->plugin;
+}
+
void GenericPluginInterface::updateActions(int numberOfSelectedItems, int numberOfSelectedCollections)
{
Q_UNUSED(numberOfSelectedItems);
@@ -94,21 +106,6 @@ PimCommon::GenericPluginInterface::RequireTypes GenericPluginInterface::requires
return None;
}
-bool GenericPluginInterface::hasPopupMenuSupport() const
-{
- return false;
-}
-
-bool GenericPluginInterface::hasToolBarSupport() const
-{
- return false;
-}
-
-bool GenericPluginInterface::hasConfigureDialog() const
-{
- return false;
-}
-
void GenericPluginInterface::showConfigureDialog(QWidget *parentWidget)
{
Q_UNUSED(parentWidget);
diff --git a/src/genericplugins/genericplugininterface.h b/src/genericplugins/genericplugininterface.h
index 85c4bab..6cbcad3 100644
--- a/src/genericplugins/genericplugininterface.h
+++ b/src/genericplugins/genericplugininterface.h
@@ -24,6 +24,7 @@ class QAction;
class KActionCollection;
namespace PimCommon
{
+class GenericPlugin;
class PIMCOMMON_EXPORT ActionType
{
public:
@@ -74,6 +75,10 @@ public:
void setActionType(const ActionType &type);
ActionType actionType() const;
+
+ void setPlugin(GenericPlugin *plugin);
+ GenericPlugin *plugin() const;
+
virtual void createAction(KActionCollection *ac) = 0;
virtual void exec() = 0;
virtual void setCurrentItems(const Akonadi::Item::List &items);
@@ -83,10 +88,6 @@ public:
virtual GenericPluginInterface::RequireTypes requires() const;
- virtual bool hasPopupMenuSupport() const;
- virtual bool hasToolBarSupport() const;
- virtual bool hasConfigureDialog() const;
-
virtual void showConfigureDialog(QWidget *parentWidget = Q_NULLPTR);
virtual void updateActions(int numberOfSelectedItems, int numberOfSelectedCollections);
diff --git a/src/genericplugins/plugininterface.cpp b/src/genericplugins/plugininterface.cpp
index d0cf994..61e82b4 100644
--- a/src/genericplugins/plugininterface.cpp
+++ b/src/genericplugins/plugininterface.cpp
@@ -86,6 +86,7 @@ void PluginInterface::createPluginInterface()
}
Q_FOREACH (PimCommon::GenericPlugin *plugin, PimCommon::GenericPluginManager::self()->pluginsList()) {
PimCommon::GenericPluginInterface *interface = plugin->createInterface(d->mActionCollection, d->mParentWidget);
+ interface->setPlugin(plugin);
connect(interface, &PimCommon::GenericPluginInterface::emitPluginActivated, this, &PluginInterface::slotPluginActivated);
d->mListGenericInterface.append(interface);
}
@@ -166,7 +167,7 @@ QHash<PimCommon::ActionType::Type, QList<QAction *> > PluginInterface::actionsTy
} else {
listType.insert(type, QList<QAction *>() << actionType.action());
}
- if (interface->hasPopupMenuSupport()) {
+ if (interface->plugin()->hasPopupMenuSupport()) {
type = PimCommon::ActionType::PopupMenu;
if (listType.contains(type)) {
QList<QAction *> lst = listType.value(type);
@@ -178,7 +179,7 @@ QHash<PimCommon::ActionType::Type, QList<QAction *> > PluginInterface::actionsTy
listType.insert(type, QList<QAction *>() << actionType.action());
}
}
- if (interface->hasToolBarSupport()) {
+ if (interface->plugin()->hasToolBarSupport()) {
type = PimCommon::ActionType::ToolBar;
if (listType.contains(type)) {
QList<QAction *> lst = listType.value(type);