summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-09-23 06:55:15 (GMT)
committerMontel Laurent <montel@kde.org>2016-09-23 06:55:15 (GMT)
commitf30ca1b6ffc206ac3ee34f798dac4e393637924b (patch)
tree0816a77c6bb64a2571a2c1ec7264c12e26cd6f93
parent08745698ed91037b72628b547f9268926115c97b (diff)
React when we click on button
-rw-r--r--src/configureplugins/configurepluginslistwidget.cpp18
-rw-r--r--src/configureplugins/configurepluginslistwidget.h4
2 files changed, 19 insertions, 3 deletions
diff --git a/src/configureplugins/configurepluginslistwidget.cpp b/src/configureplugins/configurepluginslistwidget.cpp
index 1296c66..bcfcedb 100644
--- a/src/configureplugins/configurepluginslistwidget.cpp
+++ b/src/configureplugins/configurepluginslistwidget.cpp
@@ -28,6 +28,7 @@
#include <QTreeWidget>
#include <QHeaderView>
#include <QDebug>
+#include <QAction>
//#define CONFIGUREPLUGIN_SUPPORT 1
@@ -131,12 +132,17 @@ void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUti
#ifdef CONFIGUREPLUGIN_SUPPORT
if (data.mHasConfigureDialog) {
QToolButton *but = new QToolButton(mListWidget);
+ QAction *act = new QAction(but);
+ const QStringList actData { configureGroupName, data.mIdentifier };
+ act->setData(actData);
+ but->setDefaultAction(act);
+ but->setText(i18n("..."));
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);
+ connect(but, &QToolButton::triggered, this, &ConfigurePluginsListWidget::slotConfigureClicked);
}
#endif
itemsList.append(subItem);
@@ -144,10 +150,18 @@ void ConfigurePluginsListWidget::fillTopItems(const QVector<PimCommon::PluginUti
}
}
-void ConfigurePluginsListWidget::slotClicked()
+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
}
diff --git a/src/configureplugins/configurepluginslistwidget.h b/src/configureplugins/configurepluginslistwidget.h
index 0982dca..7a8e1aa 100644
--- a/src/configureplugins/configurepluginslistwidget.h
+++ b/src/configureplugins/configurepluginslistwidget.h
@@ -24,6 +24,7 @@
#include <QTreeWidgetItem>
class QTreeWidget;
+class QAction;
namespace PimCommon
{
class PIMCOMMON_EXPORT ConfigurePluginsListWidget : public QWidget
@@ -40,6 +41,7 @@ public:
Q_SIGNALS:
void descriptionChanged(const QString &description);
void changed();
+ void configureClicked(const QString &configureGroupName, const QString &identifier);
private:
void slotItemSelectionChanged();
@@ -67,7 +69,7 @@ protected:
QTreeWidget *mListWidget;
private Q_SLOTS:
- void slotClicked();
+ void slotConfigureClicked(QAction *act);
};
}