From e5e0e91daa52812f18739f7d4c9ba0e9482708d0 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 11 Jul 2017 11:23:06 +0200 Subject: [PATCH] [CurrentContainmentActionsModel] Allow making the action about dialog modal This adjusts the "configure" dialog in the same way as the "about" dialog I fixed in 2f66c0d11c68f13dd81d6a941d4ee95a63d4bdfe Differential Revision: https://phabricator.kde.org/D6440 --- shell/currentcontainmentactionsmodel.cpp | 8 ++++++-- shell/currentcontainmentactionsmodel.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/shell/currentcontainmentactionsmodel.cpp b/shell/currentcontainmentactionsmodel.cpp index 08317ed95..a1c45a38b 100644 --- a/shell/currentcontainmentactionsmodel.cpp +++ b/shell/currentcontainmentactionsmodel.cpp @@ -181,7 +181,7 @@ void CurrentContainmentActionsModel::remove(int row) } } -void CurrentContainmentActionsModel::showConfiguration(int row) +void CurrentContainmentActionsModel::showConfiguration(int row, QQuickItem *ctx) { const QString action = itemData(index(row, 0)).value(ActionRole).toString(); @@ -193,7 +193,11 @@ void CurrentContainmentActionsModel::showConfiguration(int row) configDlg->setAttribute(Qt::WA_DeleteOnClose); QLayout *lay = new QVBoxLayout(configDlg); configDlg->setLayout(lay); - configDlg->setWindowModality(Qt::WindowModal); + if (ctx && ctx->window()) { + configDlg->setWindowModality(Qt::WindowModal); + configDlg->winId(); // so it creates the windowHandle(); + configDlg->windowHandle()->setTransientParent(ctx->window()); + } Plasma::ContainmentActions *pluginInstance = m_plugins[action]; //put the config in the dialog diff --git a/shell/currentcontainmentactionsmodel.h b/shell/currentcontainmentactionsmodel.h index 7c926e4b6..86f96f6c6 100644 --- a/shell/currentcontainmentactionsmodel.h +++ b/shell/currentcontainmentactionsmodel.h @@ -56,7 +56,7 @@ public: Q_INVOKABLE bool append(const QString &action, const QString &plugin); Q_INVOKABLE void update(int row, const QString &action, const QString &plugin); Q_INVOKABLE void remove(int row); - Q_INVOKABLE void showConfiguration(int row); + Q_INVOKABLE void showConfiguration(int row, QQuickItem *ctx = nullptr); Q_INVOKABLE void showAbout(int row, QQuickItem *ctx = nullptr); Q_INVOKABLE void save();