summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-03-10 12:13:15 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-03-11 13:50:24 -0400
commit8741908b3e29d35a33eeab6de60175958db8e54b (patch)
tree1d10cfa5b3b3ce22f7408aecbea33635de01d419 /scripts/kconfig
parent769a1c02267854c48852532e5d7b595afcfe8dd7 (diff)
kconfig: fix 'Save As' menu of xconfig
The 'Save As' menu of xconfig is not working; it always saves the kernel configuration into the default file irrespective of the file chosen in the dialog box. The 'Save' menu always writes into the default file, but it would make more sense to write into the file previously chosen by 'Load' or 'Save As'. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/qconf.cc42
-rw-r--r--scripts/kconfig/qconf.h1
2 files changed, 36 insertions, 7 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 8be8a70c5542..ce7fc87a49a7 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1392,6 +1392,8 @@ ConfigMainWindow::ConfigMainWindow(void)
1392 conf_set_changed_callback(conf_changed); 1392 conf_set_changed_callback(conf_changed);
1393 // Set saveAction's initial state 1393 // Set saveAction's initial state
1394 conf_changed(); 1394 conf_changed();
1395 configname = xstrdup(conf_get_configname());
1396
1395 QAction *saveAsAction = new QAction("Save &As...", this); 1397 QAction *saveAsAction = new QAction("Save &As...", this);
1396 connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); 1398 connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs()));
1397 QAction *searchAction = new QAction("&Find", this); 1399 QAction *searchAction = new QAction("&Find", this);
@@ -1520,17 +1522,29 @@ ConfigMainWindow::ConfigMainWindow(void)
1520 1522
1521void ConfigMainWindow::loadConfig(void) 1523void ConfigMainWindow::loadConfig(void)
1522{ 1524{
1523 QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname()); 1525 QString str;
1524 if (s.isNull()) 1526 QByteArray ba;
1527 const char *name;
1528
1529 str = QFileDialog::getOpenFileName(this, "", configname);
1530 if (str.isNull())
1525 return; 1531 return;
1526 if (conf_read(QFile::encodeName(s))) 1532
1533 ba = str.toLocal8Bit();
1534 name = ba.data();
1535
1536 if (conf_read(name))
1527 QMessageBox::information(this, "qconf", "Unable to load configuration!"); 1537 QMessageBox::information(this, "qconf", "Unable to load configuration!");
1538
1539 free(configname);
1540 configname = xstrdup(name);
1541
1528 ConfigView::updateListAll(); 1542 ConfigView::updateListAll();
1529} 1543}
1530 1544
1531bool ConfigMainWindow::saveConfig(void) 1545bool ConfigMainWindow::saveConfig(void)
1532{ 1546{
1533 if (conf_write(NULL)) { 1547 if (conf_write(configname)) {
1534 QMessageBox::information(this, "qconf", "Unable to save configuration!"); 1548 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1535 return false; 1549 return false;
1536 } 1550 }
@@ -1541,10 +1555,24 @@ bool ConfigMainWindow::saveConfig(void)
1541 1555
1542void ConfigMainWindow::saveConfigAs(void) 1556void ConfigMainWindow::saveConfigAs(void)
1543{ 1557{
1544 QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname()); 1558 QString str;
1545 if (s.isNull()) 1559 QByteArray ba;
1560 const char *name;
1561
1562 str = QFileDialog::getSaveFileName(this, "", configname);
1563 if (str.isNull())
1546 return; 1564 return;
1547 saveConfig(); 1565
1566 ba = str.toLocal8Bit();
1567 name = ba.data();
1568
1569 if (conf_write(name)) {
1570 QMessageBox::information(this, "qconf", "Unable to save configuration!");
1571 }
1572 conf_write_autoconf(0);
1573
1574 free(configname);
1575 configname = xstrdup(name);
1548} 1576}
1549 1577
1550void ConfigMainWindow::searchConfig(void) 1578void ConfigMainWindow::searchConfig(void)
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 41df466e67d9..45bfe9b2b966 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -291,6 +291,7 @@ protected:
291class ConfigMainWindow : public QMainWindow { 291class ConfigMainWindow : public QMainWindow {
292 Q_OBJECT 292 Q_OBJECT
293 293
294 char *configname;
294 static QAction *saveAction; 295 static QAction *saveAction;
295 static void conf_changed(void); 296 static void conf_changed(void);
296public: 297public: