diff options
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/confdata.c | 12 | ||||
-rw-r--r-- | scripts/kconfig/lkc_proto.h | 1 | ||||
-rw-r--r-- | scripts/kconfig/qconf.cc | 13 | ||||
-rw-r--r-- | scripts/kconfig/qconf.h | 3 |
4 files changed, 27 insertions, 2 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 4bbbb5b09c8d..664fe29dacef 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -767,18 +767,28 @@ int conf_write_autoconf(void) | |||
767 | } | 767 | } |
768 | 768 | ||
769 | static int sym_change_count; | 769 | static int sym_change_count; |
770 | static void (*conf_changed_callback)(void); | ||
770 | 771 | ||
771 | void sym_set_change_count(int count) | 772 | void sym_set_change_count(int count) |
772 | { | 773 | { |
774 | int _sym_change_count = sym_change_count; | ||
773 | sym_change_count = count; | 775 | sym_change_count = count; |
776 | if (conf_changed_callback && | ||
777 | (bool)_sym_change_count != (bool)count) | ||
778 | conf_changed_callback(); | ||
774 | } | 779 | } |
775 | 780 | ||
776 | void sym_add_change_count(int count) | 781 | void sym_add_change_count(int count) |
777 | { | 782 | { |
778 | sym_change_count += count; | 783 | sym_set_change_count(count + sym_change_count); |
779 | } | 784 | } |
780 | 785 | ||
781 | bool conf_get_changed(void) | 786 | bool conf_get_changed(void) |
782 | { | 787 | { |
783 | return sym_change_count; | 788 | return sym_change_count; |
784 | } | 789 | } |
790 | |||
791 | void conf_set_changed_callback(void (*fn)(void)) | ||
792 | { | ||
793 | conf_changed_callback = fn; | ||
794 | } | ||
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 84bb139789a0..15030770d1ad 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -6,6 +6,7 @@ P(conf_read_simple,int,(const char *name, int)); | |||
6 | P(conf_write,int,(const char *name)); | 6 | P(conf_write,int,(const char *name)); |
7 | P(conf_write_autoconf,int,(void)); | 7 | P(conf_write_autoconf,int,(void)); |
8 | P(conf_get_changed,bool,(void)); | 8 | P(conf_get_changed,bool,(void)); |
9 | P(conf_set_changed_callback, void,(void (*fn)(void))); | ||
9 | 10 | ||
10 | /* menu.c */ | 11 | /* menu.c */ |
11 | P(rootmenu,struct menu,); | 12 | P(rootmenu,struct menu,); |
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 8d60d99bd9f1..0b2fcc417f59 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -38,6 +38,8 @@ | |||
38 | static QApplication *configApp; | 38 | static QApplication *configApp; |
39 | static ConfigSettings *configSettings; | 39 | static ConfigSettings *configSettings; |
40 | 40 | ||
41 | QAction *ConfigMainWindow::saveAction; | ||
42 | |||
41 | static inline QString qgettext(const char* str) | 43 | static inline QString qgettext(const char* str) |
42 | { | 44 | { |
43 | return QString::fromLocal8Bit(gettext(str)); | 45 | return QString::fromLocal8Bit(gettext(str)); |
@@ -1306,8 +1308,11 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1306 | connect(quitAction, SIGNAL(activated()), SLOT(close())); | 1308 | connect(quitAction, SIGNAL(activated()), SLOT(close())); |
1307 | QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); | 1309 | QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); |
1308 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); | 1310 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); |
1309 | QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); | 1311 | saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); |
1310 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); | 1312 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); |
1313 | conf_set_changed_callback(conf_changed); | ||
1314 | // Set saveAction's initial state | ||
1315 | conf_changed(); | ||
1311 | QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); | 1316 | QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); |
1312 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); | 1317 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); |
1313 | QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this); | 1318 | QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this); |
@@ -1658,6 +1663,12 @@ void ConfigMainWindow::saveSettings(void) | |||
1658 | configSettings->writeSizes("/split2", split2->sizes()); | 1663 | configSettings->writeSizes("/split2", split2->sizes()); |
1659 | } | 1664 | } |
1660 | 1665 | ||
1666 | void ConfigMainWindow::conf_changed(void) | ||
1667 | { | ||
1668 | if (saveAction) | ||
1669 | saveAction->setEnabled(conf_get_changed()); | ||
1670 | } | ||
1671 | |||
1661 | void fixup_rootmenu(struct menu *menu) | 1672 | void fixup_rootmenu(struct menu *menu) |
1662 | { | 1673 | { |
1663 | struct menu *child; | 1674 | struct menu *child; |
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 6a9e3b14c227..6fc1c5f14425 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -297,6 +297,9 @@ protected: | |||
297 | 297 | ||
298 | class ConfigMainWindow : public QMainWindow { | 298 | class ConfigMainWindow : public QMainWindow { |
299 | Q_OBJECT | 299 | Q_OBJECT |
300 | |||
301 | static QAction *saveAction; | ||
302 | static void conf_changed(void); | ||
300 | public: | 303 | public: |
301 | ConfigMainWindow(void); | 304 | ConfigMainWindow(void); |
302 | public slots: | 305 | public slots: |