Mailinglist Archive: yast-commit (503 mails)
| < Previous | Next > |
[yast-commit] r41077 - /branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
- From: sh-sh-sh@xxxxxxxxxxxxxxxx
- Date: Tue, 25 Sep 2007 10:06:36 -0000
- Message-id: <20070925100636.EA77723EAF@xxxxxxxxxxxxxxxx>
Author: sh-sh-sh
Date: Tue Sep 25 12:06:36 2007
New Revision: 41077
URL: http://svn.opensuse.org/viewcvs/yast?rev=41077&view=rev
Log:
removed cruft
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc?rev=41077&r1=41076&r2=41077&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc Tue Sep 25 12:06:36 2007
@@ -133,229 +133,3 @@
macroRecorder->recordWidgetProperty( this, YUIProperty_CurrentItem );
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#if 0
-
-YCPValue
-YTree::changeWidget( const YCPSymbol & property, const YCPValue & newvalue )
-{
- string s = property->symbol();
-
- /*
- * @property string Label the label above the Tree
- */
- if ( s == YUIProperty_Label )
- {
- if ( newvalue->isString() )
- {
- setLabel( newvalue->asString() );
- return YCPBoolean( true );
- }
- else
- {
- y2error( "Tree: Invalid parameter %s for Label property - must be string.",
- newvalue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
-
- /*
- * @property itemId CurrentItem the currently selected item
- * Alias: Value
- */
- else if ( s == YUIProperty_CurrentItem ||
- s == YUIProperty_Value )
- {
- YTreeItem *it = findItemWithId ( newvalue );
-
- // Let user also pass a string of the item text instead of an id...
- if ( ! it && newvalue->isString() )
- it = findItemWithText ( newvalue->asString() );
-
- if ( it )
- {
- setCurrentItem ( it );
- return YCPBoolean( true );
-
- }
- else // no such item found
- {
- y2error( "Tree: No item %s existing", newvalue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
-
- /**
- * @property YTreeItem list Items
- * The items that are displayed
- */
- else if ( s == YUIProperty_Items )
- {
- if ( newvalue->isList() )
- {
- deleteAllItems();
- YCPList itemlist = newvalue->asList();
-
- if ( ! parseItemList( itemlist ) )
- {
- y2error ("%s: Error parsing item list", widgetClass() );
- return YCPBoolean( false );
- }
- rebuildTree();
- }
- return YCPBoolean( true );
- }
- else
- {
- return YWidget::changeWidget( property, newvalue );
- }
-}
-
-
-
-YCPValue YTree::queryWidget( const YCPSymbol & property )
-{
- string s = property->symbol();
-
- if ( s == YUIProperty_Label )
- {
- return getLabel();
- }
- else if ( s == YUIProperty_CurrentItem ||
- s == YUIProperty_Value )
- {
- const YTreeItem * item = getCurrentItem();
-
- if ( item )
- return item->hasId() ? item->id() : item->label();
- else
- return YCPVoid();
- }
- else if ( s == YUIProperty_Items )
- {
- return itemsTermList( items );
- }
- /*
- * @property OpenItems a map of open items - can only be queried, not set
- */
- else if ( s == YUIProperty_OpenItems )
- {
- YCPMap openItems;
- findOpenItems( openItems, items );
-
- return openItems;
- }
- /*
- * @property CurrentBranch a list of the current item and all its ancestors
- * from the root item to the current item- either the respective IDs or,
- * for items that don't have IDs, the item text. If no item is currently
- * selected, 'nil' is returned.
- *
- * This property can only be queried, not set.
- */
- else if ( s == YUIProperty_CurrentBranch )
- {
- return currentBranch();
- }
- else
- return YWidget::queryWidget( property );
-
- return YCPVoid();
-}
-
-
-
-YCPValue YTree::currentBranch() const
-{
- const YTreeItem *current = getCurrentItem();
-
- if ( ! current )
- return YCPVoid();
-
- YCPList branchList;
- branchToList( branchList, current );
-
- return branchList;
-}
-
-
-
-void YTree::branchToList( YCPList & branchList, const YTreeItem * item )
-{
- if ( item )
- {
- if ( item->parent() )
- {
- branchToList( branchList, item->parent() );
- }
-
- branchList->add( item->hasId() ? item->id() : item->label() )
- }
-}
-
-
-
-void YTree::findOpenItems( YCPMap & openItems, YTreeItemList items )
-{
- for ( YTreeItemListIterator it = items.begin();
- it != items.end();
- ++it )
- {
- YTreeItem * item = *it;
-
- if ( item->isOpen() )
- {
- YCPValue id = item->getId();
-
- if ( id.isNull() )
- openItems->add( item->getText(), YCPString( "Text" ) );
- else
- openItems->add( id, YCPString( "ID" ) );
-
- findOpenItems( openItems, item->itemList() );
- }
- }
-}
-
-
-
-YTreeItem *
-YTree::findItemWithId( const YCPValue & id )
-{
- for ( unsigned i=0; i < items.size(); i++ )
- {
- YTreeItem *it = items[i]->findItemWithId ( id );
-
- if ( it )
- return it;
- }
-
- return ( YTreeItem * ) 0;
-}
-
-
-
-
-#endif
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Tue Sep 25 12:06:36 2007
New Revision: 41077
URL: http://svn.opensuse.org/viewcvs/yast?rev=41077&view=rev
Log:
removed cruft
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc?rev=41077&r1=41076&r2=41077&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YTree.cc Tue Sep 25 12:06:36 2007
@@ -133,229 +133,3 @@
macroRecorder->recordWidgetProperty( this, YUIProperty_CurrentItem );
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#if 0
-
-YCPValue
-YTree::changeWidget( const YCPSymbol & property, const YCPValue & newvalue )
-{
- string s = property->symbol();
-
- /*
- * @property string Label the label above the Tree
- */
- if ( s == YUIProperty_Label )
- {
- if ( newvalue->isString() )
- {
- setLabel( newvalue->asString() );
- return YCPBoolean( true );
- }
- else
- {
- y2error( "Tree: Invalid parameter %s for Label property - must be string.",
- newvalue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
-
- /*
- * @property itemId CurrentItem the currently selected item
- * Alias: Value
- */
- else if ( s == YUIProperty_CurrentItem ||
- s == YUIProperty_Value )
- {
- YTreeItem *it = findItemWithId ( newvalue );
-
- // Let user also pass a string of the item text instead of an id...
- if ( ! it && newvalue->isString() )
- it = findItemWithText ( newvalue->asString() );
-
- if ( it )
- {
- setCurrentItem ( it );
- return YCPBoolean( true );
-
- }
- else // no such item found
- {
- y2error( "Tree: No item %s existing", newvalue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
-
- /**
- * @property YTreeItem list Items
- * The items that are displayed
- */
- else if ( s == YUIProperty_Items )
- {
- if ( newvalue->isList() )
- {
- deleteAllItems();
- YCPList itemlist = newvalue->asList();
-
- if ( ! parseItemList( itemlist ) )
- {
- y2error ("%s: Error parsing item list", widgetClass() );
- return YCPBoolean( false );
- }
- rebuildTree();
- }
- return YCPBoolean( true );
- }
- else
- {
- return YWidget::changeWidget( property, newvalue );
- }
-}
-
-
-
-YCPValue YTree::queryWidget( const YCPSymbol & property )
-{
- string s = property->symbol();
-
- if ( s == YUIProperty_Label )
- {
- return getLabel();
- }
- else if ( s == YUIProperty_CurrentItem ||
- s == YUIProperty_Value )
- {
- const YTreeItem * item = getCurrentItem();
-
- if ( item )
- return item->hasId() ? item->id() : item->label();
- else
- return YCPVoid();
- }
- else if ( s == YUIProperty_Items )
- {
- return itemsTermList( items );
- }
- /*
- * @property OpenItems a map of open items - can only be queried, not set
- */
- else if ( s == YUIProperty_OpenItems )
- {
- YCPMap openItems;
- findOpenItems( openItems, items );
-
- return openItems;
- }
- /*
- * @property CurrentBranch a list of the current item and all its ancestors
- * from the root item to the current item- either the respective IDs or,
- * for items that don't have IDs, the item text. If no item is currently
- * selected, 'nil' is returned.
- *
- * This property can only be queried, not set.
- */
- else if ( s == YUIProperty_CurrentBranch )
- {
- return currentBranch();
- }
- else
- return YWidget::queryWidget( property );
-
- return YCPVoid();
-}
-
-
-
-YCPValue YTree::currentBranch() const
-{
- const YTreeItem *current = getCurrentItem();
-
- if ( ! current )
- return YCPVoid();
-
- YCPList branchList;
- branchToList( branchList, current );
-
- return branchList;
-}
-
-
-
-void YTree::branchToList( YCPList & branchList, const YTreeItem * item )
-{
- if ( item )
- {
- if ( item->parent() )
- {
- branchToList( branchList, item->parent() );
- }
-
- branchList->add( item->hasId() ? item->id() : item->label() )
- }
-}
-
-
-
-void YTree::findOpenItems( YCPMap & openItems, YTreeItemList items )
-{
- for ( YTreeItemListIterator it = items.begin();
- it != items.end();
- ++it )
- {
- YTreeItem * item = *it;
-
- if ( item->isOpen() )
- {
- YCPValue id = item->getId();
-
- if ( id.isNull() )
- openItems->add( item->getText(), YCPString( "Text" ) );
- else
- openItems->add( id, YCPString( "ID" ) );
-
- findOpenItems( openItems, item->itemList() );
- }
- }
-}
-
-
-
-YTreeItem *
-YTree::findItemWithId( const YCPValue & id )
-{
- for ( unsigned i=0; i < items.size(); i++ )
- {
- YTreeItem *it = items[i]->findItemWithId ( id );
-
- if ( it )
- return it;
- }
-
- return ( YTreeItem * ) 0;
-}
-
-
-
-
-#endif
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |