diff --git a/wallpapers/image/image.cpp b/wallpapers/image/image.cpp index beb02c61c..381f8e839 100644 --- a/wallpapers/image/image.cpp +++ b/wallpapers/image/image.cpp @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include @@ -589,7 +591,7 @@ void Image::backgroundsFound(const QStringList &paths, const QString &token) } } -void Image::getNewWallpaper() +void Image::getNewWallpaper(QQuickItem *ctx) { if (!m_newStuffDialog) { m_newStuffDialog = new KNS3::DownloadDialog( QString::fromLatin1("wallpaper.knsrc") ); @@ -597,6 +599,13 @@ void Image::getNewWallpaper() strong->setTitle(i18n("Download Wallpapers")); connect(m_newStuffDialog.data(), &QDialog::accepted, this, &Image::newStuffFinished); } + + if (ctx && ctx->window()) { + m_newStuffDialog->setWindowModality(Qt::WindowModal); + m_newStuffDialog->winId(); // so it creates the windowHandle(); + m_newStuffDialog->windowHandle()->setTransientParent(ctx->window()); + } + m_newStuffDialog.data()->show(); } diff --git a/wallpapers/image/image.h b/wallpapers/image/image.h index aa738f93c..09345c8fc 100644 --- a/wallpapers/image/image.h +++ b/wallpapers/image/image.h @@ -38,6 +38,7 @@ class QPropertyAnimation; class QFileDialog; +class QQuickItem; class KDirWatch; class KJob; @@ -82,7 +83,7 @@ class Image : public QObject, public QQmlParserStatus Q_INVOKABLE void addSlidePath(const QString &path); Q_INVOKABLE void removeSlidePath(const QString &path); - Q_INVOKABLE void getNewWallpaper(); + Q_INVOKABLE void getNewWallpaper(QQuickItem *ctx = nullptr); Q_INVOKABLE void showFileDialog(); Q_INVOKABLE void addUsersWallpaper(const QString &file); diff --git a/wallpapers/image/imagepackage/contents/ui/config.qml b/wallpapers/image/imagepackage/contents/ui/config.qml index ad243e083..d373b9f7c 100644 --- a/wallpapers/image/imagepackage/contents/ui/config.qml +++ b/wallpapers/image/imagepackage/contents/ui/config.qml @@ -353,7 +353,7 @@ ColumnLayout { iconName: "get-hot-new-stuff" text: i18nd("plasma_applet_org.kde.image","Get New Wallpapers...") visible: KAuthorized.authorize("ghns") - onClicked: imageWallpaper.getNewWallpaper(); + onClicked: imageWallpaper.getNewWallpaper(this); } } }