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