diff --git a/wallpapers/image/image.h b/wallpapers/image/image.h --- 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 @@ 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/image.cpp b/wallpapers/image/image.cpp --- a/wallpapers/image/image.cpp +++ b/wallpapers/image/image.cpp @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include @@ -589,14 +591,21 @@ } } -void Image::getNewWallpaper() +void Image::getNewWallpaper(QQuickItem *ctx) { if (!m_newStuffDialog) { m_newStuffDialog = new KNS3::DownloadDialog( QString::fromLatin1("wallpaper.knsrc") ); KNS3::DownloadDialog *strong = m_newStuffDialog.data(); 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/imagepackage/contents/ui/config.qml b/wallpapers/image/imagepackage/contents/ui/config.qml --- a/wallpapers/image/imagepackage/contents/ui/config.qml +++ b/wallpapers/image/imagepackage/contents/ui/config.qml @@ -353,7 +353,7 @@ 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); } } }