00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "kactionclasses.h"
00028
00029 #include <assert.h>
00030 #include <fontconfig/fontconfig.h>
00031
00032 #include <qcursor.h>
00033 #include <qclipboard.h>
00034 #include <qfontdatabase.h>
00035 #include <qobjectlist.h>
00036 #include <qwhatsthis.h>
00037 #include <qtimer.h>
00038 #include <qregexp.h>
00039
00040 #include <dcopclient.h>
00041 #include <dcopref.h>
00042 #include <kaccel.h>
00043 #include <kapplication.h>
00044 #include <kconfig.h>
00045 #include <kdebug.h>
00046 #include <kfontcombo.h>
00047 #include <kfontdialog.h>
00048 #include <klocale.h>
00049 #include <kmainwindow.h>
00050 #include <kmenubar.h>
00051 #include <kpopupmenu.h>
00052 #include <ktoolbar.h>
00053 #include <ktoolbarbutton.h>
00054 #include <kurl.h>
00055 #include <kstandarddirs.h>
00056 #include <kstringhandler.h>
00057
00058 class KToggleAction::KToggleActionPrivate
00059 {
00060 public:
00061 KToggleActionPrivate()
00062 {
00063 m_checked = false;
00064 m_checkedGuiItem = 0;
00065 }
00066
00067 bool m_checked;
00068 QString m_exclusiveGroup;
00069 KGuiItem* m_checkedGuiItem;
00070 };
00071
00072 KToggleAction::KToggleAction( const QString& text, const KShortcut& cut,
00073 QObject* parent,
00074 const char* name )
00075 : KAction( text, cut, parent, name )
00076 {
00077 d = new KToggleActionPrivate;
00078 }
00079
00080 KToggleAction::KToggleAction( const QString& text, const KShortcut& cut,
00081 const QObject* receiver, const char* slot,
00082 QObject* parent, const char* name )
00083 : KAction( text, cut, receiver, slot, parent, name )
00084 {
00085 d = new KToggleActionPrivate;
00086 }
00087
00088 KToggleAction::KToggleAction( const QString& text, const QIconSet& pix,
00089 const KShortcut& cut,
00090 QObject* parent, const char* name )
00091 : KAction( text, pix, cut, parent, name )
00092 {
00093 d = new KToggleActionPrivate;
00094 }
00095
00096 KToggleAction::KToggleAction( const QString& text, const QString& pix,
00097 const KShortcut& cut,
00098 QObject* parent, const char* name )
00099 : KAction( text, pix, cut, parent, name )
00100 {
00101 d = new KToggleActionPrivate;
00102 }
00103
00104 KToggleAction::KToggleAction( const QString& text, const QIconSet& pix,
00105 const KShortcut& cut,
00106 const QObject* receiver,
00107 const char* slot, QObject* parent,
00108 const char* name )
00109 : KAction( text, pix, cut, receiver, slot, parent, name )
00110 {
00111 d = new KToggleActionPrivate;
00112 }
00113
00114 KToggleAction::KToggleAction( const QString& text, const QString& pix,
00115 const KShortcut& cut,
00116 const QObject* receiver,
00117 const char* slot, QObject* parent,
00118 const char* name )
00119 : KAction( text, pix, cut, receiver, slot, parent, name )
00120 {
00121 d = new KToggleActionPrivate;
00122 }
00123
00124 KToggleAction::KToggleAction( QObject* parent, const char* name )
00125 : KAction( parent, name )
00126 {
00127 d = new KToggleActionPrivate;
00128 }
00129
00130 KToggleAction::~KToggleAction()
00131 {
00132 delete d->m_checkedGuiItem;
00133 delete d;
00134 }
00135
00136 int KToggleAction::plug( QWidget* widget, int index )
00137 {
00138 if ( !::qt_cast<QPopupMenu *>( widget ) && !::qt_cast<KToolBar *>( widget ) )
00139 {
00140 kdWarning() << "Can not plug KToggleAction in " << widget->className() << endl;
00141 return -1;
00142 }
00143 if (kapp && !kapp->authorizeKAction(name()))
00144 return -1;
00145
00146 int _index = KAction::plug( widget, index );
00147 if ( _index == -1 )
00148 return _index;
00149
00150 if ( ::qt_cast<KToolBar *>( widget ) ) {
00151 KToolBar *bar = static_cast<KToolBar *>( widget );
00152
00153 bar->setToggle( itemId( _index ), true );
00154 bar->setButton( itemId( _index ), isChecked() );
00155 }
00156
00157 if ( d->m_checked )
00158 updateChecked( _index );
00159
00160 return _index;
00161 }
00162
00163 void KToggleAction::setChecked( bool c )
00164 {
00165 if ( c == d->m_checked )
00166 return;
00167
00168
00169 d->m_checked = c;
00170
00171 int len = containerCount();
00172
00173 for( int i = 0; i < len; ++i )
00174 updateChecked( i );
00175
00176 if ( c && parent() && !exclusiveGroup().isEmpty() ) {
00177 const QObjectList *list = parent()->children();
00178 if ( list ) {
00179 QObjectListIt it( *list );
00180 for( ; it.current(); ++it ) {
00181 if ( ::qt_cast<KToggleAction *>( it.current() ) && it.current() != this &&
00182 static_cast<KToggleAction*>(it.current())->exclusiveGroup() == exclusiveGroup() ) {
00183 KToggleAction *a = static_cast<KToggleAction*>(it.current());
00184 if( a->isChecked() ) {
00185 a->setChecked( false );
00186 emit a->toggled( false );
00187 }
00188 }
00189 }
00190 }
00191 }
00192 }
00193
00194 void KToggleAction::updateChecked( int id )
00195 {
00196 QWidget *w = container( id );
00197
00198 if ( ::qt_cast<QPopupMenu *>( w ) ) {
00199 QPopupMenu* pm = static_cast<QPopupMenu*>(w);
00200 int itemId_ = itemId( id );
00201 if ( !d->m_checkedGuiItem )
00202 pm->setItemChecked( itemId_, d->m_checked );
00203 else {
00204 const KGuiItem* gui = d->m_checked ? d->m_checkedGuiItem : &guiItem();
00205 if ( d->m_checkedGuiItem->hasIcon() )
00206 pm->changeItem( itemId_, gui->iconSet( KIcon::Small ), gui->text() );
00207 else
00208 pm->changeItem( itemId_, gui->text() );
00209 if ( !d->m_checkedGuiItem->whatsThis().isEmpty() )
00210 pm->setWhatsThis( itemId_, gui->whatsThis() );
00211 updateShortcut( pm, itemId_ );
00212 }
00213 }
00214 else if ( ::qt_cast<QMenuBar *>( w ) )
00215 static_cast<QMenuBar*>(w)->setItemChecked( itemId( id ), d->m_checked );
00216 else if ( ::qt_cast<KToolBar *>( w ) )
00217 {
00218 QWidget* r = static_cast<KToolBar*>( w )->getButton( itemId( id ) );
00219 if ( r && ::qt_cast<KToolBarButton *>( r ) ) {
00220 static_cast<KToolBar*>( w )->setButton( itemId( id ), d->m_checked );
00221 if ( d->m_checkedGuiItem && d->m_checkedGuiItem->hasIcon() ) {
00222 const KGuiItem* gui = d->m_checked ? d->m_checkedGuiItem : &guiItem();
00223 static_cast<KToolBar*>( w )->setButtonIconSet( itemId( id ), gui->iconSet( KIcon::Toolbar ) );
00224 }
00225 }
00226 }
00227 }
00228
00229 void KToggleAction::slotActivated()
00230 {
00231 setChecked( !isChecked() );
00232 KAction::slotActivated();
00233 emit toggled( isChecked() );
00234 }
00235
00236 bool KToggleAction::isChecked() const
00237 {
00238 return d->m_checked;
00239 }
00240
00241 void KToggleAction::setExclusiveGroup( const QString& name )
00242 {
00243 d->m_exclusiveGroup = name;
00244 }
00245
00246 QString KToggleAction::exclusiveGroup() const
00247 {
00248 return d->m_exclusiveGroup;
00249 }
00250
00251 void KToggleAction::setCheckedState( const KGuiItem& checkedItem )
00252 {
00253 delete d->m_checkedGuiItem;
00254 d->m_checkedGuiItem = new KGuiItem( checkedItem );
00255 }
00256
00257 QString KToggleAction::toolTip() const
00258 {
00259 if ( d->m_checkedGuiItem && d->m_checked )
00260 return d->m_checkedGuiItem->toolTip();
00261 else
00262 return KAction::toolTip();
00263 }
00264
00265 KRadioAction::KRadioAction( const QString& text, const KShortcut& cut,
00266 QObject* parent, const char* name )
00267 : KToggleAction( text, cut, parent, name )
00268 {
00269 }
00270
00271 KRadioAction::KRadioAction( const QString& text, const KShortcut& cut,
00272 const QObject* receiver, const char* slot,
00273 QObject* parent, const char* name )
00274 : KToggleAction( text, cut, receiver, slot, parent, name )
00275 {
00276 }
00277
00278 KRadioAction::KRadioAction( const QString& text, const QIconSet& pix,
00279 const KShortcut& cut,
00280 QObject* parent, const char* name )
00281 : KToggleAction( text, pix, cut, parent, name )
00282 {
00283 }
00284
00285 KRadioAction::KRadioAction( const QString& text, const QString& pix,
00286 const KShortcut& cut,
00287 QObject* parent, const char* name )
00288 : KToggleAction( text, pix, cut, parent, name )
00289 {
00290 }
00291
00292 KRadioAction::KRadioAction( const QString& text, const QIconSet& pix,
00293 const KShortcut& cut,
00294 const QObject* receiver, const char* slot,
00295 QObject* parent, const char* name )
00296 : KToggleAction( text, pix, cut, receiver, slot, parent, name )
00297 {
00298 }
00299
00300 KRadioAction::KRadioAction( const QString& text, const QString& pix,
00301 const KShortcut& cut,
00302 const QObject* receiver, const char* slot,
00303 QObject* parent, const char* name )
00304 : KToggleAction( text, pix, cut, receiver, slot, parent, name )
00305 {
00306 }
00307
00308 KRadioAction::KRadioAction( QObject* parent, const char* name )
00309 : KToggleAction( parent, name )
00310 {
00311 }
00312
00313 void KRadioAction::slotActivated()
00314 {
00315 if ( isChecked() )
00316 {
00317 const QObject *senderObj = sender();
00318
00319 if ( !senderObj || !::qt_cast<const KToolBarButton *>( senderObj ) )
00320 return;
00321
00322 const_cast<KToolBarButton *>( static_cast<const KToolBarButton *>( senderObj ) )->on( true );
00323
00324 return;
00325 }
00326
00327 KToggleAction::slotActivated();
00328 }
00329
00330 class KSelectAction::KSelectActionPrivate
00331 {
00332 public:
00333 KSelectActionPrivate()
00334 {
00335 m_edit = false;
00336 m_menuAccelsEnabled = true;
00337 m_menu = 0;
00338 m_current = -1;
00339 m_comboWidth = -1;
00340 }
00341 bool m_edit;
00342 bool m_menuAccelsEnabled;
00343 QPopupMenu *m_menu;
00344 int m_current;
00345 int m_comboWidth;
00346 QStringList m_list;
00347
00348 QString makeMenuText( const QString &_text )
00349 {
00350 if ( m_menuAccelsEnabled )
00351 return _text;
00352 QString text = _text;
00353 uint i = 0;
00354 while ( i < text.length() ) {
00355 if ( text[ i ] == '&' ) {
00356 text.insert( i, '&' );
00357 i += 2;
00358 }
00359 else
00360 ++i;
00361 }
00362 return text;
00363 }
00364 };
00365
00366 KSelectAction::KSelectAction( const QString& text, const KShortcut& cut,
00367 QObject* parent, const char* name )
00368 : KAction( text, cut, parent, name )
00369 {
00370 d = new KSelectActionPrivate;
00371 }
00372
00373 KSelectAction::KSelectAction( const QString& text, const KShortcut& cut,
00374 const QObject* receiver, const char* slot,
00375 QObject* parent, const char* name )
00376 : KAction( text, cut, receiver, slot, parent, name )
00377 {
00378 d = new KSelectActionPrivate;
00379 }
00380
00381 KSelectAction::KSelectAction( const QString& text, const QIconSet& pix,
00382 const KShortcut& cut,
00383 QObject* parent, const char* name )
00384 : KAction( text, pix, cut, parent, name )
00385 {
00386 d = new KSelectActionPrivate;
00387 }
00388
00389 KSelectAction::KSelectAction( const QString& text, const QString& pix,
00390 const KShortcut& cut,
00391 QObject* parent, const char* name )
00392 : KAction( text, pix, cut, parent, name )
00393 {
00394 d = new KSelectActionPrivate;
00395 }
00396
00397 KSelectAction::KSelectAction( const QString& text, const QIconSet& pix,
00398 const KShortcut& cut,
00399 const QObject* receiver,
00400 const char* slot, QObject* parent,
00401 const char* name )
00402 : KAction( text, pix, cut, receiver, slot, parent, name )
00403 {
00404 d = new KSelectActionPrivate;
00405 }
00406
00407 KSelectAction::KSelectAction( const QString& text, const QString& pix,
00408 const KShortcut& cut,
00409 const QObject* receiver,
00410 const char* slot, QObject* parent,
00411 const char* name )
00412 : KAction( text, pix, cut, receiver, slot, parent, name )
00413 {
00414 d = new KSelectActionPrivate;
00415 }
00416
00417 KSelectAction::KSelectAction( QObject* parent, const char* name )
00418 : KAction( parent, name )
00419 {
00420 d = new KSelectActionPrivate;
00421 }
00422
00423 KSelectAction::~KSelectAction()
00424 {
00425 assert(d);
00426 delete d->m_menu;
00427 delete d; d = 0;
00428 }
00429
00430 void KSelectAction::setCurrentItem( int id )
00431 {
00432 if ( id >= (int)d->m_list.count() ) {
00433 Q_ASSERT(id < (int)d->m_list.count());
00434 return;
00435 }
00436
00437 if ( d->m_menu )
00438 {
00439 if ( d->m_current >= 0 )
00440 d->m_menu->setItemChecked( d->m_current, false );
00441 if ( id >= 0 )
00442 d->m_menu->setItemChecked( id, true );
00443 }
00444
00445 d->m_current = id;
00446
00447 int len = containerCount();
00448
00449 for( int i = 0; i < len; ++i )
00450 updateCurrentItem( i );
00451
00452
00453
00454
00455 }
00456
00457 void KSelectAction::setComboWidth( int width )
00458 {
00459 if ( width < 0 )
00460 return;
00461
00462 d->m_comboWidth=width;
00463
00464 int len = containerCount();
00465
00466 for( int i = 0; i < len; ++i )
00467 updateComboWidth( i );
00468
00469 }
00470 QPopupMenu* KSelectAction::popupMenu() const
00471 {
00472 kdDebug(129) << "KAction::popupMenu()" << endl;
00473 if ( !d->m_menu )
00474 {
00475 d->m_menu = new KPopupMenu(0L, "KSelectAction::popupMenu()");
00476 setupMenu();
00477 if ( d->m_current >= 0 )
00478 d->m_menu->setItemChecked( d->m_current, true );
00479 }
00480
00481 return d->m_menu;
00482 }
00483
00484 void KSelectAction::setupMenu() const
00485 {
00486 if ( !d->m_menu )
00487 return;
00488 d->m_menu->clear();
00489
00490 QStringList::ConstIterator it = d->m_list.begin();
00491 for( uint id = 0; it != d->m_list.end(); ++it, ++id ) {
00492 QString text = *it;
00493 if ( !text.isEmpty() )
00494 d->m_menu->insertItem( d->makeMenuText( text ), this, SLOT( slotActivated( int ) ), 0, id );
00495 else
00496 d->m_menu->insertSeparator();
00497 }
00498 }
00499
00500 void KSelectAction::changeItem( int index, const QString& text )
00501 {
00502 if ( index < 0 || index >= (int)d->m_list.count() )
00503 {
00504 kdWarning() << "KSelectAction::changeItem Index out of scope" << endl;
00505 return;
00506 }
00507
00508 d->m_list[ index ] = text;
00509
00510 if ( d->m_menu )
00511 d->m_menu->changeItem( index, d->makeMenuText( text ) );
00512
00513 int len = containerCount();
00514 for( int i = 0; i < len; ++i )
00515 changeItem( i, index, text );
00516 }
00517
00518 void KSelectAction::changeItem( int id, int index, const QString& text)
00519 {
00520 if ( index < 0 )
00521 return;
00522
00523 QWidget* w = container( id );
00524 if ( ::qt_cast<KToolBar *>( w ) )
00525 {
00526 QWidget* r = (static_cast<KToolBar*>( w ))->getWidget( itemId( id ) );
00527 if ( ::qt_cast<QComboBox *>( r ) )
00528 {
00529 QComboBox *b = static_cast<QComboBox*>( r );
00530 b->changeItem(text, index );
00531 }
00532 }
00533 }
00534
00535 void KSelectAction::setItems( const QStringList &lst )
00536 {
00537 d->m_list = lst;
00538 d->m_current = -1;
00539
00540 setupMenu();
00541
00542 int len = containerCount();
00543 for( int i = 0; i < len; ++i )
00544 updateItems( i );
00545
00546
00547 setEnabled ( lst.count() > 0 || d->m_edit );
00548 }
00549
00550 QStringList KSelectAction::items() const
00551 {
00552 return d->m_list;
00553 }
00554
00555 QString KSelectAction::currentText() const
00556 {
00557 if ( currentItem() < 0 )
00558 return QString::null;
00559
00560 return d->m_list[ currentItem() ];
00561 }
00562
00563 int KSelectAction::currentItem() const
00564 {
00565 return d->m_current;
00566 }
00567
00568 void KSelectAction::updateCurrentItem( int id )
00569 {
00570 if ( d->m_current < 0 )
00571 return;
00572
00573 QWidget* w = container( id );
00574 if ( ::qt_cast<KToolBar *>( w ) ) {
00575 QWidget* r = static_cast<KToolBar*>( w )->getWidget( itemId( id ) );
00576 if ( ::qt_cast<QComboBox *>( r ) ) {
00577 QComboBox *b = static_cast<QComboBox*>( r );
00578 b->setCurrentItem( d->m_current );
00579 }
00580 }
00581 }
00582
00583 int KSelectAction::comboWidth() const
00584 {
00585 return d->m_comboWidth;
00586 }
00587
00588 void KSelectAction::updateComboWidth( int id )
00589 {
00590 QWidget* w = container( id );
00591 if ( ::qt_cast<KToolBar *>( w ) ) {
00592 QWidget* r = static_cast<KToolBar*>( w )->getWidget( itemId( id ) );
00593 if ( ::qt_cast<QComboBox *>( r ) ) {
00594 QComboBox *cb = static_cast<QComboBox*>( r );
00595 cb->setMinimumWidth( d->m_comboWidth );
00596 cb->setMaximumWidth( d->m_comboWidth );
00597 }
00598 }
00599 }
00600
00601 void KSelectAction::updateItems( int id )
00602 {
00603 kdDebug(129) << "KAction::updateItems( " << id << ", lst )" << endl;
00604 QWidget* w = container( id );
00605 if ( ::qt_cast<KToolBar *>( w ) ) {
00606 QWidget* r = static_cast<KToolBar*>( w )->getWidget( itemId( id ) );
00607 if ( ::qt_cast<QComboBox *>( r ) ) {
00608 QComboBox *cb = static_cast<QComboBox*>( r );
00609 cb->clear();
00610 QStringList lst = comboItems();
00611 QStringList::ConstIterator it = lst.begin();
00612 for( ; it != lst.end(); ++it )
00613 cb->insertItem( *it );
00614
00615
00616
00617
00618 cb->unsetFont();
00619 }
00620 }
00621 }
00622
00623 int KSelectAction::plug( QWidget *widget, int index )
00624 {
00625 if (kapp && !kapp->authorizeKAction(name()))
00626 return -1;
00627 kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl;
00628 if ( ::qt_cast<QPopupMenu *>( widget) )
00629 {
00630
00631 (void)popupMenu();
00632
00633 QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
00634 int id;
00635 if ( hasIcon() )
00636 id = menu->insertItem( iconSet(), text(), d->m_menu, -1, index );
00637 else
00638 id = menu->insertItem( text(), d->m_menu, -1, index );
00639
00640 if ( !isEnabled() )
00641 menu->setItemEnabled( id, false );
00642
00643 QString wth = whatsThis();
00644 if ( !wth.isEmpty() )
00645 menu->setWhatsThis( id, wth );
00646
00647 addContainer( menu, id );
00648 connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
00649
00650 return containerCount() - 1;
00651 }
00652 else if ( ::qt_cast<KToolBar *>( widget ) )
00653 {
00654 KToolBar* bar = static_cast<KToolBar*>( widget );
00655 int id_ = KAction::getToolButtonID();
00656 bar->insertCombo( comboItems(), id_, isEditable(),
00657 SIGNAL( activated( const QString & ) ), this,
00658 SLOT( slotActivated( const QString & ) ), isEnabled(),
00659 toolTip(), -1, index );
00660
00661 QComboBox *cb = bar->getCombo( id_ );
00662 if ( cb )
00663 {
00664 if (!isEditable()) cb->setFocusPolicy(QWidget::NoFocus);
00665 cb->setMinimumWidth( cb->sizeHint().width() );
00666 if ( d->m_comboWidth > 0 )
00667 {
00668 cb->setMinimumWidth( d->m_comboWidth );
00669 cb->setMaximumWidth( d->m_comboWidth );
00670 }
00671 cb->setInsertionPolicy( QComboBox::NoInsertion );
00672 QWhatsThis::add( cb, whatsThis() );
00673 }
00674
00675 addContainer( bar, id_ );
00676
00677 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
00678
00679 updateCurrentItem( containerCount() - 1 );
00680
00681 return containerCount() - 1;
00682 }
00683 else if ( ::qt_cast<QMenuBar *>( widget ) )
00684 {
00685
00686 (void)popupMenu();
00687
00688 QMenuBar* menu = static_cast<QMenuBar*>( widget );
00689 int id = menu->insertItem( text(), d->m_menu, -1, index );
00690
00691 if ( !isEnabled() )
00692 menu->setItemEnabled( id, false );
00693
00694 QString wth = whatsThis();
00695 if ( !wth.isEmpty() )
00696 menu->setWhatsThis( id, wth );
00697
00698 addContainer( menu, id );
00699 connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
00700
00701 return containerCount() - 1;
00702 }
00703
00704 kdWarning() << "Can not plug KAction in " << widget->className() << endl;
00705 return -1;
00706 }
00707
00708 QStringList KSelectAction::comboItems() const
00709 {
00710 if( d->m_menuAccelsEnabled ) {
00711 QStringList lst;
00712 QStringList::ConstIterator it = d->m_list.begin();
00713 for( ; it != d->m_list.end(); ++it )
00714 {
00715 QString item = *it;
00716 int i = item.find( '&' );
00717 if ( i > -1 )
00718 item = item.remove( i, 1 );
00719 lst.append( item );
00720 }
00721 return lst;
00722 }
00723 else
00724 return d->m_list;
00725 }
00726
00727 void KSelectAction::clear()
00728 {
00729 if ( d->m_menu )
00730 d->m_menu->clear();
00731
00732 int len = containerCount();
00733 for( int i = 0; i < len; ++i )
00734 updateClear( i );
00735 }
00736
00737 void KSelectAction::updateClear( int id )
00738 {
00739 QWidget* w = container( id );
00740 if ( ::qt_cast<KToolBar *>( w ) ) {
00741 QWidget* r = static_cast<KToolBar*>( w )->getWidget( itemId( id ) );
00742 if ( ::qt_cast<QComboBox *>( r ) ) {
00743 QComboBox *b = static_cast<QComboBox*>( r );
00744 b->clear();
00745 }
00746 }
00747 }
00748
00749 void KSelectAction::slotActivated( int id )
00750 {
00751 if ( d->m_current == id )
00752 return;
00753
00754 setCurrentItem( id );
00755
00756
00757 QTimer::singleShot( 0, this, SLOT( slotActivated() ) );
00758 }
00759
00760 void KSelectAction::slotActivated( const QString &text )
00761 {
00762 if ( isEditable() )
00763 {
00764 QStringList lst = items();
00765 if(!lst.contains(text))
00766 {
00767 lst.append( text );
00768 setItems( lst );
00769 }
00770 }
00771
00772 int i = items().findIndex( text );
00773 if ( i > -1 )
00774 setCurrentItem( i );
00775 else
00776 setCurrentItem( comboItems().findIndex( text ) );
00777
00778
00779 QTimer::singleShot( 0, this, SLOT( slotActivated() ) );
00780 }
00781
00782 void KSelectAction::slotActivated()
00783 {
00784 KAction::slotActivated();
00785 kdDebug(129) << "KSelectAction::slotActivated currentItem=" << currentItem() << " currentText=" << currentText() << endl;
00786 emit activated( currentItem() );
00787 emit activated( currentText() );
00788 }
00789
00790 void KSelectAction::setEditable( bool edit )
00791 {
00792 d->m_edit = edit;
00793 }
00794
00795 bool KSelectAction::isEditable() const
00796 {
00797 return d->m_edit;
00798 }
00799
00800 void KSelectAction::setRemoveAmpersandsInCombo( bool b )
00801 {
00802 setMenuAccelsEnabled( b );
00803 }
00804
00805 bool KSelectAction::removeAmpersandsInCombo() const
00806 {
00807 return menuAccelsEnabled( );
00808 }
00809
00810 void KSelectAction::setMenuAccelsEnabled( bool b )
00811 {
00812 d->m_menuAccelsEnabled = b;
00813 }
00814
00815 bool KSelectAction::menuAccelsEnabled() const
00816 {
00817 return d->m_menuAccelsEnabled;
00818 }
00819
00820 class KListAction::KListActionPrivate
00821 {
00822 public:
00823 KListActionPrivate()
00824 {
00825 m_current = 0;
00826 }
00827 int m_current;
00828 };
00829
00830 KListAction::KListAction( const QString& text, const KShortcut& cut,
00831 QObject* parent, const char* name )
00832 : KSelectAction( text, cut, parent, name )
00833 {
00834 d = new KListActionPrivate;
00835 }
00836
00837 KListAction::KListAction( const QString& text, const KShortcut& cut,
00838 const QObject* receiver, const char* slot,
00839 QObject* parent, const char* name )
00840 : KSelectAction( text, cut, parent, name )
00841 {
00842 d = new KListActionPrivate;
00843 if ( receiver )
00844 connect( this, SIGNAL( activated( int ) ), receiver, slot );
00845 }
00846
00847 KListAction::KListAction( const QString& text, const QIconSet& pix,
00848 const KShortcut& cut,
00849 QObject* parent, const char* name )
00850 : KSelectAction( text, pix, cut, parent, name )
00851 {
00852 d = new KListActionPrivate;
00853 }
00854
00855 KListAction::KListAction( const QString& text, const QString& pix,
00856 const KShortcut& cut,
00857 QObject* parent, const char* name )
00858 : KSelectAction( text, pix, cut, parent, name )
00859 {
00860 d = new KListActionPrivate;
00861 }
00862
00863 KListAction::KListAction( const QString& text, const QIconSet& pix,
00864 const KShortcut& cut, const QObject* receiver,
00865 const char* slot, QObject* parent,
00866 const char* name )
00867 : KSelectAction( text, pix, cut, parent, name )
00868 {
00869 d = new KListActionPrivate;
00870 if ( receiver )
00871 connect( this, SIGNAL( activated( int ) ), receiver, slot );
00872 }
00873
00874 KListAction::KListAction( const QString& text, const QString& pix,
00875 const KShortcut& cut, const QObject* receiver,
00876 const char* slot, QObject* parent,
00877 const char* name )
00878 : KSelectAction( text, pix, cut, parent, name )
00879 {
00880 d = new KListActionPrivate;
00881 if ( receiver )
00882 connect( this, SIGNAL( activated( int ) ), receiver, slot );
00883 }
00884
00885 KListAction::KListAction( QObject* parent, const char* name )
00886 : KSelectAction( parent, name )
00887 {
00888 d = new KListActionPrivate;
00889 }
00890
00891 KListAction::~KListAction()
00892 {
00893 delete d; d = 0;
00894 }
00895
00896 void KListAction::setCurrentItem( int index )
00897 {
00898 KSelectAction::setCurrentItem( index );
00899 d->m_current = index;
00900
00901
00902
00903
00904 }
00905
00906 QString KListAction::currentText() const
00907 {
00908 if ( currentItem() < 0 )
00909 return QString::null;
00910
00911 return items()[ currentItem() ];
00912 }
00913
00914 int KListAction::currentItem() const
00915 {
00916 return d->m_current;
00917 }
00918
00919 class KRecentFilesAction::KRecentFilesActionPrivate
00920 {
00921 public:
00922 KRecentFilesActionPrivate()
00923 {
00924 m_maxItems = 0;
00925 m_popup = 0;
00926 }
00927 uint m_maxItems;
00928 KPopupMenu *m_popup;
00929 };
00930
00931 KRecentFilesAction::KRecentFilesAction( const QString& text,
00932 const KShortcut& cut,
00933 QObject* parent, const char* name,
00934 uint maxItems )
00935 : KListAction( text, cut, parent, name)
00936 {
00937 d = new KRecentFilesActionPrivate;
00938 d->m_maxItems = maxItems;
00939
00940 init();
00941 }
00942
00943 KRecentFilesAction::KRecentFilesAction( const QString& text,
00944 const KShortcut& cut,
00945 const QObject* receiver,
00946 const char* slot,
00947 QObject* parent, const char* name,
00948 uint maxItems )
00949 : KListAction( text, cut, parent, name)
00950 {
00951 d = new KRecentFilesActionPrivate;
00952 d->m_maxItems = maxItems;
00953
00954 init();
00955
00956 if ( receiver )
00957 connect( this, SIGNAL(urlSelected(const KURL&)),
00958 receiver, slot );
00959 }
00960
00961 KRecentFilesAction::KRecentFilesAction( const QString& text,
00962 const QIconSet& pix,
00963 const KShortcut& cut,
00964 QObject* parent, const char* name,
00965 uint maxItems )
00966 : KListAction( text, pix, cut, parent, name)
00967 {
00968 d = new KRecentFilesActionPrivate;
00969 d->m_maxItems = maxItems;
00970
00971 init();
00972 }
00973
00974 KRecentFilesAction::KRecentFilesAction( const QString& text,
00975 const QString& pix,
00976 const KShortcut& cut,
00977 QObject* parent, const char* name,
00978 uint maxItems )
00979 : KListAction( text, pix, cut, parent, name)
00980 {
00981 d = new KRecentFilesActionPrivate;
00982 d->m_maxItems = maxItems;
00983
00984 init();
00985 }
00986
00987 KRecentFilesAction::KRecentFilesAction( const QString& text,
00988 const QIconSet& pix,
00989 const KShortcut& cut,
00990 const QObject* receiver,
00991 const char* slot,
00992 QObject* parent, const char* name,
00993 uint maxItems )
00994 : KListAction( text, pix, cut, parent, name)
00995 {
00996 d = new KRecentFilesActionPrivate;
00997 d->m_maxItems = maxItems;
00998
00999 init();
01000
01001 if ( receiver )
01002 connect( this, SIGNAL(urlSelected(const KURL&)),
01003 receiver, slot );
01004 }
01005
01006 KRecentFilesAction::KRecentFilesAction( const QString& text,
01007 const QString& pix,
01008 const KShortcut& cut,
01009 const QObject* receiver,
01010 const char* slot,
01011 QObject* parent, const char* name,
01012 uint maxItems )
01013 : KListAction( text, pix, cut, parent, name)
01014 {
01015 d = new KRecentFilesActionPrivate;
01016 d->m_maxItems = maxItems;
01017
01018 init();
01019
01020 if ( receiver )
01021 connect( this, SIGNAL(urlSelected(const KURL&)),
01022 receiver, slot );
01023 }
01024
01025 KRecentFilesAction::KRecentFilesAction( QObject* parent, const char* name,
01026 uint maxItems )
01027 : KListAction( parent, name )
01028 {
01029 d = new KRecentFilesActionPrivate;
01030 d->m_maxItems = maxItems;
01031
01032 init();
01033 }
01034
01035 void KRecentFilesAction::init()
01036 {
01037 KRecentFilesAction *that = const_cast<KRecentFilesAction*>(this);
01038 that->d->m_popup = new KPopupMenu;
01039 connect(d->m_popup, SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()));
01040 connect(d->m_popup, SIGNAL(activated(int)), this, SLOT(menuItemActivated(int)));
01041 connect( this, SIGNAL( activated( const QString& ) ),
01042 this, SLOT( itemSelected( const QString& ) ) );
01043
01044 setMenuAccelsEnabled( false );
01045 }
01046
01047 KRecentFilesAction::~KRecentFilesAction()
01048 {
01049 delete d->m_popup;
01050 delete d; d = 0;
01051 }
01052
01053 uint KRecentFilesAction::maxItems() const
01054 {
01055 return d->m_maxItems;
01056 }
01057
01058 void KRecentFilesAction::setMaxItems( uint maxItems )
01059 {
01060 QStringList lst = items();
01061 uint oldCount = lst.count();
01062
01063
01064 d->m_maxItems = maxItems;
01065
01066
01067 while( lst.count() > maxItems )
01068 {
01069
01070 lst.remove( lst.last() );
01071 }
01072
01073
01074 if( lst.count() != oldCount )
01075 setItems( lst );
01076 }
01077
01078 void KRecentFilesAction::addURL( const KURL& url )
01079 {
01080 if ( url.isLocalFile() && !KGlobal::dirs()->relativeLocation("tmp", url.path()).startsWith("/"))
01081 return;
01082 QString file = url.pathOrURL();
01083 QStringList lst = items();
01084
01085
01086 lst.remove( file );
01087
01088
01089 if( lst.count() == d->m_maxItems )
01090 {
01091
01092 lst.remove( lst.last() );
01093 }
01094
01095
01096 lst.prepend( file );
01097 setItems( lst );
01098 }
01099
01100 void KRecentFilesAction::removeURL( const KURL& url )
01101 {
01102 QStringList lst = items();
01103 QString file = url.pathOrURL();
01104
01105
01106 if( lst.count() > 0 )
01107 {
01108 lst.remove( file );
01109 setItems( lst );
01110 }
01111 }
01112
01113 void KRecentFilesAction::clearURLList()
01114 {
01115 clear();
01116 }
01117
01118 void KRecentFilesAction::loadEntries( KConfig* config, QString groupname)
01119 {
01120 QString key;
01121 QString value;
01122 QString oldGroup;
01123 QStringList lst;
01124
01125 oldGroup = config->group();
01126
01127 if (groupname.isEmpty())
01128 groupname = "RecentFiles";
01129 config->setGroup( groupname );
01130
01131
01132 for( unsigned int i = 1 ; i <= d->m_maxItems ; i++ )
01133 {
01134 key = QString( "File%1" ).arg( i );
01135 value = config->readPathEntry( key );
01136
01137 if (!value.isNull())
01138 lst.append( value );
01139 }
01140
01141
01142 setItems( lst );
01143
01144 config->setGroup( oldGroup );
01145 }
01146
01147 void KRecentFilesAction::saveEntries( KConfig* config, QString groupname )
01148 {
01149 QString key;
01150 QString value;
01151 QString oldGroup;
01152 QStringList lst = items();
01153
01154 oldGroup = config->group();
01155
01156 if (groupname.isEmpty())
01157 groupname = "RecentFiles";
01158 config->deleteGroup( groupname, true );
01159 config->setGroup( groupname );
01160
01161
01162 for( unsigned int i = 1 ; i <= lst.count() ; i++ )
01163 {
01164 key = QString( "File%1" ).arg( i );
01165 value = lst[ i - 1 ];
01166 config->writePathEntry( key, value );
01167 }
01168
01169 config->setGroup( oldGroup );
01170 }
01171
01172 void KRecentFilesAction::itemSelected( const QString& text )
01173 {
01174 emit urlSelected( KURL( text ) );
01175 }
01176
01177 void KRecentFilesAction::menuItemActivated( int id )
01178 {
01179 emit urlSelected( KURL(d->m_popup->text(id)) );
01180 }
01181
01182 void KRecentFilesAction::menuAboutToShow()
01183 {
01184 KPopupMenu *menu = d->m_popup;
01185 menu->clear();
01186 QStringList list = items();
01187 for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
01188 menu->insertItem(*it);
01189 }
01190
01191 int KRecentFilesAction::plug( QWidget *widget, int index )
01192 {
01193 if (kapp && !kapp->authorizeKAction(name()))
01194 return -1;
01195
01196
01197 if ( ::qt_cast<KToolBar *>( widget ) )
01198 {
01199 KToolBar *bar = (KToolBar *)widget;
01200
01201 int id_ = KAction::getToolButtonID();
01202
01203 KInstance * instance;
01204 if ( m_parentCollection )
01205 instance = m_parentCollection->instance();
01206 else
01207 instance = KGlobal::instance();
01208
01209 bar->insertButton( icon(), id_, SIGNAL( clicked() ), this,
01210 SLOT( slotClicked() ), isEnabled(), plainText(),
01211 index, instance );
01212
01213 addContainer( bar, id_ );
01214
01215 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
01216
01217 bar->setDelayedPopup( id_, d->m_popup, true);
01218
01219 if ( !whatsThis().isEmpty() )
01220 QWhatsThis::add( bar->getButton( id_ ), whatsThisWithIcon() );
01221
01222 return containerCount() - 1;
01223 }
01224
01225 return KListAction::plug( widget, index );
01226 }
01227
01228 void KRecentFilesAction::slotClicked()
01229 {
01230 KAction::slotActivated();
01231 }
01232
01233 void KRecentFilesAction::slotActivated(const QString& text)
01234 {
01235 KListAction::slotActivated(text);
01236 }
01237
01238
01239 void KRecentFilesAction::slotActivated(int id)
01240 {
01241 KListAction::slotActivated(id);
01242 }
01243
01244
01245 void KRecentFilesAction::slotActivated()
01246 {
01247 emit activated( currentItem() );
01248 emit activated( currentText() );
01249 }
01250
01251
01252 class KFontAction::KFontActionPrivate
01253 {
01254 public:
01255 KFontActionPrivate()
01256 {
01257 }
01258 QStringList m_fonts;
01259 };
01260
01261 KFontAction::KFontAction( const QString& text,
01262 const KShortcut& cut, QObject* parent,
01263 const char* name )
01264 : KSelectAction( text, cut, parent, name )
01265 {
01266 d = new KFontActionPrivate;
01267 KFontChooser::getFontList( d->m_fonts, 0 );
01268 KSelectAction::setItems( d->m_fonts );
01269 setEditable( true );
01270 }
01271
01272 KFontAction::KFontAction( const QString& text, const KShortcut& cut,
01273 const QObject* receiver, const char* slot,
01274 QObject* parent, const char* name )
01275 : KSelectAction( text, cut, receiver, slot, parent, name )
01276 {
01277 d = new KFontActionPrivate;
01278 KFontChooser::getFontList( d->m_fonts, 0 );
01279 KSelectAction::setItems( d->m_fonts );
01280 setEditable( true );
01281 }
01282
01283 KFontAction::KFontAction( const QString& text, const QIconSet& pix,
01284 const KShortcut& cut,
01285 QObject* parent, const char* name )
01286 : KSelectAction( text, pix, cut, parent, name )
01287 {
01288 d = new KFontActionPrivate;
01289 KFontChooser::getFontList( d->m_fonts, 0 );
01290 KSelectAction::setItems( d->m_fonts );
01291 setEditable( true );
01292 }
01293
01294 KFontAction::KFontAction( const QString& text, const QString& pix,
01295 const KShortcut& cut,
01296 QObject* parent, const char* name )
01297 : KSelectAction( text, pix, cut, parent, name )
01298 {
01299 d = new KFontActionPrivate;
01300 KFontChooser::getFontList( d->m_fonts, 0 );
01301 KSelectAction::setItems( d->m_fonts );
01302 setEditable( true );
01303 }
01304
01305 KFontAction::KFontAction( const QString& text, const QIconSet& pix,
01306 const KShortcut& cut,
01307 const QObject* receiver, const char* slot,
01308 QObject* parent, const char* name )
01309 : KSelectAction( text, pix, cut, receiver, slot, parent, name )
01310 {
01311 d = new KFontActionPrivate;
01312 KFontChooser::getFontList( d->m_fonts, 0 );
01313 KSelectAction::setItems( d->m_fonts );
01314 setEditable( true );
01315 }
01316
01317 KFontAction::KFontAction( const QString& text, const QString& pix,
01318 const KShortcut& cut,
01319 const QObject* receiver, const char* slot,
01320 QObject* parent, const char* name )
01321 : KSelectAction( text, pix, cut, receiver, slot, parent, name )
01322 {
01323 d = new KFontActionPrivate;
01324 KFontChooser::getFontList( d->m_fonts, 0 );
01325 KSelectAction::setItems( d->m_fonts );
01326 setEditable( true );
01327 }
01328
01329 KFontAction::KFontAction( uint fontListCriteria, const QString& text,
01330 const KShortcut& cut, QObject* parent,
01331 const char* name )
01332 : KSelectAction( text, cut, parent, name )
01333 {
01334 d = new KFontActionPrivate;
01335 KFontChooser::getFontList( d->m_fonts, fontListCriteria );
01336 KSelectAction::setItems( d->m_fonts );
01337 setEditable( true );
01338 }
01339
01340 KFontAction::KFontAction( uint fontListCriteria, const QString& text, const QString& pix,
01341 const KShortcut& cut,
01342 QObject* parent, const char* name )
01343 : KSelectAction( text, pix, cut, parent, name )
01344 {
01345 d = new KFontActionPrivate;
01346 KFontChooser::getFontList( d->m_fonts, fontListCriteria );
01347 KSelectAction::setItems( d->m_fonts );
01348 setEditable( true );
01349 }
01350
01351 KFontAction::KFontAction( QObject* parent, const char* name )
01352 : KSelectAction( parent, name )
01353 {
01354 d = new KFontActionPrivate;
01355 KFontChooser::getFontList( d->m_fonts, 0 );
01356 KSelectAction::setItems( d->m_fonts );
01357 setEditable( true );
01358 }
01359
01360 KFontAction::~KFontAction()
01361 {
01362 delete d;
01363 d = 0;
01364 }
01365
01366
01367
01368
01369 void KFontAction::setFont( const QString &family )
01370 {
01371 QString lowerName = family.lower();
01372 int i = 0;
01373 for ( QStringList::Iterator it = d->m_fonts.begin(); it != d->m_fonts.end(); ++it, ++i )
01374 {
01375 if ((*it).lower() == lowerName)
01376 {
01377 setCurrentItem(i);
01378 return;
01379 }
01380 }
01381 i = lowerName.find(" [");
01382 if (i>-1)
01383 {
01384 lowerName = lowerName.left(i);
01385 i = 0;
01386 for ( QStringList::Iterator it = d->m_fonts.begin(); it != d->m_fonts.end(); ++it, ++i )
01387 {
01388 if ((*it).lower() == lowerName)
01389 {
01390 setCurrentItem(i);
01391 return;
01392 }
01393 }
01394 }
01395
01396 lowerName += " [";
01397 i = 0;
01398 for ( QStringList::Iterator it = d->m_fonts.begin(); it != d->m_fonts.end(); ++it, ++i )
01399 {
01400 if ((*it).lower().startsWith(lowerName))
01401 {
01402 setCurrentItem(i);
01403 return;
01404 }
01405 }
01406
01407
01408
01409 FcPattern *pattern = NULL;
01410 FcConfig *config = NULL;
01411 QString realFamily;
01412 QRegExp regExp("[-:]");
01413 pattern = FcNameParse( (unsigned char*) family.ascii() );
01414 FcDefaultSubstitute(pattern);
01415 FcConfigSubstitute (config, pattern, FcMatchPattern);
01416 pattern = FcFontMatch(NULL, pattern, NULL);
01417 realFamily = (char*)FcNameUnparse(pattern);
01418 realFamily.remove(realFamily.find(regExp), realFamily.length());
01419
01420 if ( !realFamily.isEmpty() && realFamily != family )
01421 setFont( realFamily );
01422 else
01423 kdDebug(129) << "Font not found " << family.lower() << endl;
01424 }
01425
01426 int KFontAction::plug( QWidget *w, int index )
01427 {
01428 if (kapp && !kapp->authorizeKAction(name()))
01429 return -1;
01430 if ( ::qt_cast<KToolBar *>( w ) )
01431 {
01432 KToolBar* bar = static_cast<KToolBar*>( w );
01433 int id_ = KAction::getToolButtonID();
01434 KFontCombo *cb = new KFontCombo( items(), bar );
01435 connect( cb, SIGNAL( activated( const QString & ) ),
01436 SLOT( slotActivated( const QString & ) ) );
01437 cb->setEnabled( isEnabled() );
01438 bar->insertWidget( id_, comboWidth(), cb, index );
01439 cb->setMinimumWidth( cb->sizeHint().width() );
01440
01441 addContainer( bar, id_ );
01442
01443 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
01444
01445 updateCurrentItem( containerCount() - 1 );
01446
01447 return containerCount() - 1;
01448 }
01449 else return KSelectAction::plug( w, index );
01450 }
01451
01452 class KFontSizeAction::KFontSizeActionPrivate
01453 {
01454 public:
01455 KFontSizeActionPrivate()
01456 {
01457 }
01458 };
01459
01460 KFontSizeAction::KFontSizeAction( const QString& text,
01461 const KShortcut& cut,
01462 QObject* parent, const char* name )
01463 : KSelectAction( text, cut, parent, name )
01464 {
01465 init();
01466 }
01467
01468 KFontSizeAction::KFontSizeAction( const QString& text,
01469 const KShortcut& cut,
01470 const QObject* receiver, const char* slot,
01471 QObject* parent, const char* name )
01472 : KSelectAction( text, cut, receiver, slot, parent, name )
01473 {
01474 init();
01475 }
01476
01477 KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix,
01478 const KShortcut& cut,
01479 QObject* parent, const char* name )
01480 : KSelectAction( text, pix, cut, parent, name )
01481 {
01482 init();
01483 }
01484
01485 KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix,
01486 const KShortcut& cut,
01487 QObject* parent, const char* name )
01488 : KSelectAction( text, pix, cut, parent, name )
01489 {
01490 init();
01491 }
01492
01493 KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix,
01494 const KShortcut& cut,
01495 const QObject* receiver,
01496 const char* slot, QObject* parent,
01497 const char* name )
01498 : KSelectAction( text, pix, cut, receiver, slot, parent, name )
01499 {
01500 init();
01501 }
01502
01503 KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix,
01504 const KShortcut& cut,
01505 const QObject* receiver,
01506 const char* slot, QObject* parent,
01507 const char* name )
01508 : KSelectAction( text, pix, cut, receiver, slot, parent, name )
01509 {
01510 init();
01511 }
01512
01513 KFontSizeAction::KFontSizeAction( QObject* parent, const char* name )
01514 : KSelectAction( parent, name )
01515 {
01516 init();
01517 }
01518
01519 KFontSizeAction::~KFontSizeAction()
01520 {
01521 delete d;
01522 d = 0;
01523 }
01524
01525 void KFontSizeAction::init()
01526 {
01527 d = new KFontSizeActionPrivate;
01528
01529 setEditable( true );
01530 QFontDatabase fontDB;
01531 QValueList<int> sizes = fontDB.standardSizes();
01532 QStringList lst;
01533 for ( QValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it )
01534 lst.append( QString::number( *it ) );
01535
01536 setItems( lst );
01537 }
01538
01539 void KFontSizeAction::setFontSize( int size )
01540 {
01541 if ( size == fontSize() ) {
01542 setCurrentItem( items().findIndex( QString::number( size ) ) );
01543 return;
01544 }
01545
01546 if ( size < 1 ) {
01547 kdWarning() << "KFontSizeAction: Size " << size << " is out of range" << endl;
01548 return;
01549 }
01550
01551 int index = items().findIndex( QString::number( size ) );
01552 if ( index == -1 ) {
01553
01554 QValueList<int> lst;
01555
01556 QStringList itemsList = items();
01557 for (QStringList::Iterator it = itemsList.begin() ; it != itemsList.end() ; ++it)
01558 lst.append( (*it).toInt() );
01559
01560 lst.append( size );
01561
01562 qHeapSort( lst );
01563
01564 QStringList strLst;
01565 for (QValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it)
01566 strLst.append( QString::number(*it) );
01567 KSelectAction::setItems( strLst );
01568
01569 index = lst.findIndex( size );
01570 setCurrentItem( index );
01571 }
01572 else
01573 setCurrentItem( index );
01574
01575
01576
01577
01578
01579
01580 }
01581
01582 int KFontSizeAction::fontSize() const
01583 {
01584 return currentText().toInt();
01585 }
01586
01587 void KFontSizeAction::slotActivated( int index )
01588 {
01589 KSelectAction::slotActivated( index );
01590
01591 emit fontSizeChanged( items()[ index ].toInt() );
01592 }
01593
01594 void KFontSizeAction::slotActivated( const QString& size )
01595 {
01596 setFontSize( size.toInt() );
01597 KSelectAction::slotActivated( size );
01598 emit fontSizeChanged( size.toInt() );
01599 }
01600
01601 class KActionMenu::KActionMenuPrivate
01602 {
01603 public:
01604 KActionMenuPrivate()
01605 {
01606 m_popup = new KPopupMenu(0L,"KActionMenu::KActionMenuPrivate");
01607 m_delayed = true;
01608 m_stickyMenu = true;
01609 }
01610 ~KActionMenuPrivate()
01611 {
01612 delete m_popup; m_popup = 0;
01613 }
01614 KPopupMenu *m_popup;
01615 bool m_delayed;
01616 bool m_stickyMenu;
01617 };
01618
01619 KActionMenu::KActionMenu( QObject* parent, const char* name )
01620 : KAction( parent, name )
01621 {
01622 d = new KActionMenuPrivate;
01623 setShortcutConfigurable( false );
01624 }
01625
01626 KActionMenu::KActionMenu( const QString& text, QObject* parent,
01627 const char* name )
01628 : KAction( text, 0, parent, name )
01629 {
01630 d = new KActionMenuPrivate;
01631 setShortcutConfigurable( false );
01632 }
01633
01634 KActionMenu::KActionMenu( const QString& text, const QIconSet& icon,
01635 QObject* parent, const char* name )
01636 : KAction( text, icon, 0, parent, name )
01637 {
01638 d = new KActionMenuPrivate;
01639 setShortcutConfigurable( false );
01640 }
01641
01642 KActionMenu::KActionMenu( const QString& text, const QString& icon,
01643 QObject* parent, const char* name )
01644 : KAction( text, icon, 0, parent, name )
01645 {
01646 d = new KActionMenuPrivate;
01647 setShortcutConfigurable( false );
01648 }
01649
01650 KActionMenu::~KActionMenu()
01651 {
01652 unplugAll();
01653 kdDebug(129) << "KActionMenu::~KActionMenu()" << endl;
01654 delete d; d = 0;
01655 }
01656
01657 void KActionMenu::popup( const QPoint& global )
01658 {
01659 popupMenu()->popup( global );
01660 }
01661
01662 KPopupMenu* KActionMenu::popupMenu() const
01663 {
01664 return d->m_popup;
01665 }
01666
01667 void KActionMenu::insert( KAction* cmd, int index )
01668 {
01669 if ( cmd )
01670 cmd->plug( d->m_popup, index );
01671 }
01672
01673 void KActionMenu::remove( KAction* cmd )
01674 {
01675 if ( cmd )
01676 cmd->unplug( d->m_popup );
01677 }
01678
01679 bool KActionMenu::delayed() const {
01680 return d->m_delayed;
01681 }
01682
01683 void KActionMenu::setDelayed(bool _delayed) {
01684 d->m_delayed = _delayed;
01685 }
01686
01687 bool KActionMenu::stickyMenu() const {
01688 return d->m_stickyMenu;
01689 }
01690
01691 void KActionMenu::setStickyMenu(bool sticky) {
01692 d->m_stickyMenu = sticky;
01693 }
01694
01695 int KActionMenu::plug( QWidget* widget, int index )
01696 {
01697 if (kapp && !kapp->authorizeKAction(name()))
01698 return -1;
01699 kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl;
01700 if ( ::qt_cast<QPopupMenu *>( widget ) )
01701 {
01702 QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
01703 int id;
01704 if ( hasIcon() )
01705 id = menu->insertItem( iconSet(), text(), d->m_popup, -1, index );
01706 else
01707 id = menu->insertItem( text(), d->m_popup, -1, index );
01708
01709 if ( !isEnabled() )
01710 menu->setItemEnabled( id, false );
01711
01712 addContainer( menu, id );
01713 connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
01714
01715 if ( m_parentCollection )
01716 m_parentCollection->connectHighlight( menu, this );
01717
01718 return containerCount() - 1;
01719 }
01720 else if ( ::qt_cast<KToolBar *>( widget ) )
01721 {
01722 KToolBar *bar = static_cast<KToolBar *>( widget );
01723
01724 int id_ = KAction::getToolButtonID();
01725
01726 if ( icon().isEmpty() && !iconSet().isNull() )
01727 bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this,
01728 SLOT( slotActivated() ), isEnabled(), plainText(),
01729 index );
01730 else
01731 {
01732 KInstance *instance;
01733
01734 if ( m_parentCollection )
01735 instance = m_parentCollection->instance();
01736 else
01737 instance = KGlobal::instance();
01738
01739 bar->insertButton( icon(), id_, SIGNAL( clicked() ), this,
01740 SLOT( slotActivated() ), isEnabled(), plainText(),
01741 index, instance );
01742 }
01743
01744 addContainer( bar, id_ );
01745
01746 if (!whatsThis().isEmpty())
01747 QWhatsThis::add( bar->getButton(id_), whatsThis() );
01748
01749 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
01750
01751 if (delayed()) {
01752 bar->setDelayedPopup( id_, popupMenu(), stickyMenu() );
01753 } else {
01754 bar->getButton(id_)->setPopup(popupMenu(), stickyMenu() );
01755 }
01756
01757 if ( m_parentCollection )
01758 m_parentCollection->connectHighlight( bar, this );
01759
01760 return containerCount() - 1;
01761 }
01762 else if ( ::qt_cast<QMenuBar *>( widget ) )
01763 {
01764 QMenuBar *bar = static_cast<QMenuBar *>( widget );
01765
01766 int id;
01767
01768 id = bar->insertItem( text(), popupMenu(), -1, index );
01769
01770 if ( !isEnabled() )
01771 bar->setItemEnabled( id, false );
01772
01773 addContainer( bar, id );
01774 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
01775
01776 return containerCount() - 1;
01777 }
01778
01779 return -1;
01780 }
01781
01783
01784 KToolBarPopupAction::KToolBarPopupAction( const QString& text,
01785 const QString& icon,
01786 const KShortcut& cut,
01787 QObject* parent, const char* name )
01788 : KAction( text, icon, cut, parent, name )
01789 {
01790 m_popup = 0;
01791 m_delayed = true;
01792 m_stickyMenu = true;
01793 }
01794
01795 KToolBarPopupAction::KToolBarPopupAction( const QString& text,
01796 const QString& icon,
01797 const KShortcut& cut,
01798 const QObject* receiver,
01799 const char* slot, QObject* parent,
01800 const char* name )
01801 : KAction( text, icon, cut, receiver, slot, parent, name )
01802 {
01803 m_popup = 0;
01804 m_delayed = true;
01805 m_stickyMenu = true;
01806 }
01807
01808 KToolBarPopupAction::KToolBarPopupAction( const KGuiItem& item,
01809 const KShortcut& cut,
01810 const QObject* receiver,
01811 const char* slot, KActionCollection* parent,
01812 const char* name )
01813 : KAction( item, cut, receiver, slot, parent, name )
01814 {
01815 m_popup = 0;
01816 m_delayed = true;
01817 m_stickyMenu = true;
01818 }
01819
01820 KToolBarPopupAction::~KToolBarPopupAction()
01821 {
01822 delete m_popup;
01823 }
01824
01825 bool KToolBarPopupAction::delayed() const {
01826 return m_delayed;
01827 }
01828
01829 void KToolBarPopupAction::setDelayed(bool delayed) {
01830 m_delayed = delayed;
01831 }
01832
01833 bool KToolBarPopupAction::stickyMenu() const {
01834 return m_stickyMenu;
01835 }
01836
01837 void KToolBarPopupAction::setStickyMenu(bool sticky) {
01838 m_stickyMenu = sticky;
01839 }
01840
01841 int KToolBarPopupAction::plug( QWidget *widget, int index )
01842 {
01843 if (kapp && !kapp->authorizeKAction(name()))
01844 return -1;
01845
01846
01847 if ( ::qt_cast<KToolBar *>( widget ) )
01848 {
01849 KToolBar *bar = (KToolBar *)widget;
01850
01851 int id_ = KAction::getToolButtonID();
01852
01853 if ( icon().isEmpty() && !iconSet().isNull() ) {
01854 bar->insertButton( iconSet().pixmap(), id_, SIGNAL( buttonClicked(int, Qt::ButtonState) ), this,
01855 SLOT( slotButtonClicked(int, Qt::ButtonState) ),
01856 isEnabled(), plainText(),
01857 index );
01858 } else {
01859 KInstance * instance;
01860 if ( m_parentCollection )
01861 instance = m_parentCollection->instance();
01862 else
01863 instance = KGlobal::instance();
01864
01865 bar->insertButton( icon(), id_, SIGNAL( buttonClicked(int, Qt::ButtonState) ), this,
01866 SLOT( slotButtonClicked(int, Qt::ButtonState) ),
01867 isEnabled(), plainText(),
01868 index, instance );
01869 }
01870
01871 addContainer( bar, id_ );
01872
01873 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
01874
01875 if (delayed()) {
01876 bar->setDelayedPopup( id_, popupMenu(), stickyMenu() );
01877 } else {
01878 bar->getButton(id_)->setPopup(popupMenu(), stickyMenu());
01879 }
01880
01881 if ( !whatsThis().isEmpty() )
01882 QWhatsThis::add( bar->getButton( id_ ), whatsThisWithIcon() );
01883
01884 return containerCount() - 1;
01885 }
01886
01887 return KAction::plug( widget, index );
01888 }
01889
01890 KPopupMenu *KToolBarPopupAction::popupMenu() const
01891 {
01892 if ( !m_popup ) {
01893 KToolBarPopupAction *that = const_cast<KToolBarPopupAction*>(this);
01894 that->m_popup = new KPopupMenu;
01895 }
01896 return m_popup;
01897 }
01898
01900
01901 KToggleToolBarAction::KToggleToolBarAction( const char* toolBarName,
01902 const QString& text, KActionCollection* parent, const char* name )
01903 : KToggleAction( text, KShortcut(), parent, name )
01904 , m_toolBarName( toolBarName )
01905 , m_toolBar( 0L )
01906 {
01907 }
01908
01909 KToggleToolBarAction::KToggleToolBarAction( KToolBar *toolBar, const QString &text,
01910 KActionCollection *parent, const char *name )
01911 : KToggleAction( text, KShortcut(), parent, name )
01912 , m_toolBarName( 0 ), m_toolBar( toolBar )
01913 {
01914 }
01915
01916 KToggleToolBarAction::~KToggleToolBarAction()
01917 {
01918 }
01919
01920 int KToggleToolBarAction::plug( QWidget* w, int index )
01921 {
01922 if (kapp && !kapp->authorizeKAction(name()))
01923 return -1;
01924
01925 if ( !m_toolBar ) {
01926
01927 QWidget * tl = w;
01928 QWidget * n;
01929 while ( !tl->isDialog() && ( n = tl->parentWidget() ) )
01930 tl = n;
01931
01932 KMainWindow * mw = dynamic_cast<KMainWindow *>(tl);
01933
01934 if ( mw )
01935 m_toolBar = mw->toolBar( m_toolBarName );
01936 }
01937
01938 if( m_toolBar ) {
01939 setChecked( m_toolBar->isVisible() );
01940 connect( m_toolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(setChecked(bool)) );
01941
01942 connect( m_toolBar, SIGNAL(visibilityChanged(bool)), this, SIGNAL(toggled(bool)) );
01943 } else {
01944 setEnabled( false );
01945 }
01946
01947 return KToggleAction::plug( w, index );
01948 }
01949
01950 void KToggleToolBarAction::setChecked( bool c )
01951 {
01952 if( m_toolBar && c != m_toolBar->isVisible() ) {
01953 if( c ) {
01954 m_toolBar->show();
01955 } else {
01956 m_toolBar->hide();
01957 }
01958 QMainWindow* mw = m_toolBar->mainWindow();
01959 if ( mw && ::qt_cast<KMainWindow *>( mw ) )
01960 static_cast<KMainWindow *>( mw )->setSettingsDirty();
01961 }
01962 KToggleAction::setChecked( c );
01963 }
01964
01966
01967 KToggleFullScreenAction::KToggleFullScreenAction( const KShortcut &cut,
01968 const QObject* receiver, const char* slot,
01969 QObject* parent, QWidget* window,
01970 const char* name )
01971 : KToggleAction( QString::null, cut, receiver, slot, parent, name ),
01972 window( NULL )
01973 {
01974 setWindow( window );
01975 }
01976
01977 KToggleFullScreenAction::~KToggleFullScreenAction()
01978 {
01979 }
01980
01981 void KToggleFullScreenAction::setWindow( QWidget* w )
01982 {
01983 if( window )
01984 window->removeEventFilter( this );
01985 window = w;
01986 if( window )
01987 window->installEventFilter( this );
01988 }
01989
01990 void KToggleFullScreenAction::setChecked( bool c )
01991 {
01992 if (c)
01993 {
01994 setText(i18n("Exit F&ull Screen Mode"));
01995 setIcon("window_nofullscreen");
01996 }
01997 else
01998 {
01999 setText(i18n("F&ull Screen Mode"));
02000 setIcon("window_fullscreen");
02001 }
02002 KToggleAction::setChecked( c );
02003 }
02004
02005 bool KToggleFullScreenAction::eventFilter( QObject* o, QEvent* e )
02006 {
02007 if( o == window )
02008 #if QT_VERSION >= 0x030300
02009 if( e->type() == QEvent::WindowStateChange )
02010 #else
02011 if( e->type() == QEvent::ShowFullScreen || e->type() == QEvent::ShowNormal
02012 || e->type() == QEvent::ShowMaximized || e->type() == QEvent::ShowMinimized )
02013 #endif
02014 {
02015 if( window->isFullScreen() != isChecked())
02016 slotActivated();
02017 }
02018 return false;
02019 }
02020
02022
02023 KWidgetAction::KWidgetAction( QWidget* widget,
02024 const QString& text, const KShortcut& cut,
02025 const QObject* receiver, const char* slot,
02026 KActionCollection* parent, const char* name )
02027 : KAction( text, cut, receiver, slot, parent, name )
02028 , m_widget( widget )
02029 , m_autoSized( false )
02030 {
02031 connect( this, SIGNAL(enabled(bool)), widget, SLOT(setEnabled(bool)) );
02032 }
02033
02034 KWidgetAction::~KWidgetAction()
02035 {
02036 }
02037
02038 void KWidgetAction::setAutoSized( bool autoSized )
02039 {
02040 if( m_autoSized == autoSized )
02041 return;
02042
02043 m_autoSized = autoSized;
02044
02045 if( !m_widget || !isPlugged() )
02046 return;
02047
02048 KToolBar* toolBar = (KToolBar*)m_widget->parent();
02049 int i = findContainer( toolBar );
02050 if ( i == -1 )
02051 return;
02052 int id = itemId( i );
02053
02054 toolBar->setItemAutoSized( id, m_autoSized );
02055 }
02056
02057 int KWidgetAction::plug( QWidget* w, int index )
02058 {
02059 if (kapp && !kapp->authorizeKAction(name()))
02060 return -1;
02061
02062 if ( !::qt_cast<KToolBar *>( w ) ) {
02063 kdError() << "KWidgetAction::plug: KWidgetAction must be plugged into KToolBar." << endl;
02064 return -1;
02065 }
02066 if ( !m_widget ) {
02067 kdError() << "KWidgetAction::plug: Widget was deleted or null!" << endl;
02068 return -1;
02069 }
02070
02071 KToolBar* toolBar = static_cast<KToolBar*>( w );
02072
02073 int id = KAction::getToolButtonID();
02074
02075 m_widget->reparent( toolBar, QPoint() );
02076 toolBar->insertWidget( id, 0, m_widget, index );
02077 toolBar->setItemAutoSized( id, m_autoSized );
02078
02079 QWhatsThis::add( m_widget, whatsThis() );
02080 addContainer( toolBar, id );
02081
02082 connect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) );
02083 connect( toolBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
02084
02085 return containerCount() - 1;
02086 }
02087
02088 void KWidgetAction::unplug( QWidget *w )
02089 {
02090 if( !m_widget || !isPlugged() )
02091 return;
02092
02093 KToolBar* toolBar = (KToolBar*)m_widget->parent();
02094 if ( toolBar == w )
02095 {
02096 disconnect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) );
02097 m_widget->reparent( 0L, QPoint(), false );
02098 }
02099 KAction::unplug( w );
02100 }
02101
02102 void KWidgetAction::slotToolbarDestroyed()
02103 {
02104
02105 Q_ASSERT( isPlugged() );
02106 if( !m_widget || !isPlugged() )
02107 return;
02108
02109
02110 m_widget->reparent( 0L, QPoint(), false );
02111 }
02112
02114
02115 KActionSeparator::KActionSeparator( QObject *parent, const char *name )
02116 : KAction( parent, name )
02117 {
02118 }
02119
02120 KActionSeparator::~KActionSeparator()
02121 {
02122 }
02123
02124 int KActionSeparator::plug( QWidget *widget, int index )
02125 {
02126 if ( ::qt_cast<QPopupMenu *>( widget) )
02127 {
02128 QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
02129
02130 int id = menu->insertSeparator( index );
02131
02132 addContainer( menu, id );
02133 connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
02134
02135 return containerCount() - 1;
02136 }
02137 else if ( ::qt_cast<QMenuBar *>( widget ) )
02138 {
02139 QMenuBar *menuBar = static_cast<QMenuBar *>( widget );
02140
02141 int id = menuBar->insertSeparator( index );
02142
02143 addContainer( menuBar, id );
02144
02145 connect( menuBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
02146
02147 return containerCount() - 1;
02148 }
02149 else if ( ::qt_cast<KToolBar *>( widget ) )
02150 {
02151 KToolBar *toolBar = static_cast<KToolBar *>( widget );
02152
02153 int id = toolBar->insertSeparator( index );
02154
02155 addContainer( toolBar, id );
02156
02157 connect( toolBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
02158
02159 return containerCount() - 1;
02160 }
02161
02162 return -1;
02163 }
02164
02165 KPasteTextAction::KPasteTextAction( const QString& text,
02166 const QString& icon,
02167 const KShortcut& cut,
02168 const QObject* receiver,
02169 const char* slot, QObject* parent,
02170 const char* name)
02171 : KAction( text, icon, cut, receiver, slot, parent, name )
02172 {
02173 m_popup = new KPopupMenu;
02174 connect(m_popup, SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()));
02175 connect(m_popup, SIGNAL(activated(int)), this, SLOT(menuItemActivated(int)));
02176 m_popup->setCheckable(true);
02177 m_mixedMode = true;
02178 }
02179
02180 KPasteTextAction::~KPasteTextAction()
02181 {
02182 delete m_popup;
02183 }
02184
02185 void KPasteTextAction::setMixedMode(bool mode)
02186 {
02187 m_mixedMode = mode;
02188 }
02189
02190 int KPasteTextAction::plug( QWidget *widget, int index )
02191 {
02192 if (kapp && !kapp->authorizeKAction(name()))
02193 return -1;
02194 if ( ::qt_cast<KToolBar *>( widget ) )
02195 {
02196 KToolBar *bar = (KToolBar *)widget;
02197
02198 int id_ = KAction::getToolButtonID();
02199
02200 KInstance * instance;
02201 if ( m_parentCollection )
02202 instance = m_parentCollection->instance();
02203 else
02204 instance = KGlobal::instance();
02205
02206 bar->insertButton( icon(), id_, SIGNAL( clicked() ), this,
02207 SLOT( slotActivated() ), isEnabled(), plainText(),
02208 index, instance );
02209
02210 addContainer( bar, id_ );
02211
02212 connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
02213
02214 bar->setDelayedPopup( id_, m_popup, true );
02215
02216 if ( !whatsThis().isEmpty() )
02217 QWhatsThis::add( bar->getButton( id_ ), whatsThisWithIcon() );
02218
02219 return containerCount() - 1;
02220 }
02221
02222 return KAction::plug( widget, index );
02223 }
02224
02225 void KPasteTextAction::menuAboutToShow()
02226 {
02227 m_popup->clear();
02228 QStringList list;
02229 DCOPClient *client = kapp->dcopClient();
02230 if (client->isAttached() && client->isApplicationRegistered("klipper")) {
02231 DCOPRef klipper("klipper","klipper");
02232 DCOPReply reply = klipper.call("getClipboardHistoryMenu");
02233 if (reply.isValid())
02234 list = reply;
02235 }
02236 QString clipboardText = qApp->clipboard()->text(QClipboard::Clipboard);
02237 if (list.isEmpty())
02238 list << clipboardText;
02239 bool found = false;
02240 for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it )
02241 {
02242 QString text = KStringHandler::cEmSqueeze((*it).simplifyWhiteSpace(), m_popup->fontMetrics(), 20);
02243 text.replace("&", "&&");
02244 int id = m_popup->insertItem(text);
02245 if (!found && *it == clipboardText)
02246 {
02247 m_popup->setItemChecked(id, true);
02248 found = true;
02249 }
02250 }
02251 }
02252
02253 void KPasteTextAction::menuItemActivated( int id)
02254 {
02255 DCOPClient *client = kapp->dcopClient();
02256 if (client->isAttached() && client->isApplicationRegistered("klipper")) {
02257 DCOPRef klipper("klipper","klipper");
02258 DCOPReply reply = klipper.call("getClipboardHistoryItem(int)", m_popup->indexOf(id));
02259 if (!reply.isValid())
02260 return;
02261 QString clipboardText = reply;
02262 reply = klipper.call("setClipboardContents(QString)", clipboardText);
02263 if (reply.isValid())
02264 kdDebug(129) << "Clipboard: " << qApp->clipboard()->text(QClipboard::Clipboard) << endl;
02265 }
02266 QTimer::singleShot(20, this, SLOT(slotActivated()));
02267 }
02268
02269 void KPasteTextAction::slotActivated()
02270 {
02271 if (!m_mixedMode) {
02272 QWidget *w = qApp->widgetAt(QCursor::pos(), true);
02273 QMimeSource *data = QApplication::clipboard()->data();
02274 if (!data->provides("text/plain") && w) {
02275 m_popup->popup(w->mapToGlobal(QPoint(0, w->height())));
02276 } else
02277 KAction::slotActivated();
02278 } else
02279 KAction::slotActivated();
02280 }
02281
02282
02283 void KToggleAction::virtual_hook( int id, void* data )
02284 { KAction::virtual_hook( id, data ); }
02285
02286 void KRadioAction::virtual_hook( int id, void* data )
02287 { KToggleAction::virtual_hook( id, data ); }
02288
02289 void KSelectAction::virtual_hook( int id, void* data )
02290 { KAction::virtual_hook( id, data ); }
02291
02292 void KListAction::virtual_hook( int id, void* data )
02293 { KSelectAction::virtual_hook( id, data ); }
02294
02295 void KRecentFilesAction::virtual_hook( int id, void* data )
02296 { KListAction::virtual_hook( id, data ); }
02297
02298 void KFontAction::virtual_hook( int id, void* data )
02299 { KSelectAction::virtual_hook( id, data ); }
02300
02301 void KFontSizeAction::virtual_hook( int id, void* data )
02302 { KSelectAction::virtual_hook( id, data ); }
02303
02304 void KActionMenu::virtual_hook( int id, void* data )
02305 { KAction::virtual_hook( id, data ); }
02306
02307 void KToolBarPopupAction::virtual_hook( int id, void* data )
02308 { KAction::virtual_hook( id, data ); }
02309
02310 void KToggleToolBarAction::virtual_hook( int id, void* data )
02311 { KToggleAction::virtual_hook( id, data ); }
02312
02313 void KToggleFullScreenAction::virtual_hook( int id, void* data )
02314 { KToggleAction::virtual_hook( id, data ); }
02315
02316 void KWidgetAction::virtual_hook( int id, void* data )
02317 { KAction::virtual_hook( id, data ); }
02318
02319 void KActionSeparator::virtual_hook( int id, void* data )
02320 { KAction::virtual_hook( id, data ); }
02321
02322 void KPasteTextAction::virtual_hook( int id, void* data )
02323 { KAction::virtual_hook( id, data ); }
02324
02325
02326
02327
02328 #include "kactionclasses.moc"