-rw-r--r-- | microkde/kdeui/kaction.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/microkde/kdeui/kaction.cpp b/microkde/kdeui/kaction.cpp index 77d36a5..d38a6d5 100644 --- a/microkde/kdeui/kaction.cpp +++ b/microkde/kdeui/kaction.cpp | |||
@@ -207,17 +207,16 @@ KAction::KAction( QObject* parent, const char* name ) | |||
207 | { | 207 | { |
208 | 208 | ||
209 | initPrivate( QString::null, KShortcut(), 0, 0 ); | 209 | initPrivate( QString::null, KShortcut(), 0, 0 ); |
210 | } | 210 | } |
211 | // KDE 4: remove end | 211 | // KDE 4: remove end |
212 | 212 | ||
213 | KAction::~KAction() | 213 | KAction::~KAction() |
214 | { | 214 | { |
215 | kdDebug(129) << "KAction::~KAction( this = \"" << name() << "\" )" << endl; // -- ellis | ||
216 | #ifndef KDE_NO_COMPAT | 215 | #ifndef KDE_NO_COMPAT |
217 | if (d->m_kaccel) | 216 | if (d->m_kaccel) |
218 | unplugAccel(); | 217 | unplugAccel(); |
219 | #endif | 218 | #endif |
220 | 219 | ||
221 | // If actionCollection hasn't already been destructed, | 220 | // If actionCollection hasn't already been destructed, |
222 | if ( m_parentCollection ) { | 221 | if ( m_parentCollection ) { |
223 | m_parentCollection->take( this ); | 222 | m_parentCollection->take( this ); |
@@ -430,17 +429,18 @@ bool KAction::setShortcut( const KShortcut& cut ) | |||
430 | } | 429 | } |
431 | */ | 430 | */ |
432 | 431 | ||
433 | return true; | 432 | return true; |
434 | } | 433 | } |
435 | 434 | ||
436 | bool KAction::updateKAccelShortcut( KAccel* kaccel ) | 435 | bool KAction::updateKAccelShortcut( KAccel* kaccel ) |
437 | { | 436 | { |
438 | qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); | 437 | //qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); |
438 | |||
439 | // Check if action is permitted | 439 | // Check if action is permitted |
440 | /*US | 440 | /*US |
441 | if (kapp && !kapp->authorizeKAction(name())) | 441 | if (kapp && !kapp->authorizeKAction(name())) |
442 | return false; | 442 | return false; |
443 | 443 | ||
444 | bool b = true; | 444 | bool b = true; |
445 | 445 | ||
446 | if ( !kaccel->actions().actionPtr( name() ) ) { | 446 | if ( !kaccel->actions().actionPtr( name() ) ) { |
@@ -457,33 +457,35 @@ bool KAction::updateKAccelShortcut( KAccel* kaccel ) | |||
457 | 457 | ||
458 | return b; | 458 | return b; |
459 | */ | 459 | */ |
460 | return true; | 460 | return true; |
461 | } | 461 | } |
462 | 462 | ||
463 | void KAction::insertKAccel( KAccel* kaccel ) | 463 | void KAction::insertKAccel( KAccel* kaccel ) |
464 | { | 464 | { |
465 | qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); | 465 | //qDebug("KAction::updateKAccelShortcut~ ...1 has top be fixed"); |
466 | |||
466 | /*US | 467 | /*US |
467 | //kdDebug(129) << "KAction::insertKAccel( " << kaccel << " ): this = " << this << endl; | 468 | //kdDebug(129) << "KAction::insertKAccel( " << kaccel << " ): this = " << this << endl; |
468 | if ( !kaccel->actions().actionPtr( name() ) ) { | 469 | if ( !kaccel->actions().actionPtr( name() ) ) { |
469 | if( updateKAccelShortcut( kaccel ) ) { | 470 | if( updateKAccelShortcut( kaccel ) ) { |
470 | d->m_kaccelList.append( kaccel ); | 471 | d->m_kaccelList.append( kaccel ); |
471 | connect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) ); | 472 | connect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) ); |
472 | } | 473 | } |
473 | } | 474 | } |
474 | else | 475 | else |
475 | kdWarning(129) << "KAction::insertKAccel( kaccel = " << kaccel << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis | 476 | kdWarning(129) << "KAction::insertKAccel( kaccel = " << kaccel << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis |
476 | */ | 477 | */ |
477 | } | 478 | } |
478 | 479 | ||
479 | void KAction::removeKAccel( KAccel* kaccel ) | 480 | void KAction::removeKAccel( KAccel* kaccel ) |
480 | { | 481 | { |
481 | qDebug("KAction::removeKAccel~ ...1 has top be fixed"); | 482 | // qDebug("KAction::removeKAccel~ ...1 has top be fixed"); |
483 | |||
482 | /*US | 484 | /*US |
483 | //kdDebug(129) << "KAction::removeKAccel( " << i << " ): this = " << this << endl; | 485 | //kdDebug(129) << "KAction::removeKAccel( " << i << " ): this = " << this << endl; |
484 | for( uint i = 0; i < d->m_kaccelList.count(); i++ ) { | 486 | for( uint i = 0; i < d->m_kaccelList.count(); i++ ) { |
485 | if( d->m_kaccelList[i] == kaccel ) { | 487 | if( d->m_kaccelList[i] == kaccel ) { |
486 | kaccel->remove( name() ); | 488 | kaccel->remove( name() ); |
487 | d->m_kaccelList.remove( d->m_kaccelList.at( i ) ); | 489 | d->m_kaccelList.remove( d->m_kaccelList.at( i ) ); |
488 | disconnect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) ); | 490 | disconnect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) ); |
489 | break; | 491 | break; |
@@ -506,17 +508,18 @@ void KAction::updateShortcut( int i ) | |||
506 | QWidget* w = container( i ); | 508 | QWidget* w = container( i ); |
507 | if ( w->inherits( "QPopupMenu" ) ) { | 509 | if ( w->inherits( "QPopupMenu" ) ) { |
508 | QPopupMenu* menu = static_cast<QPopupMenu*>(w); | 510 | QPopupMenu* menu = static_cast<QPopupMenu*>(w); |
509 | updateShortcut( menu, id ); | 511 | updateShortcut( menu, id ); |
510 | } | 512 | } |
511 | else if ( w->inherits( "QMenuBar" ) ) | 513 | else if ( w->inherits( "QMenuBar" ) ) |
512 | //US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id ); | 514 | //US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id ); |
513 | //US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id ); | 515 | //US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id ); |
514 | qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed"); | 516 | |
517 | ; //qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed"); | ||
515 | 518 | ||
516 | } | 519 | } |
517 | 520 | ||
518 | void KAction::updateShortcut( QPopupMenu* menu, int id ) | 521 | void KAction::updateShortcut( QPopupMenu* menu, int id ) |
519 | { | 522 | { |
520 | /*US | 523 | /*US |
521 | //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl; | 524 | //kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl; |
522 | // If the action has a KAccel object, | 525 | // If the action has a KAccel object, |
@@ -534,17 +537,19 @@ void KAction::updateShortcut( QPopupMenu* menu, int id ) | |||
534 | // Otherwise insert the shortcut itself into the popup menu. | 537 | // Otherwise insert the shortcut itself into the popup menu. |
535 | else { | 538 | else { |
536 | // This is a fall-hack in case the KAction is missing a proper parent collection. | 539 | // This is a fall-hack in case the KAction is missing a proper parent collection. |
537 | // It should be removed eventually. --ellis | 540 | // It should be removed eventually. --ellis |
538 | menu->setAccel( d->m_cut.keyCodeQt(), id ); | 541 | menu->setAccel( d->m_cut.keyCodeQt(), id ); |
539 | kdWarning(129) << "KAction::updateShortcut(): name = \"" << name() << "\", cut = " << d->m_cut.toStringInternal() << "; No KAccel, probably missing a parent collection." << endl; | 542 | kdWarning(129) << "KAction::updateShortcut(): name = \"" << name() << "\", cut = " << d->m_cut.toStringInternal() << "; No KAccel, probably missing a parent collection." << endl; |
540 | } | 543 | } |
541 | */ | 544 | */ |
542 | qDebug("KAction::updateShortcut( QPopupMenu* menu, int id ) ...1 has top be fixed"); | 545 | |
546 | |||
547 | //qDebug("KAction::updateShortcut( QPopupMenu* menu, int id ) ...1 has top be fixed"); | ||
543 | 548 | ||
544 | } | 549 | } |
545 | 550 | ||
546 | const KShortcut& KAction::shortcut() const | 551 | const KShortcut& KAction::shortcut() const |
547 | { | 552 | { |
548 | return d->m_cut; | 553 | return d->m_cut; |
549 | } | 554 | } |
550 | 555 | ||
@@ -560,17 +565,17 @@ QString KAction::shortcutText() const | |||
560 | 565 | ||
561 | void KAction::setShortcutText( const QString& s ) | 566 | void KAction::setShortcutText( const QString& s ) |
562 | { | 567 | { |
563 | setShortcut( KShortcut(s) ); | 568 | setShortcut( KShortcut(s) ); |
564 | } | 569 | } |
565 | 570 | ||
566 | int KAction::accel() const | 571 | int KAction::accel() const |
567 | { | 572 | { |
568 | qDebug("KAction::accel() ...1 has top be fixed"); | 573 | // qDebug("KAction::accel() ...1 has top be fixed"); |
569 | //US return d->m_cut.keyCodeQt(); | 574 | //US return d->m_cut.keyCodeQt(); |
570 | return 0; | 575 | return 0; |
571 | } | 576 | } |
572 | 577 | ||
573 | void KAction::setGroup( const QString& grp ) | 578 | void KAction::setGroup( const QString& grp ) |
574 | { | 579 | { |
575 | d->m_group = grp; | 580 | d->m_group = grp; |
576 | 581 | ||
@@ -596,27 +601,27 @@ bool KAction::isEnabled() const | |||
596 | 601 | ||
597 | bool KAction::isShortcutConfigurable() const | 602 | bool KAction::isShortcutConfigurable() const |
598 | { | 603 | { |
599 | return d->m_configurable; | 604 | return d->m_configurable; |
600 | } | 605 | } |
601 | 606 | ||
602 | void KAction::setToolTip( const QString& tt ) | 607 | void KAction::setToolTip( const QString& tt ) |
603 | { | 608 | { |
604 | qDebug("KAction::setToolTip ...1 has top be fixed"); | 609 | //qDebug("KAction::setToolTip ...1 has top be fixed"); |
605 | d->setToolTip( tt ); | 610 | d->setToolTip( tt ); |
606 | 611 | ||
607 | int len = containerCount(); | 612 | int len = containerCount(); |
608 | for( int i = 0; i < len; ++i ) | 613 | for( int i = 0; i < len; ++i ) |
609 | updateToolTip( i ); | 614 | updateToolTip( i ); |
610 | } | 615 | } |
611 | 616 | ||
612 | void KAction::updateToolTip( int i ) | 617 | void KAction::updateToolTip( int i ) |
613 | { | 618 | { |
614 | qDebug("KAction::updateToolTip ...1 has top be fixed"); | 619 | //qDebug("KAction::updateToolTip ...1 has top be fixed"); |
615 | QWidget *w = container( i ); | 620 | QWidget *w = container( i ); |
616 | 621 | ||
617 | if ( w->inherits( "KToolBar" ) ) | 622 | if ( w->inherits( "KToolBar" ) ) |
618 | QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); | 623 | QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); |
619 | else if ( w->inherits( "QToolBar" ) ) | 624 | else if ( w->inherits( "QToolBar" ) ) |
620 | QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); | 625 | QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() ); |
621 | } | 626 | } |
622 | 627 | ||
@@ -628,24 +633,17 @@ QString KAction::toolTip() const | |||
628 | int KAction::plug( QWidget *w, int index ) | 633 | int KAction::plug( QWidget *w, int index ) |
629 | { | 634 | { |
630 | //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl; | 635 | //kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl; |
631 | if (w == 0) { | 636 | if (w == 0) { |
632 | kdWarning(129) << "KAction::plug called with 0 argument\n"; | 637 | kdWarning(129) << "KAction::plug called with 0 argument\n"; |
633 | return -1; | 638 | return -1; |
634 | } | 639 | } |
635 | 640 | ||
636 | #ifndef NDEBUG | 641 | |
637 | KAccel* kaccel = kaccelCurrent(); | ||
638 | // If there is a shortcut, but no KAccel available | ||
639 | if( !d->m_cut.isNull() && kaccel == 0 ) { | ||
640 | kdWarning(129) << "KAction::plug(): has no KAccel object; this = " << this << " name = " << name() << " parentCollection = " << m_parentCollection << endl; // ellis | ||
641 | //US kdDebug(129) << kdBacktrace() << endl; | ||
642 | } | ||
643 | #endif | ||
644 | 642 | ||
645 | // Check if action is permitted | 643 | // Check if action is permitted |
646 | //US if (kapp && !kapp->authorizeKAction(name())) | 644 | //US if (kapp && !kapp->authorizeKAction(name())) |
647 | //US return -1; | 645 | //US return -1; |
648 | 646 | ||
649 | plugShortcut(); | 647 | plugShortcut(); |
650 | 648 | ||
651 | if ( w->inherits("QPopupMenu") ) | 649 | if ( w->inherits("QPopupMenu") ) |
@@ -770,17 +768,18 @@ void KAction::unplug( QWidget *w ) | |||
770 | removeContainer( i ); | 768 | removeContainer( i ); |
771 | 769 | ||
772 | if ( m_parentCollection ) | 770 | if ( m_parentCollection ) |
773 | m_parentCollection->disconnectHighlight( w, this ); | 771 | m_parentCollection->disconnectHighlight( w, this ); |
774 | } | 772 | } |
775 | 773 | ||
776 | void KAction::plugAccel(KAccel *kacc, bool configurable) | 774 | void KAction::plugAccel(KAccel *kacc, bool configurable) |
777 | { | 775 | { |
778 | qDebug("KAction::plugAccel ...1 has top be fixed"); | 776 | // qDebug("KAction::plugAccel ...1 has top be fixed"); |
777 | |||
779 | /*US | 778 | /*US |
780 | kdWarning(129) << "KAction::plugAccel(): call to deprecated action." << endl; | 779 | kdWarning(129) << "KAction::plugAccel(): call to deprecated action." << endl; |
781 | kdDebug(129) << kdBacktrace() << endl; | 780 | kdDebug(129) << kdBacktrace() << endl; |
782 | //kdDebug(129) << "KAction::plugAccel( kacc = " << kacc << " ): name \"" << name() << "\"" << endl; | 781 | //kdDebug(129) << "KAction::plugAccel( kacc = " << kacc << " ): name \"" << name() << "\"" << endl; |
783 | if ( d->m_kaccel ) | 782 | if ( d->m_kaccel ) |
784 | unplugAccel(); | 783 | unplugAccel(); |
785 | 784 | ||
786 | // If the parent collection's accel ptr isn't set yet | 785 | // If the parent collection's accel ptr isn't set yet |
@@ -801,30 +800,31 @@ void KAction::plugAccel(KAccel *kacc, bool configurable) | |||
801 | } | 800 | } |
802 | else | 801 | else |
803 | kdWarning(129) << "KAction::plugAccel( kacc = " << kacc << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis | 802 | kdWarning(129) << "KAction::plugAccel( kacc = " << kacc << " ): KAccel object already contains an action name \"" << name() << "\"" << endl; // -- ellis |
804 | */ | 803 | */ |
805 | } | 804 | } |
806 | 805 | ||
807 | void KAction::unplugAccel() | 806 | void KAction::unplugAccel() |
808 | { | 807 | { |
809 | qDebug("KAction::unplugAccel ...1 has top be fixed"); | 808 | // qDebug("KAction::unplugAccel ...1 has top be fixed"); |
810 | /*US | 809 | /*US |
811 | //kdDebug(129) << "KAction::unplugAccel() " << this << " " << name() << endl; | 810 | //kdDebug(129) << "KAction::unplugAccel() " << this << " " << name() << endl; |
812 | if ( d->m_kaccel ) | 811 | if ( d->m_kaccel ) |
813 | { | 812 | { |
814 | d->m_kaccel->remove(name()); | 813 | d->m_kaccel->remove(name()); |
815 | d->m_kaccel = 0; | 814 | d->m_kaccel = 0; |
816 | } | 815 | } |
817 | */ | 816 | */ |
818 | } | 817 | } |
819 | 818 | ||
820 | void KAction::plugMainWindowAccel( QWidget *w ) | 819 | void KAction::plugMainWindowAccel( QWidget *w ) |
821 | { | 820 | { |
822 | qDebug("KAction::plugMainWindowAccel ...1 has top be fixed"); | 821 | // qDebug("KAction::plugMainWindowAccel ...1 has top be fixed"); |
822 | |||
823 | /*US | 823 | /*US |
824 | // Note: topLevelWidget() stops too early, we can't use it. | 824 | // Note: topLevelWidget() stops too early, we can't use it. |
825 | QWidget * tl = w; | 825 | QWidget * tl = w; |
826 | QWidget * n; | 826 | QWidget * n; |
827 | while ( !tl->isDialog() && ( n = tl->parentWidget() ) ) // lookup parent and store | 827 | while ( !tl->isDialog() && ( n = tl->parentWidget() ) ) // lookup parent and store |
828 | tl = n; | 828 | tl = n; |
829 | 829 | ||
830 | KMainWindow * mw = dynamic_cast<KMainWindow *>(tl); // try to see if it's a kmainwindow | 830 | KMainWindow * mw = dynamic_cast<KMainWindow *>(tl); // try to see if it's a kmainwindow |
@@ -910,17 +910,17 @@ void KAction::updateText( int i ) | |||
910 | int id = itemId( i ); | 910 | int id = itemId( i ); |
911 | static_cast<QPopupMenu*>(w)->changeItem( id, d->text() ); | 911 | static_cast<QPopupMenu*>(w)->changeItem( id, d->text() ); |
912 | updateShortcut( static_cast<QPopupMenu*>(w), id ); | 912 | updateShortcut( static_cast<QPopupMenu*>(w), id ); |
913 | } | 913 | } |
914 | else if ( w->inherits( "QMenuBar" ) ) | 914 | else if ( w->inherits( "QMenuBar" ) ) |
915 | static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() ); | 915 | static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() ); |
916 | else if ( w->inherits( "KToolBar" ) ) | 916 | else if ( w->inherits( "KToolBar" ) ) |
917 | { | 917 | { |
918 | qDebug("KAction::updateText ...3 has top be fixed"); | 918 | //qDebug("KAction::updateText ...3 has top be fixed"); |
919 | QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) ); | 919 | QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) ); |
920 | if ( button->inherits( "KToolBarButton" ) ) | 920 | if ( button->inherits( "KToolBarButton" ) ) |
921 | static_cast<KToolBarButton *>(button)->setText( d->plainText() ); | 921 | static_cast<KToolBarButton *>(button)->setText( d->plainText() ); |
922 | 922 | ||
923 | } | 923 | } |
924 | } | 924 | } |
925 | 925 | ||
926 | QString KAction::text() const | 926 | QString KAction::text() const |
@@ -1113,17 +1113,17 @@ void KAction::activate() | |||
1113 | 1113 | ||
1114 | void KAction::slotActivated() | 1114 | void KAction::slotActivated() |
1115 | { | 1115 | { |
1116 | emit activated(); | 1116 | emit activated(); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | void KAction::slotDestroyed() | 1119 | void KAction::slotDestroyed() |
1120 | { | 1120 | { |
1121 | kdDebug(129) << "KAction::slotDestroyed(): this = " << this << ", name = \"" << name() << "\", sender = " << sender() << endl; | 1121 | |
1122 | const QObject* o = sender(); | 1122 | const QObject* o = sender(); |
1123 | 1123 | ||
1124 | /* | 1124 | /* |
1125 | 1125 | ||
1126 | 1126 | ||
1127 | // KDE 4: remove | 1127 | // KDE 4: remove |
1128 | if ( o == d->m_kaccel ) | 1128 | if ( o == d->m_kaccel ) |
1129 | { | 1129 | { |