-QVariantMap CoreAccountSettings::retrieveAccountData(AccountId id) {
- QVariantMap map;
- QString base = QString::number(id.toInt());
- foreach(const QString &key, localChildKeys(base)) {
- map[key] = localValue(base + "/" + key);
- }
-
- // FIXME Migration from 0.5 -> 0.6
- if(!map.contains("Uuid") && map.contains("Connection")) {
- QVariantMap oldmap = map.value("Connection").toMap();
- map["AccountName"] = oldmap.value("AccountName");
- map["HostName"] = oldmap.value("Host");
- map["Port"] = oldmap.value("Port");
- map["User"] = oldmap.value("User");
- map["Password"] = oldmap.value("Password");
- map["StorePassword"] = oldmap.value("RememberPasswd");
- map["UseSSL"] = oldmap.value("useSsl");
- map["UseProxy"] = oldmap.value("useProxy");
- map["ProxyHostName"] = oldmap.value("proxyHost");
- map["ProxyPort"] = oldmap.value("proxyPort");
- map["ProxyUser"] = oldmap.value("proxyUser");
- map["ProxyPassword"] = oldmap.value("proxyPassword");
- map["ProxyType"] = oldmap.value("proxyType");
-
- map["AccountId"] = id.toInt();
- map["Uuid"] = QUuid::createUuid().toString();
- }
+QVariantMap CoreAccountSettings::retrieveAccountData(AccountId id) const
+{
+ QVariantMap map;
+ QString base = QString::number(id.toInt());
+ foreach (const QString& key, localChildKeys(base)) {
+ map[key] = localValue(base + "/" + key);
+ }
+
+ // FIXME Migration from 0.5 -> 0.6
+ if (!map.contains("Uuid") && map.contains("Connection")) {
+ QVariantMap oldmap = map.value("Connection").toMap();
+ map["AccountName"] = oldmap.value("AccountName");
+ map["HostName"] = oldmap.value("Host");
+ map["Port"] = oldmap.value("Port");
+ map["User"] = oldmap.value("User");
+ map["Password"] = oldmap.value("Password");
+ map["StorePassword"] = oldmap.value("RememberPasswd");
+ map["UseSSL"] = oldmap.value("useSsl");
+ map["UseProxy"] = oldmap.value("useProxy");
+ map["ProxyHostName"] = oldmap.value("proxyHost");
+ map["ProxyPort"] = oldmap.value("proxyPort");
+ map["ProxyUser"] = oldmap.value("proxyUser");
+ map["ProxyPassword"] = oldmap.value("proxyPassword");
+ map["ProxyType"] = oldmap.value("proxyType");
+ map["Internal"] = oldmap.value("InternalAccount");
+
+ map["AccountId"] = id.toInt();
+ map["Uuid"] = QUuid::createUuid().toString();
+ }
+
+ return map;
+}
+
+void CoreAccountSettings::setAccountValue(const QString& key, const QVariant& value)
+{
+ if (!Client::currentCoreAccount().isValid())
+ return;
+ setLocalValue(QString("%1/%2/%3").arg(Client::currentCoreAccount().accountId().toInt()).arg(_subgroup).arg(key), value);
+}