- foreach(NetworkId id, s.networkIds()) {
- NetworkInfo info = s.networkInfo(id);
- createNetwork(info, true);
- }
-
- // FIXME Migrate old settings if available...
- if(!_networks.count()) {
- QVariantMap networks = s.sessionValue("Networks").toMap();
- if(networks.keys().count()) {
- qWarning() << "Migrating your old network settings to the new format!";
- foreach(QString netname, networks.keys()) {
- QVariantMap network = networks[netname].toMap();
- NetworkId netid = Core::networkId(user(), netname);
- NetworkInfo info;
- info.networkId = netid;
- info.networkName = netname;
- info.identity = 1;
- info.codecForEncoding = "ISO-8859-15";
- info.codecForDecoding = "ISO-8859-15";
- QVariantList slist;
- foreach(QVariant v, network["Servers"].toList()) {
- QVariantMap server;
- server["Host"] = v.toMap()["Address"];
- server["Port"] = v.toMap()["Port"];
- slist << server;
- }
- info.serverList = slist;
- createNetwork(info, true);
- }
- }