remove the legacy config machinery

This commit is contained in:
Marco Martin 2014-02-11 13:29:37 +01:00
parent 66d10d5c5a
commit 6f256aa7e6
2 changed files with 0 additions and 95 deletions

View File

@ -258,75 +258,6 @@ void AppletInterface::setConfigurationRequired(bool needsConfiguring, const QStr
appletScript()->setConfigurationRequired(needsConfiguring, reason); 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) QString AppletInterface::file(const QString &fileType)
{ {
return appletScript()->filePath(fileType, QString()); return appletScript()->filePath(fileType, QString());

View File

@ -109,12 +109,6 @@ class AppletInterface : public AppletQuickItem
*/ */
Q_PROPERTY(QObject* configuration READ configuration CONSTANT) 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 * 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; 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) static AppletInterface *qmlAttachedProperties(QObject *object)
{ {
return qobject_cast<AppletInterface *>(AppletQuickItem::qmlAttachedProperties(object)); return qobject_cast<AppletInterface *>(AppletQuickItem::qmlAttachedProperties(object));
@ -272,9 +252,6 @@ public:
int screen() const; int screen() const;
QString activeConfig() const;
void setActiveConfig(const QString &name);
bool immutable() const; bool immutable() const;
bool userConfiguring() const; bool userConfiguring() const;
int apiVersion() const; int apiVersion() const;
@ -317,9 +294,6 @@ private:
QStringList m_actions; QStringList m_actions;
QSignalMapper *m_actionSignals; QSignalMapper *m_actionSignals;
QString m_currentConfig;
QMap<QString, Plasma::ConfigLoader*> m_configs;
KDeclarative::ConfigPropertyMap *m_configuration; KDeclarative::ConfigPropertyMap *m_configuration;
DeclarativeAppletScript *m_appletScriptEngine; DeclarativeAppletScript *m_appletScriptEngine;