[Wallpaper Configuration] Make Get New Stuff dialog modal to config window

Differential Revision: https://phabricator.kde.org/D7073
wilder-5.14
Kai Uwe Broulik 9 years ago
parent bd468dced1
commit 3558afa957
  1. 11
      wallpapers/image/image.cpp
  2. 3
      wallpapers/image/image.h
  3. 2
      wallpapers/image/imagepackage/contents/ui/config.qml

@ -37,6 +37,8 @@
#include <QTimer>
#include <QMimeDatabase>
#include <QImageReader>
#include <QQuickItem>
#include <QQuickWindow>
#include <QDebug>
#include <KDirWatch>
@ -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();
}

@ -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);

@ -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);
}
}
}

Loading…
Cancel
Save