Author: kmachalkova
Date: Mon Dec 17 11:23:44 2007
New Revision: 43115
URL: http://svn.opensuse.org/viewcvs/yast?rev=43115&view=rev
Log:
Adding table items modified so that it does not use
static indexing - exchanging table content (`Items)
then misbehaves (#343870)
Modified:
trunk/ncurses/src/NCTable.cc
Modified: trunk/ncurses/src/NCTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCTable.cc?rev=43115&r1=43114&r2=43115&view=diff
==============================================================================
--- trunk/ncurses/src/NCTable.cc (original)
+++ trunk/ncurses/src/NCTable.cc Mon Dec 17 11:23:44 2007
@@ -179,8 +179,6 @@
void NCTable::addItem( YItem *yitem )
{
- //static counter - to remember last inserted item
- static int idx = 0;
YTableItem *item = dynamic_cast(yitem);
YUI_CHECK_PTR(item);
@@ -197,7 +195,7 @@
}
//Insert @idx
- NCTableLine *newline = new NCTableLine( Items, idx++ );
+ NCTableLine *newline = new NCTableLine( Items, item->index() );
YUI_CHECK_PTR(newline);
newline->setOrigItem( item );
@@ -205,7 +203,7 @@
if (item->selected() )
{
- setCurrentItem( myPad()->Lines() ) ;
+ setCurrentItem( item->index() ) ;
}
//Do not forget to redraw whole stuff at the end
@@ -327,7 +325,7 @@
{
const NCTableLine *cline = myPad()->GetLine( myPad()->CurPos().L );
if ( cline )
- YTable::selectItem( cline->origItem() );
+ selectItem( cline->origItem(), true );
}
///////////////////////////////////////////////////////////////////
@@ -512,13 +510,14 @@
}
}
- selectCurrentItem();
if ( notify() && immediateMode() && citem != getCurrentItem() )
{
ret = NCursesEvent::SelectionChanged;
}
+ selectCurrentItem();
+
return ret;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org