|
|
|
@ -229,7 +229,7 @@ void Tray::slotOnlineMode()
|
|
|
|
|
|
|
|
|
|
void Tray::slotNewVPNConnection()
|
|
|
|
|
{
|
|
|
|
|
printf("Creating new VPN connection\n\r");
|
|
|
|
|
printf("Creating new VPN connection\n");
|
|
|
|
|
// create a new VPN connection
|
|
|
|
|
Connection* conn = new VPNConnection();
|
|
|
|
|
|
|
|
|
@ -410,7 +410,7 @@ Tray::slotStateChanged(TQ_UINT32 state)
|
|
|
|
|
setPixmap (loadIcon ("knetworkmanager"));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("NM state: %d\n\r", nm_state);
|
|
|
|
|
printf("NM state: %d\n", nm_state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
@ -443,7 +443,7 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
Storage* storage = Storage::getInstance();
|
|
|
|
|
bool hasSecretsStored = storage->hasSecretsStored(connection, setting);
|
|
|
|
|
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded\n\r");
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded\n");
|
|
|
|
|
kdDebug() << "Tray::slotVPNSecretsNeeded" << endl;
|
|
|
|
|
|
|
|
|
|
// default secrets handling for all other connection types
|
|
|
|
@ -454,7 +454,7 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
//if (hasSecretsStored && (!request_new))
|
|
|
|
|
if (hasSecretsStored)
|
|
|
|
|
{
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded: Restoring saved secrets\n\r");
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded: Restoring saved secrets\n");
|
|
|
|
|
// We have secrets stored, restore them
|
|
|
|
|
// if (storage->restoreVPNSecrets(connection, setting))
|
|
|
|
|
// {
|
|
|
|
@ -463,17 +463,17 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
TQString id = connection->getID();
|
|
|
|
|
TQString type = setting->getType();
|
|
|
|
|
|
|
|
|
|
printf("restoreVPNSecrets\n\r");
|
|
|
|
|
printf("restoreVPNSecrets\n");
|
|
|
|
|
// ID is necessary
|
|
|
|
|
if (id.isEmpty()) {
|
|
|
|
|
printf("VPN connection ID is empty!\n\r");
|
|
|
|
|
printf("VPN connection ID is empty!\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// Get a group for this setting
|
|
|
|
|
TQString setting_grp = TQString("ConnectionSecrets_%1_%2").arg(id).arg(type);
|
|
|
|
|
|
|
|
|
|
// Restore the settings
|
|
|
|
|
printf("Restoring VPN secret: %s\n\r", setting_grp.ascii());
|
|
|
|
|
printf("Restoring VPN secret: %s\n", setting_grp.ascii());
|
|
|
|
|
|
|
|
|
|
TDEConfigGroup secrets_grp(TDEGlobal::config(), setting_grp);
|
|
|
|
|
TQMap<TQString, TQString> config_map = TDEGlobal::config()->entryMap(setting_grp);
|
|
|
|
@ -483,7 +483,7 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
// ConnectionSetting* setting = conn->getSetting(typetwo);
|
|
|
|
|
// if (!setting)
|
|
|
|
|
// {
|
|
|
|
|
// printf("Secrets cannot be restored!\n\r");
|
|
|
|
|
// printf("Secrets cannot be restored!\n");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// Read the SettingsMap from tdeconfig
|
|
|
|
@ -502,12 +502,12 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
// Remove the annoying XML <string> stuff
|
|
|
|
|
xmldata.replace("<string>", "");
|
|
|
|
|
xmldata.replace("</string>", "");
|
|
|
|
|
//printf("Got %s with value %s\n\r", key.ascii(), xmldata.ascii());
|
|
|
|
|
//printf("Got %s with value %s\n", key.ascii(), xmldata.ascii());
|
|
|
|
|
map.insert(key, xmldata);
|
|
|
|
|
number_of_secrets_found++;
|
|
|
|
|
}
|
|
|
|
|
if (number_of_secrets_found > 0) {
|
|
|
|
|
printf("Got secrets from file, continuing...\n\r");
|
|
|
|
|
printf("Got secrets from file, continuing...\n");
|
|
|
|
|
|
|
|
|
|
// Good, we have new secrets now, update the settings
|
|
|
|
|
//map = _vpnAuthWidget->getPasswords();
|
|
|
|
@ -527,7 +527,7 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
conn->slotSecretsProvided(prop);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded: New secrets requested\n\r");
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded: New secrets requested\n");
|
|
|
|
|
// OK, NM requests new secrets...do something!
|
|
|
|
|
ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection);
|
|
|
|
|
VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth");
|
|
|
|
@ -540,7 +540,7 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
passdata.remove("\r");
|
|
|
|
|
passdata.remove("\n");
|
|
|
|
|
passdata.remove("\t");
|
|
|
|
|
//printf("Trying to set %s to value %s\n\r", it.key().ascii(), passdata.ascii());
|
|
|
|
|
//printf("Trying to set %s to value %s\n", it.key().ascii(), passdata.ascii());
|
|
|
|
|
auth->setPasswords(it.key(), passdata);
|
|
|
|
|
}
|
|
|
|
|
auth->show();
|
|
|
|
@ -549,7 +549,7 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
//connection->slotSecretsProvided(setting);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded: New secrets needed\n\r");
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded: New secrets needed\n");
|
|
|
|
|
// OK, NM needs new secrets...do something!
|
|
|
|
|
ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection);
|
|
|
|
|
VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth");
|
|
|
|
@ -560,7 +560,7 @@ Tray::slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, Connectio
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded: New secrets needed\n\r");
|
|
|
|
|
printf("Tray::slotVPNSecretsNeeded: New secrets needed\n");
|
|
|
|
|
// OK, NM needs new secrets...do something!
|
|
|
|
|
ConnectionSettings::VPNConnection* conn = dynamic_cast<ConnectionSettings::VPNConnection*>(connection);
|
|
|
|
|
VPNAuthenticationDialog* auth = new VPNAuthenticationDialog(conn, this, "vpnauth");
|
|
|
|
@ -578,7 +578,7 @@ Tray::slotSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSe
|
|
|
|
|
if (connection->getType() == NM_SETTING_VPN_SETTING_NAME)
|
|
|
|
|
{
|
|
|
|
|
if (vpn_new_credentials_needed == 1) {
|
|
|
|
|
printf("VPN connection failed with bad credentials\n\r");
|
|
|
|
|
printf("VPN connection failed with bad credentials\n");
|
|
|
|
|
vpn_new_credentials_needed = 0;
|
|
|
|
|
request_new = 1;
|
|
|
|
|
}
|
|
|
|
@ -897,7 +897,7 @@ void Tray::updateTrayIcon(NMDeviceState state)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (found_any_active_connection == 1) {
|
|
|
|
|
// printf("Active connection found\n\r");
|
|
|
|
|
// printf("Active connection found\n");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if ((current_vpn_state == NM_VPN_CONNECTION_STATE_FAILED) || (current_vpn_state == NM_VPN_CONNECTION_STATE_DISCONNECTED)) {
|
|
|
|
@ -940,8 +940,8 @@ void Tray::updateTrayIcon(NMDeviceState state)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("VPN state: %d\n\r", current_vpn_state);
|
|
|
|
|
//printf("Activated is: %d\n\r", NM_VPN_CONNECTION_STATE_ACTIVATED);
|
|
|
|
|
printf("VPN state: %d\n", current_vpn_state);
|
|
|
|
|
//printf("Activated is: %d\n", NM_VPN_CONNECTION_STATE_ACTIVATED);
|
|
|
|
|
// stop the old movie to avoid unnecessary wakups
|
|
|
|
|
DeviceTrayComponent * dtc = d->foregroundTrayComponent;
|
|
|
|
|
|
|
|
|
@ -976,7 +976,7 @@ void Tray::updateTrayIcon(NMDeviceState state)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nm_device_state_global = state;
|
|
|
|
|
//printf("Device state: %d\n\r", nm_device_state_global);
|
|
|
|
|
//printf("Device state: %d\n", nm_device_state_global);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Tray::updateActiveConnection(NMDeviceState state)
|
|
|
|
@ -1010,7 +1010,7 @@ void Tray::slotDeviceRemovedNotify(Device* dev)
|
|
|
|
|
|
|
|
|
|
void Tray::slotVPNBannerShow(const TQString& vpnbanner)
|
|
|
|
|
{
|
|
|
|
|
printf("VPN banner: %s\n\r", vpnbanner.ascii());
|
|
|
|
|
printf("VPN banner: %s\n", vpnbanner.ascii());
|
|
|
|
|
KNotifyClient::event(winId(), "knm-nm-vpn-banner", vpnbanner);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|