summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-18 21:48:50 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-18 21:48:50 -0500
commitbb5795c1b5445afac3645d7ccec240c4e3f4128a (patch)
treeea47e454f63a31c729aa62b56194781adf76d82a
parentf62332d1fbb374ea0f528c042fadb105d3e45d09 (diff)
downloadtdenetworkmanager-bb5795c1b5445afac3645d7ccec240c4e3f4128a.tar.gz
tdenetworkmanager-bb5795c1b5445afac3645d7ccec240c4e3f4128a.zip
Fix crash when attempting to add VPN connection when VPN service is not available
-rw-r--r--tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp11
-rw-r--r--tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp9
-rw-r--r--tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h3
3 files changed, 18 insertions, 5 deletions
diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp
index 36140d8..ec2ce50 100644
--- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp
+++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_setting_vpn_widget.cpp
@@ -31,6 +31,7 @@
#include <tqcombobox.h>
#include <tqiconset.h>
#include <kiconloader.h>
+#include <kpushbutton.h>
#include <tqwidgetstack.h>
#include <kuser.h>
@@ -46,6 +47,7 @@ VPNWidgetImpl::VPNWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget
, _new_conn(new_conn)
{
_vpnsetting = dynamic_cast<TDEVPNConnection*>(conn);
+ _parentdialog = dynamic_cast<ConnectionSettingsDialogImpl*>(parent);
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingVPNWidget(this);
@@ -61,7 +63,10 @@ VPNWidgetImpl::Init()
VPNServiceList list = VPNManager::getVPNServices();
if (list.isEmpty()) {
- // FIXME Do something useful here
+ if (_parentdialog) {
+ _parentdialog->_disable_next_button = true;
+ _parentdialog->slotEnableButtons();
+ }
}
else {
int index = 0;
@@ -108,6 +113,10 @@ VPNWidgetImpl::Init()
slotServiceComboActivated(index - 1);
}
}
+ if (_parentdialog) {
+ _parentdialog->_disable_next_button = false;
+ _parentdialog->slotEnableButtons();
+ }
}
// lock the combo when editing an already existing connection
diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp
index d60fe9b..9cb8b46 100644
--- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp
+++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.cpp
@@ -58,6 +58,7 @@ using namespace ConnectionSettings;
ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection* conn, bool new_conn, TQByteArray networkextid, TQWidget* parent, const char* name, bool modal, WFlags fl)
: ConnectionSettingsDialog(parent, name, modal, fl)
+ , _disable_next_button(false)
, _conn(conn)
, _new_conn(new_conn)
, _networkextid(networkextid)
@@ -78,7 +79,7 @@ ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(TDENetworkConnection*
pbCancel->setIconSet(SmallIcon("cancel", TQIconSet::Automatic));
pbSave->setIconSet(SmallIcon("ok", TQIconSet::Automatic));
- // enable or disable buttons accroding to the current state
+ // enable or disable buttons according to the current state
slotEnableButtons();
}
@@ -430,13 +431,13 @@ ConnectionSettingsDialogImpl::slotEnableButtons()
Next: enabled if another widget is available
*/
enabled = true;
- if (current == _widgetIds.fromLast()) {
+ if (current == _widgetIds.fromLast() || _disable_next_button) {
enabled = false;
}
pbNext->setEnabled(enabled);
/*
- Back: enabled if the current widget has a predecessor
+ Back: enabled if the current widget has a predecessor
*/
enabled = true;
if (current == _widgetIds.begin()) {
@@ -445,7 +446,7 @@ ConnectionSettingsDialogImpl::slotEnableButtons()
pbBack->setEnabled(enabled);
/*
- Connect: only show connect if the connection is valid
+ Connect: only show connect if the connection is valid
*/
if (_conn) {
TDEGlobalNetworkManager* nm = TDEGlobal::networkManager();
diff --git a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h
index b9f54f1..51e4b6c 100644
--- a/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h
+++ b/tdenetworkmanager/src/configwidgets/tdenetman-connection_settings_dialog.h
@@ -64,6 +64,9 @@ class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog
signals:
void connectionSaved();
+ public:
+ bool _disable_next_button;
+
private:
void updateDialogForDeviceType();
void createWidgetsForConnection(TDENetworkConnection*, bool new_conn);