Author: gs Date: Thu Jul 10 13:08:04 2008 New Revision: 48952 URL: http://svn.opensuse.org/viewcvs/yast?rev=48952&view=rev Log: short cut support improved Modified: trunk/ncurses/src/NCDumbTab.cc trunk/ncurses/src/NCDumbTab.h Modified: trunk/ncurses/src/NCDumbTab.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCDumbTab.cc?rev=48952&r1=48951&r2=48952&view=diff ============================================================================== --- trunk/ncurses/src/NCDumbTab.cc (original) +++ trunk/ncurses/src/NCDumbTab.cc Thu Jul 10 13:08:04 2008 @@ -125,7 +125,8 @@ break; case KEY_HOTKEY: - yuiMilestone() << "HOT key" << endl; + setCurrentTab( hotKey ); + case KEY_RETURN: ret = createMenuEvent( currentIndex ); break; @@ -135,6 +136,28 @@ return ret; } +void NCDumbTab::setCurrentTab( wint_t key ) +{ + + YItemIterator listIt = itemsBegin(); + NClabel tablabel; + unsigned int i = 0; + + while ( listIt != itemsEnd() ) + { + tablabel = NCstring( (*listIt)->label() ); + tablabel.stripHotkey(); + yuiMilestone() << "HOTkey: " << tablabel.hotkey() << " key: " << key << endl; + if ( tablabel.hotkey() == key ) + { + currentIndex = i; + break; + } + ++listIt; + ++i; + } +} + NCursesEvent NCDumbTab::createMenuEvent( unsigned int index ) { NCursesEvent ret = NCursesEvent::menu; @@ -269,8 +292,11 @@ { tablabel = NCstring( (*listIt)->label() ); tablabel.stripHotkey(); - if ( tablabel.hasHotkey() ) + if ( tablabel.hasHotkey() && tablabel.hotkey() == key ) + { + hotKey = key; ret = true; + } ++listIt; } Modified: trunk/ncurses/src/NCDumbTab.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCDumbTab.h?rev=48952&r1=48951&r2=48952&view=diff ============================================================================== --- trunk/ncurses/src/NCDumbTab.h (original) +++ trunk/ncurses/src/NCDumbTab.h Thu Jul 10 13:08:04 2008 @@ -35,6 +35,7 @@ NCDumbTab( const NCDumbTab & ); unsigned int currentIndex; + wint_t hotKey; protected: @@ -74,6 +75,7 @@ NCursesEvent createMenuEvent( unsigned int index); + void setCurrentTab( wint_t key ); }; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org