Author: gs Date: Thu Feb 3 13:31:48 2011 New Revision: 63324 URL: http://svn.opensuse.org/viewcvs/yast?rev=63324&view=rev Log: muliSel: return ValueChanged if checkbox is on/off and SelectionChanged when scrolled in tree Modified: trunk/ncurses/src/NCTree.cc Modified: trunk/ncurses/src/NCTree.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCTree.cc?rev=63324&a... ============================================================================== --- trunk/ncurses/src/NCTree.cc (original) +++ trunk/ncurses/src/NCTree.cc Thu Feb 3 13:31:48 2011 @@ -502,18 +502,19 @@ NCursesEvent ret = NCursesEvent::none; YTreeItem * oldCurrentItem = getCurrentItem(); + bool handled = handleInput( key ); // NCTreePad::handleInput() + const YItem * currentItem = getCurrentItem(); + + if ( !currentItem ) + return ret; + if ( multiSel ) { - if ( ! handleInput( key ) ) // NCTreePad::handleInput() + if ( ! handled ) { - const YItem * currentItem = getCurrentItem(); - - if ( !currentItem ) - return ret; - switch ( key ) { - case KEY_SPACE: // KEY_SPACE is handled in NCTreeLine::handleInput + // KEY_SPACE is handled in NCTreeLine::handleInput case KEY_RETURN: if ( currentItem->selected() ) @@ -523,7 +524,7 @@ if ( notify() ) { - ret = NCursesEvent::ValueChanged; + return NCursesEvent::ValueChanged; } break; } @@ -531,11 +532,11 @@ } else { - if ( ! handleInput( key ) ) // NCTreePad::handleInput() + if ( ! handled ) { switch ( key ) { - case KEY_SPACE: // KEY_SPACE is handled in NCTreeLine::handleInput + // KEY_SPACE is handled in NCTreeLine::handleInput case KEY_RETURN: if ( notify() ) @@ -546,21 +547,14 @@ } } - const YItem * currentItem = getCurrentItem(); - - if ( !currentItem ) - return ret; - YTree::selectItem( const_cast<YItem *>( currentItem ), true ); + } - yuiDebug() << "Old item: " << oldCurrentItem->label() << " Current: " << currentItem->label() << endl; - - if ( notify() && immediateMode() && ( oldCurrentItem != currentItem ) ) + if ( notify() && immediateMode() && ( oldCurrentItem != currentItem ) ) ret = NCursesEvent::SelectionChanged; - - yuiDebug() << "Notify: " << ( notify() ? "true" : "false" ) << " Return event: " << ret << endl; - } + yuiDebug() << "Notify: " << ( notify() ? "true" : "false" ) << + " Return event: " << ret.reason << endl; return ret; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org