[PATCH] qconf: relocate Search Command
[deliverable/linux.git] / scripts / kconfig / qconf.cc
index 393f3749f3306c3d5584db7e09e24f0823e7fc11..83a270347c258d95b0cd35c55ea4a37f04c8d2b3 100644 (file)
@@ -38,6 +38,8 @@
 static QApplication *configApp;
 static ConfigSettings *configSettings;
 
+QAction *ConfigMainWindow::saveAction;
+
 static inline QString qgettext(const char* str)
 {
        return QString::fromLocal8Bit(gettext(str));
@@ -87,6 +89,7 @@ void ConfigItem::okRename(int col)
 {
        Parent::okRename(col);
        sym_set_string_value(menu->sym, text(dataColIdx).latin1());
+       listView()->updateList(this);
 }
 #endif
 
@@ -798,7 +801,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
                        QAction *action;
 
                        headerPopup = new QPopupMenu(this);
-                       action = new QAction("Show Name", 0, this);
+                       action = new QAction(NULL, "Show Name", 0, this);
                          action->setToggleAction(TRUE);
                          connect(action, SIGNAL(toggled(bool)),
                                  parent(), SLOT(setShowName(bool)));
@@ -806,7 +809,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
                                  action, SLOT(setOn(bool)));
                          action->setOn(showName);
                          action->addTo(headerPopup);
-                       action = new QAction("Show Range", 0, this);
+                       action = new QAction(NULL, "Show Range", 0, this);
                          action->setToggleAction(TRUE);
                          connect(action, SIGNAL(toggled(bool)),
                                  parent(), SLOT(setShowRange(bool)));
@@ -814,7 +817,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
                                  action, SLOT(setOn(bool)));
                          action->setOn(showRange);
                          action->addTo(headerPopup);
-                       action = new QAction("Show Data", 0, this);
+                       action = new QAction(NULL, "Show Data", 0, this);
                          action->setToggleAction(TRUE);
                          connect(action, SIGNAL(toggled(bool)),
                                  parent(), SLOT(setShowData(bool)));
@@ -915,7 +918,7 @@ void ConfigView::updateListAll(void)
 }
 
 ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
-       : Parent(parent, name), menu(0)
+       : Parent(parent, name), menu(0), sym(0)
 {
        if (name) {
                configSettings->beginGroup(name);
@@ -951,6 +954,7 @@ void ConfigInfoView::setInfo(struct menu *m)
        if (menu == m)
                return;
        menu = m;
+       sym = NULL;
        if (!menu)
                clear();
        else
@@ -1161,7 +1165,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
 QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
 {
        QPopupMenu* popup = Parent::createPopupMenu(pos);
-       QAction* action = new QAction("Show Debug Info", 0, popup);
+       QAction* action = new QAction(NULL,"Show Debug Info", 0, popup);
          action->setToggleAction(TRUE);
          connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
          connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1259,6 +1263,7 @@ void ConfigSearchWindow::search(void)
  * Construct the complete config widget
  */
 ConfigMainWindow::ConfigMainWindow(void)
+       : searchWindow(0)
 {
        QMenuBar* menu;
        bool ok;
@@ -1305,11 +1310,14 @@ ConfigMainWindow::ConfigMainWindow(void)
          connect(quitAction, SIGNAL(activated()), SLOT(close()));
        QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this);
          connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
-       QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this);
+       saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this);
          connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
+       conf_set_changed_callback(conf_changed);
+       // Set saveAction's initial state
+       conf_changed();
        QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this);
          connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
-       QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this);
+       QAction *searchAction = new QAction("Find", "&Find", CTRL+Key_F, this);
          connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
        QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this);
          connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
@@ -1366,10 +1374,13 @@ ConfigMainWindow::ConfigMainWindow(void)
        saveAction->addTo(config);
        saveAsAction->addTo(config);
        config->insertSeparator();
-       searchAction->addTo(config);
-       config->insertSeparator();
        quitAction->addTo(config);
 
+       // create edit menu
+       QPopupMenu* editMenu = new QPopupMenu(this);
+       menu->insertItem("&Edit", editMenu);
+       searchAction->addTo(editMenu);
+
        // create options menu
        QPopupMenu* optionMenu = new QPopupMenu(this);
        menu->insertItem("&Option", optionMenu);
@@ -1584,7 +1595,7 @@ void ConfigMainWindow::showFullView(void)
  */
 void ConfigMainWindow::closeEvent(QCloseEvent* e)
 {
-       if (!sym_change_count) {
+       if (!conf_get_changed()) {
                e->accept();
                return;
        }
@@ -1657,6 +1668,12 @@ void ConfigMainWindow::saveSettings(void)
        configSettings->writeSizes("/split2", split2->sizes());
 }
 
+void ConfigMainWindow::conf_changed(void)
+{
+       if (saveAction)
+               saveAction->setEnabled(conf_get_changed());
+}
+
 void fixup_rootmenu(struct menu *menu)
 {
        struct menu *child;
This page took 0.027269 seconds and 5 git commands to generate.