diff options
author | Michal Marek <mmarek@suse.cz> | 2011-05-25 09:10:25 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2011-07-25 09:50:34 -0400 |
commit | bac6aa865b3dc98e9fbc17f11d4d513d6b0bc435 (patch) | |
tree | 26b8c3a2567286ea4da5489ac7df1c51a1f94026 | |
parent | eb4cf5a642f6430cffff7ba5d8d9bd46ea409281 (diff) |
xconfig: Abort close if configuration cannot be saved
Give the user an opportunity to fix the error or save the configuration
under a different path.
Reported-by: Hiromu Yakura <hiromu1996@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rw-r--r-- | scripts/kconfig/qconf.cc | 13 | ||||
-rw-r--r-- | scripts/kconfig/qconf.h | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 31e01cdbfc6e..df274febb3e5 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void) | |||
1478 | ConfigView::updateListAll(); | 1478 | ConfigView::updateListAll(); |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | void ConfigMainWindow::saveConfig(void) | 1481 | bool ConfigMainWindow::saveConfig(void) |
1482 | { | 1482 | { |
1483 | if (conf_write(NULL)) | 1483 | if (conf_write(NULL)) { |
1484 | QMessageBox::information(this, "qconf", _("Unable to save configuration!")); | 1484 | QMessageBox::information(this, "qconf", _("Unable to save configuration!")); |
1485 | return false; | ||
1486 | } | ||
1487 | return true; | ||
1485 | } | 1488 | } |
1486 | 1489 | ||
1487 | void ConfigMainWindow::saveConfigAs(void) | 1490 | void ConfigMainWindow::saveConfigAs(void) |
@@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) | |||
1642 | mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); | 1645 | mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); |
1643 | switch (mb.exec()) { | 1646 | switch (mb.exec()) { |
1644 | case QMessageBox::Yes: | 1647 | case QMessageBox::Yes: |
1645 | saveConfig(); | 1648 | if (saveConfig()) |
1649 | e->accept(); | ||
1650 | else | ||
1651 | e->ignore(); | ||
1652 | break; | ||
1646 | case QMessageBox::No: | 1653 | case QMessageBox::No: |
1647 | e->accept(); | 1654 | e->accept(); |
1648 | break; | 1655 | break; |
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 91677d900dbd..3715b3e7212c 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -311,7 +311,7 @@ public slots: | |||
311 | void listFocusChanged(void); | 311 | void listFocusChanged(void); |
312 | void goBack(void); | 312 | void goBack(void); |
313 | void loadConfig(void); | 313 | void loadConfig(void); |
314 | void saveConfig(void); | 314 | bool saveConfig(void); |
315 | void saveConfigAs(void); | 315 | void saveConfigAs(void); |
316 | void searchConfig(void); | 316 | void searchConfig(void); |
317 | void showSingleView(void); | 317 | void showSingleView(void); |