summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-23 05:03:14 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-23 05:03:14 (GMT)
commit32323cd0e854469267f1833e8afcdf5d57563437 (patch)
treeeab0cd24d76533ca64a6e1d8f53a73fe23ee9cee
parent93650a79f269d98fb5fd2fe7842aa87e8714c5fc (diff)
Add info about configure dialog support
-rw-r--r--CMakeLists.txt4
-rw-r--r--messagecomposer/src/plugineditor/plugineditormanager.cpp70
2 files changed, 37 insertions, 37 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d74ef3b..fc2d29f 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.62")
+set(PIM_VERSION "5.3.63")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(AKONADIMIME_LIB_VERSION "5.3.40")
@@ -39,7 +39,7 @@ set(KMIME_LIB_VERSION "5.3.40")
set(KPIMTEXTEDIT_LIB_VERSION "5.3.43")
set(LIBKDEPIM_LIB_VERSION "5.3.42")
set(LIBKLEO_LIB_VERSION "5.3.40")
-set(PIMCOMMON_LIB_VERSION "5.3.50")
+set(PIMCOMMON_LIB_VERSION "5.3.54")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test Network PrintSupport WebEngine WebEngineWidgets WebKitWidgets)
diff --git a/messagecomposer/src/plugineditor/plugineditormanager.cpp b/messagecomposer/src/plugineditor/plugineditormanager.cpp
index 5144fea..12336b3 100644
--- a/messagecomposer/src/plugineditor/plugineditormanager.cpp
+++ b/messagecomposer/src/plugineditor/plugineditormanager.cpp
@@ -49,15 +49,17 @@ class PluginEditorInfo
public:
PluginEditorInfo()
: order(0),
- plugin(Q_NULLPTR)
+ plugin(Q_NULLPTR),
+ isEnabled(true)
{
}
- QString saveName() const;
-
- KPluginMetaData metaData;
+ QString metaDataFileNameBaseName;
+ QString metaDataFileName;
+ PimCommon::PluginUtilData pluginData;
int order;
PluginEditor *plugin;
+ bool isEnabled;
};
Q_GLOBAL_STATIC(PluginEditorManagerInstancePrivate, sInstance)
@@ -104,31 +106,31 @@ bool PluginEditorManagerPrivate::initializePlugins()
QSet<QString> unique;
while (i.hasPrevious()) {
PluginEditorInfo info;
- info.metaData = i.previous();
-
- //Store plugin info
- PimCommon::PluginUtilData pluginData = PimCommon::PluginUtil::createPluginMetaData(info.metaData);
- mPluginDataList.append(pluginData);
-
- const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, pluginData.mEnableByDefault, pluginData.mIdentifier);
- if (isPluginActivated) {
- const QVariant p = info.metaData.rawData().value(QStringLiteral("X-KDE-KMailEditor-Order")).toVariant();
- int order = -1;
- if (p.isValid()) {
- order = p.toInt();
- }
- info.order = order;
- if (pluginVersion() == info.metaData.version()) {
- // only load plugins once, even if found multiple times!
- if (unique.contains(info.saveName())) {
- continue;
- }
- info.plugin = Q_NULLPTR;
- mPluginList.push_back(info);
- unique.insert(info.saveName());
- } else {
- qCWarning(MESSAGECOMPOSER_LOG) << "Plugin " << info.metaData.name() << " doesn't have correction plugin version. It will not be loaded.";
+ const KPluginMetaData data = i.previous();
+
+ //1) get plugin data => name/description etc.
+ info.pluginData = PimCommon::PluginUtil::createPluginMetaData(data);
+ //2) look at if plugin is activated
+ const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, info.pluginData.mEnableByDefault, info.pluginData.mIdentifier);
+ info.isEnabled = isPluginActivated;
+ info.metaDataFileNameBaseName = QFileInfo(data.fileName()).baseName();
+ info.metaDataFileName = data.fileName();
+ const QVariant p = data.rawData().value(QStringLiteral("X-KDE-KMailEditor-Order")).toVariant();
+ int order = -1;
+ if (p.isValid()) {
+ order = p.toInt();
+ }
+ info.order = order;
+ if (pluginVersion() == data.version()) {
+ // only load plugins once, even if found multiple times!
+ if (unique.contains(info.metaDataFileNameBaseName)) {
+ continue;
}
+ info.plugin = Q_NULLPTR;
+ mPluginList.push_back(info);
+ unique.insert(info.metaDataFileNameBaseName);
+ } else {
+ qCWarning(MESSAGECOMPOSER_LOG) << "Plugin " << data.name() << " doesn't have correction plugin version. It will not be loaded.";
}
}
QVector<PluginEditorInfo>::iterator end(mPluginList.end());
@@ -140,10 +142,13 @@ bool PluginEditorManagerPrivate::initializePlugins()
void PluginEditorManagerPrivate::loadPlugin(PluginEditorInfo *item)
{
- KPluginLoader pluginLoader(item->metaData.fileName());
+ KPluginLoader pluginLoader(item->metaDataFileName);
if (pluginLoader.factory()) {
- item->plugin = pluginLoader.factory()->create<PluginEditor>(q, QVariantList() << item->saveName());
+ item->plugin = pluginLoader.factory()->create<PluginEditor>(q, QVariantList() << item->metaDataFileNameBaseName);
+ item->plugin->setIsEnabled(item->isEnabled);
+ item->pluginData.mHasConfigureDialog = item->plugin->hasConfigureDialog();
item->plugin->setOrder(item->order);
+ mPluginDataList.append(item->pluginData);
}
}
@@ -190,11 +195,6 @@ PluginEditorManager *PluginEditorManager::self()
return sInstance->pluginManager;
}
-QString PluginEditorInfo::saveName() const
-{
- return QFileInfo(metaData.fileName()).baseName();
-}
-
QVector<PluginEditor *> PluginEditorManager::pluginsList() const
{
return d->pluginsList();