summaryrefslogtreecommitdiffstats
path: root/tdenetworkmanager
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-10 21:18:39 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-10 21:18:39 -0500
commit94881634c452a182c71121771a3f576af60a3872 (patch)
tree5be7faca855f893abb24ae8937dc0a63d569c3b8 /tdenetworkmanager
parentb99db6aa82bcdba086ec51c292415b1a2bdb8cf7 (diff)
downloadtdenetworkmanager-94881634c452a182c71121771a3f576af60a3872.tar.gz
tdenetworkmanager-94881634c452a182c71121771a3f576af60a3872.zip
Clean up the code slightly
Diffstat (limited to 'tdenetworkmanager')
-rw-r--r--tdenetworkmanager/TODO4
-rw-r--r--tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp48
-rw-r--r--tdenetworkmanager/src/tdenetman-connection_editor.cpp6
-rw-r--r--tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp27
4 files changed, 34 insertions, 51 deletions
diff --git a/tdenetworkmanager/TODO b/tdenetworkmanager/TODO
index ea2e206..80660c2 100644
--- a/tdenetworkmanager/TODO
+++ b/tdenetworkmanager/TODO
@@ -1,2 +1,4 @@
-VPN support
+Prompt user when connection fails
+Tell the user when he/she enters an invalid setting
+Better VPN support; there should be a visual indication of VPN status in the tray icon
Translations
diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp
index c4f488b..ba4aa18 100644
--- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp
+++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp
@@ -60,22 +60,18 @@ VPNWidgetImpl::Init()
// fill in all possible VPN services
VPNServiceList list = VPNManager::getVPNServices();
- if (list.isEmpty())
- {
+ if (list.isEmpty()) {
// FIXME Do something useful here
}
- else
- {
+ else {
int index = 0;
- for (VPNServiceList::Iterator it = list.begin(); it != list.end(); ++it)
- {
+ for (VPNServiceList::Iterator it = list.begin(); it != list.end(); ++it) {
TQString icon;
TQString disp_name;
// get service icon and display name
VPNService* service = *it;
- if (service)
- {
+ if (service) {
icon = service->getIcon();
disp_name = service->getDisplayName();
}
@@ -99,14 +95,14 @@ VPNWidgetImpl::Init()
}
// no special icon for this service, use default
- if (icon.isEmpty())
+ if (icon.isEmpty()) {
icon = "encrypted";
+ }
_mainWid->cboServices->insertItem(SmallIcon(icon, TQIconSet::Automatic), disp_name, index);
_mapServiceCombo.insert(index++, *it);
- if (service->getService() == _vpnsetting->vpnPluginID)
- {
+ if (service->getService() == _vpnsetting->vpnPluginID) {
// preselect the correct service
_mainWid->cboServices->setCurrentItem(index - 1);
slotServiceComboActivated(index - 1);
@@ -115,10 +111,10 @@ VPNWidgetImpl::Init()
}
// lock the combo when editing an already existing connection
- if (!_new_conn)
+ if (!_new_conn) {
_mainWid->cboServices->setEnabled(false);
- else
- {
+ }
+ else {
// preselect the correct service
_mainWid->cboServices->setCurrentItem(0);
slotServiceComboActivated(0);
@@ -135,17 +131,14 @@ VPNWidgetImpl::Init()
VPNConfigWidget*
VPNWidgetImpl::getVPNConfigWidget(VPNService* service)
{
- if (_mapServiceWidget.find(service) != _mapServiceWidget.end())
- {
+ if (_mapServiceWidget.find(service) != _mapServiceWidget.end()) {
// return the already available config widget
return *_mapServiceWidget.find(service);
}
- else
- {
+ else {
// we have to create a new one
VPNPlugin* plugin = service->getVPNPlugin();
- if (plugin)
- {
+ if (plugin) {
VPNConfigWidget* config = plugin->CreateConfigWidget(_mainWid->widgetStack);
_mapServiceWidget.insert(service, config);
return config;
@@ -159,19 +152,16 @@ void
VPNWidgetImpl::slotServiceComboActivated(int index)
{
VPNService* service;
- if (_mapServiceCombo.find(index) != _mapServiceCombo.end())
- {
+ if (_mapServiceCombo.find(index) != _mapServiceCombo.end()) {
service = *_mapServiceCombo.find(index);
- if (service)
- {
+ if (service) {
VPNConfigWidget* config = getVPNConfigWidget(service);
_mainWid->widgetStack->raiseWidget(config);
config->setVPNData(_vpnsetting->ipConfig.routeConfigurations, _vpnsetting->pluginData, _vpnsetting->pluginSecrets);
}
}
- else
- {
+ else {
//FIXME - do something useful here
}
}
@@ -181,14 +171,12 @@ VPNWidgetImpl::Deactivate()
{
// update the setting from the currently selected vpn service
VPNService* service = *_mapServiceCombo.find(_mainWid->cboServices->currentItem());
- if (service)
- {
+ if (service) {
// set the correct service type
_vpnsetting->vpnPluginID = service->getService();
VPNConfigWidget* config = *_mapServiceWidget.find(service);
- if (config)
- {
+ if (config) {
// update the vpn properties
_vpnsetting->pluginData = config->getVPNProperties();
// update the vpn secrets
diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp
index 906e158..5a00c30 100644
--- a/tdenetworkmanager/src/tdenetman-connection_editor.cpp
+++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp
@@ -68,9 +68,9 @@ class ConnectionListViewItem : public KListViewItem
else if (_conn->type() == TDENetworkConnectionType::WiFi) {
setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small));
}
-// else if (_conn->type() == TDENetworkConnectionType::VPN) {
-// setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small));
-// }
+ else if (_conn->type() == TDENetworkConnectionType::VPN) {
+ setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small));
+ }
else {
setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small));
}
diff --git a/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp
index a0826bd..2d9e0d7 100644
--- a/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp
+++ b/tdenetworkmanager/vpn-plugins/strongswan/src/tdenetman-strongswan.cpp
@@ -119,39 +119,32 @@ void StrongswanConfig::setVPNData(TDENetworkSingleRouteConfigurationList& routes
m_vpnSecrets = secrets;
// fill up our inputfields (only textfields atm)
- for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
- {
+ for(TDENetworkSettingsMap::iterator it = properties.begin(); it != properties.end(); ++it) {
TQString entry = it.key();
TQString value = it.data();
- if (entry == "gateway")
- {
+ if (entry == "gateway") {
_strongswanWidget->gateway->setText(value);
}
- else if (entry == "certificate")
- {
+ else if (entry == "certificate") {
_strongswanWidget->certificate->setURL(value);
}
- else if (entry == "username")
- {
+ else if (entry == "username") {
_strongswanWidget->username->setText(value);
}
- else if (entry == "method")
- {
- StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt());
+ else if (entry == "method") {
+ StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt());
_strongswanWidget->authtype->setCurrentItem(type);
}
+
// Options
- else if (entry == "chkUDPenc")
- {
+ else if (entry == "chkUDPenc") {
_strongswanWidget->chkUDPenc->setChecked(value == "true");
}
- else if (entry == "chkIPcomp")
- {
+ else if (entry == "chkIPcomp") {
_strongswanWidget->chkIPcomp->setChecked(value == "true");
}
- else if (entry == "chkIPinner")
- {
+ else if (entry == "chkIPinner") {
_strongswanWidget->chkIPinner->setChecked(value == "true");
}
}