From cd96e2b64294d102f7cc184a8abd54cb6d77f234 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 9 Apr 2024 08:08:44 +0300 Subject: [PATCH] kdeplasma-addons: drop potd feature of frame applet Signed-off-by: Ivailo Monev --- kdeplasma-addons/applets/frame/frame.cpp | 61 +------------------ kdeplasma-addons/applets/frame/frame.h | 4 -- .../applets/frame/imageSettings.ui | 35 ----------- kdeplasma-addons/applets/frame/slideshow.cpp | 24 -------- kdeplasma-addons/applets/frame/slideshow.h | 13 ++-- 5 files changed, 5 insertions(+), 132 deletions(-) diff --git a/kdeplasma-addons/applets/frame/frame.cpp b/kdeplasma-addons/applets/frame/frame.cpp index fcae28d0..e168fed4 100644 --- a/kdeplasma-addons/applets/frame/frame.cpp +++ b/kdeplasma-addons/applets/frame/frame.cpp @@ -44,7 +44,6 @@ #include #include -#include #include #include #include @@ -196,8 +195,6 @@ void Frame::configChanged() m_slideshowTime = cg.readEntry("slideshow time", 60); // default to 1 minute m_currentUrl = cg.readEntry("url", m_currentUrl); setAssociatedApplicationUrls(m_currentUrl); - m_potdProvider = cg.readEntry("potdProvider", QString()); - m_potd = cg.readEntry("potd", false); m_autoUpdateIntervall = cg.readEntry("autoupdate time", 0); initSlideShow(); @@ -537,23 +534,6 @@ void Frame::createConfigurationInterface(KConfigDialog *parent) { m_configDialog = new ConfigDialog(parent); - KService::List services = KServiceTypeTrader::self()->query("PlasmaPoTD/Plugin"); - foreach(const KService::Ptr &service, services) { - const QString service_name(service->name()); - const QVariant service_identifier(service->property("X-KDE-PlasmaPoTDProvider-Identifier", QVariant::String).toString()); - m_configDialog->imageUi.potdComboBox->insertItem(m_configDialog->imageUi.potdComboBox->count(), service_name, service_identifier); - } - - QStandardItemModel* model = static_cast(m_configDialog->imageUi.pictureComboBox->model()); - QStandardItem* item = model->item(2); - - if (item) { - if (services.isEmpty()) - item->setFlags(item->flags() & ~Qt::ItemIsEnabled); - else - item->setFlags(item->flags() | Qt::ItemIsEnabled); - } - parent->addPage(m_configDialog->imageSettings, i18n("Image"), icon()); parent->addPage(m_configDialog->appearanceSettings, i18n("Appearance"), "preferences-desktop-theme"); parent->setDefaultButton(KDialog::Ok); @@ -572,8 +552,6 @@ void Frame::createConfigurationInterface(KConfigDialog *parent) if (m_slideShow) { m_configDialog->imageUi.pictureComboBox->setCurrentIndex(1); - } else if (m_potd) { - m_configDialog->imageUi.pictureComboBox->setCurrentIndex(2); } else { m_configDialog->imageUi.pictureComboBox->setCurrentIndex(0); } @@ -581,11 +559,6 @@ void Frame::createConfigurationInterface(KConfigDialog *parent) m_configDialog->imageUi.randomCheckBox->setCheckState(m_random ? Qt::Checked : Qt::Unchecked); m_configDialog->imageUi.recursiveCheckBox->setCheckState(m_recursiveSlideShow ? Qt::Checked : Qt::Unchecked); - if (!m_potdProvider.isEmpty()) - m_configDialog->imageUi.potdComboBox->setCurrentIndex(m_configDialog->imageUi.potdComboBox->findData(m_potdProvider)); - else - m_configDialog->imageUi.potdComboBox->setCurrentIndex(0); - m_configDialog->setCurrentUrl(m_currentUrl); m_configDialog->imageUi.slideShowDirList->clear(); m_configDialog->imageUi.slideShowDirList->addItems(m_slideShowPaths); @@ -611,8 +584,6 @@ void Frame::createConfigurationInterface(KConfigDialog *parent) parent, SLOT(settingsModified())); connect(m_configDialog->imageUi.recursiveCheckBox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); - connect(m_configDialog->imageUi.potdComboBox, SIGNAL(currentIndexChanged(int)), - parent, SLOT(settingsModified())); connect(m_configDialog->appearanceUi.roundCheckBox, SIGNAL(toggled(bool)), parent, SLOT(settingsModified())); connect(m_configDialog->appearanceUi.shadowCheckBox, SIGNAL(toggled(bool)), @@ -636,17 +607,10 @@ void Frame::configAccepted() m_frameColor = m_configDialog->frameColor(); cg.writeEntry("frameColor", m_frameColor); - bool wasPotd = m_potd; - if (m_configDialog->imageUi.pictureComboBox->currentIndex() == 1) { m_slideShow = true; - m_potd = false; - } else if (m_configDialog->imageUi.pictureComboBox->currentIndex() == 2) { - m_slideShow = false; - m_potd = true; } else { m_slideShow = false; - m_potd = false; } m_random = m_configDialog->random(); @@ -674,30 +638,11 @@ void Frame::configAccepted() m_autoUpdateIntervall = AutoUpdateTimer.second() + AutoUpdateTimer.minute() * 60 + AutoUpdateTimer.hour() * 3600; cg.writeEntry("autoupdate time", m_autoUpdateIntervall); - QString potdProvider = m_configDialog->imageUi.potdComboBox->itemData(m_configDialog->imageUi.potdComboBox->currentIndex()).toString(); - - if ((wasPotd && !m_potd) || (m_potd && potdProvider != m_potdProvider)) { - // if we go from potd to no potd, or if the provider changes, then we first want to - // stop the potd engine - stopPotd(); - } - - m_potdProvider = potdProvider; - cg.writeEntry("potdProvider", m_potdProvider); - cg.writeEntry("potd", m_potd); - initSlideShow(); emit configNeedsSaving(); } -void Frame::stopPotd() -{ - Plasma::DataEngine *engine = dataEngine("potd"); - engine->disconnectSource(m_potdProvider, m_mySlideShow); - m_autoUpdateTimer->stop(); -} - void Frame::initSlideShow() { m_mySlideShow->setUpdateInterval(0); @@ -707,9 +652,6 @@ void Frame::initSlideShow() m_mySlideShow->setRandom(m_random); m_mySlideShow->setDirs(m_slideShowPaths, m_recursiveSlideShow); m_mySlideShow->setUpdateInterval(m_slideshowTime * 1000); - } else if (m_potd) { - Plasma::DataEngine *engine = dataEngine("potd"); - engine->connectSource(m_potdProvider, m_mySlideShow); } else { //no slideshow so no random stuff m_mySlideShow->setRandom(false); m_mySlideShow->setImage(m_currentUrl.url()); @@ -751,8 +693,7 @@ void Frame::dropEvent(QGraphicsSceneDragDropEvent *event) m_slideShow = false; } - stopPotd(); - m_potd = false; + m_autoUpdateTimer->stop(); initSlideShow(); KConfigGroup cg = config(); diff --git a/kdeplasma-addons/applets/frame/frame.h b/kdeplasma-addons/applets/frame/frame.h index 760318e8..32dce3a4 100644 --- a/kdeplasma-addons/applets/frame/frame.h +++ b/kdeplasma-addons/applets/frame/frame.h @@ -85,7 +85,6 @@ protected: QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const; private: - void stopPotd(); void initSlideShow(); void checkSlideFrame(); @@ -101,9 +100,6 @@ private: bool m_roundCorners; /// If true, the picture will have a drop shadow. bool m_shadow; - /// PoTD - QString m_potdProvider; - bool m_potd; /// Stores the current picture URL when slideShow is false. Wikipedia Picture of the Day is default. KUrl m_currentUrl; /// The current slideshow folder diff --git a/kdeplasma-addons/applets/frame/imageSettings.ui b/kdeplasma-addons/applets/frame/imageSettings.ui index d707f671..b3a4d00d 100644 --- a/kdeplasma-addons/applets/frame/imageSettings.ui +++ b/kdeplasma-addons/applets/frame/imageSettings.ui @@ -23,11 +23,6 @@ Slideshow - - - Picture of the day - - @@ -320,36 +315,6 @@ Useful if you want a live cam or weather data to be up to date. - - - - - - Select Picture of the day source: - - - potdComboBox - - - - - - - - - - Qt::Vertical - - - - 20 - 68 - - - - - - diff --git a/kdeplasma-addons/applets/frame/slideshow.cpp b/kdeplasma-addons/applets/frame/slideshow.cpp index a1ab5a4a..82270342 100644 --- a/kdeplasma-addons/applets/frame/slideshow.cpp +++ b/kdeplasma-addons/applets/frame/slideshow.cpp @@ -226,28 +226,4 @@ void SlideShow::clearPicture() m_image = QImage(); } -void SlideShow::dataUpdated(const QString &name, const Plasma::DataEngine::Data &data) -{ - Q_UNUSED(name); - if (data.isEmpty()) { - m_image = QImage(); - m_picture->setMessage(i18n("No Picture from this Provider.")); - return; - } - - m_image = data["Image"].value(); - m_currentUrl = data["Url"].toString(); - //kDebug() << name << "got data with keys of" << data.keys() << m_image.isNull() << data["Url"]; - //Compatibility with old dataengines - if (m_image.isNull()) { - QPixmap tmpPixmap = data["Image"].value(); - if (!tmpPixmap.isNull()) { - m_image = tmpPixmap.toImage(); - } - } - - m_picture->setMessage(QString()); - emit pictureUpdated(); -} - #include "moc_slideshow.cpp" diff --git a/kdeplasma-addons/applets/frame/slideshow.h b/kdeplasma-addons/applets/frame/slideshow.h index 49d4905b..ac2c786f 100644 --- a/kdeplasma-addons/applets/frame/slideshow.h +++ b/kdeplasma-addons/applets/frame/slideshow.h @@ -20,17 +20,13 @@ #ifndef SLIDESHOW_H #define SLIDESHOW_H -#include -#include -#include - -#include - -#include - #include "picture.h" #include +#include +#include +#include +#include class SlideShow : public QObject { @@ -50,7 +46,6 @@ public: void setUpdateInterval(int msec); public Q_SLOTS: - void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data); void firstPicture(); void nextPicture(); void previousPicture();