- QPopupMenu* popup = (QPopupMenu*)w;
- if ( index < (int)popup->count() - 1 )
- {
- int id = popup->idAt( popup->count() - 1 );
- if ( id != -1 )
- {
- QMenuItem* item = popup->findItem( id );
- if ( item && item->isSeparator() )
- {
- popup->removeItem( id );
- popup->insertSeparator( index );
- }
- else
- {
- QPopupMenu* p = item ? item->popup() : 0;
- int accel = popup->accel( id );
- bool isOn = popup->isItemEnabled( id );
- QString text = popup->text( id );
- QIconSet icon;
- if ( popup->iconSet( id ) )
- icon = *popup->iconSet( id );
- popup->removeItem( id );
- int pos;
- if ( icon.isNull() )
- if ( p )
- pos = popup->indexOf( popup->insertItem( text, p, id, index ) );
- else
- pos = popup->indexOf( popup->insertItem( text, id, index ) );
- else
- if ( p )
- pos = popup->indexOf( popup->insertItem( icon, text, p, id, index ) );
- else
- pos = popup->indexOf( popup->insertItem( icon, text, p, id, index ) );
- popup->setId( pos, id );
- popup->setAccel( accel, id );
- popup->setItemEnabled( id, isOn );
- if ( !p )
- popup->connectItem( id, this, SLOT( internalActivation() ) );
- }
- }
- }
+ if ( e->type() == QEvent::ActionAdded && ((QActionEvent*)e)->action() == this )
+ QApplication::postEvent( this, new ActionNotify( true, (QWidget*)o ) );
+ if ( e->type() == QEvent::ActionRemoved && ((QActionEvent*)e)->action() == this )
+ QApplication::postEvent( this, new ActionNotify( false, (QWidget*)o ) );