sata_mv: fix pci_enable_msi() error handling
[powerpc.git] / scripts / kconfig / qconf.cc
index f5628c5..512c2f5 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
 
@@ -603,6 +606,8 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
 
                visible = menu_is_visible(child);
                if (showAll || visible) {
+                       if (!child->sym && !child->list && !child->prompt)
+                               continue;
                        if (!item || item->menu != child)
                                item = new ConfigItem(parent, last, child, visible);
                        else
@@ -915,7 +920,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 +956,7 @@ void ConfigInfoView::setInfo(struct menu *m)
        if (menu == m)
                return;
        menu = m;
+       sym = NULL;
        if (!menu)
                clear();
        else
@@ -1244,6 +1250,7 @@ void ConfigSearchWindow::search(void)
 
        free(result);
        list->list->clear();
+       info->clear();
 
        result = sym_re_search(editField->text().latin1());
        if (!result)
@@ -1306,11 +1313,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()));
@@ -1367,10 +1377,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);
@@ -1461,7 +1474,10 @@ void ConfigMainWindow::searchConfig(void)
 void ConfigMainWindow::changeMenu(struct menu *menu)
 {
        configList->setRootMenu(menu);
-       backAction->setEnabled(TRUE);
+       if (configList->rootEntry->parent == &rootmenu)
+               backAction->setEnabled(FALSE);
+       else
+               backAction->setEnabled(TRUE);
 }
 
 void ConfigMainWindow::setMenuLink(struct menu *menu)
@@ -1585,7 +1601,7 @@ void ConfigMainWindow::showFullView(void)
  */
 void ConfigMainWindow::closeEvent(QCloseEvent* e)
 {
-       if (!sym_change_count) {
+       if (!conf_get_changed()) {
                e->accept();
                return;
        }
@@ -1658,6 +1674,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;