[yast-commit] r63428 - in /branches/SuSE-Code-11-SP2-Branch/ncurses: package/yast2-ncurses.changes src/NCMultiSelectionBox.cc

Author: gs Date: Wed Feb 16 10:54:26 2011 New Revision: 63428 URL: http://svn.opensuse.org/viewcvs/yast?rev=63428&view=rev Log: NCMultiSelectionBox: adjust preferred width, avoid invalid pointers Modified: branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCMultiSelectionBox.cc Modified: branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ncurse... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes (original) +++ branches/SuSE-Code-11-SP2-Branch/ncurses/package/yast2-ncurses.changes Wed Feb 16 10:54:26 2011 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Feb 16 10:51:16 CET 2011 - gs@suse.de + +- NCMultiSelectionBox: adjust preferred width, avoid invalid + pointers + +------------------------------------------------------------------- Wed Oct 13 14:26:38 CEST 2010 - gs@suse.de - NCRichText: bug-fix for pre tag (bnc #484629) Modified: branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCMultiSelectionBox.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP2-Branch/ncurse... ============================================================================== --- branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCMultiSelectionBox.cc (original) +++ branches/SuSE-Code-11-SP2-Branch/ncurses/src/NCMultiSelectionBox.cc Wed Feb 16 10:54:26 2011 @@ -40,7 +40,8 @@ int NCMultiSelectionBox::preferredWidth() { - return wGetDefsze().W; + wsze sze = wGetDefsze(); + return sze.W > ( int )( labelWidth() + 2 ) ? sze.W : ( labelWidth() + 2 ); } @@ -77,7 +78,8 @@ void NCMultiSelectionBox::setCurrentItem( YItem * item ) { - myPad()->ScrlLine( item->index() ); + if ( item ) + myPad()->ScrlLine( item->index() ); } void NCMultiSelectionBox::addItem( YItem * item ) @@ -136,22 +138,27 @@ bool NCMultiSelectionBox::isItemSelected( YItem *item ) { - return item->selected(); + if ( item ) + return item->selected(); + else + return false; } void NCMultiSelectionBox::selectItem( YItem *yitem, bool selected ) { - YMultiSelectionBox::selectItem( yitem, selected ); - - //retrieve pointer to the line tag associated with this item - NCTableTag * tag = ( NCTableTag * )yitem->data(); - YUI_CHECK_PTR( tag ); + if ( yitem ) + { + YMultiSelectionBox::selectItem( yitem, selected ); - tag->SetSelected( selected ); + //retrieve pointer to the line tag associated with this item + NCTableTag * tag = ( NCTableTag * )yitem->data(); + YUI_CHECK_PTR( tag ); - DrawPad(); + tag->SetSelected( selected ); + DrawPad(); + } } @@ -162,6 +169,8 @@ for ( unsigned int i = 0; i < getNumLines(); i++ ) { NCTableTag *t = tagCell( i ); + YUI_CHECK_PTR( t ); + t->SetSelected( false ); } @@ -176,8 +185,8 @@ void NCMultiSelectionBox::toggleCurrentItem() { YItem *it = currentItem(); - selectItem( it, !( it->selected() ) ); - + if ( it ) + selectItem( it, !( it->selected() ) ); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
gs@svn2.opensuse.org