Report backend connection modification failures to user

Refresh network list on connection modification
pull/1/head
Timothy Pearson 12 years ago
parent 3a8c577420
commit 71bf63b44f

@ -286,20 +286,23 @@ ConnectionSettingsDialogImpl::slotConnect()
TDEGlobalNetworkManager* nm = KGlobal::networkManager(); TDEGlobalNetworkManager* nm = KGlobal::networkManager();
// add/save the connection // add/save the connection
nm->saveConnection(_conn); if (nm->saveConnection(_conn)) {
// activate device
// activate device if (_conn && nm) {
if (_conn && nm) { // // VPN connection needs a special specific object
// // VPN connection needs a special specific object // if (_conn->getType() == NM_SETTING_VPN_SETTING_NAME) {
// if (_conn->getType() == NM_SETTING_VPN_SETTING_NAME) { // TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
// TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection(); // TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
// TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn); // nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err);
// nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err); // }
// } // else {
// else { // we need to call ActivateDevice async
// we need to call ActivateDevice async nm->initiateConnection(_conn->UUID);
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(); emit connectionSaved();
@ -325,7 +328,9 @@ ConnectionSettingsDialogImpl::slotSave()
TDEGlobalNetworkManager* nm = KGlobal::networkManager(); TDEGlobalNetworkManager* nm = KGlobal::networkManager();
// save the connection // 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(); emit connectionSaved();
this->close(true); this->close(true);

@ -33,13 +33,14 @@
#include <tqlabel.h> #include <tqlabel.h>
#include <tqpopupmenu.h> #include <tqpopupmenu.h>
// kde headers // tde headers
#include <kiconloader.h> #include <kiconloader.h>
#include <kdebug.h> #include <kdebug.h>
#include <kpushbutton.h> #include <kpushbutton.h>
#include <klistview.h> #include <klistview.h>
#include <klocale.h> #include <klocale.h>
#include <kcombobox.h> #include <kcombobox.h>
#include <kmessagebox.h>
// tdenm headers // tdenm headers
#include "tdenetman-connection_editor.h" #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())); popup->insertItem(KGlobal::iconLoader()->loadIcon("wired", KIcon::Small), i18n("Wired"), this, TQT_SLOT(slotNewWiredConnection()));
// if (!VPNManager::getVPNServices().isEmpty()) { // 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); pbNew->setPopup(popup);
@ -158,7 +159,7 @@ void ConnectionEditorImpl::slotNewWiredConnection()
*/ */
void ConnectionEditorImpl::slotNewVPNConnection() void ConnectionEditorImpl::slotNewVPNConnection()
{ {
// slotEditNewConnection(new TDEVPNConnection()); slotEditNewConnection(new TDEVPNConnection());
} }
/* /*
@ -174,6 +175,11 @@ void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn)
void ConnectionEditorImpl::slotRefreshConnectionList() void ConnectionEditorImpl::slotRefreshConnectionList()
{ {
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (!nm) {
return;
}
nm->loadConnectionInformation();
fillConnectionList(); fillConnectionList();
} }
@ -224,7 +230,9 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection()
lvConnections->takeItem(item); lvConnections->takeItem(item);
delete 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"));
}
} }
/* /*

@ -165,7 +165,7 @@ void Tray::slotEditConnections()
if (!nm) return; if (!nm) return;
if (tdenetworkmanager_editor_dialog_count == 0) nm->loadConnectionInformation(); 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(); dlg->show();
} }

Loading…
Cancel
Save