summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-23 11:37:27 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-23 12:00:25 (GMT)
commit1b05d8012a4e1399f401a8716d6f282df8f9e1e5 (patch)
tree46c2c52fe96d2d44dbabba65168d245b5a1fd346
parentf30b0b2280e590ca7b26ef470c89d8a47e6e9fc4 (diff)
improve configure dialog plugin support
-rw-r--r--messagecomposer/src/plugineditor/plugineditormanager.cpp18
-rw-r--r--messagecomposer/src/plugineditor/plugineditormanager.h1
-rw-r--r--messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.cpp5
-rw-r--r--messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.h2
-rw-r--r--messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.cpp18
-rw-r--r--messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.h1
-rw-r--r--messageviewer/src/header/headerstylepluginmanager.cpp18
-rw-r--r--messageviewer/src/header/headerstylepluginmanager.h1
-rw-r--r--messageviewer/src/viewerplugins/viewerplugin.cpp5
-rw-r--r--messageviewer/src/viewerplugins/viewerplugin.h1
-rw-r--r--messageviewer/src/viewerplugins/viewerpluginmanager.cpp18
-rw-r--r--messageviewer/src/viewerplugins/viewerpluginmanager.h1
-rw-r--r--webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.cpp5
-rw-r--r--webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.h2
-rw-r--r--webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp18
-rw-r--r--webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h1
16 files changed, 115 insertions, 0 deletions
diff --git a/messagecomposer/src/plugineditor/plugineditormanager.cpp b/messagecomposer/src/plugineditor/plugineditormanager.cpp
index 12336b3..0b83073 100644
--- a/messagecomposer/src/plugineditor/plugineditormanager.cpp
+++ b/messagecomposer/src/plugineditor/plugineditormanager.cpp
@@ -87,6 +87,7 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
+ PluginEditor *pluginFromIdentifier(const QString &id);
private:
QVector<PluginEditorInfo> mPluginList;
QVector<PimCommon::PluginUtilData> mPluginDataList;
@@ -179,6 +180,17 @@ QString PluginEditorManagerPrivate::configPrefixSettingKey() const
return QStringLiteral("KMailEditorPlugin");
}
+PluginEditor *PluginEditorManagerPrivate::pluginFromIdentifier(const QString &id)
+{
+ QVector<PluginEditorInfo>::ConstIterator end(mPluginList.constEnd());
+ for (QVector<PluginEditorInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
+ if ((*it).pluginData.mIdentifier == id) {
+ return (*it).plugin;
+ }
+ }
+ return {};
+}
+
PluginEditorManager::PluginEditorManager(QObject *parent)
: QObject(parent),
d(new MessageComposer::PluginEditorManagerPrivate(this))
@@ -215,3 +227,9 @@ QString PluginEditorManager::configPrefixSettingKey() const
return d->configPrefixSettingKey();
}
+PluginEditor *PluginEditorManager::pluginFromIdentifier(const QString &id)
+{
+ return d->pluginFromIdentifier(id);
+}
+
+
diff --git a/messagecomposer/src/plugineditor/plugineditormanager.h b/messagecomposer/src/plugineditor/plugineditormanager.h
index cb5d341..597332c 100644
--- a/messagecomposer/src/plugineditor/plugineditormanager.h
+++ b/messagecomposer/src/plugineditor/plugineditormanager.h
@@ -43,6 +43,7 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
+ PluginEditor *pluginFromIdentifier(const QString &id);
private:
PluginEditorManagerPrivate *const d;
};
diff --git a/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.cpp b/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.cpp
index 8a120d3..683d80c 100644
--- a/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.cpp
+++ b/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.cpp
@@ -49,6 +49,11 @@ bool PluginEditorCheckBeforeSend::hasConfigureDialog() const
return false;
}
+void PluginEditorCheckBeforeSend::showConfigureDialog(QWidget *parent)
+{
+ Q_UNUSED(parent);
+}
+
PluginEditorCheckBeforeSendConfigureWidgetSetting PluginEditorCheckBeforeSend::createConfigureWidget(KIdentityManagement::IdentityManager *identityManager, QWidget *parent) const
{
Q_UNUSED(identityManager)
diff --git a/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.h b/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.h
index f164c6a..f61c383 100644
--- a/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.h
+++ b/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesend.h
@@ -62,6 +62,8 @@ public:
virtual bool hasConfigureDialog() const;
+ virtual void showConfigureDialog(QWidget *parent = Q_NULLPTR);
+
virtual PluginEditorCheckBeforeSendConfigureWidgetSetting createConfigureWidget(KIdentityManagement::IdentityManager *identityManager, QWidget *parent) const;
void emitConfigChanged();
diff --git a/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.cpp b/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.cpp
index a6ee029..65f0f35 100644
--- a/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.cpp
+++ b/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.cpp
@@ -84,6 +84,7 @@ public:
QString configPrefixSettingKey() const;
QString configGroupName() const;
QVector<PimCommon::PluginUtilData> pluginsDataList() const;
+ PluginEditorCheckBeforeSend *pluginFromIdentifier(const QString &id);
private:
QVector<PimCommon::PluginUtilData> mPluginDataList;
PluginEditorCheckBeforeSendManager *q;
@@ -168,6 +169,18 @@ QVector<PluginEditorCheckBeforeSend *> PluginEditorCheckBeforeSendManagerPrivate
return lst;
}
+PluginEditorCheckBeforeSend *PluginEditorCheckBeforeSendManagerPrivate::pluginFromIdentifier(const QString &id)
+{
+ QVector<PluginEditorCheckBeforeSendInfo>::ConstIterator end(mPluginList.constEnd());
+ for (QVector<PluginEditorCheckBeforeSendInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
+ if ((*it).pluginData.mIdentifier == id) {
+ return (*it).plugin;
+ }
+ }
+ return {};
+}
+
+
PluginEditorCheckBeforeSendManager::PluginEditorCheckBeforeSendManager(QObject *parent)
: QObject(parent),
d(new MessageComposer::PluginEditorCheckBeforeSendManagerPrivate(this))
@@ -203,3 +216,8 @@ QVector<PimCommon::PluginUtilData> PluginEditorCheckBeforeSendManager::pluginsDa
{
return d->pluginsDataList();
}
+
+PluginEditorCheckBeforeSend *PluginEditorCheckBeforeSendManager::pluginFromIdentifier(const QString &id)
+{
+ return d->pluginFromIdentifier(id);
+}
diff --git a/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.h b/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.h
index e8e9e5c..c7ae4f5 100644
--- a/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.h
+++ b/messagecomposer/src/plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.h
@@ -41,6 +41,7 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
QVector<PimCommon::PluginUtilData> pluginsDataList() const;
+ PluginEditorCheckBeforeSend *pluginFromIdentifier(const QString &id);
private:
PluginEditorCheckBeforeSendManagerPrivate *const d;
};
diff --git a/messageviewer/src/header/headerstylepluginmanager.cpp b/messageviewer/src/header/headerstylepluginmanager.cpp
index bfbd92d..9be74d1 100644
--- a/messageviewer/src/header/headerstylepluginmanager.cpp
+++ b/messageviewer/src/header/headerstylepluginmanager.cpp
@@ -77,6 +77,7 @@ public:
void loadPlugin(HeaderStylePluginInfo *item);
QString configGroupName() const;
QString configPrefixSettingKey() const;
+ MessageViewer::HeaderStylePlugin *pluginFromIdentifier(const QString &id);
private:
QVector<PimCommon::PluginUtilData> mPluginDataList;
QVector<HeaderStylePluginInfo> mPluginList;
@@ -187,6 +188,18 @@ void HeaderStylePluginManagerPrivate::loadPlugin(HeaderStylePluginInfo *item)
}
}
+MessageViewer::HeaderStylePlugin *HeaderStylePluginManagerPrivate::pluginFromIdentifier(const QString &id)
+{
+ QVector<HeaderStylePluginInfo>::ConstIterator end(mPluginList.constEnd());
+ for (QVector<HeaderStylePluginInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
+ if ((*it).pluginData.mIdentifier == id) {
+ return (*it).plugin;
+ }
+ }
+ return {};
+}
+
+
HeaderStylePluginManager *HeaderStylePluginManager::self()
{
return sInstance->headerStylePluginManager;
@@ -232,3 +245,8 @@ QVector<PimCommon::PluginUtilData> HeaderStylePluginManager::pluginsDataList() c
{
return d->pluginDataList();
}
+
+MessageViewer::HeaderStylePlugin *HeaderStylePluginManager::pluginFromIdentifier(const QString &id)
+{
+ return d->pluginFromIdentifier(id);
+}
diff --git a/messageviewer/src/header/headerstylepluginmanager.h b/messageviewer/src/header/headerstylepluginmanager.h
index 676897f..c3b637e 100644
--- a/messageviewer/src/header/headerstylepluginmanager.h
+++ b/messageviewer/src/header/headerstylepluginmanager.h
@@ -42,6 +42,7 @@ public:
QVector<PimCommon::PluginUtilData> pluginsDataList() const;
QString configPrefixSettingKey() const;
QString configGroupName() const;
+ MessageViewer::HeaderStylePlugin *pluginFromIdentifier(const QString &id);
private:
HeaderStylePluginManagerPrivate *const d;
};
diff --git a/messageviewer/src/viewerplugins/viewerplugin.cpp b/messageviewer/src/viewerplugins/viewerplugin.cpp
index 45225d1..3b90b05 100644
--- a/messageviewer/src/viewerplugins/viewerplugin.cpp
+++ b/messageviewer/src/viewerplugins/viewerplugin.cpp
@@ -44,6 +44,11 @@ ViewerPlugin::~ViewerPlugin()
delete d;
}
+void ViewerPlugin::showConfigureDialog(QWidget *parent)
+{
+ Q_UNUSED(parent);
+}
+
void ViewerPlugin::setIsEnabled(bool enabled)
{
d->mEnabled = enabled;
diff --git a/messageviewer/src/viewerplugins/viewerplugin.h b/messageviewer/src/viewerplugins/viewerplugin.h
index 00b2779..929d0fb 100644
--- a/messageviewer/src/viewerplugins/viewerplugin.h
+++ b/messageviewer/src/viewerplugins/viewerplugin.h
@@ -37,6 +37,7 @@ public:
virtual MessageViewer::ViewerPluginInterface *createView(QWidget *parent, KActionCollection *ac) = 0;
virtual QString viewerPluginName() const = 0;
+ virtual void showConfigureDialog(QWidget *parent = Q_NULLPTR);
void setIsEnabled(bool enabled);
bool isEnabled() const;
diff --git a/messageviewer/src/viewerplugins/viewerpluginmanager.cpp b/messageviewer/src/viewerplugins/viewerpluginmanager.cpp
index 3f78efa..b429850 100644
--- a/messageviewer/src/viewerplugins/viewerpluginmanager.cpp
+++ b/messageviewer/src/viewerplugins/viewerpluginmanager.cpp
@@ -84,6 +84,7 @@ public:
QString pluginName;
QString configGroupName() const;
QString configPrefixSettingKey() const;
+ ViewerPlugin *pluginFromIdentifier(const QString &id);
private:
QVector<ViewerPluginInfo> mPluginList;
QVector<PimCommon::PluginUtilData> mPluginDataList;
@@ -191,6 +192,17 @@ QVector<PimCommon::PluginUtilData> ViewerPluginManagerPrivate::pluginDataList()
return mPluginDataList;
}
+ViewerPlugin *ViewerPluginManagerPrivate::pluginFromIdentifier(const QString &id)
+{
+ QVector<ViewerPluginInfo>::ConstIterator end(mPluginList.constEnd());
+ for (QVector<ViewerPluginInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
+ if ((*it).pluginData.mIdentifier == id) {
+ return (*it).plugin;
+ }
+ }
+ return {};
+}
+
ViewerPluginManager::ViewerPluginManager(QObject *parent)
: QObject(parent),
@@ -252,3 +264,9 @@ QString ViewerPluginManager::configPrefixSettingKey() const
{
return d->configPrefixSettingKey();
}
+
+MessageViewer::ViewerPlugin *ViewerPluginManager::pluginFromIdentifier(const QString &id)
+{
+ return d->pluginFromIdentifier(id);
+}
+
diff --git a/messageviewer/src/viewerplugins/viewerpluginmanager.h b/messageviewer/src/viewerplugins/viewerpluginmanager.h
index ea0548a..44a20e1 100644
--- a/messageviewer/src/viewerplugins/viewerpluginmanager.h
+++ b/messageviewer/src/viewerplugins/viewerpluginmanager.h
@@ -49,6 +49,7 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
+ MessageViewer::ViewerPlugin *pluginFromIdentifier(const QString &id);
private:
ViewerPluginManagerPrivate *const d;
};
diff --git a/webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.cpp b/webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.cpp
index 72074f0..a728bae 100644
--- a/webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.cpp
+++ b/webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.cpp
@@ -38,6 +38,11 @@ bool NetworkPluginUrlInterceptor::hasConfigureDialog() const
return false;
}
+void NetworkPluginUrlInterceptor::showConfigureDialog(QWidget *parent)
+{
+ Q_UNUSED(parent);
+}
+
NetworkPluginUrlInterceptorConfigureWidgetSetting NetworkPluginUrlInterceptor::createConfigureWidget(QWidget *parent)
{
Q_UNUSED(parent);
diff --git a/webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.h b/webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.h
index a97e970..b622bd8 100644
--- a/webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.h
+++ b/webengineviewer/src/urlinterceptor/networkpluginurlinterceptor.h
@@ -54,6 +54,8 @@ public:
virtual NetworkPluginUrlInterceptorInterface *createInterface(QWebEngineView *webEngine, QObject *parent = Q_NULLPTR) = 0;
virtual bool hasConfigureDialog() const;
+ virtual void showConfigureDialog(QWidget *parent = Q_NULLPTR);
+
virtual NetworkPluginUrlInterceptorConfigureWidgetSetting createConfigureWidget(QWidget *parent = Q_NULLPTR);
void setIsEnabled(bool enabled);
diff --git a/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp b/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp
index 3321967..4dc2a7e 100644
--- a/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp
+++ b/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp
@@ -87,6 +87,7 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
QVector<PimCommon::PluginUtilData> pluginDataList() const;
+ NetworkPluginUrlInterceptor *pluginFromIdentifier(const QString &id);
private:
QVector<MailNetworkUrlInterceptorPluginInfo> mPluginList;
QVector<PimCommon::PluginUtilData> mPluginDataList;
@@ -173,11 +174,23 @@ void NetworkUrlInterceptorPluginManagerPrivate::loadPlugin(MailNetworkUrlInterce
}
}
+WebEngineViewer::NetworkPluginUrlInterceptor *NetworkUrlInterceptorPluginManagerPrivate::pluginFromIdentifier(const QString &id)
+{
+ QVector<MailNetworkUrlInterceptorPluginInfo>::ConstIterator end(mPluginList.constEnd());
+ for (QVector<MailNetworkUrlInterceptorPluginInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
+ if ((*it).pluginData.mIdentifier == id) {
+ return (*it).plugin;
+ }
+ }
+ return {};
+}
+
NetworkUrlInterceptorPluginManager *NetworkUrlInterceptorPluginManager::self()
{
return sInstance->mailNetworkUrlInterceptorPluginManager;
}
+
NetworkUrlInterceptorPluginManager::NetworkUrlInterceptorPluginManager(QObject *parent)
: QObject(parent),
d(new NetworkUrlInterceptorPluginManagerPrivate(this))
@@ -209,3 +222,8 @@ QVector<PimCommon::PluginUtilData> NetworkUrlInterceptorPluginManager::pluginsDa
{
return d->pluginDataList();
}
+
+WebEngineViewer::NetworkPluginUrlInterceptor *NetworkUrlInterceptorPluginManager::pluginFromIdentifier(const QString &id)
+{
+ return d->pluginFromIdentifier(id);
+}
diff --git a/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h b/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h
index 89f87ed..e91e966 100644
--- a/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h
+++ b/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h
@@ -40,6 +40,7 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
QVector<PimCommon::PluginUtilData> pluginsDataList() const;
+ WebEngineViewer::NetworkPluginUrlInterceptor *pluginFromIdentifier(const QString &id);
private:
NetworkUrlInterceptorPluginManagerPrivate *const d;
};