summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-23 21:36:59 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-23 21:36:59 (GMT)
commit75fb78308c03799cef2d4304e3b0dafbf05aba1f (patch)
tree2b87d1d139c98e4aa10746b8a6a852e4aed5d6ce
parenta2780a0b72d048259905c66e3b0bf88848da1814 (diff)
Activate configure plugin button
-rw-r--r--src/configureplugins/configureplugindialog.cpp27
-rw-r--r--src/configureplugins/configureplugindialog.h10
-rw-r--r--src/configureplugins/configurepluginslistwidget.cpp13
3 files changed, 35 insertions, 15 deletions
diff --git a/src/configureplugins/configureplugindialog.cpp b/src/configureplugins/configureplugindialog.cpp
index c6af811..285cce5 100644
--- a/src/configureplugins/configureplugindialog.cpp
+++ b/src/configureplugins/configureplugindialog.cpp
@@ -20,6 +20,7 @@
#include <QVBoxLayout>
#include <KLocalizedString>
#include <QDialogButtonBox>
+#include <QPushButton>
#include <KConfigGroup>
#include <KSharedConfig>
@@ -40,14 +41,36 @@ void ConfigurePluginDialog::initLayout()
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(createLayout());
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, this);
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Help, this);
layout->addWidget(buttonBox);
connect(buttonBox, &QDialogButtonBox::accepted, this, &ConfigurePluginDialog::slotAccepted);
- connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfigurePluginDialog::rejected);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfigurePluginDialog::reject);
+ connect(buttonBox, &QDialogButtonBox::helpRequested, this, &ConfigurePluginDialog::slotHelpClicked);
+ connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &ConfigurePluginDialog::slotRestoreDefaultClicked);
readConfig();
load();
}
+void ConfigurePluginDialog::reset()
+{
+ //Reimplement it.
+}
+
+QString ConfigurePluginDialog::helpAnchor() const
+{
+ return {};
+}
+
+void ConfigurePluginDialog::slotHelpClicked()
+{
+ //TODO
+}
+
+void ConfigurePluginDialog::slotRestoreDefaultClicked()
+{
+ reset();
+}
+
void ConfigurePluginDialog::slotAccepted()
{
save();
diff --git a/src/configureplugins/configureplugindialog.h b/src/configureplugins/configureplugindialog.h
index 97fd016..217458f 100644
--- a/src/configureplugins/configureplugindialog.h
+++ b/src/configureplugins/configureplugindialog.h
@@ -34,9 +34,15 @@ protected:
virtual QWidget *createLayout() = 0;
virtual void save() = 0;
virtual void load() = 0;
-private Q_SLOTS:
- void slotAccepted();
+ virtual void reset();
+
+ virtual QString helpAnchor() const;
+
+
private:
+ void slotHelpClicked();
+ void slotAccepted();
+ void slotRestoreDefaultClicked();
void saveConfig();
void readConfig();
};
diff --git a/src/configureplugins/configurepluginslistwidget.cpp b/src/configureplugins/configurepluginslistwidget.cpp
index bcfcedb..69aa312 100644
--- a/src/configureplugins/configurepluginslistwidget.cpp
+++ b/src/configureplugins/configurepluginslistwidget.cpp
@@ -30,8 +30,6 @@
#include <QDebug>
#include <QAction>
-//#define CONFIGUREPLUGIN_SUPPORT 1
-
using namespace PimCommon;
ConfigurePluginsListWidget::ConfigurePluginsListWidget(QWidget *parent)
: QWidget(parent)
@@ -111,10 +109,10 @@ void ConfigurePluginsListWidget::savePlugins(const QString &groupName, const QSt
void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUtilData> &lst, const QString &topLevelItemName,
const QString &groupName, const QString &prefixKey, QList<PluginItem *> &itemsList, const QString &configureGroupName)
{
-#ifdef CONFIGUREPLUGIN_SUPPORT
+ //TODO need to fix it.
mListWidget->setColumnCount(2);
mListWidget->header()->resizeSection(0, 300);
-#endif
+
itemsList.clear();
if (!lst.isEmpty()) {
QTreeWidgetItem *topLevel = new QTreeWidgetItem(mListWidget, QStringList() << topLevelItemName);
@@ -129,7 +127,6 @@ void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUti
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
if (data.mHasConfigureDialog) {
QToolButton *but = new QToolButton(mListWidget);
QAction *act = new QAction(but);
@@ -144,7 +141,6 @@ void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUti
mListWidget->setItemWidget(subItem, 1, but);
connect(but, &QToolButton::triggered, this, &ConfigurePluginsListWidget::slotConfigureClicked);
}
-#endif
itemsList.append(subItem);
}
}
@@ -152,17 +148,12 @@ void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUti
void ConfigurePluginsListWidget::slotConfigureClicked(QAction *act)
{
-#ifdef CONFIGUREPLUGIN_SUPPORT
if (act) {
const QStringList lst = act->data().toStringList();
if (lst.count() == 2) {
Q_EMIT configureClicked(lst.at(0), lst.at(1));
}
}
- qDebug() << " void ConfigurePluginsListWidget::slotClicked()";
-#else
- Q_UNUSED(act);
-#endif
}
void ConfigurePluginsListWidget::changeState(const QList<PluginItem *> &items)