author | benmeyer <benmeyer> | 2002-10-31 20:05:57 (UTC) |
---|---|---|
committer | benmeyer <benmeyer> | 2002-10-31 20:05:57 (UTC) |
commit | 16d3fac9169e400f5542ca0e3aa993cc5c5db574 (patch) (side-by-side diff) | |
tree | ac8587cb0faed786bcb362e47949b0ade5d81ada | |
parent | 6f6bf05d544a579d513c476453483ef9bedad49f (diff) | |
download | opie-16d3fac9169e400f5542ca0e3aa993cc5c5db574.zip opie-16d3fac9169e400f5542ca0e3aa993cc5c5db574.tar.gz opie-16d3fac9169e400f5542ca0e3aa993cc5c5db574.tar.bz2 |
Fixed error message and made window stay if error message doesn't go away.
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 bool error = false; if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ staticGroupBox->hide(); dhcpCheckBox->hide(); leaseTime->hide(); leaseHoursLabel->hide(); } } /** * Save the current settings, then write out the interfaces file and close. */ -void InterfaceSetupImp::saveChanges(){ +bool InterfaceSetupImp::saveChanges(){ if(!saveSettings()) - return; + return false; interfaces->write(); + return true; } /** * Save the settings for the current Interface. * @return bool true if successfull, false otherwise */ bool InterfaceSetupImp::saveSettings(){ // eh can't really do anything about it other then return. :-D if(!interfaces->isInterfaceSet()) return true; bool error = false; // Loopback case if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); return true; } if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ - QMessageBox::information(this, "Not Saved.", "Please fill in address, subnet,\n and gateway entries.", "Ok"); + QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", "Ok"); return false; } interfaces->removeAllInterfaceOptions(); // DHCP if(dhcpCheckBox->isChecked()){ interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); } else{ 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 @@ #include "interfacesetup.h" #include <qdialog.h> class Interface; class Interfaces; class InterfaceSetupImp : public InterfaceSetup { Q_OBJECT public: InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); - void saveChanges(); + bool saveChanges(); public slots: void setProfile(const QString &profile); bool saveSettings(); + private: Interfaces *interfaces; Interface *interface; }; #include <qlayout.h> class InterfaceSetupImpDialog : public QDialog { Q_OBJECT @@ -34,22 +35,22 @@ public: QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); setCaption("Interface Setup"); interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); InterfaceSetupLayout->addWidget( interfaceSetup ); }; void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; private: InterfaceSetupImp *interfaceSetup; protected slots: void accept(){ - interfaceSetup->saveChanges(); - QDialog::accept(); + if(interfaceSetup->saveChanges()) + QDialog::accept(); }; }; #endif // interfacesetupimp.h 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() config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); return writeWirelessOpts( ); } /** */ void WLANImp::accept() { if ( writeConfig() ){ - interfaceSetup->saveChanges(); - QDialog::accept(); + if(interfaceSetup->saveChanges()) + QDialog::accept(); } } bool WLANImp::writeWirelessOpts( QString scheme ) { qWarning( "WLANImp::writeWirelessOpts entered." ); QString prev = "/etc/pcmcia/wireless.opts"; QFile prevFile(prev); if ( !prevFile.open( IO_ReadOnly ) ) return false; 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 bool error = false; if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ staticGroupBox->hide(); dhcpCheckBox->hide(); leaseTime->hide(); leaseHoursLabel->hide(); } } /** * Save the current settings, then write out the interfaces file and close. */ -void InterfaceSetupImp::saveChanges(){ +bool InterfaceSetupImp::saveChanges(){ if(!saveSettings()) - return; + return false; interfaces->write(); + return true; } /** * Save the settings for the current Interface. * @return bool true if successfull, false otherwise */ bool InterfaceSetupImp::saveSettings(){ // eh can't really do anything about it other then return. :-D if(!interfaces->isInterfaceSet()) return true; bool error = false; // Loopback case if(interfaces->getInterfaceMethod(error) == INTERFACES_LOOPBACK){ interfaces->setAuto(interface->getInterfaceName(), autoStart->isChecked()); return true; } if(!dhcpCheckBox->isChecked() && (ipAddressEdit->text().isEmpty() || subnetMaskEdit->text().isEmpty())){ - QMessageBox::information(this, "Not Saved.", "Please fill in address, subnet,\n and gateway entries.", "Ok"); + QMessageBox::information(this, "Not Saved.", "Please fill in the IP address and\n subnet entries.", "Ok"); return false; } interfaces->removeAllInterfaceOptions(); // DHCP if(dhcpCheckBox->isChecked()){ interfaces->setInterfaceMethod(INTERFACES_METHOD_DHCP); interfaces->setInterfaceOption("leasehours", QString("%1").arg(leaseTime->value())); interfaces->setInterfaceOption("leasetime", QString("%1").arg(leaseTime->value()*60*60)); } else{ 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 @@ #include "interfacesetup.h" #include <qdialog.h> class Interface; class Interfaces; class InterfaceSetupImp : public InterfaceSetup { Q_OBJECT public: InterfaceSetupImp( QWidget* parent = 0, const char* name = 0, Interface *i=0, WFlags fl = 0); - void saveChanges(); + bool saveChanges(); public slots: void setProfile(const QString &profile); bool saveSettings(); + private: Interfaces *interfaces; Interface *interface; }; #include <qlayout.h> class InterfaceSetupImpDialog : public QDialog { Q_OBJECT @@ -34,22 +35,22 @@ public: QVBoxLayout *InterfaceSetupLayout = new QVBoxLayout( this ); setCaption("Interface Setup"); interfaceSetup = new InterfaceSetupImp(this, "InterfaceSetup",i,fl); InterfaceSetupLayout->addWidget( interfaceSetup ); }; void setProfile(QString &profile){ interfaceSetup->setProfile(profile);}; private: InterfaceSetupImp *interfaceSetup; protected slots: void accept(){ - interfaceSetup->saveChanges(); - QDialog::accept(); + if(interfaceSetup->saveChanges()) + QDialog::accept(); }; }; #endif // interfacesetupimp.h 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() config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); return writeWirelessOpts( ); } /** */ void WLANImp::accept() { if ( writeConfig() ){ - interfaceSetup->saveChanges(); - QDialog::accept(); + if(interfaceSetup->saveChanges()) + QDialog::accept(); } } bool WLANImp::writeWirelessOpts( QString scheme ) { qWarning( "WLANImp::writeWirelessOpts entered." ); QString prev = "/etc/pcmcia/wireless.opts"; QFile prevFile(prev); if ( !prevFile.open( IO_ReadOnly ) ) return false; QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; |