-
-bool QtxMRUAction::addTo( QWidget* wid )
-{
- if ( !wid || !wid->inherits( "QPopupMenu" ) )
- return false;
-
- QPopupMenu* pm = (QPopupMenu*)wid;
- checkPopup( pm );
-
- int mode = popupMode();
-
- if ( ( mode == Items && myItems.contains( pm ) ) ||
- ( mode == SubMenu && myMenus.contains( pm ) ) )
- return false;
-
- bool exist = myItems.contains( pm ) || myMenus.contains( pm );
-
- if ( mode == SubMenu && !QtxAction::addTo( wid ) )
- return false;
-
- if ( mode == Items )
- {
- myItems.insert( pm, Item() );
- myItems[pm].pId = myItems[pm].nId -1;
- connect( pm, SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) );
- }
- else if ( mode == SubMenu )
- {
- myMenus.insert( pm, new QPopupMenu( pm ) );
- setPopup( pm, pm->idAt( pm->count() - 1 ), myMenus[pm] );
- connect( myMenus[pm], SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) );
- }
-
- if ( !exist )
- {
- connect( pm, SIGNAL( aboutToShow() ), this, SLOT( onAboutToShow() ) );
- connect( pm, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
- }
-
- return insertLinks( pm, mode );
-}
-
-/*!
- Name: addTo [public]
- Desc: Add the MRU links to the specified popup at given index according to the popup mode.
-*/
-
-bool QtxMRUAction::addTo( QWidget* wid, const int idx )
-{
- if ( !QtxAction::addTo( wid, idx ) )
- return false;
-
- QPopupMenu* pm = (QPopupMenu*)wid;
-
- removeLinks( pm, popupMode() );
- insertLinks( pm, popupMode(), idx );
-
- return true;
-}
-
-/*!
- Name: removeFrom [public]
- Desc: Removes all MRU links from specified popup.
-*/
-
-bool QtxMRUAction::removeFrom( QWidget* wid )
-{
- QtxAction::removeFrom( wid );
-
- QPopupMenu* pm = (QPopupMenu*)wid;
- if ( !wid || !wid->inherits( "QPopupMenu" ) )
- return false;
-
- if ( myItems.contains( pm ) )
- {
- removeLinks( pm, Items );
- myItems.remove( pm );
- disconnect( pm, SIGNAL( activated( int ) ), this, SLOT( onActivated( int ) ) );
- }
- if ( myMenus.contains( pm ) )
- {
- removeLinks( pm, SubMenu );
- delete myMenus[pm];
- myMenus.remove( pm );
- }
-
- disconnect( pm, SIGNAL( aboutToShow() ), this, SLOT( onAboutToShow() ) );
- disconnect( pm, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
-
- return true;
-}
-
-/*!
- Name: loadLinks [public]
- Desc: Load the MRU links from specified resource manager section.
- If parameter 'clear' is 'true' then link list will be cleared first.
-*/
-