Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/image.cpp
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | |||||
42 | #include <QQuickWindow> | 42 | #include <QQuickWindow> | ||
43 | 43 | | |||
44 | #include <QDebug> | 44 | #include <QDebug> | ||
45 | #include <KDirWatch> | 45 | #include <KDirWatch> | ||
46 | #include <QFileDialog> | 46 | #include <QFileDialog> | ||
47 | #include <KRandom> | 47 | #include <KRandom> | ||
48 | #include <KIO/Job> | 48 | #include <KIO/Job> | ||
49 | #include <krun.h> | 49 | #include <krun.h> | ||
50 | #include <KNewStuff3/KNS3/DownloadDialog> | | |||
51 | #include <klocalizedstring.h> | 50 | #include <klocalizedstring.h> | ||
52 | 51 | | |||
53 | #include <Plasma/Theme> | 52 | #include <Plasma/Theme> | ||
54 | #include <Plasma/PluginLoader> | 53 | #include <Plasma/PluginLoader> | ||
55 | #include <qstandardpaths.h> | 54 | #include <qstandardpaths.h> | ||
56 | #include "backgroundlistmodel.h" | 55 | #include "backgroundlistmodel.h" | ||
57 | #include "slidemodel.h" | 56 | #include "slidemodel.h" | ||
58 | #include "slidefiltermodel.h" | 57 | #include "slidefiltermodel.h" | ||
▲ Show 20 Lines • Show All 580 Lines • ▼ Show 20 Line(s) | 637 | } else { | |||
639 | m_currentSlide = -1; | 638 | m_currentSlide = -1; | ||
640 | } | 639 | } | ||
641 | m_slideFilterModel->sort(0); | 640 | m_slideFilterModel->sort(0); | ||
642 | nextSlide(); | 641 | nextSlide(); | ||
643 | m_timer.start(m_delay * 1000); | 642 | m_timer.start(m_delay * 1000); | ||
644 | } | 643 | } | ||
645 | } | 644 | } | ||
646 | 645 | | |||
647 | void Image::getNewWallpaper(QQuickItem *ctx) | | |||
648 | { | | |||
649 | if (!m_newStuffDialog) { | | |||
650 | m_newStuffDialog = new KNS3::DownloadDialog( QString::fromLatin1("wallpaper.knsrc") ); | | |||
651 | KNS3::DownloadDialog *strong = m_newStuffDialog.data(); | | |||
652 | strong->setTitle(i18n("Download Wallpapers")); | | |||
653 | connect(m_newStuffDialog.data(), &QDialog::accepted, this, &Image::newStuffFinished); | | |||
654 | } | | |||
655 | | ||||
656 | if (ctx && ctx->window()) { | | |||
657 | m_newStuffDialog->setWindowModality(Qt::WindowModal); | | |||
658 | m_newStuffDialog->winId(); // so it creates the windowHandle(); | | |||
659 | m_newStuffDialog->windowHandle()->setTransientParent(ctx->window()); | | |||
660 | } | | |||
661 | | ||||
662 | m_newStuffDialog.data()->show(); | | |||
663 | } | | |||
664 | | ||||
665 | void Image::newStuffFinished() | 646 | void Image::newStuffFinished() | ||
666 | { | 647 | { | ||
667 | if (m_model && (!m_newStuffDialog || m_newStuffDialog.data()->changedEntries().size() > 0)) { | 648 | if (m_model) { | ||
668 | m_model->reload(m_usersWallpapers); | 649 | m_model->reload(m_usersWallpapers); | ||
669 | } | 650 | } | ||
670 | } | 651 | } | ||
671 | 652 | | |||
672 | void Image::showFileDialog() | 653 | void Image::showFileDialog() | ||
673 | { | 654 | { | ||
674 | if (!m_dialog) { | 655 | if (!m_dialog) { | ||
675 | QUrl baseUrl; | 656 | QUrl baseUrl; | ||
▲ Show 20 Lines • Show All 239 Lines • Show Last 20 Lines |