Fix network-manager OpenVPN settings interface

This resolves Bug 1530
Ensure that a device tray component is always shown
pull/1/head
Timothy Pearson 11 years ago
parent c5ff9d998a
commit 73618d03cf

@ -129,9 +129,14 @@ VPNWidgetImpl::Init()
slotServiceComboActivated(0); slotServiceComboActivated(0);
} }
#if 0
// update the username to the current one // update the username to the current one
KUser user; KUser user;
_vpnsetting->lockedUserName = user.loginName(); _vpnsetting->lockedUserName = user.loginName();
#else
// Not needed for NM 0.9 and above?
_vpnsetting->lockedUserName = TQString::null;
#endif
// notification if VPN service is selected // notification if VPN service is selected
connect(_mainWid->cboServices, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotServiceComboActivated(int))); connect(_mainWid->cboServices, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotServiceComboActivated(int)));

@ -440,7 +440,7 @@ void Tray::slotRemoveDeviceTrayComponent(TQString dev)
if (dev_comp->device() == dev) if (dev_comp->device() == dev)
{ {
if (d->foregroundTrayComponent && dev_comp->device() == d->foregroundTrayComponent->device() ) { if (d->foregroundTrayComponent && dev_comp->device() == d->foregroundTrayComponent->device() ) {
d->foregroundTrayComponent = 0; d->foregroundTrayComponent = NULL;
} }
// remove the appropriate action // remove the appropriate action
@ -666,6 +666,9 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt)
updateTrayDeviceManagerState(); updateTrayDeviceManagerState();
} }
} }
// Make sure a relevant foregroundTrayComponent is shown at all times...
showActiveDeviceTray();
} }
} }
} }

@ -69,35 +69,35 @@ VPNAuthenticationWidget* OpenVPNPlugin::CreateAuthenticationWidget(TQWidget* par
/************************************ /************************************
* OpenVPNConnectionType * OpenVPNConnectionType
************************************/ ************************************/
OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(int prop) OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(TQString prop)
{ {
if (prop == 0) if (prop == "tls")
return X509; return X509;
else if (prop == 1) else if (prop == "static-key")
return SHARED_KEY; return SHARED_KEY;
else if (prop == 2) else if (prop == "password")
return PASSWORD; return PASSWORD;
else if (prop == 3) else if (prop == "password-tls")
return X509USERPASS; return X509USERPASS;
return UNKNOWN; return UNKNOWN;
} }
int OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) TQString OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
{ {
switch(connType) switch(connType)
{ {
case X509: case X509:
return 0; return "tls";
case SHARED_KEY: case SHARED_KEY:
return 1; return "static-key";
case PASSWORD: case PASSWORD:
return 2; return "password";
case X509USERPASS: case X509USERPASS:
return 3; return "password-tls";
default: default:
return -1; return TQString::null;
} }
return -1; return TQString::null;
} }
/************************************ /************************************
@ -201,7 +201,7 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
if (entry == "connection-type") if (entry == "connection-type")
{ {
OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value.toInt()); OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value);
_openvpnWidget->cboConnectionType->setCurrentItem(type); _openvpnWidget->cboConnectionType->setCurrentItem(type);
_openvpnWidget->widgetStack->raiseWidget(type); _openvpnWidget->widgetStack->raiseWidget(type);
} }
@ -221,9 +221,13 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
_openvpnWidget->chkDefaultPort->setChecked(true); _openvpnWidget->chkDefaultPort->setChecked(true);
} }
} }
else if (entry == "proto" || entry == "proto-tcp") else if (entry == "proto")
{ {
_openvpnWidget->chkUseTCP->setChecked( value == "yes"); _openvpnWidget->chkUseTCP->setChecked(value == "yes");
}
else if (entry == "proto-tcp")
{
_openvpnWidget->chkUseTCP->setChecked(value == "yes");
} }
else if (entry == "ca") else if (entry == "ca")
{ {
@ -244,7 +248,7 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
} }
else if (entry == "comp-lzo") else if (entry == "comp-lzo")
{ {
_openvpnWidget->chkUseLZO->setChecked(value == "true"); _openvpnWidget->chkUseLZO->setChecked(value == "yes");
} }
else if (entry == "shared-key" || entry == "static-key") else if (entry == "shared-key" || entry == "static-key")
{ {
@ -262,8 +266,8 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
{ {
_openvpnWidget->editRemoteIP->setText(value); _openvpnWidget->editRemoteIP->setText(value);
} }
else if (entry == "dev" || entry == "tap-dev") { else if (entry == "tap-dev") {
_openvpnWidget->chkUseTAP->setChecked(value == "true"); _openvpnWidget->chkUseTAP->setChecked(value == "yes");
} }
else if (entry == "ta") else if (entry == "ta")
{ {
@ -295,7 +299,7 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T
TDENetworkSettingsMap OpenVPNConfig::getVPNProperties() TDENetworkSettingsMap OpenVPNConfig::getVPNProperties()
{ {
// Build a list of properties // Build a list of properties
m_vpnProperties.insert("connection-type", TQString::number(OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem()))); m_vpnProperties.insert("connection-type", OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem()));
m_vpnProperties.insert("remote", TQString(_openvpnWidget->gateway->text())); m_vpnProperties.insert("remote", TQString(_openvpnWidget->gateway->text()));
// port is not necessary // port is not necessary
@ -318,10 +322,10 @@ TDENetworkSettingsMap OpenVPNConfig::getVPNProperties()
} }
if (_openvpnWidget->chkUseLZO->isChecked()) { if (_openvpnWidget->chkUseLZO->isChecked()) {
m_vpnProperties.insert("comp-lzo", TQString("true")); m_vpnProperties.insert("comp-lzo", TQString("yes"));
} }
else { else {
m_vpnProperties.insert("comp-lzo", TQString("false")); m_vpnProperties.insert("comp-lzo", TQString("no"));
} }
m_vpnProperties.insert("static-key", TQString(_openvpnWidget->editSharedKey->url())); m_vpnProperties.insert("static-key", TQString(_openvpnWidget->editSharedKey->url()));
@ -330,12 +334,17 @@ TDENetworkSettingsMap OpenVPNConfig::getVPNProperties()
m_vpnProperties.insert("remote-ip", TQString(_openvpnWidget->editRemoteIP->text())); m_vpnProperties.insert("remote-ip", TQString(_openvpnWidget->editRemoteIP->text()));
if (_openvpnWidget->chkUseTAP->isChecked()) { if (_openvpnWidget->chkUseTAP->isChecked()) {
m_vpnProperties.insert("tap-dev", "true"); m_vpnProperties.insert("tap-dev", "yes");
m_vpnProperties.insert("proto-tcp", "true"); }
else {
m_vpnProperties.insert("tap-dev", "no");
}
if (_openvpnWidget->chkUseTCP->isChecked()) {
m_vpnProperties.insert("proto-tcp", "yes");
} }
else { else {
m_vpnProperties.insert("tap-dev", "false"); m_vpnProperties.insert("proto-tcp", "no");
m_vpnProperties.insert("proto-tcp", "false");
} }
if (_openvpnWidget->chkUseTLS->isChecked()) { if (_openvpnWidget->chkUseTLS->isChecked()) {
@ -569,7 +578,7 @@ void OpenVPNAuthentication::setVPNData(TDENetworkSingleRouteConfigurationList& /
{ {
if (it.key() == "connection-type") if (it.key() == "connection-type")
{ {
_connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data().toInt()); _connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data());
break; break;
} }
} }

@ -59,8 +59,8 @@ class OpenVPNConnectionType
, X509USERPASS , X509USERPASS
}; };
static CONNECTIONTYPE mapString2ConnectionType(int string); static CONNECTIONTYPE mapString2ConnectionType(TQString string);
static int mapConnectionType2String(CONNECTIONTYPE connectionType); static TQString mapConnectionType2String(CONNECTIONTYPE connectionType);
}; };
class OpenVPNConfig : public VPNConfigWidget class OpenVPNConfig : public VPNConfigWidget

Loading…
Cancel
Save