diff --git a/kcms/lookandfeel/kcm.h b/kcms/lookandfeel/kcm.h --- a/kcms/lookandfeel/kcm.h +++ b/kcms/lookandfeel/kcm.h @@ -30,7 +30,7 @@ #include #include -class QQuickView; +class QQuickItem; class QStandardItemModel; class KCMLookandFeel : public KQuickAddons::ConfigModule @@ -108,7 +108,7 @@ void loadModel(); - Q_INVOKABLE void getNewStuff(); + Q_INVOKABLE void getNewStuff(QQuickItem *ctx); public Q_SLOTS: void load() override; diff --git a/kcms/lookandfeel/kcm.cpp b/kcms/lookandfeel/kcm.cpp --- a/kcms/lookandfeel/kcm.cpp +++ b/kcms/lookandfeel/kcm.cpp @@ -36,11 +36,10 @@ #include #include -#include -#include -#include #include #include +#include +#include #include #include @@ -106,13 +105,20 @@ { } -void KCMLookandFeel::getNewStuff() +void KCMLookandFeel::getNewStuff(QQuickItem *ctx) { if (!m_newStuffDialog) { m_newStuffDialog = new KNS3::DownloadDialog( QLatin1String("lookandfeel.knsrc") ); m_newStuffDialog.data()->setWindowTitle(i18n("Download New Look And Feel Packages")); + m_newStuffDialog->setWindowModality(Qt::WindowModal); + m_newStuffDialog->winId(); // so it creates the windowHandle(); connect(m_newStuffDialog.data(), &KNS3::DownloadDialog::accepted, this, &KCMLookandFeel::loadModel); } + + if (ctx && ctx->window()) { + m_newStuffDialog->windowHandle()->setTransientParent(ctx->window()); + } + m_newStuffDialog.data()->show(); } diff --git a/kcms/lookandfeel/package/contents/ui/main.qml b/kcms/lookandfeel/package/contents/ui/main.qml --- a/kcms/lookandfeel/package/contents/ui/main.qml +++ b/kcms/lookandfeel/package/contents/ui/main.qml @@ -80,7 +80,7 @@ QtControls.Button { text: i18n("Get New Looks...") icon.name: "get-hot-new-stuff" - onClicked: kcm.getNewStuff(); + onClicked: kcm.getNewStuff(this); } } }