summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/kactioncollection.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdeui/kactioncollection.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kdeui/kactioncollection.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kactioncollection.cpp50
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
@@ -1,184 +1,186 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org> 2 Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
3 (C) 1999 Simon Hausmann <hausmann@kde.org> 3 (C) 1999 Simon Hausmann <hausmann@kde.org>
4 (C) 2000 Nicolas Hadacek <haadcek@kde.org> 4 (C) 2000 Nicolas Hadacek <haadcek@kde.org>
5 (C) 2000 Kurt Granroth <granroth@kde.org> 5 (C) 2000 Kurt Granroth <granroth@kde.org>
6 (C) 2000 Michael Koch <koch@kde.org> 6 (C) 2000 Michael Koch <koch@kde.org>
7 (C) 2001 Holger Freyther <freyther@kde.org> 7 (C) 2001 Holger Freyther <freyther@kde.org>
8 (C) 2002 Ellis Whitehead <ellis@kde.org> 8 (C) 2002 Ellis Whitehead <ellis@kde.org>
9 (C) 2002 Joseph Wenninger <jowenn@kde.org> 9 (C) 2002 Joseph Wenninger <jowenn@kde.org>
10 10
11 This library is free software; you can redistribute it and/or 11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public 12 modify it under the terms of the GNU Library General Public
13 License version 2 as published by the Free Software Foundation. 13 License version 2 as published by the Free Software Foundation.
14 14
15 This library is distributed in the hope that it will be useful, 15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details. 18 Library General Public License for more details.
19 19
20 You should have received a copy of the GNU Library General Public License 20 You should have received a copy of the GNU Library General Public License
21 along with this library; see the file COPYING.LIB. If not, write to 21 along with this library; see the file COPYING.LIB. If not, write to
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. 23 Boston, MA 02111-1307, USA.
24*/ 24*/
25 25
26#include "kactioncollection.h" 26#include "kactioncollection.h"
27//US#include "kactionshortcutlist.h" 27//US#include "kactionshortcutlist.h"
28 28
29#include <qptrdict.h> 29#include <q3ptrdict.h>
30//Added by qt3to4:
31#include <Q3ValueList>
30//US#include <qvariant.h> 32//US#include <qvariant.h>
31 33
32//US#include <kaccel.h> 34//US#include <kaccel.h>
33//US#include <kaccelbase.h> 35//US#include <kaccelbase.h>
34//US#include <kapplication.h> 36//US#include <kapplication.h>
35#include <kdebug.h> 37#include <kdebug.h>
36//US#include <kxmlguifactory.h> 38//US#include <kxmlguifactory.h>
37 39
38//US I included the following files 40//US I included the following files
39#include <qasciidict.h> 41#include <q3asciidict.h>
40#include <qptrlist.h> 42#include <q3ptrlist.h>
41#include "kaction.h" 43#include "kaction.h"
42#include <kglobal.h> 44#include <kglobal.h>
43#include <qobject.h> 45#include <qobject.h>
44#include <qwidget.h> 46#include <qwidget.h>
45 47
46class KActionCollection::KActionCollectionPrivate 48class KActionCollection::KActionCollectionPrivate
47{ 49{
48public: 50public:
49 KActionCollectionPrivate() 51 KActionCollectionPrivate()
50 { 52 {
51//US m_instance = 0; 53//US m_instance = 0;
52 //m_bOneKAccelOnly = false; 54 //m_bOneKAccelOnly = false;
53 //m_iWidgetCurrent = 0; 55 //m_iWidgetCurrent = 0;
54 m_bAutoConnectShortcuts = true; 56 m_bAutoConnectShortcuts = true;
55 m_widget = 0; 57 m_widget = 0;
56 m_kaccel = m_builderKAccel = 0; 58 m_kaccel = m_builderKAccel = 0;
57 m_dctHighlightContainers.setAutoDelete( true ); 59 m_dctHighlightContainers.setAutoDelete( true );
58 m_highlight = false; 60 m_highlight = false;
59 m_currentHighlightAction = 0; 61 m_currentHighlightAction = 0;
60 m_statusCleared = true; 62 m_statusCleared = true;
61 } 63 }
62 64
63//US KInstance *m_instance; 65//US KInstance *m_instance;
64//US QString m_sXMLFile; 66//US QString m_sXMLFile;
65 bool m_bAutoConnectShortcuts; 67 bool m_bAutoConnectShortcuts;
66 //bool m_bOneKAccelOnly; 68 //bool m_bOneKAccelOnly;
67 //int m_iWidgetCurrent; 69 //int m_iWidgetCurrent;
68 //QValueList<QWidget*> m_widgetList; 70 //QValueList<QWidget*> m_widgetList;
69 //QValueList<KAccel*> m_kaccelList; 71 //QValueList<KAccel*> m_kaccelList;
70 QValueList<KActionCollection*> m_docList; 72 Q3ValueList<KActionCollection*> m_docList;
71 QWidget *m_widget; 73 QWidget *m_widget;
72 KAccel *m_kaccel; 74 KAccel *m_kaccel;
73 KAccel *m_builderKAccel; 75 KAccel *m_builderKAccel;
74 76
75 QAsciiDict<KAction> m_actionDict; 77 Q3AsciiDict<KAction> m_actionDict;
76 QPtrDict< QPtrList<KAction> > m_dctHighlightContainers; 78 Q3PtrDict< Q3PtrList<KAction> > m_dctHighlightContainers;
77 bool m_highlight; 79 bool m_highlight;
78 KAction *m_currentHighlightAction; 80 KAction *m_currentHighlightAction;
79 bool m_statusCleared; 81 bool m_statusCleared;
80}; 82};
81 83
82KActionCollection::KActionCollection( QWidget *parent, const char *name /*US, 84KActionCollection::KActionCollection( QWidget *parent, const char *name /*US,
83 KInstance *instance */) 85 KInstance *instance */)
84 : QObject( (QObject*)parent, name ) 86 : QObject( (QObject*)parent, name )
85{ 87{
86 kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis 88 kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis
87 d = new KActionCollectionPrivate; 89 d = new KActionCollectionPrivate;
88 if( parent ) 90 if( parent )
89 setWidget( parent ); 91 setWidget( parent );
90 //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); 92 //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0);
91//US setInstance( instance ); 93//US setInstance( instance );
92} 94}
93 95
94 96
95KActionCollection::KActionCollection( QWidget *watch, QObject* parent, const char *name /*US, 97KActionCollection::KActionCollection( QWidget *watch, QObject* parent, const char *name /*US,
96 KInstance *instance */) 98 KInstance *instance */)
97 : QObject( parent, name ) 99 : QObject( parent, name )
98{ 100{
99 kdDebug(129) << "KActionCollection::KActionCollection( " << watch << ", " << parent << ", " << name << " ): this = " << this << endl; //ellis 101 kdDebug(129) << "KActionCollection::KActionCollection( " << watch << ", " << parent << ", " << name << " ): this = " << this << endl; //ellis
100 d = new KActionCollectionPrivate; 102 d = new KActionCollectionPrivate;
101 if( watch ) 103 if( watch )
102 setWidget( watch ); 104 setWidget( watch );
103 //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); 105 //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0);
104//US setInstance( instance ); 106//US setInstance( instance );
105} 107}
106 108
107// KDE 4: remove 109// KDE 4: remove
108KActionCollection::KActionCollection( QObject *parent, const char *name /*US, 110KActionCollection::KActionCollection( QObject *parent, const char *name /*US,
109 KInstance *instance */) 111 KInstance *instance */)
110 : QObject( parent, name ) 112 : QObject( parent, name )
111{ 113{
112 kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis 114 kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis
113//US kdBacktrace not available 115//US kdBacktrace not available
114//US kdDebug(129) << kdBacktrace() << endl; 116//US kdDebug(129) << kdBacktrace() << endl;
115 d = new KActionCollectionPrivate; 117 d = new KActionCollectionPrivate;
116//US QWidget* w = dynamic_cast<QWidget*>( parent ); 118//US QWidget* w = dynamic_cast<QWidget*>( parent );
117 QWidget* w = (QWidget*)( parent ); 119 QWidget* w = (QWidget*)( parent );
118 if( w ) 120 if( w )
119 setWidget( w ); 121 setWidget( w );
120 //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0); 122 //d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0);
121//US setInstance( instance ); 123//US setInstance( instance );
122} 124}
123 125
124KActionCollection::KActionCollection( const KActionCollection &copy ) 126KActionCollection::KActionCollection( const KActionCollection &copy )
125 : QObject() 127 : QObject()
126{ 128{
127 kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl; 129 kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl;
128 d = new KActionCollectionPrivate; 130 d = new KActionCollectionPrivate;
129 *this = copy; 131 *this = copy;
130} 132}
131// KDE 4: remove end 133// KDE 4: remove end
132 134
133KActionCollection::~KActionCollection() 135KActionCollection::~KActionCollection()
134{ 136{
135 kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl; 137 kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl;
136 for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) { 138 for ( Q3AsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) {
137 KAction* pAction = it.current(); 139 KAction* pAction = it.current();
138 if ( pAction->m_parentCollection == this ) 140 if ( pAction->m_parentCollection == this )
139 pAction->m_parentCollection = 0L; 141 pAction->m_parentCollection = 0L;
140 } 142 }
141 143
142//US delete d->m_kaccel; 144//US delete d->m_kaccel;
143//US delete d->m_builderKAccel; 145//US delete d->m_builderKAccel;
144 delete d; d = 0; 146 delete d; d = 0;
145} 147}
146 148
147void KActionCollection::setWidget( QWidget* w ) 149void KActionCollection::setWidget( QWidget* w )
148{ 150{
149 //if ( d->m_actionDict.count() > 0 ) { 151 //if ( d->m_actionDict.count() > 0 ) {
150 // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl; 152 // kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl;
151 // kdDebug(129) << kdBacktrace() << endl; 153 // kdDebug(129) << kdBacktrace() << endl;
152 //} 154 //}
153 //else 155 //else
154 if ( !d->m_widget ) { 156 if ( !d->m_widget ) {
155 d->m_widget = w; 157 d->m_widget = w;
156 //qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde"); 158 //qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde");
157//US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" ); 159//US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" );
158 } 160 }
159 else if ( d->m_widget != w ) 161 else if ( d->m_widget != w )
160 ; 162 ;
161 163
162} 164}
163 165
164void KActionCollection::setAutoConnectShortcuts( bool b ) 166void KActionCollection::setAutoConnectShortcuts( bool b )
165{ 167{
166 d->m_bAutoConnectShortcuts = b; 168 d->m_bAutoConnectShortcuts = b;
167} 169}
168 170
169bool KActionCollection::isAutoConnectShortcuts() 171bool KActionCollection::isAutoConnectShortcuts()
170{ 172{
171 return d->m_bAutoConnectShortcuts; 173 return d->m_bAutoConnectShortcuts;
172} 174}
173 175
174bool KActionCollection::addDocCollection( KActionCollection* pDoc ) 176bool KActionCollection::addDocCollection( KActionCollection* pDoc )
175{ 177{
176 d->m_docList.append( pDoc ); 178 d->m_docList.append( pDoc );
177 return true; 179 return true;
178} 180}
179 181
180void KActionCollection::beginXMLPlug( QWidget *widget ) 182void KActionCollection::beginXMLPlug( QWidget *widget )
181{ 183{
182 qDebug("KActionCollection::beginXMLPlug has to be fixed"); 184 qDebug("KActionCollection::beginXMLPlug has to be fixed");
183/*US 185/*US
184 kdDebug(129) << "KActionCollection::beginXMLPlug( buildWidget = " << widget << " ): this = " << this << " d->m_builderKAccel = " << d->m_builderKAccel << endl; 186 kdDebug(129) << "KActionCollection::beginXMLPlug( buildWidget = " << widget << " ): this = " << this << " d->m_builderKAccel = " << d->m_builderKAccel << endl;
@@ -320,402 +322,402 @@ const KAccel* KActionCollection::kaccel() const
320 d->m_mainwindow = mw; 322 d->m_mainwindow = mw;
321 else 323 else
322 kdDebug(129) << "KAction::plugMainWindowAccel: Toplevel widget isn't a KMainWindow, can't plug accel. " << tl << endl; 324 kdDebug(129) << "KAction::plugMainWindowAccel: Toplevel widget isn't a KMainWindow, can't plug accel. " << tl << endl;
323}*/ 325}*/
324 326
325void KActionCollection::_insert( KAction* action ) 327void KActionCollection::_insert( KAction* action )
326{ 328{
327 char unnamed_name[100]; 329 char unnamed_name[100];
328 const char *name = action->name(); 330 const char *name = action->name();
329 if( qstrcmp( name, "unnamed" ) == 0 ) 331 if( qstrcmp( name, "unnamed" ) == 0 )
330 { 332 {
331 sprintf(unnamed_name, "unnamed-%p", (void *)action); 333 sprintf(unnamed_name, "unnamed-%p", (void *)action);
332 name = unnamed_name; 334 name = unnamed_name;
333 } 335 }
334 KAction *a = d->m_actionDict[ name ]; 336 KAction *a = d->m_actionDict[ name ];
335 if ( a == action ) 337 if ( a == action )
336 return; 338 return;
337 339
338 d->m_actionDict.insert( name, action ); 340 d->m_actionDict.insert( name, action );
339 341
340 emit inserted( action ); 342 emit inserted( action );
341} 343}
342 344
343void KActionCollection::_remove( KAction* action ) 345void KActionCollection::_remove( KAction* action )
344{ 346{
345 delete _take( action ); 347 delete _take( action );
346} 348}
347 349
348KAction* KActionCollection::_take( KAction* action ) 350KAction* KActionCollection::_take( KAction* action )
349{ 351{
350 char unnamed_name[100]; 352 char unnamed_name[100];
351 const char *name = action->name(); 353 const char *name = action->name();
352 if( qstrcmp( name, "unnamed" ) == 0 ) 354 if( qstrcmp( name, "unnamed" ) == 0 )
353 { 355 {
354 sprintf(unnamed_name, "unnamed-%p", (void *) action); 356 sprintf(unnamed_name, "unnamed-%p", (void *) action);
355 name = unnamed_name; 357 name = unnamed_name;
356 } 358 }
357 359
358 KAction *a = d->m_actionDict.take( name ); 360 KAction *a = d->m_actionDict.take( name );
359 if ( !a || a != action ) 361 if ( !a || a != action )
360 return 0; 362 return 0;
361 363
362 emit removed( action ); 364 emit removed( action );
363 return a; 365 return a;
364} 366}
365 367
366void KActionCollection::_clear() 368void KActionCollection::_clear()
367{ 369{
368 QAsciiDictIterator<KAction> it( d->m_actionDict ); 370 Q3AsciiDictIterator<KAction> it( d->m_actionDict );
369 while ( it.current() ) 371 while ( it.current() )
370 _remove( it.current() ); 372 _remove( it.current() );
371} 373}
372 374
373void KActionCollection::insert( KAction* action ) { _insert( action ); } 375void KActionCollection::insert( KAction* action ) { _insert( action ); }
374void KActionCollection::remove( KAction* action ) { _remove( action ); } 376void KActionCollection::remove( KAction* action ) { _remove( action ); }
375KAction* KActionCollection::take( KAction* action ) { return _take( action ); } 377KAction* KActionCollection::take( KAction* action ) { return _take( action ); }
376void KActionCollection::clear() { _clear(); } 378void KActionCollection::clear() { _clear(); }
377KAccel* KActionCollection::accel() { return kaccel(); } 379KAccel* KActionCollection::accel() { return kaccel(); }
378const KAccel* KActionCollection::accel() const { return kaccel(); } 380const KAccel* KActionCollection::accel() const { return kaccel(); }
379KAccel* KActionCollection::builderKAccel() const { return d->m_builderKAccel; } 381KAccel* KActionCollection::builderKAccel() const { return d->m_builderKAccel; }
380 382
381KAction* KActionCollection::action( const char* name, const char* classname ) const 383KAction* KActionCollection::action( const char* name, const char* classname ) const
382{ 384{
383 KAction* pAction = 0; 385 KAction* pAction = 0;
384 386
385 if ( !classname && name ) 387 if ( !classname && name )
386 pAction = d->m_actionDict[ name ]; 388 pAction = d->m_actionDict[ name ];
387 389
388 else { 390 else {
389 QAsciiDictIterator<KAction> it( d->m_actionDict ); 391 Q3AsciiDictIterator<KAction> it( d->m_actionDict );
390 for( ; it.current(); ++it ) 392 for( ; it.current(); ++it )
391 { 393 {
392 if ( ( !name || strcmp( it.current()->name(), name ) == 0 ) && 394 if ( ( !name || strcmp( it.current()->name(), name ) == 0 ) &&
393 ( !classname || strcmp( it.current()->className(), classname ) == 0 ) ) { 395 ( !classname || strcmp( it.current()->className(), classname ) == 0 ) ) {
394 pAction = it.current(); 396 pAction = it.current();
395 break; 397 break;
396 } 398 }
397 } 399 }
398 } 400 }
399 401
400 if( !pAction ) { 402 if( !pAction ) {
401 for( uint i = 0; i < d->m_docList.count() && !pAction; i++ ) 403 for( uint i = 0; i < d->m_docList.count() && !pAction; i++ )
402 pAction = d->m_docList[i]->action( name, classname ); 404 pAction = d->m_docList[i]->action( name, classname );
403 } 405 }
404 406
405 return pAction; 407 return pAction;
406} 408}
407 409
408KAction* KActionCollection::action( int index ) const 410KAction* KActionCollection::action( int index ) const
409{ 411{
410 QAsciiDictIterator<KAction> it( d->m_actionDict ); 412 Q3AsciiDictIterator<KAction> it( d->m_actionDict );
411 it += index; 413 it += index;
412 return it.current(); 414 return it.current();
413// return d->m_actions.at( index ); 415// return d->m_actions.at( index );
414} 416}
415/*US 417/*US
416bool KActionCollection::readShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) 418bool KActionCollection::readShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig )
417{ 419{
418 return KActionShortcutList(this).readSettings( sConfigGroup, pConfig ); 420 return KActionShortcutList(this).readSettings( sConfigGroup, pConfig );
419} 421}
420 422
421bool KActionCollection::writeShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) const 423bool KActionCollection::writeShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) const
422{ 424{
423 return KActionShortcutList((KActionCollection*)this).writeSettings( sConfigGroup, pConfig ); 425 return KActionShortcutList((KActionCollection*)this).writeSettings( sConfigGroup, pConfig );
424} 426}
425*/ 427*/
426uint KActionCollection::count() const 428uint KActionCollection::count() const
427{ 429{
428 return d->m_actionDict.count(); 430 return d->m_actionDict.count();
429} 431}
430 432
431QStringList KActionCollection::groups() const 433QStringList KActionCollection::groups() const
432{ 434{
433 QStringList lst; 435 QStringList lst;
434 436
435 QAsciiDictIterator<KAction> it( d->m_actionDict ); 437 Q3AsciiDictIterator<KAction> it( d->m_actionDict );
436 for( ; it.current(); ++it ) 438 for( ; it.current(); ++it )
437 if ( !it.current()->group().isEmpty() && !lst.contains( it.current()->group() ) ) 439 if ( !it.current()->group().isEmpty() && !lst.contains( it.current()->group() ) )
438 lst.append( it.current()->group() ); 440 lst.append( it.current()->group() );
439 441
440 return lst; 442 return lst;
441} 443}
442 444
443KActionPtrList KActionCollection::actions( const QString& group ) const 445KActionPtrList KActionCollection::actions( const QString& group ) const
444{ 446{
445 KActionPtrList lst; 447 KActionPtrList lst;
446 448
447 QAsciiDictIterator<KAction> it( d->m_actionDict ); 449 Q3AsciiDictIterator<KAction> it( d->m_actionDict );
448 for( ; it.current(); ++it ) 450 for( ; it.current(); ++it )
449 if ( it.current()->group() == group ) 451 if ( it.current()->group() == group )
450 lst.append( it.current() ); 452 lst.append( it.current() );
451 else if ( it.current()->group().isEmpty() && group.isEmpty() ) 453 else if ( it.current()->group().isEmpty() && group.isEmpty() )
452 lst.append( it.current() ); 454 lst.append( it.current() );
453 455
454 return lst; 456 return lst;
455} 457}
456 458
457KActionPtrList KActionCollection::actions() const 459KActionPtrList KActionCollection::actions() const
458{ 460{
459 KActionPtrList lst; 461 KActionPtrList lst;
460 462
461 QAsciiDictIterator<KAction> it( d->m_actionDict ); 463 Q3AsciiDictIterator<KAction> it( d->m_actionDict );
462 for( ; it.current(); ++it ) 464 for( ; it.current(); ++it )
463 lst.append( it.current() ); 465 lst.append( it.current() );
464 466
465 return lst; 467 return lst;
466} 468}
467 469
468/*US we have no instance object. Use KGlobal instead 470/*US we have no instance object. Use KGlobal instead
469void KActionCollection::setInstance( KInstance *instance ) 471void KActionCollection::setInstance( KInstance *instance )
470{ 472{
471 if ( instance ) 473 if ( instance )
472 d->m_instance = instance; 474 d->m_instance = instance;
473qDebug("KActionCollection::setInstance has to be fixed"); 475qDebug("KActionCollection::setInstance has to be fixed");
474 else 476 else
475 d->m_instance = KGlobal::instance(); 477 d->m_instance = KGlobal::instance();
476} 478}
477 479
478KInstance *KActionCollection::instance() const 480KInstance *KActionCollection::instance() const
479{ 481{
480 return d->m_instance; 482 return d->m_instance;
481} 483}
482*/ 484*/
483 485
484/*US we have no XML facility in microkde 486/*US we have no XML facility in microkde
485void KActionCollection::setXMLFile( const QString& sXMLFile ) 487void KActionCollection::setXMLFile( const QString& sXMLFile )
486{ 488{
487 d->m_sXMLFile = sXMLFile; 489 d->m_sXMLFile = sXMLFile;
488} 490}
489 491
490const QString& KActionCollection::xmlFile() const 492const QString& KActionCollection::xmlFile() const
491{ 493{
492 return d->m_sXMLFile; 494 return d->m_sXMLFile;
493} 495}
494*/ 496*/
495 497
496void KActionCollection::setHighlightingEnabled( bool enable ) 498void KActionCollection::setHighlightingEnabled( bool enable )
497{ 499{
498 d->m_highlight = enable; 500 d->m_highlight = enable;
499} 501}
500 502
501bool KActionCollection::highlightingEnabled() const 503bool KActionCollection::highlightingEnabled() const
502{ 504{
503 return d->m_highlight; 505 return d->m_highlight;
504} 506}
505 507
506void KActionCollection::connectHighlight( QWidget *container, KAction *action ) 508void KActionCollection::connectHighlight( QWidget *container, KAction *action )
507{ 509{
508 if ( !d->m_highlight ) 510 if ( !d->m_highlight )
509 return; 511 return;
510 512
511 QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; 513 Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
512 514
513 if ( !actionList ) 515 if ( !actionList )
514 { 516 {
515 actionList = new QPtrList<KAction>; 517 actionList = new Q3PtrList<KAction>;
516 518
517 if ( container->inherits( "QPopupMenu" ) ) 519 if ( container->inherits( "Q3PopupMenu" ) )
518 { 520 {
519 connect( container, SIGNAL( highlighted( int ) ), 521 connect( container, SIGNAL( highlighted( int ) ),
520 this, SLOT( slotMenuItemHighlighted( int ) ) ); 522 this, SLOT( slotMenuItemHighlighted( int ) ) );
521 connect( container, SIGNAL( aboutToHide() ), 523 connect( container, SIGNAL( aboutToHide() ),
522 this, SLOT( slotMenuAboutToHide() ) ); 524 this, SLOT( slotMenuAboutToHide() ) );
523 } 525 }
524//US else if ( container->inherits( "KToolBar" ) ) 526//US else if ( container->inherits( "KToolBar" ) )
525 else if ( container->inherits( "QToolBar" ) ) 527 else if ( container->inherits( "Q3ToolBar" ) )
526 { 528 {
527 connect( container, SIGNAL( highlighted( int, bool ) ), 529 connect( container, SIGNAL( highlighted( int, bool ) ),
528 this, SLOT( slotToolBarButtonHighlighted( int, bool ) ) ); 530 this, SLOT( slotToolBarButtonHighlighted( int, bool ) ) );
529 } 531 }
530 532
531 connect( container, SIGNAL( destroyed() ), 533 connect( container, SIGNAL( destroyed() ),
532 this, SLOT( slotDestroyed() ) ); 534 this, SLOT( slotDestroyed() ) );
533 535
534 d->m_dctHighlightContainers.insert( container, actionList ); 536 d->m_dctHighlightContainers.insert( container, actionList );
535 } 537 }
536 538
537 actionList->append( action ); 539 actionList->append( action );
538} 540}
539 541
540void KActionCollection::disconnectHighlight( QWidget *container, KAction *action ) 542void KActionCollection::disconnectHighlight( QWidget *container, KAction *action )
541{ 543{
542 if ( !d->m_highlight ) 544 if ( !d->m_highlight )
543 return; 545 return;
544 546
545 QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ]; 547 Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
546 548
547 if ( !actionList ) 549 if ( !actionList )
548 return; 550 return;
549 551
550 actionList->removeRef( action ); 552 actionList->removeRef( action );
551 553
552 if ( actionList->count() == 0 ) 554 if ( actionList->count() == 0 )
553 d->m_dctHighlightContainers.remove( container ); 555 d->m_dctHighlightContainers.remove( container );
554} 556}
555 557
556void KActionCollection::slotMenuItemHighlighted( int id ) 558void KActionCollection::slotMenuItemHighlighted( int id )
557{ 559{
558 if ( !d->m_highlight ) 560 if ( !d->m_highlight )
559 return; 561 return;
560 562
561 if ( d->m_currentHighlightAction ) 563 if ( d->m_currentHighlightAction )
562 emit actionHighlighted( d->m_currentHighlightAction, false ); 564 emit actionHighlighted( d->m_currentHighlightAction, false );
563 565
564 QWidget *container = static_cast<QWidget *>( const_cast<QObject *>( sender() ) ); 566 QWidget *container = static_cast<QWidget *>( const_cast<QObject *>( sender() ) );
565 567
566 d->m_currentHighlightAction = findAction( container, id ); 568 d->m_currentHighlightAction = findAction( container, id );
567 569
568 if ( !d->m_currentHighlightAction ) 570 if ( !d->m_currentHighlightAction )
569 { 571 {
570 if ( !d->m_statusCleared ) 572 if ( !d->m_statusCleared )
571 emit clearStatusText(); 573 emit clearStatusText();
572 d->m_statusCleared = true; 574 d->m_statusCleared = true;
573 return; 575 return;
574 } 576 }
575 577
576 d->m_statusCleared = false; 578 d->m_statusCleared = false;
577 emit actionHighlighted( d->m_currentHighlightAction ); 579 emit actionHighlighted( d->m_currentHighlightAction );
578 emit actionHighlighted( d->m_currentHighlightAction, true ); 580 emit actionHighlighted( d->m_currentHighlightAction, true );
579 emit actionStatusText( d->m_currentHighlightAction->toolTip() ); 581 emit actionStatusText( d->m_currentHighlightAction->toolTip() );
580} 582}
581 583
582void KActionCollection::slotMenuAboutToHide() 584void KActionCollection::slotMenuAboutToHide()
583{ 585{
584 if ( d->m_currentHighlightAction ) 586 if ( d->m_currentHighlightAction )
585 emit actionHighlighted( d->m_currentHighlightAction, false ); 587 emit actionHighlighted( d->m_currentHighlightAction, false );
586 d->m_currentHighlightAction = 0; 588 d->m_currentHighlightAction = 0;
587 589
588 if ( !d->m_statusCleared ) 590 if ( !d->m_statusCleared )
589 emit clearStatusText(); 591 emit clearStatusText();
590 d->m_statusCleared = true; 592 d->m_statusCleared = true;
591} 593}
592 594
593void KActionCollection::slotToolBarButtonHighlighted( int id, bool highlight ) 595void KActionCollection::slotToolBarButtonHighlighted( int id, bool highlight )
594{ 596{
595 if ( !d->m_highlight ) 597 if ( !d->m_highlight )
596 return; 598 return;
597 599
598 QWidget *container = static_cast<QWidget *>( const_cast<QObject *>( sender() ) ); 600 QWidget *container = static_cast<QWidget *>( const_cast<QObject *>( sender() ) );
599 601
600 KAction *action = findAction( container, id ); 602 KAction *action = findAction( container, id );
601 603
602 if ( !action ) 604 if ( !action )
603 { 605 {
604 d->m_currentHighlightAction = 0; 606 d->m_currentHighlightAction = 0;
605 // use tooltip groups for toolbar status text stuff instead (Simon) 607 // use tooltip groups for toolbar status text stuff instead (Simon)
606// emit clearStatusText(); 608// emit clearStatusText();
607 return; 609 return;
608 } 610 }
609 611
610 emit actionHighlighted( action, highlight ); 612 emit actionHighlighted( action, highlight );
611 613
612 if ( highlight ) 614 if ( highlight )
613 d->m_currentHighlightAction = action; 615 d->m_currentHighlightAction = action;
614 else 616 else
615 { 617 {
616 d->m_currentHighlightAction = 0; 618 d->m_currentHighlightAction = 0;
617// emit clearStatusText(); 619// emit clearStatusText();
618 } 620 }
619} 621}
620 622
621void KActionCollection::slotDestroyed() 623void KActionCollection::slotDestroyed()
622{ 624{
623 d->m_dctHighlightContainers.remove( reinterpret_cast<void *>( const_cast<QObject *>(sender()) ) ); 625 d->m_dctHighlightContainers.remove( reinterpret_cast<void *>( const_cast<QObject *>(sender()) ) );
624} 626}
625 627
626KAction *KActionCollection::findAction( QWidget *container, int id ) 628KAction *KActionCollection::findAction( QWidget *container, int id )
627{ 629{
628 QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ]; 630 Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ];
629 631
630 if ( !actionList ) 632 if ( !actionList )
631 return 0; 633 return 0;
632 634
633 QPtrListIterator<KAction> it( *actionList ); 635 Q3PtrListIterator<KAction> it( *actionList );
634 for (; it.current(); ++it ) 636 for (; it.current(); ++it )
635 if ( it.current()->isPlugged( container, id ) ) 637 if ( it.current()->isPlugged( container, id ) )
636 return it.current(); 638 return it.current();
637 639
638 return 0; 640 return 0;
639} 641}
640 642
641// KDE 4: remove 643// KDE 4: remove
642KActionCollection KActionCollection::operator+(const KActionCollection &c ) const 644KActionCollection KActionCollection::operator+(const KActionCollection &c ) const
643{ 645{
644 kdWarning(129) << "KActionCollection::operator+(): function is severely deprecated." << endl; 646 kdWarning(129) << "KActionCollection::operator+(): function is severely deprecated." << endl;
645 KActionCollection ret( *this ); 647 KActionCollection ret( *this );
646 648
647 QValueList<KAction *> actions = c.actions(); 649 Q3ValueList<KAction *> actions = c.actions();
648 QValueList<KAction *>::ConstIterator it = actions.begin(); 650 Q3ValueList<KAction *>::ConstIterator it = actions.begin();
649 QValueList<KAction *>::ConstIterator end = actions.end(); 651 Q3ValueList<KAction *>::ConstIterator end = actions.end();
650 for (; it != end; ++it ) 652 for (; it != end; ++it )
651 ret.insert( *it ); 653 ret.insert( *it );
652 654
653 return ret; 655 return ret;
654} 656}
655 657
656KActionCollection &KActionCollection::operator=( const KActionCollection &copy ) 658KActionCollection &KActionCollection::operator=( const KActionCollection &copy )
657{ 659{
658 kdWarning(129) << "KActionCollection::operator=(): function is severely deprecated." << endl; 660 kdWarning(129) << "KActionCollection::operator=(): function is severely deprecated." << endl;
659 //d->m_bOneKAccelOnly = copy.d->m_bOneKAccelOnly; 661 //d->m_bOneKAccelOnly = copy.d->m_bOneKAccelOnly;
660 //d->m_iWidgetCurrent = copy.d->m_iWidgetCurrent; 662 //d->m_iWidgetCurrent = copy.d->m_iWidgetCurrent;
661 //d->m_widgetList = copy.d->m_widgetList; 663 //d->m_widgetList = copy.d->m_widgetList;
662 //d->m_kaccelList = copy.d->m_kaccelList; 664 //d->m_kaccelList = copy.d->m_kaccelList;
663 d->m_widget = copy.d->m_widget; 665 d->m_widget = copy.d->m_widget;
664 d->m_kaccel = copy.d->m_kaccel; 666 d->m_kaccel = copy.d->m_kaccel;
665 d->m_actionDict = copy.d->m_actionDict; 667 d->m_actionDict = copy.d->m_actionDict;
666//US setInstance( copy.instance() ); 668//US setInstance( copy.instance() );
667 return *this; 669 return *this;
668} 670}
669 671
670KActionCollection &KActionCollection::operator+=( const KActionCollection &c ) 672KActionCollection &KActionCollection::operator+=( const KActionCollection &c )
671{ 673{
672 kdWarning(129) << "KActionCollection::operator+=(): function is severely deprecated." << endl; 674 kdWarning(129) << "KActionCollection::operator+=(): function is severely deprecated." << endl;
673 QAsciiDictIterator<KAction> it(c.d->m_actionDict); 675 Q3AsciiDictIterator<KAction> it(c.d->m_actionDict);
674 for ( ; it.current(); ++it ) 676 for ( ; it.current(); ++it )
675 insert( it.current() ); 677 insert( it.current() );
676 678
677 return *this; 679 return *this;
678} 680}
679// KDE 4: remove end 681// KDE 4: remove end
680 682
681//--------------------------------------------------------------------- 683//---------------------------------------------------------------------
682// KActionShortcutList 684// KActionShortcutList
683//--------------------------------------------------------------------- 685//---------------------------------------------------------------------
684/*US 686/*US
685KActionShortcutList::KActionShortcutList( KActionCollection* pColl ) 687KActionShortcutList::KActionShortcutList( KActionCollection* pColl )
686: m_actions( *pColl ) 688: m_actions( *pColl )
687 { } 689 { }
688KActionShortcutList::~KActionShortcutList() 690KActionShortcutList::~KActionShortcutList()
689 { } 691 { }
690uint KActionShortcutList::count() const 692uint KActionShortcutList::count() const
691 { return m_actions.count(); } 693 { return m_actions.count(); }
692QString KActionShortcutList::name( uint i ) const 694QString KActionShortcutList::name( uint i ) const
693 { return m_actions.action(i)->name(); } 695 { return m_actions.action(i)->name(); }
694QString KActionShortcutList::label( uint i ) const 696QString KActionShortcutList::label( uint i ) const
695 { return m_actions.action(i)->text(); } 697 { return m_actions.action(i)->text(); }
696QString KActionShortcutList::whatsThis( uint i ) const 698QString KActionShortcutList::whatsThis( uint i ) const
697 { return m_actions.action(i)->whatsThis(); } 699 { return m_actions.action(i)->whatsThis(); }
698const KShortcut& KActionShortcutList::shortcut( uint i ) const 700const KShortcut& KActionShortcutList::shortcut( uint i ) const
699 { return m_actions.action(i)->shortcut(); } 701 { return m_actions.action(i)->shortcut(); }
700const KShortcut& KActionShortcutList::shortcutDefault( uint i ) const 702const KShortcut& KActionShortcutList::shortcutDefault( uint i ) const
701 { return m_actions.action(i)->shortcutDefault(); } 703 { return m_actions.action(i)->shortcutDefault(); }
702bool KActionShortcutList::isConfigurable( uint i ) const 704bool KActionShortcutList::isConfigurable( uint i ) const
703 { return m_actions.action(i)->isShortcutConfigurable(); } 705 { return m_actions.action(i)->isShortcutConfigurable(); }
704bool KActionShortcutList::setShortcut( uint i, const KShortcut& cut ) 706bool KActionShortcutList::setShortcut( uint i, const KShortcut& cut )
705 { return m_actions.action(i)->setShortcut( cut ); } 707 { return m_actions.action(i)->setShortcut( cut ); }
706const KInstance* KActionShortcutList::instance() const 708const KInstance* KActionShortcutList::instance() const
707 { return m_actions.instance(); } 709 { return m_actions.instance(); }
708QVariant KActionShortcutList::getOther( Other, uint ) const 710QVariant KActionShortcutList::getOther( Other, uint ) const
709 { return QVariant(); } 711 { return QVariant(); }
710bool KActionShortcutList::setOther( Other, uint, QVariant ) 712bool KActionShortcutList::setOther( Other, uint, QVariant )
711 { return false; } 713 { return false; }
712 714
713bool KActionShortcutList::save() const 715bool KActionShortcutList::save() const
714{ 716{
715 kdDebug(129) << "KActionShortcutList::save(): xmlFile = " << m_actions.xmlFile() << endl; 717 kdDebug(129) << "KActionShortcutList::save(): xmlFile = " << m_actions.xmlFile() << endl;
716 718
717 if( m_actions.xmlFile().isEmpty() ) 719 if( m_actions.xmlFile().isEmpty() )
718 return writeSettings(); 720 return writeSettings();
719 721
720 QString tagActionProp = QString::fromLatin1("ActionProperties"); 722 QString tagActionProp = QString::fromLatin1("ActionProperties");
721 QString tagAction = QString::fromLatin1("Action"); 723 QString tagAction = QString::fromLatin1("Action");