summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-09 05:47:55 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-09 05:47:55 (GMT)
commitfea2b196d2cdbd4737cdce36640426526f6dfc2b (patch)
tree2e9aa15272c82c9076c6e2acb11d0e8bb7050adc
parent2cfe4c263f6bc1e260325da975db597a88f6b7fe (diff)
Add method to define actioncollection
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/configureplugins/configurepluginslistwidget.cpp1
-rw-r--r--src/genericplugins/plugininterface.cpp17
-rw-r--r--src/genericplugins/plugininterface.h3
4 files changed, 16 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 16b8c34..6e8e8e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,7 +21,7 @@ include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
include(ECMInstallIcons)
-set(PIM_VERSION "5.3.46")
+set(PIM_VERSION "5.3.47")
set(PIMCOMMON_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
diff --git a/src/configureplugins/configurepluginslistwidget.cpp b/src/configureplugins/configurepluginslistwidget.cpp
index 6f273e2..ce1c5cd 100644
--- a/src/configureplugins/configurepluginslistwidget.cpp
+++ b/src/configureplugins/configurepluginslistwidget.cpp
@@ -41,7 +41,6 @@ ConfigurePluginsListWidget::ConfigurePluginsListWidget(QWidget *parent)
connect(mListWidget, &QTreeWidget::itemChanged, this, &ConfigurePluginsListWidget::slotItemChanged);
mainLayout->addWidget(mListWidget);
-
}
ConfigurePluginsListWidget::~ConfigurePluginsListWidget()
diff --git a/src/genericplugins/plugininterface.cpp b/src/genericplugins/plugininterface.cpp
index 3b88049..7910acb 100644
--- a/src/genericplugins/plugininterface.cpp
+++ b/src/genericplugins/plugininterface.cpp
@@ -30,9 +30,9 @@ using namespace PimCommon;
class PimCommon::PluginInterfacePrivate
{
public:
- PluginInterfacePrivate(KActionCollection *ac)
+ PluginInterfacePrivate()
: mParentWidget(Q_NULLPTR),
- mActionCollection(ac)
+ mActionCollection(Q_NULLPTR)
{
}
@@ -43,9 +43,9 @@ public:
QVector<PimCommon::GenericPluginInterface *> mListGenericInterface;
};
-PluginInterface::PluginInterface(KActionCollection *ac, QObject *parent)
+PluginInterface::PluginInterface(QObject *parent)
: QObject(parent),
- d(new PimCommon::PluginInterfacePrivate(ac))
+ d(new PimCommon::PluginInterfacePrivate)
{
}
@@ -54,6 +54,11 @@ PluginInterface::~PluginInterface()
delete d;
}
+void PimCommon::PluginInterface::setActionCollection(KActionCollection *ac)
+{
+ d->mActionCollection = ac;
+}
+
void PluginInterface::initializePlugins()
{
PimCommon::GenericPluginManager::self()->setPluginName(d->mPluginName);
@@ -75,6 +80,10 @@ void PluginInterface::setServiceTypeName(const QString &name)
void PluginInterface::createPluginInterface()
{
+ if (!d->mActionCollection) {
+ qCWarning(PIMCOMMON_LOG) << "Missing action collection";
+ return;
+ }
Q_FOREACH (PimCommon::GenericPlugin *plugin, PimCommon::GenericPluginManager::self()->pluginsList()) {
PimCommon::GenericPluginInterface *interface = plugin->createInterface(d->mActionCollection, d->mParentWidget);
connect(interface, &PimCommon::GenericPluginInterface::emitPluginActivated, this, &PluginInterface::slotPluginActivated);
diff --git a/src/genericplugins/plugininterface.h b/src/genericplugins/plugininterface.h
index d44c371..efa7863 100644
--- a/src/genericplugins/plugininterface.h
+++ b/src/genericplugins/plugininterface.h
@@ -31,7 +31,7 @@ class PIMCOMMON_EXPORT PluginInterface : public QObject
{
Q_OBJECT
public:
- explicit PluginInterface(KActionCollection *ac, QObject *parent = Q_NULLPTR);
+ explicit PluginInterface(QObject *parent = Q_NULLPTR);
~PluginInterface();
void setParentWidget(QWidget *widget);
@@ -47,6 +47,7 @@ public:
void initializePluginActions(const QString &prefix, KXMLGUIClient *guiClient);
void updateActions(int numberOfSelectedItems, int numberOfSelectedCollections);
+ void setActionCollection(KActionCollection *ac);
private Q_SLOTS:
void slotPluginActivated(PimCommon::GenericPluginInterface *interface);