![](https://seccdn.libravatar.org/avatar/d95f774280866d45941b1365718208ff.jpg?s=120&d=mm&r=g)
Author: kmachalkova Date: Mon Oct 15 18:19:47 2007 New Revision: 41440 URL: http://svn.opensuse.org/viewcvs/yast?rev=41440&view=rev Log: - Do not add combobox entries twice - Fixed selecting entries - Removed mostly obsoleted stuff (getValue, setValue) - setInputMaxLength adapted Modified: branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.h branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui Modified: branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc?rev=41440&r1=41439&r2=41440&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.cc Mon Oct 15 18:19:47 2007 @@ -48,7 +48,7 @@ WIDDBG << endl; setLabel( nlabel ); hotlabel = &label; - setValue( "" ); + setText( "" ); } /////////////////////////////////////////////////////////////////// @@ -161,19 +161,6 @@ NCWidget::wDelete(); } -#if 0 -void NCComboBox::itemAdded( const YCPString & ntext, - int idx, - bool selected ) -{ - deflist.push_back( ntext ); - if ( selected || index == -1 ) { - setValue( ntext ); - index = idx; - } -} -#endif - /////////////////////////////////////////////////////////////////// // // @@ -191,7 +178,7 @@ deflist.push_back( item->label() ); if ( item->selected() || index == -1 ) { - setValue( item->label() ); + setText( item->label() ); index = item->index(); } } @@ -213,7 +200,7 @@ deflist.push_back( label ); if ( selected || index == -1 ) { - setValue( label ); + setText( label ); index = item->index(); } } @@ -253,7 +240,7 @@ string::size_type h = strip.find( '&' ); if ( h != string::npos ) strip.erase( h, 1 ); - setValue( strip ); + setText( strip ); index = idx; break; } @@ -275,26 +262,6 @@ return index; } -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : NCComboBox::setValue -// METHOD TYPE : void -// -// DESCRIPTION : -// -void NCComboBox::setValue( const string & ntext ) -{ - privText = NCstring( ntext ); - buffer = privText.str(); - modified = false; - fldstart = 0; - curpos = mayedit ? buffer.length() : 0; - index = -1; - setDefsze(); - tUpdate(); - Redraw(); -} /////////////////////////////////////////////////////////////////// // @@ -317,33 +284,6 @@ Redraw(); } -#if 0 -/////////////////////////////////////////////////////////////////// -// -// -// METHOD NAME : NCComboBox::getValue -// METHOD TYPE : YCPString -// -// DESCRIPTION : -// -YCPString NCComboBox::getValue() const -{ - if ( modified ) - return NCstring( buffer ).YCPstr(); - - if ( index != -1 ) { - int idx = 0; - list<YCPString>::const_iterator entry; - for ( entry = deflist.begin(); entry != deflist.end(); ++entry, ++idx ) { - if ( idx == index ) { - return *entry; - } - } - } - - return text.YCPstr(); -} -#endif string NCComboBox::text() { @@ -668,8 +608,6 @@ if (!deflist.empty()) { wpos at( ScreenPos() + wpos( win->height(), -1 ) ); NCPopupList * dialog = new NCPopupList( at, "", deflist, index ); - dialog->createEntries( deflist, index ); - dialog->dumpWidgetTree(); int idx = dialog->post(); if ( idx != -1 ) setCurrentItem( idx ); @@ -691,14 +629,12 @@ void NCComboBox::deleteAllItems() { YComboBox::deleteAllItems(); deflist.clear(); - setValue( "" ); + setText( "" ); } -void NCComboBox::setInputMaxLength( const YCPInteger & numberOfChars) +void NCComboBox::setInputMaxLength( int nr) { - int nr = numberOfChars->asInteger()->value(); - // if there is more text then the maximum number of chars, // truncate the text and update the buffer if ( nr >= 0 && (int)buffer.length() > nr ) { Modified: branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.h?rev=41440&r1=41439&r2=41440&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.h (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCComboBox.h Mon Oct 15 18:19:47 2007 @@ -60,7 +60,7 @@ NCstring validChars; list<string> deflist; - int index; + int index; void setDefsze(); void tUpdate(); @@ -109,12 +109,6 @@ virtual void setLabel( const string & nlabel ); - // FIXME - internally used? move to private? or obsolete? same as setText() ? - virtual void setValue( const string & ntext ); -#if 0 - virtual YCPString getValue() const; -#endif - virtual void setText( const string & ntext ); virtual string text(); @@ -139,7 +133,7 @@ // limits the input to numberOfChars characters and truncates the text // if appropriate - void setInputMaxLength( const YCPInteger & numberOfChars); + void setInputMaxLength( int nr ); }; Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc?rev=41440&r1=41439&r2=41440&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupList.cc Mon Oct 15 18:19:47 2007 @@ -61,7 +61,6 @@ createList( row ); for ( list<string>::const_iterator entry = deflist.begin(); entry != deflist.end(); ++entry ) { - //row[0] = (*entry); YItem *item = new YTableItem( (*entry )); addItem( item ); } Modified: branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc?rev=41440&r1=41439&r2=41440&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc (original) +++ branches/tmp/sh/mod-ui/ncurses/src/NCPopupTable.cc Mon Oct 15 18:19:47 2007 @@ -68,8 +68,6 @@ sellist->SetHotCol( 0 ); sellist->setNotify( true ); - currentDialog()->dumpWidgetTree(); - } /////////////////////////////////////////////////////////////////// Modified: branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui?rev=41440&r1=41439&r2=41440&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui (original) +++ branches/tmp/sh/mod-ui/ncurses/src/README_mod-ui Mon Oct 15 18:19:47 2007 @@ -41,11 +41,6 @@ This leads to segfault when widgets are deleted from YUI at the end! call YDialog::deleteTopmostDialog(); to delete NCPopupList -FIXME: entries are added twice -> see FileSelection examples - check setValue() (not used ???) -TODO: Do something with adding items into NCPopupList, so that -they can be read back. - NCPopupMenu/NCMenuButton ------------------------- -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org