aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2006-06-09 01:12:47 -0400
committerSam Ravnborg <sam@mars.ravnborg.org>2006-06-09 10:28:07 -0400
commitb65a47e1ac494777d853d7952cef611eedc22037 (patch)
tree1ad1b133e65fd2600631667c441b63ccc9ae3348 /scripts/kconfig
parentab45d190fd4acf0b0e5d307294ce24a90a69cc23 (diff)
kconfig: jump to linked menu prompt
If clicking on of the links, which leads to a visible prompt, jump to it in the symbol list. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/qconf.cc109
-rw-r--r--scripts/kconfig/qconf.h6
2 files changed, 86 insertions, 29 deletions
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 425ce5ce2d12..393f3749f330 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -381,6 +381,18 @@ void ConfigList::saveSettings(void)
381 } 381 }
382} 382}
383 383
384ConfigItem* ConfigList::findConfigItem(struct menu *menu)
385{
386 ConfigItem* item = (ConfigItem*)menu->data;
387
388 for (; item; item = item->nextItem) {
389 if (this == item->listView())
390 break;
391 }
392
393 return item;
394}
395
384void ConfigList::updateSelection(void) 396void ConfigList::updateSelection(void)
385{ 397{
386 struct menu *menu; 398 struct menu *menu;
@@ -524,6 +536,7 @@ void ConfigList::setRootMenu(struct menu *menu)
524 rootEntry = menu; 536 rootEntry = menu;
525 updateListAll(); 537 updateListAll();
526 setSelected(currentItem(), hasFocus()); 538 setSelected(currentItem(), hasFocus());
539 ensureItemVisible(currentItem());
527} 540}
528 541
529void ConfigList::setParentMenu(void) 542void ConfigList::setParentMenu(void)
@@ -766,14 +779,16 @@ skip:
766 779
767void ConfigList::focusInEvent(QFocusEvent *e) 780void ConfigList::focusInEvent(QFocusEvent *e)
768{ 781{
769 Parent::focusInEvent(e); 782 struct menu *menu = NULL;
770 783
771 QListViewItem* item = currentItem(); 784 Parent::focusInEvent(e);
772 if (!item)
773 return;
774 785
775 setSelected(item, TRUE); 786 ConfigItem* item = (ConfigItem *)currentItem();
776 emit gotFocus(); 787 if (item) {
788 setSelected(item, TRUE);
789 menu = item->menu;
790 }
791 emit gotFocus(menu);
777} 792}
778 793
779void ConfigList::contextMenuEvent(QContextMenuEvent *e) 794void ConfigList::contextMenuEvent(QContextMenuEvent *e)
@@ -933,6 +948,8 @@ void ConfigInfoView::setShowDebug(bool b)
933 948
934void ConfigInfoView::setInfo(struct menu *m) 949void ConfigInfoView::setInfo(struct menu *m)
935{ 950{
951 if (menu == m)
952 return;
936 menu = m; 953 menu = m;
937 if (!menu) 954 if (!menu)
938 clear(); 955 clear();
@@ -954,6 +971,7 @@ void ConfigInfoView::setSource(const QString& name)
954 if (sscanf(p, "m%p", &m) == 1 && menu != m) { 971 if (sscanf(p, "m%p", &m) == 1 && menu != m) {
955 menu = m; 972 menu = m;
956 menuInfo(); 973 menuInfo();
974 emit menuSelected(menu);
957 } 975 }
958 break; 976 break;
959 case 's': 977 case 's':
@@ -1380,10 +1398,14 @@ ConfigMainWindow::ConfigMainWindow(void)
1380 connect(menuList, SIGNAL(menuSelected(struct menu *)), 1398 connect(menuList, SIGNAL(menuSelected(struct menu *)),
1381 SLOT(changeMenu(struct menu *))); 1399 SLOT(changeMenu(struct menu *)));
1382 1400
1383 connect(configList, SIGNAL(gotFocus(void)), 1401 connect(configList, SIGNAL(gotFocus(struct menu *)),
1384 SLOT(listFocusChanged(void))); 1402 helpText, SLOT(setInfo(struct menu *)));
1385 connect(menuList, SIGNAL(gotFocus(void)), 1403 connect(menuList, SIGNAL(gotFocus(struct menu *)),
1404 helpText, SLOT(setInfo(struct menu *)));
1405 connect(menuList, SIGNAL(gotFocus(struct menu *)),
1386 SLOT(listFocusChanged(void))); 1406 SLOT(listFocusChanged(void)));
1407 connect(helpText, SIGNAL(menuSelected(struct menu *)),
1408 SLOT(setMenuLink(struct menu *)));
1387 1409
1388 QString listMode = configSettings->readEntry("/listMode", "symbol"); 1410 QString listMode = configSettings->readEntry("/listMode", "symbol");
1389 if (listMode == "single") 1411 if (listMode == "single")
@@ -1403,18 +1425,6 @@ ConfigMainWindow::ConfigMainWindow(void)
1403 split2->setSizes(sizes); 1425 split2->setSizes(sizes);
1404} 1426}
1405 1427
1406/*
1407 * display a new help entry as soon as a new menu entry is selected
1408 */
1409void ConfigMainWindow::setHelp(QListViewItem* item)
1410{
1411 struct menu* menu = 0;
1412
1413 if (item)
1414 menu = ((ConfigItem*)item)->menu;
1415 helpText->setInfo(menu);
1416}
1417
1418void ConfigMainWindow::loadConfig(void) 1428void ConfigMainWindow::loadConfig(void)
1419{ 1429{
1420 QString s = QFileDialog::getOpenFileName(".config", NULL, this); 1430 QString s = QFileDialog::getOpenFileName(".config", NULL, this);
@@ -1453,17 +1463,62 @@ void ConfigMainWindow::changeMenu(struct menu *menu)
1453 backAction->setEnabled(TRUE); 1463 backAction->setEnabled(TRUE);
1454} 1464}
1455 1465
1456void ConfigMainWindow::listFocusChanged(void) 1466void ConfigMainWindow::setMenuLink(struct menu *menu)
1457{ 1467{
1458 if (menuList->hasFocus()) { 1468 struct menu *parent;
1459 if (menuList->mode == menuMode) 1469 ConfigList* list = NULL;
1470 ConfigItem* item;
1471
1472 if (!menu_is_visible(menu) && !configView->showAll())
1473 return;
1474
1475 switch (configList->mode) {
1476 case singleMode:
1477 list = configList;
1478 parent = menu_get_parent_menu(menu);
1479 if (!parent)
1480 return;
1481 list->setRootMenu(parent);
1482 break;
1483 case symbolMode:
1484 if (menu->flags & MENU_ROOT) {
1485 configList->setRootMenu(menu);
1460 configList->clearSelection(); 1486 configList->clearSelection();
1461 setHelp(menuList->selectedItem()); 1487 list = menuList;
1462 } else if (configList->hasFocus()) { 1488 } else {
1463 setHelp(configList->selectedItem()); 1489 list = configList;
1490 parent = menu_get_parent_menu(menu->parent);
1491 if (!parent)
1492 return;
1493 item = menuList->findConfigItem(parent);
1494 if (item) {
1495 menuList->setSelected(item, TRUE);
1496 menuList->ensureItemVisible(item);
1497 }
1498 list->setRootMenu(parent);
1499 }
1500 break;
1501 case fullMode:
1502 list = configList;
1503 break;
1504 }
1505
1506 if (list) {
1507 item = list->findConfigItem(menu);
1508 if (item) {
1509 list->setSelected(item, TRUE);
1510 list->ensureItemVisible(item);
1511 list->setFocus();
1512 }
1464 } 1513 }
1465} 1514}
1466 1515
1516void ConfigMainWindow::listFocusChanged(void)
1517{
1518 if (menuList->mode == menuMode)
1519 configList->clearSelection();
1520}
1521
1467void ConfigMainWindow::goBack(void) 1522void ConfigMainWindow::goBack(void)
1468{ 1523{
1469 ConfigItem* item; 1524 ConfigItem* item;
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index b824f78cc06d..6a9e3b14c227 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -55,6 +55,7 @@ public:
55 { 55 {
56 return (ConfigView*)Parent::parent(); 56 return (ConfigView*)Parent::parent();
57 } 57 }
58 ConfigItem* findConfigItem(struct menu *);
58 59
59protected: 60protected:
60 void keyPressEvent(QKeyEvent *e); 61 void keyPressEvent(QKeyEvent *e);
@@ -77,7 +78,7 @@ signals:
77 void menuChanged(struct menu *menu); 78 void menuChanged(struct menu *menu);
78 void menuSelected(struct menu *menu); 79 void menuSelected(struct menu *menu);
79 void parentSelected(void); 80 void parentSelected(void);
80 void gotFocus(void); 81 void gotFocus(struct menu *);
81 82
82public: 83public:
83 void updateListAll(void) 84 void updateListAll(void)
@@ -258,6 +259,7 @@ public slots:
258 259
259signals: 260signals:
260 void showDebugChanged(bool); 261 void showDebugChanged(bool);
262 void menuSelected(struct menu *);
261 263
262protected: 264protected:
263 void symbolInfo(void); 265 void symbolInfo(void);
@@ -298,8 +300,8 @@ class ConfigMainWindow : public QMainWindow {
298public: 300public:
299 ConfigMainWindow(void); 301 ConfigMainWindow(void);
300public slots: 302public slots:
301 void setHelp(QListViewItem* item);
302 void changeMenu(struct menu *); 303 void changeMenu(struct menu *);
304 void setMenuLink(struct menu *);
303 void listFocusChanged(void); 305 void listFocusChanged(void);
304 void goBack(void); 306 void goBack(void);
305 void loadConfig(void); 307 void loadConfig(void);