30 #include <tqtooltip.h>
31 #include <tqwhatsthis.h>
34 #include <kaccelbase.h>
35 #include <kaccelprivate.h>
36 #include <kapplication.h>
39 #include <kmainwindow.h>
41 #include <kpopupmenu.h>
43 #include <ktoolbarbutton.h>
46 #include <X11/Xdefs.h>
48 #include <X11/Xatom.h>
49 #include <X11/Intrinsic.h>
50 #include <X11/StringDefs.h>
51 #include <X11/Shell.h>
53 #include <X11/Xft/Xft.h>
78 static int toolbutton_no = -2;
79 return toolbutton_no--;
86 class KAction::KActionPrivate :
public KGuiItem
92 m_configurable =
true;
96 TQValueList<KAccel*> m_kaccelList;
108 Container() { m_container = 0; m_representative = 0; m_id = 0; }
109 Container(
const Container& s ) { m_container = s.m_container;
110 m_id = s.m_id; m_representative = s.m_representative; }
111 TQWidget* m_container;
113 TQWidget* m_representative;
116 TQValueList<Container> m_containers;
124 const TQObject* receiver,
const char* slot,
126 : TQObject( parent, name ), d(new KActionPrivate)
128 initPrivate( text, cut, receiver, slot );
132 const TQObject* receiver,
const char* slot,
134 : TQObject( parent, name ), d(new KActionPrivate)
136 initPrivate( text, cut, receiver, slot );
137 d->setIconName( sIconName );
141 const TQObject* receiver,
const char* slot,
143 : TQObject( parent, name ), d(new KActionPrivate)
145 initPrivate( text, cut, receiver, slot );
146 d->setIconSet( pix );
150 const TQObject* receiver,
const char* slot,
152 : TQObject( parent, name ), d(new KActionPrivate)
154 initPrivate( item.text(), cut, receiver, slot );
156 setIcon( item.iconName() );
161 #ifndef KDE_NO_COMPAT // KDE 4: remove
163 TQObject* parent,
const char* name )
164 : TQObject( parent, name ), d(new KActionPrivate)
166 initPrivate( text, cut, 0, 0 );
170 const TQObject* receiver,
171 const char* slot, TQObject* parent,
const char* name )
172 : TQObject( parent, name ), d(new KActionPrivate)
174 initPrivate( text, cut, receiver, slot );
179 TQObject* parent,
const char* name )
180 : TQObject( parent, name ), d(new KActionPrivate)
182 initPrivate( text, cut, 0, 0 );
188 TQObject* parent,
const char* name )
189 : TQObject( parent, name ), d(new KActionPrivate)
191 initPrivate( text, cut, 0, 0 );
192 d->setIconName( pix );
197 const TQObject* receiver,
const char* slot, TQObject* parent,
199 : TQObject( parent, name ), d(new KActionPrivate)
201 initPrivate( text, cut, receiver, slot );
207 const TQObject* receiver,
const char* slot, TQObject* parent,
209 : TQObject( parent, name ), d(new KActionPrivate)
211 initPrivate( text, cut, receiver, slot );
216 : TQObject( parent, name ), d(new KActionPrivate)
218 initPrivate( TQString::null,
KShortcut(), 0, 0 );
220 #endif // KDE 4: remove end
224 kdDebug(129) <<
"KAction::~KAction( this = \"" << name() <<
"\" )" <<
endl;
225 #ifndef KDE_NO_COMPAT
231 if ( m_parentCollection ) {
232 m_parentCollection->
take(
this );
234 const TQValueList<KAccel*> & accelList = d->m_kaccelList;
235 TQValueList<KAccel*>::const_iterator itr = accelList.constBegin();
236 const TQValueList<KAccel*>::const_iterator itrEnd = accelList.constEnd();
238 const char *
const namePtr = name();
239 for (; itr != itrEnd; ++itr )
240 (*itr)->remove(namePtr);
254 void KAction::initPrivate(
const TQString& text,
const KShortcut& cut,
255 const TQObject* receiver,
const char* slot )
257 d->m_cutDefault = cut;
260 kdDebug(129) <<
"KAction::initPrivate(): this = " <<
this <<
" name = \"" << name() <<
"\" cut = " << cut.toStringInternal() <<
" m_parentCollection = " << m_parentCollection <<
endl;
261 if ( m_parentCollection )
262 m_parentCollection->
insert(
this );
264 if ( receiver && slot )
265 connect(
this, TQT_SIGNAL(
activated() ), receiver, slot );
267 if( !cut.
isNull() && !qstrcmp( name(),
"unnamed" ) )
268 kdWarning(129) <<
"KAction::initPrivate(): trying to assign a shortcut (" << cut.toStringInternal() <<
") to an unnamed action." <<
endl;
275 return (!d->m_containers.empty()) || d->m_kaccel;
280 return findContainer( container ) > -1;
285 int i = findContainer( container );
286 return ( i > -1 && itemId( i ) ==
id );
291 int i = findContainer( container );
292 return ( i > -1 && representative( i ) == _representative );
366 KAccel* KAction::kaccelCurrent()
368 if( m_parentCollection && m_parentCollection->
builderKAccel() )
370 else if( m_parentCollection && m_parentCollection->
kaccel() )
371 return m_parentCollection->
kaccel();
377 bool KAction::initShortcut(
const KShortcut& cut )
382 if( qstrcmp(
name(),
"unnamed" ) &&
383 m_parentCollection &&
385 m_parentCollection->
kaccel() )
387 insertKAccel( m_parentCollection->
kaccel() );
394 void KAction::plugShortcut()
396 KAccel*
const kaccel = kaccelCurrent();
399 if( kaccel && qstrcmp(
name(),
"unnamed" ) ) {
401 const TQValueList<KAccel*> & accelList = d->m_kaccelList;
402 TQValueList<KAccel*>::const_iterator itr = accelList.constBegin();
403 const TQValueList<KAccel*>::const_iterator itrEnd = accelList.constEnd();
405 for( ; itr != itrEnd; ++itr) {
406 if( (*itr) == kaccel )
410 insertKAccel( kaccel );
416 bool bChanged = (d->m_cut != cut);
419 KAccel*
const kaccel = kaccelCurrent();
420 bool bInsertRequired =
true;
423 const TQValueList<KAccel*> & accelList = d->m_kaccelList;
424 TQValueList<KAccel*>::const_iterator itr = accelList.constBegin();
425 const TQValueList<KAccel*>::const_iterator itrEnd = accelList.constEnd();
427 for( ; itr != itrEnd; ++itr) {
430 if( (*itr) == kaccel )
431 bInsertRequired =
false;
433 updateKAccelShortcut( *itr );
437 if( kaccel && bInsertRequired && qstrcmp( name(),
"unnamed" ) )
438 insertKAccel( kaccel );
441 #ifndef KDE_NO_COMPAT // KDE 4: remove
443 d->m_kaccel->setShortcut( name(), cut );
444 #endif // KDE 4: remove end
445 int len = containerCount();
446 for(
int i = 0; i < len; ++i )
452 bool KAction::updateKAccelShortcut(
KAccel* kaccel )
455 if (kapp && !kapp->authorizeKAction(name()))
460 if ( !kaccel->actions().actionPtr( name() ) ) {
461 if(!d->m_cut.isNull() ) {
462 kdDebug(129) <<
"Inserting " << name() <<
", " << d->text() <<
", " << d->plainText() <<
endl;
463 b = kaccel->
insert( name(), d->plainText(), TQString::null,
465 this, TQT_SLOT(slotActivated()),
475 void KAction::insertKAccel(
KAccel* kaccel )
478 if ( !kaccel->actions().actionPtr(
name() ) ) {
479 if( updateKAccelShortcut( kaccel ) ) {
480 d->m_kaccelList.append( kaccel );
481 connect( kaccel, TQT_SIGNAL(destroyed()),
this, TQT_SLOT(slotDestroyed()) );
485 kdWarning(129) <<
"KAction::insertKAccel( kaccel = " << kaccel <<
" ): KAccel object already contains an action name \"" <<
name() <<
"\"" <<
endl;
488 void KAction::removeKAccel(
KAccel* kaccel )
491 TQValueList<KAccel*> & accelList = d->m_kaccelList;
492 TQValueList<KAccel*>::iterator itr = accelList.begin();
493 const TQValueList<KAccel*>::iterator itrEnd = accelList.end();
495 for( ; itr != itrEnd; ++itr) {
496 if( (*itr) == kaccel ) {
498 accelList.remove( itr );
499 disconnect( kaccel, TQT_SIGNAL(destroyed()),
this, TQT_SLOT(slotDestroyed()) );
505 #ifndef KDE_NO_COMPAT
511 #endif // KDE 4: remove end
513 void KAction::updateShortcut(
int i )
515 int id = itemId( i );
517 TQWidget* w = container( i );
518 if ( ::tqqt_cast<TQPopupMenu *>( w ) ) {
519 TQPopupMenu* menu =
static_cast<TQPopupMenu*
>(w);
520 updateShortcut( menu,
id );
522 else if ( ::tqqt_cast<TQMenuBar *>( w ) )
523 static_cast<TQMenuBar*
>(w)->
setAccel( d->m_cut.keyCodeQt(), id );
526 void KAction::updateShortcut( TQPopupMenu* menu,
int id )
531 if ( d->m_kaccel || d->m_kaccelList.count() ) {
532 TQString s = menu->text(
id );
533 int i = s.find(
'\t' );
535 s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() );
537 s +=
"\t" + d->m_cut.seq(0).toString();
539 menu->changeItem(
id, s );
545 menu->setAccel( d->m_cut.keyCodeQt(), id );
546 kdDebug(129) <<
"KAction::updateShortcut(): name = \"" <<
name() <<
"\", cut = " << d->m_cut.toStringInternal() <<
"; No KAccel, probably missing a parent collection." <<
endl;
557 return d->m_cutDefault;
560 TQString KAction::shortcutText()
const
562 return d->m_cut.toStringInternal();
565 void KAction::setShortcutText(
const TQString& s )
570 #ifndef KDE_NO_COMPAT // Remove in KDE 4
573 return d->m_cut.keyCodeQt();
577 void KAction::setGroup(
const TQString& grp )
581 int len = containerCount();
582 for(
int i = 0; i < len; ++i )
586 void KAction::updateGroup(
int )
591 TQString KAction::group()
const
598 return d->isEnabled();
603 return d->m_configurable;
610 int len = containerCount();
611 for(
int i = 0; i < len; ++i )
615 void KAction::updateToolTip(
int i )
617 TQWidget *w = container( i );
619 if ( ::tqqt_cast<KToolBar *>( w ) )
620 TQToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
632 kdWarning(129) <<
"KAction::plug called with 0 argument\n";
640 KAccel* kaccel = kaccelCurrent();
641 if( !d->m_cut.isNull() && !kaccel ) {
642 kdDebug(129) <<
"KAction::plug(): has no KAccel object; this = " <<
this <<
" name = " << name() <<
" parentCollection = " << m_parentCollection <<
endl;
647 if (kapp && !kapp->authorizeKAction(name()))
652 if ( ::tqqt_cast<TQPopupMenu *>( w ) )
654 TQPopupMenu* menu =
static_cast<TQPopupMenu*
>( w );
657 int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt();
662 if ( m_parentCollection )
663 instance = m_parentCollection->
instance();
666 id = menu->insertItem( d->iconSet(
KIcon::Small, 0, instance ), d->text(),
this,
671 id = menu->insertItem( d->text(),
this,
677 if ( d->m_kaccelList.count() || d->m_kaccel )
678 updateShortcut( menu,
id );
682 if ( !d->isEnabled() )
683 menu->setItemEnabled(
id,
false );
685 if ( !d->whatsThis().isEmpty() )
686 menu->TQMenuData::setWhatsThis(
id, whatsThisWithIcon() );
688 addContainer( menu,
id );
689 connect( menu, TQT_SIGNAL( destroyed() ),
this, TQT_SLOT( slotDestroyed() ) );
691 if ( m_parentCollection )
694 return d->m_containers.count() - 1;
696 else if ( ::tqqt_cast<KToolBar *>( w ) )
702 if ( m_parentCollection )
703 instance = m_parentCollection->
instance();
707 if ( icon().isEmpty() && !
iconSet().pixmap().isNull() )
709 bar->
insertButton(
iconSet().pixmap(), id_, TQT_SIGNAL( buttonClicked(
int, TQt::ButtonState) ),
this,
711 d->isEnabled(), d->plainText(), index );
715 TQString icon = d->iconName();
716 if ( icon.isEmpty() )
718 bar->
insertButton( icon, id_, TQT_SIGNAL( buttonClicked(
int, TQt::ButtonState) ),
this,
720 d->isEnabled(), d->plainText(), index, instance );
724 ktb->setName( TQCString(
"toolbutton_")+name() );
726 if ( !d->whatsThis().isEmpty() )
727 TQWhatsThis::add( bar->
getButton(id_), whatsThisWithIcon() );
729 if ( !d->toolTip().isEmpty() )
730 TQToolTip::add( bar->
getButton(id_), d->toolTip() );
732 addContainer( bar, id_ );
734 connect( bar, TQT_SIGNAL( destroyed() ),
this, TQT_SLOT( slotDestroyed() ) );
736 if ( m_parentCollection )
739 return containerCount() - 1;
747 int i = findContainer( w );
750 int id = itemId( i );
752 if ( ::tqqt_cast<TQPopupMenu *>( w ) )
754 TQPopupMenu *menu =
static_cast<TQPopupMenu *
>( w );
755 menu->removeItem(
id );
757 else if ( ::tqqt_cast<KToolBar *>( w ) )
762 else if ( ::tqqt_cast<TQMenuBar *>( w ) )
764 TQMenuBar *bar =
static_cast<TQMenuBar *
>( w );
765 bar->removeItem(
id );
768 removeContainer( i );
769 if ( m_parentCollection )
775 kdWarning(129) <<
"KAction::plugAccel(): call to deprecated action." <<
endl;
787 if ( !kacc->actions().actionPtr(name()) )
790 d->m_kaccel->insert(name(), d->plainText(), TQString::null,
792 this, TQT_SLOT(slotActivated()),
794 connect(d->m_kaccel, TQT_SIGNAL(destroyed()),
this, TQT_SLOT(slotDestroyed()));
798 kdWarning(129) <<
"KAction::plugAccel( kacc = " << kacc <<
" ): KAccel object already contains an action name \"" << name() <<
"\"" <<
endl;
806 d->m_kaccel->remove(name());
811 void KAction::plugMainWindowAccel( TQWidget *w )
816 while ( !tl->isDialog() && ( n = tl->parentWidget() ) )
823 kdDebug(129) <<
"KAction::plugMainWindowAccel: Toplevel widget isn't a KMainWindow, can't plug accel. " << tl <<
endl;
829 if ( enable == d->isEnabled() )
832 #ifndef KDE_NO_COMPAT
835 d->m_kaccel->setEnabled(name(), enable);
836 #endif // KDE 4: remove end
838 const TQValueList<KAccel*> & accelList = d->m_kaccelList;
839 TQValueList<KAccel*>::const_iterator itr = accelList.constBegin();
840 const TQValueList<KAccel*>::const_iterator itrEnd = accelList.constEnd();
842 const char *
const namePtr = name();
844 for ( ; itr != itrEnd; ++itr )
845 (*itr)->setEnabled( namePtr, enable );
847 d->setEnabled( enable );
849 int len = containerCount();
850 for(
int i = 0; i < len; ++i )
853 emit enabled( d->isEnabled() );
856 void KAction::updateEnabled(
int i )
858 TQWidget *w = container( i );
860 if ( ::tqqt_cast<TQPopupMenu *>( w ) )
861 static_cast<TQPopupMenu*
>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
862 else if ( ::tqqt_cast<TQMenuBar *>( w ) )
863 static_cast<TQMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
864 else if ( ::tqqt_cast<KToolBar *>( w ) )
865 static_cast<KToolBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
870 d->m_configurable = b;
875 #ifndef KDE_NO_COMPAT
878 KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name());
880 pAction->setLabel( text );
882 #endif // KDE 4: remove end
883 const TQValueList<KAccel*> & accelList = d->m_kaccelList;
884 TQValueList<KAccel*>::const_iterator itr = accelList.constBegin();
885 const TQValueList<KAccel*>::const_iterator itrEnd = accelList.constEnd();
887 const char *
const namePtr = name();
889 for( ; itr != itrEnd; ++itr ) {
890 KAccelAction*
const pAction = (*itr)->actions().actionPtr(namePtr);
892 pAction->setLabel( text );
897 int len = containerCount();
898 for(
int i = 0; i < len; ++i )
902 void KAction::updateText(
int i )
904 TQWidget *w = container( i );
906 if ( ::tqqt_cast<TQPopupMenu *>( w ) ) {
907 int id = itemId( i );
908 static_cast<TQPopupMenu*
>(w)->changeItem(
id, d->text() );
909 if (!d->m_cut.isNull())
910 updateShortcut( static_cast<TQPopupMenu*>(w), id );
912 else if ( ::tqqt_cast<TQMenuBar *>( w ) )
913 static_cast<TQMenuBar*>(w)->changeItem( itemId( i ), d->text() );
914 else if ( ::tqqt_cast<KToolBar *>( w ) )
916 TQWidget *button =
static_cast<KToolBar *
>(w)->getWidget( itemId( i ) );
917 if ( ::tqqt_cast<KToolBarButton *>( button ) )
918 static_cast<KToolBarButton *>(button)->
setText( d->plainText() );
927 TQString KAction::plainText()
const
929 return d->plainText( );
932 void KAction::setIcon(
const TQString &icon )
934 d->setIconName( icon );
937 int len = containerCount();
938 for (
int i = 0; i < len; ++i )
942 void KAction::updateIcon(
int id )
944 TQWidget* w = container(
id );
946 if ( ::tqqt_cast<TQPopupMenu *>( w ) ) {
947 int itemId_ = itemId(
id );
948 static_cast<TQPopupMenu*
>(w)->changeItem( itemId_, d->iconSet(
KIcon::Small ), d->text() );
949 if (!d->m_cut.isNull())
950 updateShortcut( static_cast<TQPopupMenu*>(w), itemId_ );
952 else if ( ::tqqt_cast<TQMenuBar *>( w ) )
953 static_cast<TQMenuBar*>(w)->changeItem( itemId(
id ), d->iconSet(
KIcon::Small ), d->text() );
954 else if ( ::tqqt_cast<KToolBar *>( w ) )
955 static_cast<KToolBar *>(w)->setButtonIcon( itemId(
id ), d->iconName() );
958 TQString KAction::icon()
const
960 return d->iconName( );
965 d->setIconSet( iconset );
967 int len = containerCount();
968 for(
int i = 0; i < len; ++i )
973 void KAction::updateIconSet(
int id )
975 TQWidget *w = container(
id );
977 if ( ::tqqt_cast<TQPopupMenu *>( w ) )
979 int itemId_ = itemId(
id );
980 static_cast<TQPopupMenu*
>(w)->changeItem( itemId_, d->iconSet(), d->text() );
981 if (!d->m_cut.isNull())
982 updateShortcut( static_cast<TQPopupMenu*>(w), itemId_ );
984 else if ( ::tqqt_cast<TQMenuBar *>( w ) )
985 static_cast<TQMenuBar*>(w)->changeItem( itemId(
id ), d->iconSet(), d->text() );
986 else if ( ::tqqt_cast<KToolBar *>( w ) )
988 if ( icon().isEmpty() && d->hasIcon() )
989 static_cast<KToolBar *>(w)->setButtonIconSet( itemId(
id ), d->iconSet() );
997 return d->iconSet( group, size );
1000 bool KAction::hasIcon()
const
1002 return d->hasIcon();
1007 d->setWhatsThis( text );
1009 int len = containerCount();
1010 for(
int i = 0; i < len; ++i )
1011 updateWhatsThis( i );
1014 void KAction::updateWhatsThis(
int i )
1016 TQPopupMenu* pm = popupMenu( i );
1019 pm->TQMenuData::setWhatsThis( itemId( i ), d->whatsThis() );
1026 TQWidget *w = tb->
getButton( itemId( i ) );
1027 TQWhatsThis::remove( w );
1028 TQWhatsThis::add( w, d->whatsThis() );
1035 return d->whatsThis();
1038 TQString KAction::whatsThisWithIcon()
const
1041 if (!d->iconName().isEmpty())
1042 return TQString::fromLatin1(
"<img source=\"small|%1\"> %2").arg(d->iconName() ).arg(text);
1046 TQWidget* KAction::container(
int index )
const
1048 assert( index < containerCount() );
1049 return d->m_containers[ index ].m_container;
1052 KToolBar* KAction::toolBar(
int index )
const
1054 return tqt_dynamic_cast<
KToolBar *>( d->m_containers[ index ].m_container );
1057 TQPopupMenu* KAction::popupMenu(
int index )
const
1059 return tqt_dynamic_cast<TQPopupMenu *>( d->m_containers[ index ].m_container );
1062 TQWidget* KAction::representative(
int index )
const
1064 return d->m_containers[ index ].m_representative;
1067 int KAction::itemId(
int index )
const
1069 return d->m_containers[ index ].m_id;
1072 int KAction::containerCount()
const
1074 return d->m_containers.count();
1079 return d->m_kaccelList.count();
1082 void KAction::addContainer( TQWidget* c,
int id )
1084 KActionPrivate::Container p;
1087 d->m_containers.append( p );
1090 void KAction::addContainer( TQWidget* c, TQWidget* w )
1092 KActionPrivate::Container p;
1094 p.m_representative = w;
1095 d->m_containers.append( p );
1100 emit
activated( KAction::EmulatedActivation, Qt::NoButton );
1104 void KAction::slotActivated()
1106 const TQObject *senderObj = TQT_TQOBJECT_CONST(sender());
1109 if ( ::tqqt_cast<KAccelPrivate *>( senderObj ) )
1110 emit
activated( KAction::AccelActivation, Qt::NoButton );
1121 if( ::tqqt_cast<TQSignal *>(sender()))
1123 int id = tqt_dynamic_cast<
const TQSignal *>(sender())->value().toInt();
1124 int pos = findContainer(
id);
1127 TQPopupMenu* qpm = tqt_dynamic_cast<TQPopupMenu *>( container(pos) );
1131 TQt::ButtonState state;
1133 state = kpm->
state();
1135 kdDebug(129) <<
"KAction::slotPopupActivated not a KPopupMenu -> using keyboardMouseState()" <<
endl;
1138 emit
activated( KAction::PopupMenuActivation, state );
1145 kdWarning(129)<<
"Don't connect KAction::slotPopupActivated() to anything, expect into QPopupMenus which are in containers. Use slotActivated instead."<<
endl;
1146 emit
activated( KAction::PopupMenuActivation, Qt::NoButton );
1152 kdDebug(129) <<
"slotButtonClicked() state=" << state <<
endl;
1153 emit
activated( KAction::ToolBarActivation, state );
1156 if ( ( state & Qt::LeftButton ) || ( state & Qt::MidButton ) )
1161 void KAction::slotDestroyed()
1163 kdDebug(129) <<
"KAction::slotDestroyed(): this = " <<
this <<
", name = \"" << name() <<
"\", sender = " << sender() <<
endl;
1164 const TQObject*
const o = TQT_TQOBJECT_CONST(sender());
1166 #ifndef KDE_NO_COMPAT // KDE 4: remove
1167 if ( o == d->m_kaccel )
1172 #endif // KDE 4: remove end
1173 TQValueList<KAccel*> & accelList = d->m_kaccelList;
1174 TQValueList<KAccel*>::iterator itr = accelList.begin();
1175 const TQValueList<KAccel*>::iterator itrEnd = accelList.end();
1177 for( ; itr != itrEnd; ++itr)
1181 disconnect( *itr, TQT_SIGNAL(destroyed()),
this, TQT_SLOT(slotDestroyed()) );
1182 accelList.remove(itr);
1190 i = findContainer( TQT_TQWIDGET_CONST( static_cast<const QObject*>(o) ) );
1192 removeContainer( i );
1193 }
while ( i != -1 );
1196 int KAction::findContainer(
const TQWidget* widget )
const
1200 const TQValueList<KActionPrivate::Container> & containers = d->m_containers;
1202 TQValueList<KActionPrivate::Container>::ConstIterator it = containers.constBegin();
1203 const TQValueList<KActionPrivate::Container>::ConstIterator itEnd = containers.constEnd();
1205 while( it != itEnd )
1207 if ( (*it).m_representative == widget || (*it).m_container == widget )
1216 int KAction::findContainer(
const int id )
const
1220 const TQValueList<KActionPrivate::Container> & containers = d->m_containers;
1222 TQValueList<KActionPrivate::Container>::ConstIterator it = containers.constBegin();
1223 const TQValueList<KActionPrivate::Container>::ConstIterator itEnd = containers.constEnd();
1225 while( it != itEnd )
1227 if ( (*it).m_id ==
id )
1236 void KAction::removeContainer(
int index )
1240 TQValueList<KActionPrivate::Container> & containers = d->m_containers;
1242 TQValueList<KActionPrivate::Container>::Iterator it = containers.begin();
1243 const TQValueList<KActionPrivate::Container>::Iterator itEnd = containers.end();
1245 while( it != itEnd )
1249 containers.remove( it );
1258 void KAction::slotKeycodeChanged()
1260 kdDebug(129) <<
"KAction::slotKeycodeChanged()" <<
endl;
1261 KAccelAction* pAction = d->m_kaccel->actions().actionPtr(
name());
1268 return m_parentCollection;
1271 void KAction::unplugAll()
1273 while ( containerCount() != 0 )
1274 unplug( container( 0 ) );
1282 void KAction::virtual_hook(
int,
void* )
1288 #include "kaction.moc"