summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/kaction.cpp
Unidiff
Diffstat (limited to 'microkde/kdeui/kaction.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kaction.cpp75
1 files changed, 39 insertions, 36 deletions
diff --git a/microkde/kdeui/kaction.cpp b/microkde/kdeui/kaction.cpp
index d38a6d5..c2df381 100644
--- a/microkde/kdeui/kaction.cpp
+++ b/microkde/kdeui/kaction.cpp
@@ -28,6 +28,9 @@
28#include <assert.h> 28#include <assert.h>
29 29
30#include <qtooltip.h> 30#include <qtooltip.h>
31//Added by qt3to4:
32#include <Q3CString>
33#include <Q3ValueList>
31//US#include <qwhatsthis.h> 34//US#include <qwhatsthis.h>
32//US#include <kaccel.h> 35//US#include <kaccel.h>
33//US#include <kaccelbase.h> 36//US#include <kaccelbase.h>
@@ -42,9 +45,9 @@
42 45
43//US added this includefiles 46//US added this includefiles
44#include <qmenubar.h> 47#include <qmenubar.h>
45#include <qtoolbar.h> 48#include <q3toolbar.h>
46#include <qpopupmenu.h> 49#include <q3popupmenu.h>
47#include <qiconset.h> 50#include <qicon.h>
48 51
49/** 52/**
50* How it works. 53* How it works.
@@ -87,7 +90,7 @@ public:
87 } 90 }
88 91
89 KAccel *m_kaccel; 92 KAccel *m_kaccel;
90 QValueList<KAccel*> m_kaccelList; 93 Q3ValueList<KAccel*> m_kaccelList;
91 94
92 QString m_groupText; 95 QString m_groupText;
93 QString m_group; 96 QString m_group;
@@ -107,7 +110,7 @@ public:
107 QWidget* m_representative; 110 QWidget* m_representative;
108 }; 111 };
109 112
110 QValueList<Container> m_containers; 113 Q3ValueList<Container> m_containers;
111}; 114};
112 115
113//--------------------------------------------------------------------- 116//---------------------------------------------------------------------
@@ -130,7 +133,7 @@ KAction::KAction( const QString& text, const QString& sIconName, const KShortcut
130 d->setIconName( sIconName ); 133 d->setIconName( sIconName );
131} 134}
132 135
133KAction::KAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 136KAction::KAction( const QString& text, const QIcon& pix, const KShortcut& cut,
134 const QObject* receiver, const char* slot, 137 const QObject* receiver, const char* slot,
135 KActionCollection* parent, const char* name ) 138 KActionCollection* parent, const char* name )
136: QObject( parent, name ) 139: QObject( parent, name )
@@ -164,7 +167,7 @@ KAction::KAction( const QString& text, const KShortcut& cut,
164{ 167{
165 initPrivate( text, cut, receiver, slot ); 168 initPrivate( text, cut, receiver, slot );
166} 169}
167KAction::KAction( const QString& text, const QIconSet& pix, 170KAction::KAction( const QString& text, const QIcon& pix,
168 const KShortcut& cut, 171 const KShortcut& cut,
169 QObject* parent, const char* name ) 172 QObject* parent, const char* name )
170 : QObject( parent, name ) 173 : QObject( parent, name )
@@ -182,7 +185,7 @@ KAction::KAction( const QString& text, const QString& pix,
182 d->setIconName( pix ); 185 d->setIconName( pix );
183} 186}
184 187
185KAction::KAction( const QString& text, const QIconSet& pix, 188KAction::KAction( const QString& text, const QIcon& pix,
186 const KShortcut& cut, 189 const KShortcut& cut,
187 const QObject* receiver, const char* slot, QObject* parent, 190 const QObject* receiver, const char* slot, QObject* parent,
188 const char* name ) 191 const char* name )
@@ -506,8 +509,8 @@ void KAction::updateShortcut( int i )
506 int id = itemId( i ); 509 int id = itemId( i );
507 510
508 QWidget* w = container( i ); 511 QWidget* w = container( i );
509 if ( w->inherits( "QPopupMenu" ) ) { 512 if ( w->inherits( "Q3PopupMenu" ) ) {
510 QPopupMenu* menu = static_cast<QPopupMenu*>(w); 513 Q3PopupMenu* menu = static_cast<Q3PopupMenu*>(w);
511 updateShortcut( menu, id ); 514 updateShortcut( menu, id );
512 } 515 }
513 else if ( w->inherits( "QMenuBar" ) ) 516 else if ( w->inherits( "QMenuBar" ) )
@@ -518,7 +521,7 @@ void KAction::updateShortcut( int i )
518 521
519} 522}
520 523
521void KAction::updateShortcut( QPopupMenu* menu, int id ) 524void KAction::updateShortcut( Q3PopupMenu* menu, int id )
522{ 525{
523/*US 526/*US
524 //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl; 527 //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl;
@@ -621,7 +624,7 @@ void KAction::updateToolTip( int i )
621 624
622 if ( w->inherits( "KToolBar" ) ) 625 if ( w->inherits( "KToolBar" ) )
623 QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); 626 QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
624 else if ( w->inherits( "QToolBar" ) ) 627 else if ( w->inherits( "Q3ToolBar" ) )
625 QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); 628 QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
626} 629}
627 630
@@ -646,9 +649,9 @@ int KAction::plug( QWidget *w, int index )
646 649
647 plugShortcut(); 650 plugShortcut();
648 651
649 if ( w->inherits("QPopupMenu") ) 652 if ( w->inherits("Q3PopupMenu") )
650 { 653 {
651 QPopupMenu* menu = static_cast<QPopupMenu*>( w ); 654 Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( w );
652 int id; 655 int id;
653 // Don't insert shortcut into menu if it's already in a KAccel object. 656 // Don't insert shortcut into menu if it's already in a KAccel object.
654 //qDebug("KAction::plug warning: real shortcuts not available yet. "); 657 //qDebug("KAction::plug warning: real shortcuts not available yet. ");
@@ -721,7 +724,7 @@ int KAction::plug( QWidget *w, int index )
721 SLOT( slotActivated() ), 724 SLOT( slotActivated() ),
722 d->isEnabled(), d->plainText(), index/*US, instance*/ ); 725 d->isEnabled(), d->plainText(), index/*US, instance*/ );
723 } 726 }
724 bar->getButton( id_ )->setName( QCString("toolbutton_")+name() ); 727 bar->getButton( id_ )->setName( Q3CString("toolbutton_")+name() );
725 728
726//US if ( !d->whatsThis().isEmpty() ) 729//US if ( !d->whatsThis().isEmpty() )
727//US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() ); 730//US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() );
@@ -749,9 +752,9 @@ void KAction::unplug( QWidget *w )
749 return; 752 return;
750 int id = itemId( i ); 753 int id = itemId( i );
751 754
752 if ( w->inherits( "QPopupMenu" ) ) 755 if ( w->inherits( "Q3PopupMenu" ) )
753 { 756 {
754 QPopupMenu *menu = static_cast<QPopupMenu *>( w ); 757 Q3PopupMenu *menu = static_cast<Q3PopupMenu *>( w );
755 menu->removeItem( id ); 758 menu->removeItem( id );
756 } 759 }
757 else if ( w->inherits( "KToolBar" ) ) 760 else if ( w->inherits( "KToolBar" ) )
@@ -862,8 +865,8 @@ void KAction::updateEnabled( int i )
862{ 865{
863 QWidget *w = container( i ); 866 QWidget *w = container( i );
864 867
865 if ( w->inherits("QPopupMenu") ) 868 if ( w->inherits("Q3PopupMenu") )
866 static_cast<QPopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); 869 static_cast<Q3PopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
867 else if ( w->inherits("QMenuBar") ) 870 else if ( w->inherits("QMenuBar") )
868 static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() ); 871 static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
869 else if ( w->inherits( "KToolBar" ) ) 872 else if ( w->inherits( "KToolBar" ) )
@@ -906,10 +909,10 @@ void KAction::updateText( int i )
906{ 909{
907 QWidget *w = container( i ); 910 QWidget *w = container( i );
908 911
909 if ( w->inherits( "QPopupMenu" ) ) { 912 if ( w->inherits( "Q3PopupMenu" ) ) {
910 int id = itemId( i ); 913 int id = itemId( i );
911 static_cast<QPopupMenu*>(w)->changeItem( id, d->text() ); 914 static_cast<Q3PopupMenu*>(w)->changeItem( id, d->text() );
912 updateShortcut( static_cast<QPopupMenu*>(w), id ); 915 updateShortcut( static_cast<Q3PopupMenu*>(w), id );
913 } 916 }
914 else if ( w->inherits( "QMenuBar" ) ) 917 else if ( w->inherits( "QMenuBar" ) )
915 static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() ); 918 static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() );
@@ -947,16 +950,16 @@ void KAction::updateIcon( int id )
947{ 950{
948 QWidget* w = container( id ); 951 QWidget* w = container( id );
949 952
950 if ( w->inherits( "QPopupMenu" ) ) { 953 if ( w->inherits( "Q3PopupMenu" ) ) {
951 int itemId_ = itemId( id ); 954 int itemId_ = itemId( id );
952 static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() ); 955 static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() );
953 updateShortcut( static_cast<QPopupMenu*>(w), itemId_ ); 956 updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ );
954 } 957 }
955 else if ( w->inherits( "QMenuBar" ) ) 958 else if ( w->inherits( "QMenuBar" ) )
956 static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() ); 959 static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() );
957 else if ( w->inherits( "KToolBar" ) ) 960 else if ( w->inherits( "KToolBar" ) )
958 static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); 961 static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() );
959 else if ( w->inherits( "QToolBar" ) ) 962 else if ( w->inherits( "Q3ToolBar" ) )
960 { 963 {
961 qDebug("KAction::updateIcon has top be fixed"); 964 qDebug("KAction::updateIcon has top be fixed");
962//US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() ); 965//US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() );
@@ -968,7 +971,7 @@ QString KAction::icon() const
968 return d->iconName( ); 971 return d->iconName( );
969} 972}
970 973
971void KAction::setIconSet( const QIconSet &iconset ) 974void KAction::setIconSet( const QIcon &iconset )
972{ 975{
973 d->setIconSet( iconset ); 976 d->setIconSet( iconset );
974 977
@@ -982,11 +985,11 @@ void KAction::updateIconSet( int id )
982{ 985{
983 QWidget *w = container( id ); 986 QWidget *w = container( id );
984 987
985 if ( w->inherits( "QPopupMenu" ) ) 988 if ( w->inherits( "Q3PopupMenu" ) )
986 { 989 {
987 int itemId_ = itemId( id ); 990 int itemId_ = itemId( id );
988 static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() ); 991 static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() );
989 updateShortcut( static_cast<QPopupMenu*>(w), itemId_ ); 992 updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ );
990 } 993 }
991 else if ( w->inherits( "QMenuBar" ) ) 994 else if ( w->inherits( "QMenuBar" ) )
992 static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() ); 995 static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() );
@@ -999,7 +1002,7 @@ void KAction::updateIconSet( int id )
999 } 1002 }
1000} 1003}
1001 1004
1002QIconSet KAction::iconSet( KIcon::Group group, int size ) const 1005QIcon KAction::iconSet( KIcon::Group group, int size ) const
1003{ 1006{
1004 return d->iconSet( group, size ); 1007 return d->iconSet( group, size );
1005} 1008}
@@ -1022,7 +1025,7 @@ void KAction::setWhatsThis( const QString& text )
1022void KAction::updateWhatsThis( int i ) 1025void KAction::updateWhatsThis( int i )
1023{ 1026{
1024 qDebug("KAction::updateWhatsThis ...1 has top be fixed"); 1027 qDebug("KAction::updateWhatsThis ...1 has top be fixed");
1025 QPopupMenu* pm = popupMenu( i ); 1028 Q3PopupMenu* pm = popupMenu( i );
1026 if ( pm ) 1029 if ( pm )
1027 { 1030 {
1028 pm->setWhatsThis( itemId( i ), d->whatsThis() ); 1031 pm->setWhatsThis( itemId( i ), d->whatsThis() );
@@ -1064,10 +1067,10 @@ KToolBar* KAction::toolBar( int index ) const
1064 return (KToolBar *)( d->m_containers[ index ].m_container ); 1067 return (KToolBar *)( d->m_containers[ index ].m_container );
1065} 1068}
1066 1069
1067QPopupMenu* KAction::popupMenu( int index ) const 1070Q3PopupMenu* KAction::popupMenu( int index ) const
1068{ 1071{
1069//US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container ); 1072//US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container );
1070 return (QPopupMenu *)( d->m_containers[ index ].m_container ); 1073 return (Q3PopupMenu *)( d->m_containers[ index ].m_container );
1071} 1074}
1072 1075
1073QWidget* KAction::representative( int index ) const 1076QWidget* KAction::representative( int index ) const
@@ -1155,7 +1158,7 @@ void KAction::slotDestroyed()
1155int KAction::findContainer( const QWidget* widget ) const 1158int KAction::findContainer( const QWidget* widget ) const
1156{ 1159{
1157 int pos = 0; 1160 int pos = 0;
1158 QValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin(); 1161 Q3ValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin();
1159 while( it != d->m_containers.end() ) 1162 while( it != d->m_containers.end() )
1160 { 1163 {
1161 if ( (*it).m_representative == widget || (*it).m_container == widget ) 1164 if ( (*it).m_representative == widget || (*it).m_container == widget )
@@ -1170,7 +1173,7 @@ int KAction::findContainer( const QWidget* widget ) const
1170void KAction::removeContainer( int index ) 1173void KAction::removeContainer( int index )
1171{ 1174{
1172 int i = 0; 1175 int i = 0;
1173 QValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin(); 1176 Q3ValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin();
1174 while( it != d->m_containers.end() ) 1177 while( it != d->m_containers.end() )
1175 { 1178 {
1176 if ( i == index ) 1179 if ( i == index )