From 6f256aa7e6ac2a76168a46228ae08614f85d14c0 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Tue, 11 Feb 2014 13:29:37 +0100 Subject: [PATCH] remove the legacy config machinery --- .../qml/plasmoid/appletinterface.cpp | 69 ------------------- .../qml/plasmoid/appletinterface.h | 26 ------- 2 files changed, 95 deletions(-) diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index e9447c9cf..113e6a7f8 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -258,75 +258,6 @@ void AppletInterface::setConfigurationRequired(bool needsConfiguring, const QStr appletScript()->setConfigurationRequired(needsConfiguring, reason); } -QString AppletInterface::activeConfig() const -{ - return m_currentConfig.isEmpty() ? "main" : m_currentConfig; -} - -void AppletInterface::setActiveConfig(const QString &name) -{ - if (name == "main") { - m_currentConfig.clear(); - return; - } - - Plasma::ConfigLoader *loader = m_configs.value(name, 0); - - if (!loader) { - QString path = appletScript()->filePath("config", name + ".xml"); - if (path.isEmpty()) { - return; - } - - QFile f(path); - KConfigGroup cg = applet()->config(); - loader = new Plasma::ConfigLoader(&cg, &f, this); - m_configs.insert(name, loader); - } - - m_currentConfig = name; -} - -void AppletInterface::writeConfig(const QString &entry, const QVariant &value) -{ - Plasma::ConfigLoader *config = 0; - if (m_currentConfig.isEmpty()) { - config = applet()->configScheme(); - } else { - config = m_configs.value(m_currentConfig, 0); - } - - if (config) { - KConfigSkeletonItem *item = config->findItemByName(entry); - if (item) { - item->setProperty(value); - config->blockSignals(true); - config->writeConfig(); - config->blockSignals(false); - appletScript()->configNeedsSaving(); - } - } else - qWarning() << "Couldn't find a configuration entry"; -} - -QVariant AppletInterface::readConfig(const QString &entry) const -{ - Plasma::ConfigLoader *config = 0; - QVariant result; - - if (m_currentConfig.isEmpty()) { - config = applet()->configScheme(); - } else { - config = m_configs.value(m_currentConfig, 0); - } - - if (config) { - result = config->property(entry); - } - - return result; -} - QString AppletInterface::file(const QString &fileType) { return appletScript()->filePath(fileType, QString()); diff --git a/src/scriptengines/qml/plasmoid/appletinterface.h b/src/scriptengines/qml/plasmoid/appletinterface.h index 10cd15d9b..338ca8b3d 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.h +++ b/src/scriptengines/qml/plasmoid/appletinterface.h @@ -109,12 +109,6 @@ class AppletInterface : public AppletQuickItem */ Q_PROPERTY(QObject* configuration READ configuration CONSTANT) - /** - * FIXME-API: do we still want this? - * current active configuration - */ - Q_PROPERTY(QString activeConfig WRITE setActiveConfig READ activeConfig) - /** * When true the plasmoid is busy. The containment may graphically indicate that drawing for instance a spinner busy widget over it */ @@ -216,20 +210,6 @@ public: */ Q_INVOKABLE QStringList downloadedFiles() const; - /** - * FIXME: remove? - * Read a value from the configuration - * DEPRECATED: use plasmoid.configuration instead - */ - Q_INVOKABLE QVariant readConfig(const QString &entry) const; - - /** - * FIXME: remove? - * Write a value in the configuration - * DEPRECATED: use plasmoid.configuration instead - */ - Q_INVOKABLE void writeConfig(const QString &entry, const QVariant &value); - static AppletInterface *qmlAttachedProperties(QObject *object) { return qobject_cast(AppletQuickItem::qmlAttachedProperties(object)); @@ -272,9 +252,6 @@ public: int screen() const; - QString activeConfig() const; - void setActiveConfig(const QString &name); - bool immutable() const; bool userConfiguring() const; int apiVersion() const; @@ -317,9 +294,6 @@ private: QStringList m_actions; QSignalMapper *m_actionSignals; - QString m_currentConfig; - QMap m_configs; - KDeclarative::ConfigPropertyMap *m_configuration; DeclarativeAppletScript *m_appletScriptEngine;