From fd9ac403280eeba62af36a7f33351d59bf22af2f Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 25 Nov 2005 12:44:08 +0000 Subject: [PATCH] PAL10660 - regression in popup menu: many items are absent --- src/LightApp/LightApp_Selection.cxx | 47 +++++++++++++++++------------ 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/LightApp/LightApp_Selection.cxx b/src/LightApp/LightApp_Selection.cxx index b0bb01c36..4c43e644d 100644 --- a/src/LightApp/LightApp_Selection.cxx +++ b/src/LightApp/LightApp_Selection.cxx @@ -25,38 +25,47 @@ LightApp_Selection::~LightApp_Selection() } /*! - Initializetion. + Initialization. */ void LightApp_Selection::init( const QString& client, LightApp_SelectionMgr* mgr) { myPopupClient = client; + myStudy = 0; if( mgr ) { - if ( mgr->application() ) + if( mgr->application() ) myStudy = dynamic_cast( mgr->application()->activeStudy() ); - if ( !myStudy ) + if( !myStudy ) return; - SUIT_DataOwnerPtrList sel( false ); - //asl: fix for PAL10471 - //mgr->selected( sel, client ); - mgr->selected( sel ); - SUIT_DataOwnerPtrList::const_iterator anIt = sel.begin(), aLast = sel.end(); + //1) to take owners from current popup client + SUIT_DataOwnerPtrList sel( true ), cur_sel( true ); + mgr->selected( sel, client ); + + //2) to take such owners from other popup clients that it's entry is different with every entry from current list + QPtrList aSelectors; + mgr->selectors( aSelectors ); + for( SUIT_Selector* selector = aSelectors.first(); selector; selector = aSelectors.next() ) + if( selector->type()!=client ) + { + mgr->selected( cur_sel, selector->type() ); + SUIT_DataOwnerPtrList::const_iterator aLIt = cur_sel.begin(), aLLast = cur_sel.end(); + for( ; aLIt!=aLLast; aLIt++ ) + sel.append( *aLIt ); //check entry and don't append if such entry is in list already + } - QString entry, curEntry; + //3) to analyse owner and fill internal data structures + SUIT_DataOwnerPtrList::const_iterator anIt = sel.begin(), aLast = sel.end(); + QString entry; for( ; anIt!=aLast; anIt++ ) { - SUIT_DataOwner* owner = ( SUIT_DataOwner* )( (*anIt ).get() ); - LightApp_DataOwner* sowner = dynamic_cast( owner ); - if( sowner ) { - curEntry = sowner->entry(); - entry = myStudy->referencedToEntry( curEntry ); + LightApp_DataOwner* sowner = dynamic_cast( (*anIt ).get() ); + if( sowner ) + { + entry = myStudy->referencedToEntry( sowner->entry() ); myEntries.append( entry ); - if ( curEntry == entry ) - myIsReferences.append( true ); - else - myIsReferences.append( false ); + myIsReferences.append( sowner->entry() == entry ); processOwner( sowner ); } } @@ -120,7 +129,7 @@ QtxValue LightApp_Selection::globalParam( const QString& p ) const } /*! - Do nothing. + Do nothing. To be redefined by successors */ void LightApp_Selection::processOwner( const LightApp_DataOwner* ) { -- 2.39.2