6 files changed, 20 insertions, 16 deletions
diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp index 550e909..a19aaeb 100644 --- a/noncore/net/networksetup/interfaces/interfacesetupimp.cpp +++ b/noncore/net/networksetup/interfaces/interfacesetupimp.cpp | |||
@@ -27,48 +27,49 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac | |||
27 | bool error = false; | 27 | bool error = false; |
28 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 28 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
29 | staticGroupBox->hide(); | 29 | staticGroupBox->hide(); |
30 | dhcpCheckBox->hide(); | 30 | dhcpCheckBox->hide(); |
31 | leaseTime->hide(); | 31 | leaseTime->hide(); |
32 | leaseHoursLabel->hide(); | 32 | leaseHoursLabel->hide(); |
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Save the current settings, then write out the interfaces file and close. | 37 | * Save the current settings, then write out the interfaces file and close. |
38 | */ | 38 | */ |
39 | void InterfaceSetupImp::saveChanges(){ | 39 | bool InterfaceSetupImp::saveChanges(){ |
40 | if(!saveSettings()) | 40 | if(!saveSettings()) |
41 | return; | 41 | return false; |
42 | interfaces->write(); | 42 | interfaces->write(); |
43 | return true; | ||
43 | } | 44 | } |
44 | 45 | ||
45 | /** | 46 | /** |
46 | * Save the settings for the current Interface. | 47 | * Save the settings for the current Interface. |
47 | * @return bool true if successfull, false otherwise | 48 | * @return bool true if successfull, false otherwise |
48 | */ | 49 | */ |
49 | bool InterfaceSetupImp::saveSettings(){ | 50 | bool InterfaceSetupImp::saveSettings(){ |
50 | // eh can't really do anything about it other then return. :-D | 51 | // eh can't really do anything about it other then return. :-D |
51 | if(!interfaces->isInterfaceSet()) | 52 | if(!interfaces->isInterfaceSet()) |
52 | return true; | 53 | return true; |
53 | 54 | ||
54 | bool error = false; | 55 | bool error = false; |
55 | // Loopback case | 56 | // Loopback case |
56 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 57 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
57 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 58 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
58 | return true; | 59 | return true; |
59 | } | 60 | } |
60 | 61 | ||
61 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ | 62 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ |
62 | QMessageBox::information(this, "Not Saved.", "Please fill in address, subnet,\n and gateway entries.", "Ok"); | 63 | QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", "Ok"); |
63 | return false; | 64 | return false; |
64 | } | 65 | } |
65 | interfaces->removeAllInterfaceOptions(); | 66 | interfaces->removeAllInterfaceOptions(); |
66 | 67 | ||
67 | // DHCP | 68 | // DHCP |
68 | if(dhcpCheckBox->isChecked()){ | 69 | if(dhcpCheckBox->isChecked()){ |
69 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); | 70 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); |
70 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); | 71 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); |
71 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); | 72 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); |
72 | } | 73 | } |
73 | else{ | 74 | else{ |
74 | interfaces->setInterfaceMethod("static"); | 75 | interfaces->setInterfaceMethod("static"); |
diff --git a/noncore/net/networksetup/interfaces/interfacesetupimp.h b/noncore/net/networksetup/interfaces/interfacesetupimp.h index 3bbf34e..a88e190 100644 --- a/noncore/net/networksetup/interfaces/interfacesetupimp.h +++ b/noncore/net/networksetup/interfaces/interfacesetupimp.h | |||
@@ -3,29 +3,30 @@ | |||
3 | 3 | ||
4 | #include "interfacesetup.h" | 4 | #include "interfacesetup.h" |
5 | #include <qdialog.h> | 5 | #include <qdialog.h> |
6 | 6 | ||
7 | class Interface; | 7 | class Interface; |
8 | class Interfaces; | 8 | class Interfaces; |
9 | 9 | ||
10 | class InterfaceSetupImp : public InterfaceSetup { | 10 | class InterfaceSetupImp : public InterfaceSetup { |
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); | 14 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); |
15 | void saveChanges(); | 15 | bool saveChanges(); |
16 | 16 | ||
17 | public slots: | 17 | public slots: |
18 | void setProfile(const QString &profile); | 18 | void setProfile(const QString &profile); |
19 | bool saveSettings(); | 19 | bool saveSettings(); |
20 | |||
20 | private: | 21 | private: |
21 | Interfaces *interfaces; | 22 | Interfaces *interfaces; |
22 | Interface *interface; | 23 | Interface *interface; |
23 | 24 | ||
24 | }; | 25 | }; |
25 | 26 | ||
26 | 27 | ||
27 | #include <qlayout.h> | 28 | #include <qlayout.h> |
28 | 29 | ||
29 | class InterfaceSetupImpDialog : public QDialog { | 30 | class InterfaceSetupImpDialog : public QDialog { |
30 | Q_OBJECT | 31 | Q_OBJECT |
31 | 32 | ||
@@ -34,22 +35,22 @@ public: | |||
34 | QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); | 35 | QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); |
35 | setCaption("Interface Setup"); | 36 | setCaption("Interface Setup"); |
36 | interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); | 37 | interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); |
37 | InterfaceSetupLayout->addWidget( interfaceSetup ); | 38 | InterfaceSetupLayout->addWidget( interfaceSetup ); |
38 | }; | 39 | }; |
39 | void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; | 40 | void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; |
40 | 41 | ||
41 | private: | 42 | private: |
42 | InterfaceSetupImp *interfaceSetup; | 43 | InterfaceSetupImp *interfaceSetup; |
43 | 44 | ||
44 | protected slots: | 45 | protected slots: |
45 | void accept(){ | 46 | void accept(){ |
46 | interfaceSetup->saveChanges(); | 47 | if(interfaceSetup->saveChanges()) |
47 | QDialog::accept(); | 48 | QDialog::accept(); |
48 | }; | 49 | }; |
49 | 50 | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | // interfacesetupimp.h | 55 | // interfacesetupimp.h |
55 | 56 | ||
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 74bf390..01d7e36 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -112,26 +112,26 @@ bool WLANImp::writeConfig() | |||
112 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | 112 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); |
113 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | 113 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); |
114 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | 114 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); |
115 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | 115 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); |
116 | return writeWirelessOpts( ); | 116 | return writeWirelessOpts( ); |
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | */ | 120 | */ |
121 | void WLANImp::accept() | 121 | void WLANImp::accept() |
122 | { | 122 | { |
123 | if ( writeConfig() ){ | 123 | if ( writeConfig() ){ |
124 | interfaceSetup->saveChanges(); | 124 | if(interfaceSetup->saveChanges()) |
125 | QDialog::accept(); | 125 | QDialog::accept(); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | bool WLANImp::writeWirelessOpts( QString scheme ) | 129 | bool WLANImp::writeWirelessOpts( QString scheme ) |
130 | { | 130 | { |
131 | qWarning( "WLANImp::writeWirelessOpts entered." ); | 131 | qWarning( "WLANImp::writeWirelessOpts entered." ); |
132 | QString prev = "/etc/pcmcia/wireless.opts"; | 132 | QString prev = "/etc/pcmcia/wireless.opts"; |
133 | QFile prevFile(prev); | 133 | QFile prevFile(prev); |
134 | if ( !prevFile.open( IO_ReadOnly ) ) | 134 | if ( !prevFile.open( IO_ReadOnly ) ) |
135 | return false; | 135 | return false; |
136 | 136 | ||
137 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | 137 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; |
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp index 550e909..a19aaeb 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.cpp | |||
@@ -27,48 +27,49 @@ InterfaceSetupImp::InterfaceSetupImp(QWidget* parent, const char* name, Interfac | |||
27 | bool error = false; | 27 | bool error = false; |
28 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 28 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
29 | staticGroupBox->hide(); | 29 | staticGroupBox->hide(); |
30 | dhcpCheckBox->hide(); | 30 | dhcpCheckBox->hide(); |
31 | leaseTime->hide(); | 31 | leaseTime->hide(); |
32 | leaseHoursLabel->hide(); | 32 | leaseHoursLabel->hide(); |
33 | } | 33 | } |
34 | } | 34 | } |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Save the current settings, then write out the interfaces file and close. | 37 | * Save the current settings, then write out the interfaces file and close. |
38 | */ | 38 | */ |
39 | void InterfaceSetupImp::saveChanges(){ | 39 | bool InterfaceSetupImp::saveChanges(){ |
40 | if(!saveSettings()) | 40 | if(!saveSettings()) |
41 | return; | 41 | return false; |
42 | interfaces->write(); | 42 | interfaces->write(); |
43 | return true; | ||
43 | } | 44 | } |
44 | 45 | ||
45 | /** | 46 | /** |
46 | * Save the settings for the current Interface. | 47 | * Save the settings for the current Interface. |
47 | * @return bool true if successfull, false otherwise | 48 | * @return bool true if successfull, false otherwise |
48 | */ | 49 | */ |
49 | bool InterfaceSetupImp::saveSettings(){ | 50 | bool InterfaceSetupImp::saveSettings(){ |
50 | // eh can't really do anything about it other then return. :-D | 51 | // eh can't really do anything about it other then return. :-D |
51 | if(!interfaces->isInterfaceSet()) | 52 | if(!interfaces->isInterfaceSet()) |
52 | return true; | 53 | return true; |
53 | 54 | ||
54 | bool error = false; | 55 | bool error = false; |
55 | // Loopback case | 56 | // Loopback case |
56 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ | 57 | if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ |
57 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); | 58 | interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); |
58 | return true; | 59 | return true; |
59 | } | 60 | } |
60 | 61 | ||
61 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ | 62 | if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ |
62 | QMessageBox::information(this, "Not Saved.", "Please fill in address, subnet,\n and gateway entries.", "Ok"); | 63 | QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", "Ok"); |
63 | return false; | 64 | return false; |
64 | } | 65 | } |
65 | interfaces->removeAllInterfaceOptions(); | 66 | interfaces->removeAllInterfaceOptions(); |
66 | 67 | ||
67 | // DHCP | 68 | // DHCP |
68 | if(dhcpCheckBox->isChecked()){ | 69 | if(dhcpCheckBox->isChecked()){ |
69 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); | 70 | interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); |
70 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); | 71 | interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); |
71 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); | 72 | interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); |
72 | } | 73 | } |
73 | else{ | 74 | else{ |
74 | interfaces->setInterfaceMethod("static"); | 75 | interfaces->setInterfaceMethod("static"); |
diff --git a/noncore/settings/networksettings/interfaces/interfacesetupimp.h b/noncore/settings/networksettings/interfaces/interfacesetupimp.h index 3bbf34e..a88e190 100644 --- a/noncore/settings/networksettings/interfaces/interfacesetupimp.h +++ b/noncore/settings/networksettings/interfaces/interfacesetupimp.h | |||
@@ -3,29 +3,30 @@ | |||
3 | 3 | ||
4 | #include "interfacesetup.h" | 4 | #include "interfacesetup.h" |
5 | #include <qdialog.h> | 5 | #include <qdialog.h> |
6 | 6 | ||
7 | class Interface; | 7 | class Interface; |
8 | class Interfaces; | 8 | class Interfaces; |
9 | 9 | ||
10 | class InterfaceSetupImp : public InterfaceSetup { | 10 | class InterfaceSetupImp : public InterfaceSetup { |
11 | Q_OBJECT | 11 | Q_OBJECT |
12 | 12 | ||
13 | public: | 13 | public: |
14 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); | 14 | InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); |
15 | void saveChanges(); | 15 | bool saveChanges(); |
16 | 16 | ||
17 | public slots: | 17 | public slots: |
18 | void setProfile(const QString &profile); | 18 | void setProfile(const QString &profile); |
19 | bool saveSettings(); | 19 | bool saveSettings(); |
20 | |||
20 | private: | 21 | private: |
21 | Interfaces *interfaces; | 22 | Interfaces *interfaces; |
22 | Interface *interface; | 23 | Interface *interface; |
23 | 24 | ||
24 | }; | 25 | }; |
25 | 26 | ||
26 | 27 | ||
27 | #include <qlayout.h> | 28 | #include <qlayout.h> |
28 | 29 | ||
29 | class InterfaceSetupImpDialog : public QDialog { | 30 | class InterfaceSetupImpDialog : public QDialog { |
30 | Q_OBJECT | 31 | Q_OBJECT |
31 | 32 | ||
@@ -34,22 +35,22 @@ public: | |||
34 | QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); | 35 | QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); |
35 | setCaption("Interface Setup"); | 36 | setCaption("Interface Setup"); |
36 | interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); | 37 | interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); |
37 | InterfaceSetupLayout->addWidget( interfaceSetup ); | 38 | InterfaceSetupLayout->addWidget( interfaceSetup ); |
38 | }; | 39 | }; |
39 | void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; | 40 | void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; |
40 | 41 | ||
41 | private: | 42 | private: |
42 | InterfaceSetupImp *interfaceSetup; | 43 | InterfaceSetupImp *interfaceSetup; |
43 | 44 | ||
44 | protected slots: | 45 | protected slots: |
45 | void accept(){ | 46 | void accept(){ |
46 | interfaceSetup->saveChanges(); | 47 | if(interfaceSetup->saveChanges()) |
47 | QDialog::accept(); | 48 | QDialog::accept(); |
48 | }; | 49 | }; |
49 | 50 | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | // interfacesetupimp.h | 55 | // interfacesetupimp.h |
55 | 56 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 74bf390..01d7e36 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -112,26 +112,26 @@ bool WLANImp::writeConfig() | |||
112 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | 112 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); |
113 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | 113 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); |
114 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | 114 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); |
115 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | 115 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); |
116 | return writeWirelessOpts( ); | 116 | return writeWirelessOpts( ); |
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | */ | 120 | */ |
121 | void WLANImp::accept() | 121 | void WLANImp::accept() |
122 | { | 122 | { |
123 | if ( writeConfig() ){ | 123 | if ( writeConfig() ){ |
124 | interfaceSetup->saveChanges(); | 124 | if(interfaceSetup->saveChanges()) |
125 | QDialog::accept(); | 125 | QDialog::accept(); |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | bool WLANImp::writeWirelessOpts( QString scheme ) | 129 | bool WLANImp::writeWirelessOpts( QString scheme ) |
130 | { | 130 | { |
131 | qWarning( "WLANImp::writeWirelessOpts entered." ); | 131 | qWarning( "WLANImp::writeWirelessOpts entered." ); |
132 | QString prev = "/etc/pcmcia/wireless.opts"; | 132 | QString prev = "/etc/pcmcia/wireless.opts"; |
133 | QFile prevFile(prev); | 133 | QFile prevFile(prev); |
134 | if ( !prevFile.open( IO_ReadOnly ) ) | 134 | if ( !prevFile.open( IO_ReadOnly ) ) |
135 | return false; | 135 | return false; |
136 | 136 | ||
137 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | 137 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; |