From bac6aa865b3dc98e9fbc17f11d4d513d6b0bc435 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Wed, 25 May 2011 15:10:25 +0200 Subject: 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 Signed-off-by: Michal Marek --- scripts/kconfig/qconf.cc | 13 ++++++++++--- 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) ConfigView::updateListAll(); } -void ConfigMainWindow::saveConfig(void) +bool ConfigMainWindow::saveConfig(void) { - if (conf_write(NULL)) + if (conf_write(NULL)) { QMessageBox::information(this, "qconf", _("Unable to save configuration!")); + return false; + } + return true; } void ConfigMainWindow::saveConfigAs(void) @@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); switch (mb.exec()) { case QMessageBox::Yes: - saveConfig(); + if (saveConfig()) + e->accept(); + else + e->ignore(); + break; case QMessageBox::No: e->accept(); 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: void listFocusChanged(void); void goBack(void); void loadConfig(void); - void saveConfig(void); + bool saveConfig(void); void saveConfigAs(void); void searchConfig(void); void showSingleView(void); -- cgit v1.2.3