Commit 1b05d801 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

improve configure dialog plugin support

parent f30b0b22
......@@ -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);
}
......@@ -43,6 +43,7 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
PluginEditor *pluginFromIdentifier(const QString &id);
private:
PluginEditorManagerPrivate *const d;
};
......
......@@ -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)
......
......@@ -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();
......
......@@ -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);
}
......@@ -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;
};
......
......@@ -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);
}
......@@ -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;
};
......
......@@ -44,6 +44,11 @@ ViewerPlugin::~ViewerPlugin()
delete d;
}
void ViewerPlugin::showConfigureDialog(QWidget *parent)
{
Q_UNUSED(parent);
}
void ViewerPlugin::setIsEnabled(bool enabled)
{
d->mEnabled = enabled;
......
......@@ -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;
......
......@@ -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);
}
......@@ -49,6 +49,7 @@ public:
QString configGroupName() const;
QString configPrefixSettingKey() const;
MessageViewer::ViewerPlugin *pluginFromIdentifier(const QString &id);
private:
ViewerPluginManagerPrivate *const d;
};
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
}
......@@ -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;
};
......
Supports Markdown
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