diff options
author | Timothy Pearson <[email protected]> | 2013-06-03 23:33:18 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-06-03 23:33:18 -0500 |
commit | 73618d03cf0d84c06a77672617d1e40438c2523f (patch) | |
tree | c66648b30564cf1c361f17f2ddca521e37997476 | |
parent | c5ff9d998aefdd9d16cfcd337a8de448cbbe4cb1 (diff) | |
download | tdenetworkmanager-73618d03cf0d84c06a77672617d1e40438c2523f.tar.gz tdenetworkmanager-73618d03cf0d84c06a77672617d1e40438c2523f.zip |
Fix network-manager OpenVPN settings interface
This resolves Bug 1530
Ensure that a device tray component is always shown
4 files changed, 46 insertions, 29 deletions
diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp index ec2ce50..22fdbaf 100644 --- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp @@ -129,9 +129,14 @@ VPNWidgetImpl::Init() slotServiceComboActivated(0); } +#if 0 // update the username to the current one KUser user; _vpnsetting->lockedUserName = user.loginName(); +#else + // Not needed for NM 0.9 and above? + _vpnsetting->lockedUserName = TQString::null; +#endif // notification if VPN service is selected connect(_mainWid->cboServices, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotServiceComboActivated(int))); diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp index 04f26fc..f139454 100644 --- a/tdenetworkmanager/src/tdenetman-tray.cpp +++ b/tdenetworkmanager/src/tdenetman-tray.cpp @@ -440,7 +440,7 @@ void Tray::slotRemoveDeviceTrayComponent(TQString dev) if (dev_comp->device() == dev) { if (d->foregroundTrayComponent && dev_comp->device() == d->foregroundTrayComponent->device() ) { - d->foregroundTrayComponent = 0; + d->foregroundTrayComponent = NULL; } // remove the appropriate action @@ -666,6 +666,9 @@ void Tray::trayComponentNeedsCenterStage(TrayComponent *component, bool needsIt) updateTrayDeviceManagerState(); } } + + // Make sure a relevant foregroundTrayComponent is shown at all times... + showActiveDeviceTray(); } } } diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.cpp b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.cpp index f4e7520..74e245f 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.cpp +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.cpp @@ -69,35 +69,35 @@ VPNAuthenticationWidget* OpenVPNPlugin::CreateAuthenticationWidget(TQWidget* par /************************************ * OpenVPNConnectionType ************************************/ -OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(int prop) +OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(TQString prop) { - if (prop == 0) + if (prop == "tls") return X509; - else if (prop == 1) + else if (prop == "static-key") return SHARED_KEY; - else if (prop == 2) + else if (prop == "password") return PASSWORD; - else if (prop == 3) + else if (prop == "password-tls") return X509USERPASS; return UNKNOWN; } -int OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) +TQString OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType) { switch(connType) { case X509: - return 0; + return "tls"; case SHARED_KEY: - return 1; + return "static-key"; case PASSWORD: - return 2; + return "password"; case X509USERPASS: - return 3; + return "password-tls"; 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") { - OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value.toInt()); + OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value); _openvpnWidget->cboConnectionType->setCurrentItem(type); _openvpnWidget->widgetStack->raiseWidget(type); } @@ -221,9 +221,13 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T _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") { @@ -244,7 +248,7 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T } else if (entry == "comp-lzo") { - _openvpnWidget->chkUseLZO->setChecked(value == "true"); + _openvpnWidget->chkUseLZO->setChecked(value == "yes"); } else if (entry == "shared-key" || entry == "static-key") { @@ -262,8 +266,8 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T { _openvpnWidget->editRemoteIP->setText(value); } - else if (entry == "dev" || entry == "tap-dev") { - _openvpnWidget->chkUseTAP->setChecked(value == "true"); + else if (entry == "tap-dev") { + _openvpnWidget->chkUseTAP->setChecked(value == "yes"); } else if (entry == "ta") { @@ -295,7 +299,7 @@ void OpenVPNConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes, T TDENetworkSettingsMap OpenVPNConfig::getVPNProperties() { // 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())); // port is not necessary @@ -318,10 +322,10 @@ TDENetworkSettingsMap OpenVPNConfig::getVPNProperties() } if (_openvpnWidget->chkUseLZO->isChecked()) { - m_vpnProperties.insert("comp-lzo", TQString("true")); + m_vpnProperties.insert("comp-lzo", TQString("yes")); } else { - m_vpnProperties.insert("comp-lzo", TQString("false")); + m_vpnProperties.insert("comp-lzo", TQString("no")); } 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())); if (_openvpnWidget->chkUseTAP->isChecked()) { - m_vpnProperties.insert("tap-dev", "true"); - m_vpnProperties.insert("proto-tcp", "true"); + m_vpnProperties.insert("tap-dev", "yes"); + } + else { + m_vpnProperties.insert("tap-dev", "no"); + } + + if (_openvpnWidget->chkUseTCP->isChecked()) { + m_vpnProperties.insert("proto-tcp", "yes"); } else { - m_vpnProperties.insert("tap-dev", "false"); - m_vpnProperties.insert("proto-tcp", "false"); + m_vpnProperties.insert("proto-tcp", "no"); } if (_openvpnWidget->chkUseTLS->isChecked()) { @@ -569,7 +578,7 @@ void OpenVPNAuthentication::setVPNData(TDENetworkSingleRouteConfigurationList& / { if (it.key() == "connection-type") { - _connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data().toInt()); + _connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data()); break; } } diff --git a/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h index 30aad1d..a53f5d4 100644 --- a/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h +++ b/tdenetworkmanager/vpn-plugins/openvpn/src/tdenetman-openvpn.h @@ -59,8 +59,8 @@ class OpenVPNConnectionType , X509USERPASS }; - static CONNECTIONTYPE mapString2ConnectionType(int string); - static int mapConnectionType2String(CONNECTIONTYPE connectionType); + static CONNECTIONTYPE mapString2ConnectionType(TQString string); + static TQString mapConnectionType2String(CONNECTIONTYPE connectionType); }; class OpenVPNConfig : public VPNConfigWidget |