Diffstat (limited to 'microkde/kdeui/kactioncollection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/kactioncollection.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/microkde/kdeui/kactioncollection.cpp b/microkde/kdeui/kactioncollection.cpp index 69e5d02..4d66c7f 100644 --- a/microkde/kdeui/kactioncollection.cpp +++ b/microkde/kdeui/kactioncollection.cpp @@ -17,36 +17,38 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "kactioncollection.h" //US#include "kactionshortcutlist.h" -#include <qptrdict.h> +#include <q3ptrdict.h> +//Added by qt3to4: +#include <Q3ValueList> //US#include <qvariant.h> //US#include <kaccel.h> //US#include <kaccelbase.h> //US#include <kapplication.h> #include <kdebug.h> //US#include <kxmlguifactory.h> //US I included the following files -#include <qasciidict.h> -#include <qptrlist.h> +#include <q3asciidict.h> +#include <q3ptrlist.h> #include "kaction.h" #include <kglobal.h> #include <qobject.h> #include <qwidget.h> class KActionCollection::KActionCollectionPrivate { public: KActionCollectionPrivate() { //US m_instance = 0; //m_bOneKAccelOnly = false; @@ -58,31 +60,31 @@ public: m_highlight = false; m_currentHighlightAction = 0; m_statusCleared = true; } //US KInstance *m_instance; //US QString m_sXMLFile; bool m_bAutoConnectShortcuts; //bool m_bOneKAccelOnly; //int m_iWidgetCurrent; //QValueList<QWidget*> m_widgetList; //QValueList<KAccel*> m_kaccelList; - QValueList<KActionCollection*> m_docList; + Q3ValueList<KActionCollection*> m_docList; QWidget *m_widget; KAccel *m_kaccel; KAccel *m_builderKAccel; - QAsciiDict<KAction> m_actionDict; - QPtrDict< QPtrList<KAction> > m_dctHighlightContainers; + Q3AsciiDict<KAction> m_actionDict; + Q3PtrDict< Q3PtrList<KAction> > m_dctHighlightContainers; bool m_highlight; KAction *m_currentHighlightAction; bool m_statusCleared; }; KActionCollection::KActionCollection( QWidget *parent, const char *name /*US, KInstance *instance */) : QObject( (QObject*)parent, name ) { kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis d = new KActionCollectionPrivate; if( parent ) @@ -124,25 +126,25 @@ KActionCollection::KActionCollection( QObject *parent, const char *name /*US, KActionCollection::KActionCollection( const KActionCollection © ) : QObject() { kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; d = new KActionCollectionPrivate; *this = copy; } // KDE 4: remove end KActionCollection::~KActionCollection() { kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; - for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { + for ( Q3AsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { KAction* pAction = it.current(); if ( pAction->m_parentCollection == this ) pAction->m_parentCollection = 0L; } //US delete d->m_kaccel; //US delete d->m_builderKAccel; delete d; d = 0; } void KActionCollection::setWidget( QWidget* w ) { @@ -356,118 +358,118 @@ KAction* KActionCollection::_take( KAction* action ) } KAction *a = d->m_actionDict.take( name ); if ( !a || a != action ) return 0; emit removed( action ); return a; } void KActionCollection::_clear() { - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); while ( it.current() ) _remove( it.current() ); } void KActionCollection::insert( KAction* action ) { _insert( action ); } void KActionCollection::remove( KAction* action ) { _remove( action ); } KAction* KActionCollection::take( KAction* action ) { return _take( action ); } void KActionCollection::clear() { _clear(); } KAccel* KActionCollection::accel() { return kaccel(); } const KAccel* KActionCollection::accel() const { return kaccel(); } KAccel* KActionCollection::builderKAccel() const { return d->m_builderKAccel; } KAction* KActionCollection::action( const char* name, const char* classname ) const { KAction* pAction = 0; if ( !classname && name ) pAction = d->m_actionDict[ name ]; else { - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); for( ; it.current(); ++it ) { if ( ( !name || strcmp( it.current()->name(), name ) == 0 ) && ( !classname || strcmp( it.current()->className(), classname ) == 0 ) ) { pAction = it.current(); break; } } } if( !pAction ) { for( uint i = 0; i < d->m_docList.count() && !pAction; i++ ) pAction = d->m_docList[i]->action( name, classname ); } return pAction; } KAction* KActionCollection::action( int index ) const { - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); it += index; return it.current(); // return d->m_actions.at( index ); } /*US bool KActionCollection::readShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) { return KActionShortcutList(this).readSettings( sConfigGroup, pConfig ); } bool KActionCollection::writeShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) const { return KActionShortcutList((KActionCollection*)this).writeSettings( sConfigGroup, pConfig ); } */ uint KActionCollection::count() const { return d->m_actionDict.count(); } QStringList KActionCollection::groups() const { QStringList lst; - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); for( ; it.current(); ++it ) if ( !it.current()->group().isEmpty() && !lst.contains( it.current()->group() ) ) lst.append( it.current()->group() ); return lst; } KActionPtrList KActionCollection::actions( const QString& group ) const { KActionPtrList lst; - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); for( ; it.current(); ++it ) if ( it.current()->group() == group ) lst.append( it.current() ); else if ( it.current()->group().isEmpty() && group.isEmpty() ) lst.append( it.current() ); return lst; } KActionPtrList KActionCollection::actions() const { KActionPtrList lst; - QAsciiDictIterator<KAction> it( d->m_actionDict ); + Q3AsciiDictIterator<KAction> it( d->m_actionDict ); for( ; it.current(); ++it ) lst.append( it.current() ); return lst; } /*US we have no instance object. Use KGlobal instead void KActionCollection::setInstance( KInstance *instance ) { if ( instance ) d->m_instance = instance; qDebug("KActionCollection::setInstance has to be fixed"); @@ -499,59 +501,59 @@ void KActionCollection::setHighlightingEnabled( bool enable ) } bool KActionCollection::highlightingEnabled() const { return d->m_highlight; } void KActionCollection::connectHighlight( QWidget *container, KAction *action ) { if ( !d->m_highlight ) return; - QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; + Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; if ( !actionList ) { - actionList = new QPtrList<KAction>; + actionList = new Q3PtrList<KAction>; - if ( container->inherits( "QPopupMenu" ) ) + if ( container->inherits( "Q3PopupMenu" ) ) { connect( container, SIGNAL( highlighted( int ) ), this, SLOT( slotMenuItemHighlighted( int ) ) ); connect( container, SIGNAL( aboutToHide() ), this, SLOT( slotMenuAboutToHide() ) ); } //US else if ( container->inherits( "KToolBar" ) ) - else if ( container->inherits( "QToolBar" ) ) + else if ( container->inherits( "Q3ToolBar" ) ) { connect( container, SIGNAL( highlighted( int, bool ) ), this, SLOT( slotToolBarButtonHighlighted( int, bool ) ) ); } connect( container, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); d->m_dctHighlightContainers.insert( container, actionList ); } actionList->append( action ); } void KActionCollection::disconnectHighlight( QWidget *container, KAction *action ) { if ( !d->m_highlight ) return; - QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; + Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; if ( !actionList ) return; actionList->removeRef( action ); if ( actionList->count() == 0 ) d->m_dctHighlightContainers.remove( container ); } void KActionCollection::slotMenuItemHighlighted( int id ) { @@ -616,70 +618,70 @@ void KActionCollection::slotToolBarButtonHighlighted( int id, bool highlight ) d->m_currentHighlightAction = 0; // emit clearStatusText(); } } void KActionCollection::slotDestroyed() { d->m_dctHighlightContainers.remove( reinterpret_cast<void *>( const_cast<QObject *>(sender()) ) ); } KAction *KActionCollection::findAction( QWidget *container, int id ) { - QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ]; + Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ]; if ( !actionList ) return 0; - QPtrListIterator<KAction> it( *actionList ); + Q3PtrListIterator<KAction> it( *actionList ); for (; it.current(); ++it ) if ( it.current()->isPlugged( container, id ) ) return it.current(); return 0; } // KDE 4: remove KActionCollection KActionCollection::operator+(const KActionCollection &c ) const { kdWarning(129) << "KActionCollection::operator+(): function is severely deprecated." << endl; KActionCollection ret( *this ); - QValueList<KAction *> actions = c.actions(); - QValueList<KAction *>::ConstIterator it = actions.begin(); - QValueList<KAction *>::ConstIterator end = actions.end(); + Q3ValueList<KAction *> actions = c.actions(); + Q3ValueList<KAction *>::ConstIterator it = actions.begin(); + Q3ValueList<KAction *>::ConstIterator end = actions.end(); for (; it != end; ++it ) ret.insert( *it ); return ret; } KActionCollection &KActionCollection::operator=( const KActionCollection © ) { kdWarning(129) << "KActionCollection::operator=(): function is severely deprecated." << endl; //d->m_bOneKAccelOnly = copy.d->m_bOneKAccelOnly; //d->m_iWidgetCurrent = copy.d->m_iWidgetCurrent; //d->m_widgetList = copy.d->m_widgetList; //d->m_kaccelList = copy.d->m_kaccelList; d->m_widget = copy.d->m_widget; d->m_kaccel = copy.d->m_kaccel; d->m_actionDict = copy.d->m_actionDict; //US setInstance( copy.instance() ); return *this; } KActionCollection &KActionCollection::operator+=( const KActionCollection &c ) { kdWarning(129) << "KActionCollection::operator+=(): function is severely deprecated." << endl; - QAsciiDictIterator<KAction> it(c.d->m_actionDict); + Q3AsciiDictIterator<KAction> it(c.d->m_actionDict); for ( ; it.current(); ++it ) insert( it.current() ); return *this; } // KDE 4: remove end //--------------------------------------------------------------------- // KActionShortcutList //--------------------------------------------------------------------- /*US KActionShortcutList::KActionShortcutList( KActionCollection* pColl ) |