- restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey );
-
- autoOpenBranches();
-
- if ( selNum != numberOfSelected() )
- emit selectionChanged();
-}
-
-void OB_Browser::replaceTree( SUIT_DataObject* src, SUIT_DataObject* trg )
-{
- if ( !src || !trg || src->root() != getRootObject() )
- return;
-
- DataObjectKey curKey;
- DataObjectMap selObjs, openObjs;
- DataObjectKeyMap selKeys, openKeys;
-
- int selNum = numberOfSelected();
-
- SUIT_DataObject* curObj = storeState( selObjs, openObjs, selKeys, openKeys, curKey );
-
- SUIT_DataObject* parent = src->parent();
- int pos = parent ? parent->childPos( src ) : -1;
-
- src->setParent( 0 );
-
- if ( src != trg && isAutoDeleteObjects() )
- delete src;
-
- if ( parent && pos != -1 )
- parent->insertChild( trg, pos );
-
- trg->setParent( parent );
-
- createConnections( trg );
- updateView( trg );
-
- restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey );
-
- autoOpenBranches();
-
- if ( selNum != numberOfSelected() )
- emit selectionChanged();
-}
-
-void OB_Browser::updateView( const SUIT_DataObject* theStartObj )
-{
- QListView* lv = listView();
- if ( !lv )
- return;
-
- if ( !theStartObj || theStartObj->root() != getRootObject() )
- return;
-
- QListViewItem* after = 0;
- QListViewItem* parent = 0;
- QListViewItem* startItem = listViewItem( theStartObj );
-
- if ( theStartObj->parent() )
- parent = listViewItem( theStartObj->parent() );
-
- QListViewItem* prv = 0;
- QListViewItem* cur = parent ? parent->firstChild() : lv->firstChild();
- while ( !after && cur )
- {
- if ( cur == startItem )
- after = prv;
-
- prv = cur;
- cur = cur->nextSibling();
- }
-
- QPtrList<QListViewItem> delList;
- if ( !startItem && theStartObj == getRootObject() )
- {
- for ( QListViewItem* item = lv->firstChild(); item; item = item->nextSibling() )
- delList.append( item );
- }
- else
- delList.append( startItem );
-
- for ( QPtrListIterator<QListViewItem> it( delList ); it.current(); ++it )
- {
- removeReferences( it.current() );
- delete it.current();
- }