summaryrefslogtreecommitdiffstats
path: root/tdenetworkmanager
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-17 17:38:32 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-17 17:38:32 -0600
commit71bf63b44f9ec183b1af7d2051c1967ee4571bcf (patch)
tree40c4d412825dc8ef08f4e81fe136fb670a2e137b /tdenetworkmanager
parent3a8c5774204188dd71e96a0cab02ad32d6a24931 (diff)
downloadtdenetworkmanager-71bf63b44f9ec183b1af7d2051c1967ee4571bcf.tar.gz
tdenetworkmanager-71bf63b44f9ec183b1af7d2051c1967ee4571bcf.zip
Report backend connection modification failures to user
Refresh network list on connection modification
Diffstat (limited to 'tdenetworkmanager')
-rw-r--r--tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp35
-rw-r--r--tdenetworkmanager/src/tdenetman-connection_editor.cpp16
-rw-r--r--tdenetworkmanager/src/tdenetman-tray.cpp2
3 files changed, 33 insertions, 20 deletions
diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp
index 50ac293..d6c673f 100644
--- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp
+++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp
@@ -286,20 +286,23 @@ ConnectionSettingsDialogImpl::slotConnect()
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
// add/save the connection
- nm->saveConnection(_conn);
-
- // activate device
- if (_conn && nm) {
-// // VPN connection needs a special specific object
-// if (_conn->getType() == NM_SETTING_VPN_SETTING_NAME) {
-// TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
-// TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
-// nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err);
-// }
-// else {
- // we need to call ActivateDevice async
- nm->initiateConnection(_conn->UUID);
-// }
+ if (nm->saveConnection(_conn)) {
+ // activate device
+ if (_conn && nm) {
+ // // VPN connection needs a special specific object
+ // if (_conn->getType() == NM_SETTING_VPN_SETTING_NAME) {
+ // TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
+ // TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
+ // nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err);
+ // }
+ // else {
+ // we need to call ActivateDevice async
+ nm->initiateConnection(_conn->UUID);
+ // }
+ }
+ }
+ else {
+ KMessageBox::error(this, i18n("<qt><b>Unable to save network connection!</b><p>Potential causes:<br> * Insufficient permissions<br> * NetworkManager not running<br> * DBUS failure</qt>"), i18n("Unable to perform requested operation"));
}
emit connectionSaved();
@@ -325,7 +328,9 @@ ConnectionSettingsDialogImpl::slotSave()
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
// save the connection
- nm->saveConnection(_conn);
+ if (!nm->saveConnection(_conn)) {
+ KMessageBox::error(this, i18n("<qt><b>Unable to save network connection!</b><p>Potential causes:<br> * Insufficient permissions<br> * NetworkManager not running<br> * DBUS failure</qt>"), i18n("Unable to perform requested operation"));
+ }
emit connectionSaved();
this->close(true);
diff --git a/tdenetworkmanager/src/tdenetman-connection_editor.cpp b/tdenetworkmanager/src/tdenetman-connection_editor.cpp
index 994105a..a0a4e83 100644
--- a/tdenetworkmanager/src/tdenetman-connection_editor.cpp
+++ b/tdenetworkmanager/src/tdenetman-connection_editor.cpp
@@ -33,13 +33,14 @@
#include <tqlabel.h>
#include <tqpopupmenu.h>
-// kde headers
+// tde headers
#include <kiconloader.h>
#include <kdebug.h>
#include <kpushbutton.h>
#include <klistview.h>
#include <klocale.h>
#include <kcombobox.h>
+#include <kmessagebox.h>
// tdenm headers
#include "tdenetman-connection_editor.h"
@@ -110,7 +111,7 @@ ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, b
popup->insertItem(KGlobal::iconLoader()->loadIcon("wired", KIcon::Small), i18n("Wired"), this, TQT_SLOT(slotNewWiredConnection()));
// if (!VPNManager::getVPNServices().isEmpty()) {
-// popup->insertItem(KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small), i18n("VPN"), this, TQT_SLOT(slotNewVPNConnection()));
+ popup->insertItem(KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small), i18n("VPN"), this, TQT_SLOT(slotNewVPNConnection()));
// }
pbNew->setPopup(popup);
@@ -158,7 +159,7 @@ void ConnectionEditorImpl::slotNewWiredConnection()
*/
void ConnectionEditorImpl::slotNewVPNConnection()
{
-// slotEditNewConnection(new TDEVPNConnection());
+ slotEditNewConnection(new TDEVPNConnection());
}
/*
@@ -174,6 +175,11 @@ void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn)
void ConnectionEditorImpl::slotRefreshConnectionList()
{
+ TDEGlobalNetworkManager* nm = KGlobal::networkManager();
+ if (!nm) {
+ return;
+ }
+ nm->loadConnectionInformation();
fillConnectionList();
}
@@ -224,7 +230,9 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection()
lvConnections->takeItem(item);
delete item;
- nm->deleteConnection(conn->UUID);
+ if (!nm->deleteConnection(conn->UUID)) {
+ KMessageBox::error(this, i18n("<qt><b>Unable to delete network connection!</b><p>Potential causes:<br> * Insufficient permissions<br> * NetworkManager not running<br> * DBUS failure</qt>"), i18n("Unable to perform requested operation"));
+ }
}
/*
diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp
index 06c7e4d..fd955f3 100644
--- a/tdenetworkmanager/src/tdenetman-tray.cpp
+++ b/tdenetworkmanager/src/tdenetman-tray.cpp
@@ -165,7 +165,7 @@ void Tray::slotEditConnections()
if (!nm) return;
if (tdenetworkmanager_editor_dialog_count == 0) nm->loadConnectionInformation();
- ConnectionEditorImpl* dlg = new ConnectionEditorImpl(this);
+ ConnectionEditorImpl* dlg = new ConnectionEditorImpl(this, NULL, TRUE, (WFlags)TQt::WDestructiveClose);
dlg->show();
}