|
|
@ -98,7 +98,7 @@ Storage::slotConnectionAdded(Connection* con)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// connection added, save it
|
|
|
|
// connection added, save it
|
|
|
|
saveConnection(con);
|
|
|
|
saveConnection(con);
|
|
|
|
KGlobal::config()->sync();
|
|
|
|
TDEGlobal::config()->sync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
@ -106,7 +106,7 @@ Storage::slotConnectionRemoved(Connection* con)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// find the appropriate connection and delete it from the storage
|
|
|
|
// find the appropriate connection and delete it from the storage
|
|
|
|
deleteConnection(con);
|
|
|
|
deleteConnection(con);
|
|
|
|
KGlobal::config()->sync();
|
|
|
|
TDEGlobal::config()->sync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Connection*
|
|
|
|
Connection*
|
|
|
@ -133,7 +133,7 @@ Storage::restoreConnections()
|
|
|
|
kdDebug() << k_funcinfo << endl;
|
|
|
|
kdDebug() << k_funcinfo << endl;
|
|
|
|
// let's read all connections from the config-file and add them to the connection-store
|
|
|
|
// let's read all connections from the config-file and add them to the connection-store
|
|
|
|
ConnectionStore* store = ConnectionStore::getInstance();
|
|
|
|
ConnectionStore* store = ConnectionStore::getInstance();
|
|
|
|
TQStringList groups = KGlobal::config()->groupList();
|
|
|
|
TQStringList groups = TDEGlobal::config()->groupList();
|
|
|
|
const TQStringList::Iterator end = groups.end();
|
|
|
|
const TQStringList::Iterator end = groups.end();
|
|
|
|
for ( TQStringList::Iterator it = groups.begin(); it != end; ++it )
|
|
|
|
for ( TQStringList::Iterator it = groups.begin(); it != end; ++it )
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -158,7 +158,7 @@ Storage::restoreConnection(const TQString& grpname)
|
|
|
|
kdDebug() << k_funcinfo << " " << grpname << endl;
|
|
|
|
kdDebug() << k_funcinfo << " " << grpname << endl;
|
|
|
|
|
|
|
|
|
|
|
|
// we have a connection to restore
|
|
|
|
// we have a connection to restore
|
|
|
|
KConfigGroup grp( KGlobal::config(), grpname);
|
|
|
|
KConfigGroup grp( TDEGlobal::config(), grpname);
|
|
|
|
TQString id = grp.readEntry("Id");
|
|
|
|
TQString id = grp.readEntry("Id");
|
|
|
|
TQString cType = grp.readEntry("Type");
|
|
|
|
TQString cType = grp.readEntry("Type");
|
|
|
|
|
|
|
|
|
|
|
@ -217,8 +217,8 @@ Storage::restoreSetting(Connection* conn, const TQString& setting_grp_name)
|
|
|
|
kdDebug() << k_funcinfo << " " << setting_grp_name << endl;
|
|
|
|
kdDebug() << k_funcinfo << " " << setting_grp_name << endl;
|
|
|
|
kdDebug() << "restore setting: " << setting_grp_name.ascii() << endl;
|
|
|
|
kdDebug() << "restore setting: " << setting_grp_name.ascii() << endl;
|
|
|
|
|
|
|
|
|
|
|
|
KConfigGroup setting_grp(KGlobal::config(), setting_grp_name);
|
|
|
|
KConfigGroup setting_grp(TDEGlobal::config(), setting_grp_name);
|
|
|
|
TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp_name);
|
|
|
|
TQMap<TQString, TQString> config_map = TDEGlobal::config()->entryMap(setting_grp_name);
|
|
|
|
TQString type = setting_grp.readEntry("Type");
|
|
|
|
TQString type = setting_grp.readEntry("Type");
|
|
|
|
|
|
|
|
|
|
|
|
// get the appropriate setting from the connection
|
|
|
|
// get the appropriate setting from the connection
|
|
|
@ -257,8 +257,8 @@ Storage::restoreSecrets(Connection* conn, const TQString& secrets_grp_name)
|
|
|
|
kdDebug() << k_funcinfo << " " << secrets_grp_name << endl;
|
|
|
|
kdDebug() << k_funcinfo << " " << secrets_grp_name << endl;
|
|
|
|
kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl;
|
|
|
|
kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl;
|
|
|
|
|
|
|
|
|
|
|
|
KConfigGroup secrets_grp(KGlobal::config(), secrets_grp_name);
|
|
|
|
KConfigGroup secrets_grp(TDEGlobal::config(), secrets_grp_name);
|
|
|
|
TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(secrets_grp_name);
|
|
|
|
TQMap<TQString, TQString> config_map = TDEGlobal::config()->entryMap(secrets_grp_name);
|
|
|
|
TQString type = secrets_grp.readEntry("Type");
|
|
|
|
TQString type = secrets_grp.readEntry("Type");
|
|
|
|
|
|
|
|
|
|
|
|
// get the appropriate setting from the connection
|
|
|
|
// get the appropriate setting from the connection
|
|
|
@ -297,8 +297,8 @@ Storage::restoreVPNSecrets(Connection* conn, const TQString& secrets_grp_name)
|
|
|
|
kdDebug() << k_funcinfo << " " << secrets_grp_name << endl;
|
|
|
|
kdDebug() << k_funcinfo << " " << secrets_grp_name << endl;
|
|
|
|
kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl;
|
|
|
|
kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl;
|
|
|
|
|
|
|
|
|
|
|
|
KConfigGroup secrets_grp(KGlobal::config(), secrets_grp_name);
|
|
|
|
KConfigGroup secrets_grp(TDEGlobal::config(), secrets_grp_name);
|
|
|
|
TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(secrets_grp_name);
|
|
|
|
TQMap<TQString, TQString> config_map = TDEGlobal::config()->entryMap(secrets_grp_name);
|
|
|
|
TQString type = secrets_grp.readEntry("Type");
|
|
|
|
TQString type = secrets_grp.readEntry("Type");
|
|
|
|
|
|
|
|
|
|
|
|
// get the appropriate setting from the connection
|
|
|
|
// get the appropriate setting from the connection
|
|
|
@ -346,13 +346,13 @@ Storage::saveConnections()
|
|
|
|
// save this connection
|
|
|
|
// save this connection
|
|
|
|
saveConnection(*it);
|
|
|
|
saveConnection(*it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
KGlobal::config()->sync();
|
|
|
|
TDEGlobal::config()->sync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
Storage::saveConnection(Connection* conn)
|
|
|
|
Storage::saveConnection(Connection* conn)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KConfig* config = KGlobal::config();
|
|
|
|
KConfig* config = TDEGlobal::config();
|
|
|
|
TQString id = conn->getID();
|
|
|
|
TQString id = conn->getID();
|
|
|
|
TQString cType = conn->getType();
|
|
|
|
TQString cType = conn->getType();
|
|
|
|
|
|
|
|
|
|
|
@ -416,7 +416,7 @@ Storage::saveConnectionSettings(Connection* conn, TQStringList& settings_grps, T
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
Storage::saveConnectionSetting(Connection* conn, ConnectionSetting* setting, TQString& setting_grp)
|
|
|
|
Storage::saveConnectionSetting(Connection* conn, ConnectionSetting* setting, TQString& setting_grp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KConfig* config = KGlobal::config();
|
|
|
|
KConfig* config = TDEGlobal::config();
|
|
|
|
TQString id = conn->getID();
|
|
|
|
TQString id = conn->getID();
|
|
|
|
TQString type = setting->getType();
|
|
|
|
TQString type = setting->getType();
|
|
|
|
|
|
|
|
|
|
|
@ -446,7 +446,7 @@ Storage::saveConnectionSetting(Connection* conn, ConnectionSetting* setting, TQS
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
Storage::saveConnectionSecrets(Connection* conn, ConnectionSetting* setting, TQString& setting_grp)
|
|
|
|
Storage::saveConnectionSecrets(Connection* conn, ConnectionSetting* setting, TQString& setting_grp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KConfig* config = KGlobal::config();
|
|
|
|
KConfig* config = TDEGlobal::config();
|
|
|
|
TQString id = conn->getID();
|
|
|
|
TQString id = conn->getID();
|
|
|
|
TQString type = setting->getType();
|
|
|
|
TQString type = setting->getType();
|
|
|
|
bool storage_requested;
|
|
|
|
bool storage_requested;
|
|
|
@ -529,7 +529,7 @@ Storage::hasSecretsStored(Connection* connection, ConnectionSetting* setting)
|
|
|
|
// get a group for this setting
|
|
|
|
// get a group for this setting
|
|
|
|
TQString setting_grp_name = TQString("ConnectionSecrets_%1_%2").arg(id).arg(type);
|
|
|
|
TQString setting_grp_name = TQString("ConnectionSecrets_%1_%2").arg(id).arg(type);
|
|
|
|
|
|
|
|
|
|
|
|
TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp_name);
|
|
|
|
TQMap<TQString, TQString> config_map = TDEGlobal::config()->entryMap(setting_grp_name);
|
|
|
|
|
|
|
|
|
|
|
|
return !(config_map.isEmpty());
|
|
|
|
return !(config_map.isEmpty());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -593,7 +593,7 @@ Storage::restoreVPNSecrets(Connection* connection, ConnectionSetting* setting)
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
Storage::deleteConnection(Connection* conn)
|
|
|
|
Storage::deleteConnection(Connection* conn)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KConfig* config = KGlobal::config();
|
|
|
|
KConfig* config = TDEGlobal::config();
|
|
|
|
TQString id = conn->getID();
|
|
|
|
TQString id = conn->getID();
|
|
|
|
TQString cType = conn->getType();
|
|
|
|
TQString cType = conn->getType();
|
|
|
|
|
|
|
|
|
|
|
|