Skip to content

Commit

Permalink
xconfig: Abort close if configuration cannot be saved
Browse files Browse the repository at this point in the history
Give the user an opportunity to fix the error or save the configuration
under a different path.

Reported-by: Hiromu Yakura <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
michal42 committed Jul 25, 2011
1 parent eb4cf5a commit bac6aa8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions scripts/kconfig/qconf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion scripts/kconfig/qconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bac6aa8

Please sign in to comment.