summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-23 06:02:17 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-23 06:02:17 (GMT)
commitffc420d3988cd99178145ec2ead5b8df4e4ae635 (patch)
tree4c9bc8c18884c9b3d18a3d33971a5591136f0c4f
parente700338f055a518fbf4411e7809d92d4c121f81f (diff)
Add support for configure plugin
-rw-r--r--src/configureplugins/configurepluginslistwidget.cpp19
-rw-r--r--src/configureplugins/configurepluginslistwidget.h4
2 files changed, 16 insertions, 7 deletions
diff --git a/src/configureplugins/configurepluginslistwidget.cpp b/src/configureplugins/configurepluginslistwidget.cpp
index e6c0b85..b02cfea 100644
--- a/src/configureplugins/configurepluginslistwidget.cpp
+++ b/src/configureplugins/configurepluginslistwidget.cpp
@@ -27,6 +27,9 @@
#include <QToolButton>
#include <QTreeWidget>
#include <QHeaderView>
+#include <QDebug>
+
+//#define CONFIGUREPLUGIN_SUPPORT 1
using namespace PimCommon;
ConfigurePluginsListWidget::ConfigurePluginsListWidget(QWidget *parent)
@@ -122,15 +125,19 @@ void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUti
subItem->mIdentifier = data.mIdentifier;
subItem->mDescription = data.mDescription;
subItem->mEnableByDefault = data.mEnableByDefault;
+ subItem->mHasConfigureSupport = data.mHasConfigureDialog;
const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, data.mEnableByDefault, data.mIdentifier);
subItem->setCheckState(0, isPluginActivated ? Qt::Checked : Qt::Unchecked);
#ifdef CONFIGUREPLUGIN_SUPPORT
- QToolButton *but = new QToolButton(mListWidget);
- but->setFixedWidth(48);
- but->setToolTip(i18n("Configure"));
- but->setAutoFillBackground(true);
- mListWidget->setItemWidget(subItem, 1, but);
- connect(but, &QToolButton::clicked, this, &ConfigurePluginsListWidget::slotClicked);
+ if (data.mHasConfigureDialog) {
+ QToolButton *but = new QToolButton(mListWidget);
+ but->setFixedWidth(48);
+ but->setToolTip(i18n("Configure"));
+ but->setAutoFillBackground(true);
+ but->setEnabled(subItem->mHasConfigureSupport);
+ mListWidget->setItemWidget(subItem, 1, but);
+ connect(but, &QToolButton::clicked, this, &ConfigurePluginsListWidget::slotClicked);
+ }
#endif
itemsList.append(subItem);
}
diff --git a/src/configureplugins/configurepluginslistwidget.h b/src/configureplugins/configurepluginslistwidget.h
index 376643b..b651279 100644
--- a/src/configureplugins/configurepluginslistwidget.h
+++ b/src/configureplugins/configurepluginslistwidget.h
@@ -51,13 +51,15 @@ protected:
public:
PluginItem(QTreeWidgetItem *parent)
: QTreeWidgetItem(parent),
- mEnableByDefault(false)
+ mEnableByDefault(false),
+ mHasConfigureSupport(false)
{
}
QString mIdentifier;
QString mDescription;
bool mEnableByDefault;
+ bool mHasConfigureSupport;
};
void savePlugins(const QString &groupName, const QString &prefixSettingKey, const QList<PluginItem *> &listItems);
void fillTopItems(const QVector<PimCommon::PluginUtilData> &lst, const QString &topLevelItemName, const QString &groupName, const QString &prefixKey, QList<PluginItem *> &itemsList);