Commit e7832a71 authored by Pekka Lundstrom's avatar Pekka Lundstrom

Added support for cmd-remove in ssu-defaults.init

Signed-off-by: default avatarPekka Lundstrom <pekka.lundstrom@jollamobile.com>
parent 8499335d
......@@ -54,7 +54,17 @@ Ssu::Ssu(): QObject(){
defaultKeys = defaultSettings.allKeys();
defaultSettings.endGroup();
foreach (const QString &key, defaultKeys){
if (!settings->contains(key)){
// Default keys support both commands and new keys
if (key.compare("cmd-remove", Qt::CaseSensitive) == 0){
// Remove keys listed in value as string list
QStringList oldKeys = defaultSettings.value(currentSection + key).toStringList();
foreach (const QString &oldKey, oldKeys){
if (settings->contains(oldKey)){
settings->remove(oldKey);
qDebug() << "Removing old key:" << oldKey;
}
}
} else if (!settings->contains(key)){
// Add new keys..
settings->setValue(key, defaultSettings.value(currentSection + key));
qDebug() << "Adding new key: " << key;
......
# ssu configuration is located in /etc/ssu/ssu.ini
# When ssu is initialized configVersion number in that file is compared
# to configVersion in this file (/usr/share/ssu/ssu-defaults.ini).
# If this file has bigger version then upgrade takes place.
# Starting from next bigger version block new key/value pairs are read and added to
# the config (/etc/ssu/ssu.ini) assuming config doesn't have that key already.
# Old keys can be removed from the config with special key called "cmd-remove"
# Syntax cmd-remove=<old-key1>, <old-key2>, ...
[General]
configVersion=2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment