Prevent the settings dialogs from crashing when OK is pressed without changes made.
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 10 Feb 2008 13:44:07 +0000 (13:44 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 10 Feb 2008 13:44:07 +0000 (13:44 +0000)
src/qtui/settingsdlg.cpp
src/qtui/settingspagedlg.cpp

index b02e711..b5fc125 100644 (file)
@@ -121,7 +121,9 @@ void SettingsDlg::setButtonStates() {
 void SettingsDlg::buttonClicked(QAbstractButton *button) {
   switch(ui.buttonBox->standardButton(button)) {
     case QDialogButtonBox::Ok:
 void SettingsDlg::buttonClicked(QAbstractButton *button) {
   switch(ui.buttonBox->standardButton(button)) {
     case QDialogButtonBox::Ok:
-      if(applyChanges()) accept();
+      if(currentPage() && currentPage()->hasChanged()) {
+        if(applyChanges()) accept();
+      } else accept();
       break;
     case QDialogButtonBox::Apply:
       applyChanges();
       break;
     case QDialogButtonBox::Apply:
       applyChanges();
index df37ba0..2c817a9 100644 (file)
@@ -52,7 +52,9 @@ void SettingsPageDlg::setButtonStates() {
 void SettingsPageDlg::buttonClicked(QAbstractButton *button) {
   switch(ui.buttonBox->standardButton(button)) {
     case QDialogButtonBox::Ok:
 void SettingsPageDlg::buttonClicked(QAbstractButton *button) {
   switch(ui.buttonBox->standardButton(button)) {
     case QDialogButtonBox::Ok:
-      if(applyChanges()) accept();
+      if(currentPage() && currentPage()->hasChanged()) {
+        if(applyChanges()) accept();
+      } else accept();
       break;
     case QDialogButtonBox::Apply:
       applyChanges();
       break;
     case QDialogButtonBox::Apply:
       applyChanges();