summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-09 11:54:15 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-09 11:54:15 (GMT)
commit10636a37b7932140c0d3dc083beb5d27b8acd7f7 (patch)
treeec5774c4571adcdd3968cf43fa06b25285c670d8
parente00683f25de08f101bce7eb73210e49613f59596 (diff)
Allow to disable webengine plugins too
-rw-r--r--CMakeLists.txt2
-rw-r--r--webengineviewer/src/CMakeLists.txt2
-rw-r--r--webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp50
-rw-r--r--webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h2
4 files changed, 41 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2dab18..f1c9f31 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
-set(PIM_VERSION "5.3.54")
+set(PIM_VERSION "5.3.55")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
diff --git a/webengineviewer/src/CMakeLists.txt b/webengineviewer/src/CMakeLists.txt
index 27946f6..a59c9c5 100644
--- a/webengineviewer/src/CMakeLists.txt
+++ b/webengineviewer/src/CMakeLists.txt
@@ -76,12 +76,12 @@ target_include_directories(KF5WebEngineViewer PUBLIC "$<BUILD_INTERFACE:${WebEng
target_link_libraries(KF5WebEngineViewer
PUBLIC
Qt5::WebEngineWidgets
+ KF5::PimCommon
PRIVATE
KF5::CoreAddons
KF5::XmlGui
KF5::Completion
KF5::I18n
- KF5::PimCommon
KF5::WidgetsAddons
KF5::ConfigCore
)
diff --git a/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp b/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp
index 598ce02..eb3a80c 100644
--- a/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp
+++ b/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.cpp
@@ -89,9 +89,10 @@ public:
QVector<WebEngineViewer::NetworkPluginUrlInterceptor *> pluginsList() const;
QString configGroupName() const;
QString configPrefixSettingKey() const;
-
- QVector<MailNetworkUrlInterceptorPluginInfo> mPluginList;
+ QVector<PimCommon::PluginUtilData> pluginDataList() const;
private:
+ QVector<MailNetworkUrlInterceptorPluginInfo> mPluginList;
+ QVector<PimCommon::PluginUtilData> mPluginDataList;
NetworkUrlInterceptorPluginManager *q;
};
@@ -105,6 +106,11 @@ QString NetworkUrlInterceptorPluginManagerPrivate::configPrefixSettingKey() cons
return QStringLiteral("PluginsNetworkUrlInterceptor");
}
+QVector<PimCommon::PluginUtilData> NetworkUrlInterceptorPluginManagerPrivate::pluginDataList() const
+{
+ return mPluginDataList;
+}
+
void NetworkUrlInterceptorPluginManagerPrivate::initializePluginList()
{
const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("webengineviewer"), [](const KPluginMetaData & md) {
@@ -114,22 +120,36 @@ void NetworkUrlInterceptorPluginManagerPrivate::initializePluginList()
QVectorIterator<KPluginMetaData> i(plugins);
i.toBack();
QSet<QString> unique;
+ const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
+
while (i.hasPrevious()) {
MailNetworkUrlInterceptorPluginInfo info;
info.metaData = i.previous();
- const QString version = info.metaData.version();
- if (pluginVersion() == version) {
-
- // only load plugins once, even if found multiple times!
- if (unique.contains(info.saveName())) {
- continue;
+ PimCommon::PluginUtilData pluginData;
+ pluginData.mDescription = info.metaData.description();
+ pluginData.mName = info.metaData.name();
+ pluginData.mIdentifier = info.metaData.pluginId();
+ pluginData.mEnableByDefault = info.metaData.isEnabledByDefault();
+ mPluginDataList.append(pluginData);
+
+ const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, pluginData.mEnableByDefault, pluginData.mIdentifier);
+ if (isPluginActivated) {
+
+
+ const QString version = info.metaData.version();
+ if (pluginVersion() == version) {
+
+ // only load plugins once, even if found multiple times!
+ if (unique.contains(info.saveName())) {
+ continue;
+ }
+ info.plugin = Q_NULLPTR;
+ mPluginList.append(info);
+ unique.insert(info.saveName());
+ } else {
+ qCWarning(WEBENGINEVIEWER_LOG) << "Plugin " << info.metaData.name() << " doesn't have correction plugin version. It will not be loaded.";
}
- info.plugin = Q_NULLPTR;
- mPluginList.append(info);
- unique.insert(info.saveName());
- } else {
- qCWarning(WEBENGINEVIEWER_LOG) << "Plugin " << info.metaData.name() << " doesn't have correction plugin version. It will not be loaded.";
}
}
QVector<MailNetworkUrlInterceptorPluginInfo>::iterator end(mPluginList.end());
@@ -190,3 +210,7 @@ QString NetworkUrlInterceptorPluginManager::configPrefixSettingKey() const
return d->configPrefixSettingKey();
}
+QVector<PimCommon::PluginUtilData> NetworkUrlInterceptorPluginManager::pluginDataList() const
+{
+ return d->pluginDataList();
+}
diff --git a/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h b/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h
index 720d2b9..01e06d4 100644
--- a/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h
+++ b/webengineviewer/src/urlinterceptor/networkurlinterceptorpluginmanager.h
@@ -22,6 +22,7 @@
#include <QObject>
#include <QVector>
+#include <PimCommon/PluginUtil>
#include "webengineviewer_export.h"
namespace WebEngineViewer
{
@@ -38,6 +39,7 @@ public:
QVector<WebEngineViewer::NetworkPluginUrlInterceptor *> pluginsList() const;
QString configGroupName() const;
QString configPrefixSettingKey() const;
+ QVector<PimCommon::PluginUtilData> pluginDataList() const;
private:
NetworkUrlInterceptorPluginManagerPrivate *const d;
};