From e7c3c4fb7b6ff0bbea1258686f76b06a5ffb8d8d Mon Sep 17 00:00:00 2001 From: Piyush Aggarwal Date: Sat, 14 Nov 2020 13:54:21 +0530 Subject: [PATCH] indicator: open Configure menu on double click --- indicator/main.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/indicator/main.cpp b/indicator/main.cpp index a30453eda..2d47e3bae 100644 --- a/indicator/main.cpp +++ b/indicator/main.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #ifdef QSYSTRAY #include @@ -56,15 +57,22 @@ int main(int argc, char** argv) model.setDisplayFilter(DevicesModel::Reachable | DevicesModel::Paired); QMenu* menu = new QMenu; + QPointer dialog; + DaemonDbusInterface iface; - auto refreshMenu = [&iface, &model, &menu, &helper]() { + + auto refreshMenu = [&iface, &model, &menu, &helper, &dialog]() { menu->clear(); auto configure = menu->addAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure...")); - QObject::connect(configure, &QAction::triggered, configure, [](){ - KCMultiDialog* dialog = new KCMultiDialog; - dialog->addModule(QStringLiteral("kcm_kdeconnect")); - dialog->setAttribute(Qt::WA_DeleteOnClose); - dialog->show(); + QObject::connect(configure, &QAction::triggered, configure, [&dialog]() { + if (dialog == nullptr) { + dialog = new KCMultiDialog; + dialog->addModule(QStringLiteral("kcm_kdeconnect")); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->show(); + } else { + dialog->activateWindow(); + } }); for (int i=0, count = model.rowCount(); i