[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Tue May 25 21:33:13 UTC 2004


CVS commit by okellogg: 

findItem(int id): New.


  M +15 -6     umllistviewitem.cpp   1.40
  M +10 -0     umllistviewitem.h   1.12


--- kdesdk/umbrello/umbrello/umllistviewitem.cpp  #1.39:1.40
@@ -145,5 +145,5 @@ void UMLListViewItem::updateObject() {
 
         Uml::Scope scope = m_pObject->getScope();
-        setText( m_pObject->getName() );
+        //setText( m_pObject->getName() );
 
         switch( m_pObject->getBaseType() ) {
@@ -443,17 +443,26 @@ UMLListViewItem* UMLListViewItem::findUM
 }
 
+UMLListViewItem * UMLListViewItem::findItem(int id) {
+        if (getID() == id)
+                return this;
+        UMLListViewItem *childItem = static_cast<UMLListViewItem*>(firstChild());
+        while (childItem) {
+                UMLListViewItem *inner = childItem->findItem(id);
+                if (inner)
+                        return inner;
+                childItem = static_cast<UMLListViewItem*>(childItem->nextSibling());
+        }
+        return NULL;
+}
+
 void UMLListViewItem::saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) {
         QDomElement itemElement = qDoc.createElement( "listitem" );
         itemElement.setAttribute( "id", getID() );
         itemElement.setAttribute( "type", m_Type );
-        /* UNDER CONSTRUCTION: Activate when the restoring of attribute/
-           operation names in the listview is possible using just the
-           model object loading mechanism.
         if (m_pObject == NULL) {
                 kdDebug() << "UMLListViewItem::saveToXMI: saving local label "
                           << m_Label << " because m_pObject is NULL" << endl;
-         *********************/
                 itemElement.setAttribute( "label", m_Label );
-        //******************** }
+        }
         itemElement.setAttribute( "open", isOpen() );
         UMLListViewItem * childItem = static_cast<UMLListViewItem *> ( firstChild() );

--- kdesdk/umbrello/umbrello/umllistviewitem.h  #1.11:1.12
@@ -185,4 +185,14 @@ public:
 
         /**
+         * Find the UMLListViewItem of the given ID in the tree rooted at
+         * the current UMLListViewItem.
+         * Return a pointer to the item or NULL if not found.
+         *
+         * @param id            The ID to search for.
+         * @return      The item with the given ID or NULL if not found.
+         */
+        UMLListViewItem * findItem(int id);
+
+        /**
          * saves the listview item to a <listitem> tag
          */






More information about the umbrello-devel mailing list