xconfig: merge code path to conf_write()
PATCH 1/1 xconfig: merge code path to conf_write()
Michal, Hiromu,
That should fix the first error miss in xconfig. I'll have a look tonight to gconf.
- Arnaud
---
From: Arnaud Lacombe <[email protected]>
Subject: [PATCH] xconfig: merge code path to conf_write()
Avoid to have multiple path saving the config. This fixes an error check miss when the window is being closed and the user requested the config to be written.
--- scripts/kconfig/qconf.cc | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
scripts/kconfig/qconf.cc +2 -3
@@ -1489,8 +1489,7 @@ void ConfigMainWindow::saveConfigAs(void) QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); if (s.isNull()) return; - if (conf_write(QFile::encodeName(s))) - QMessageBox::information(this, "qconf", _("Unable to save configuration!")); + saveConfig(); } void ConfigMainWindow::searchConfig(void)
@@ -1643,7 +1642,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); switch (mb.exec()) { case QMessageBox::Yes: - conf_write(NULL); + saveConfig(); case QMessageBox::No: e->accept(); break;
Signature · 1 line
1.7.3.4.574.g608b.dirty
Michal Marek
AppliedQuoted 9 lines · Arnaud Lacombe
Avoid to have multiple path saving the config. This fixes an error check miss when the window is being closed and the user requested the config to be written.
Reported-by Hiromu Yakura <[email protected]>Pointed-out-by Michal Marek <[email protected]>Signed-off-by Arnaud Lacombe <[email protected]>--- scripts/kconfig/qconf.cc | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
Applied, thanks.
The following patch avoids the data loss if the configuration cannot be saved.
Michal
Subject: [PATCH] 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.
scripts/kconfig/qconf.cc +10 -3
@@ -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;
scripts/kconfig/qconf.h +1 -1
@@ -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 );
Quoted 5 lines · Michal Marek
The following patch avoids the data loss if the configuration cannot be saved.
Michal
Quoted 7 lines
Subject: [PATCH] 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<[email protected]>Signed-off-by Michal Marek<[email protected]>
I completely forgot about this patch. It's applied now and will be in 3.1.
Michal
Quoted 51 lines
scripts/kconfig/qconf.cc +10
-3@@ -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;scripts/kconfig/qconf.h +1
-2@@ -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 ); --To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Michal,
Quoted 9 lines · Michal Marek
Quoted 8 lines · Michal Marek
The following patch avoids the data loss if the configuration cannot be saved.
Michal
Subject: [PATCH] xconfig: Abort close if configuration cannot be saved
Quoted 8 lines
Quoted 5 lines
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]>I completely forgot about this patch. It's applied now and will be in 3.1.
gni ? isn't this issue already fixed by
https://patchwork.kernel.org/patch/812862/ which went in v3.0 ??
- Arnaud
Quoted 55 lines
Michal
Quoted 52 lines
scripts/kconfig/qconf.cc +2
-2@@ -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)scripts/kconfig/qconf.cc +0
-0@@ -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;
caseQMessageBox::No:
e->accept();
break;scripts/kconfig/qconf.h +1
-2@@ -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); --To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines · Arnaud Lacombe
Hi Michal,
Quoted 12 lines · Michal Marek
Quoted 11 lines · Michal Marek
The following patch avoids the data loss if the configuration cannot be saved.
Michal
Subject: [PATCH] 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.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Reported-by Hiromu Yakura<[email protected]>Signed-off-by Michal Marek<[email protected]>I completely forgot about this patch. It's applied now and will be in 3.1.
gni ? isn't this issue already fixed by
https://patchwork.kernel.org/patch/812862/ which went in v3.0 ??
That's the prerequisite. This patch makes sure that xconfig does not exit if the save failed.
Michal