diff options
| -rw-r--r-- | scripts/kconfig/qconf.cc | 42 | ||||
| -rw-r--r-- | scripts/kconfig/qconf.h | 1 |
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 | ||
| 1521 | void ConfigMainWindow::loadConfig(void) | 1523 | void 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 | ||
| 1531 | bool ConfigMainWindow::saveConfig(void) | 1545 | bool 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 | ||
| 1542 | void ConfigMainWindow::saveConfigAs(void) | 1556 | void 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 | ||
| 1550 | void ConfigMainWindow::searchConfig(void) | 1578 | void 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: | |||
| 291 | class ConfigMainWindow : public QMainWindow { | 291 | class 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); |
| 296 | public: | 297 | public: |
