@ -23,24 +23,24 @@
Boston , MA 02110 - 1301 , USA .
*/
# include " k action.h"
# include " tde action.h"
# include <assert.h>
# include <tqtooltip.h>
# include <tqwhatsthis.h>
# include < k accel.h>
# include < k accelbase.h>
# include < k accelprivate.h>
# include < tde accel.h>
# include < tde accelbase.h>
# include < tde accelprivate.h>
# include <kapplication.h>
# include <kdebug.h>
# include <kguiitem.h>
# include < k mainwindow.h>
# include < tde mainwindow.h>
# include <kmenubar.h>
# include < k popupmenu.h>
# include < k toolbar.h>
# include < k toolbarbutton.h>
# include < tde popupmenu.h>
# include < tde toolbar.h>
# include < tde toolbarbutton.h>
# include <ft2build.h>
# include <X11/Xdefs.h>
@ -88,12 +88,12 @@ class TDEAction::TDEActionPrivate : public KGuiItem
public :
TDEActionPrivate ( ) : KGuiItem ( )
{
m_ k accel = 0 ;
m_ tde accel = 0 ;
m_configurable = true ;
}
TDEAccel * m_ k accel;
TQValueList < TDEAccel * > m_ k accelList;
TDEAccel * m_ tde accel;
TQValueList < TDEAccel * > m_ tde accelList;
TQString m_groupText ;
TQString m_group ;
@ -223,7 +223,7 @@ TDEAction::~TDEAction()
{
kdDebug ( 129 ) < < " TDEAction::~TDEAction( this = \" " < < name ( ) < < " \" ) " < < endl ; // -- ellis
# ifndef KDE_NO_COMPAT
if ( d - > m_ k accel)
if ( d - > m_ tde accel)
unplugAccel ( ) ;
# endif
@ -231,7 +231,7 @@ TDEAction::~TDEAction()
if ( m_parentCollection ) {
m_parentCollection - > take ( this ) ;
const TQValueList < TDEAccel * > & accelList = d - > m_ k accelList;
const TQValueList < TDEAccel * > & accelList = d - > m_ tde accelList;
TQValueList < TDEAccel * > : : const_iterator itr = accelList . constBegin ( ) ;
const TQValueList < TDEAccel * > : : const_iterator itrEnd = accelList . constEnd ( ) ;
@ -272,7 +272,7 @@ void TDEAction::initPrivate( const TQString& text, const TDEShortcut& cut,
bool TDEAction : : isPlugged ( ) const
{
return ( ! d - > m_containers . empty ( ) ) | | d - > m_ k accel;
return ( ! d - > m_containers . empty ( ) ) | | d - > m_ tde accel;
}
bool TDEAction : : isPlugged ( const TQWidget * container ) const
@ -353,7 +353,7 @@ shortcut may be set:
On Construction : [ via initShortcut ( ) ]
insert into TDEAccel of m_parentCollection ,
if k accel( ) & & isAutoConnectShortcuts ( ) exists
if tde accel( ) & & isAutoConnectShortcuts ( ) exists
On Plug : [ via plug ( ) - > plugShortcut ( ) ]
insert into TDEAccel of m_parentCollection , if exists and not already inserted into
@ -363,12 +363,12 @@ On Read XML: [via setShortcut()]
insert into TDEAccel of m_parentCollection , if exists and not already inserted into
*/
TDEAccel * TDEAction : : k accelCurrent( )
TDEAccel * TDEAction : : tde accelCurrent( )
{
if ( m_parentCollection & & m_parentCollection - > builderTDEAccel ( ) )
return m_parentCollection - > builderTDEAccel ( ) ;
else if ( m_parentCollection & & m_parentCollection - > k accel( ) )
return m_parentCollection - > k accel( ) ;
else if ( m_parentCollection & & m_parentCollection - > tde accel( ) )
return m_parentCollection - > tde accel( ) ;
else
return 0L ;
}
@ -382,9 +382,9 @@ bool TDEAction::initShortcut( const TDEShortcut& cut )
if ( qstrcmp ( name ( ) , " unnamed " ) & &
m_parentCollection & &
m_parentCollection - > isAutoConnectShortcuts ( ) & &
m_parentCollection - > k accel( ) )
m_parentCollection - > tde accel( ) )
{
insertTDEAccel ( m_parentCollection - > k accel( ) ) ;
insertTDEAccel ( m_parentCollection - > tde accel( ) ) ;
return true ;
}
return false ;
@ -393,21 +393,21 @@ bool TDEAction::initShortcut( const TDEShortcut& cut )
// Only to be called from plug()
void TDEAction : : plugShortcut ( )
{
TDEAccel * const kaccel = k accelCurrent( ) ;
TDEAccel * const tdeaccel = tde accelCurrent( ) ;
//kdDebug(129) << "TDEAction::plugShortcut(): this = " << this << " kaccel() = " << (m_parentCollection ? m_parentCollection->k accel() : 0) << endl;
if ( k accel & & qstrcmp ( name ( ) , " unnamed " ) ) {
//kdDebug(129) << "TDEAction::plugShortcut(): this = " << this << " tdeaccel() = " << (m_parentCollection ? m_parentCollection->tde accel() : 0) << endl;
if ( tde accel & & qstrcmp ( name ( ) , " unnamed " ) ) {
// Check if already plugged into current TDEAccel object
const TQValueList < TDEAccel * > & accelList = d - > m_ k accelList;
const TQValueList < TDEAccel * > & accelList = d - > m_ tde accelList;
TQValueList < TDEAccel * > : : const_iterator itr = accelList . constBegin ( ) ;
const TQValueList < TDEAccel * > : : const_iterator itrEnd = accelList . constEnd ( ) ;
for ( ; itr ! = itrEnd ; + + itr ) {
if ( ( * itr ) = = k accel )
if ( ( * itr ) = = tde accel )
return ;
}
insertTDEAccel ( k accel ) ;
insertTDEAccel ( tde accel ) ;
}
}
@ -416,31 +416,31 @@ bool TDEAction::setShortcut( const TDEShortcut& cut )
bool bChanged = ( d - > m_cut ! = cut ) ;
d - > m_cut = cut ;
TDEAccel * const kaccel = k accelCurrent( ) ;
TDEAccel * const tdeaccel = tde accelCurrent( ) ;
bool bInsertRequired = true ;
// Apply new shortcut to all existing TDEAccel objects
const TQValueList < TDEAccel * > & accelList = d - > m_ k accelList;
const TQValueList < TDEAccel * > & accelList = d - > m_ tde accelList;
TQValueList < TDEAccel * > : : const_iterator itr = accelList . constBegin ( ) ;
const TQValueList < TDEAccel * > : : const_iterator itrEnd = accelList . constEnd ( ) ;
for ( ; itr ! = itrEnd ; + + itr ) {
// Check whether shortcut has already been plugged into
// the current k accel object.
if ( ( * itr ) = = k accel )
// the current tde accel object.
if ( ( * itr ) = = tde accel )
bInsertRequired = false ;
if ( bChanged )
updateTDEAccelShortcut ( * itr ) ;
}
// Only insert action into TDEAccel if it has a valid name,
if ( k accel & & bInsertRequired & & qstrcmp ( name ( ) , " unnamed " ) )
insertTDEAccel ( k accel ) ;
if ( tde accel & & bInsertRequired & & qstrcmp ( name ( ) , " unnamed " ) )
insertTDEAccel ( tde accel ) ;
if ( bChanged ) {
# ifndef KDE_NO_COMPAT // KDE 4: remove
if ( d - > m_ k accel )
d - > m_ k accel- > setShortcut ( name ( ) , cut ) ;
if ( d - > m_ tde accel )
d - > m_ tde accel- > setShortcut ( name ( ) , cut ) ;
# endif // KDE 4: remove end
int len = containerCount ( ) ;
for ( int i = 0 ; i < len ; + + i )
@ -449,7 +449,7 @@ bool TDEAction::setShortcut( const TDEShortcut& cut )
return true ;
}
bool TDEAction : : updateTDEAccelShortcut ( TDEAccel * k accel )
bool TDEAction : : updateTDEAccelShortcut ( TDEAccel * tde accel )
{
// Check if action is permitted
if ( kapp & & ! kapp - > authorizeTDEAction ( name ( ) ) )
@ -457,46 +457,46 @@ bool TDEAction::updateTDEAccelShortcut( TDEAccel* kaccel )
bool b = true ;
if ( ! k accel- > actions ( ) . actionPtr ( name ( ) ) ) {
if ( ! tde accel- > actions ( ) . actionPtr ( name ( ) ) ) {
if ( ! d - > m_cut . isNull ( ) ) {
kdDebug ( 129 ) < < " Inserting " < < name ( ) < < " , " < < d - > text ( ) < < " , " < < d - > plainText ( ) < < endl ;
b = k accel- > insert ( name ( ) , d - > plainText ( ) , TQString : : null ,
b = tde accel- > insert ( name ( ) , d - > plainText ( ) , TQString : : null ,
d - > m_cut ,
this , TQT_SLOT ( slotActivated ( ) ) ,
isShortcutConfigurable ( ) , isEnabled ( ) ) ;
}
}
else
b = k accel- > setShortcut ( name ( ) , d - > m_cut ) ;
b = tde accel- > setShortcut ( name ( ) , d - > m_cut ) ;
return b ;
}
void TDEAction : : insertTDEAccel ( TDEAccel * k accel )
void TDEAction : : insertTDEAccel ( TDEAccel * tde accel )
{
//kdDebug(129) << "TDEAction::insertTDEAccel( " << k accel << " ): this = " << this << endl;
if ( ! k accel- > actions ( ) . actionPtr ( name ( ) ) ) {
if ( updateTDEAccelShortcut ( k accel ) ) {
d - > m_ kaccelList. append ( k accel ) ;
connect ( k accel, TQT_SIGNAL ( destroyed ( ) ) , this , TQT_SLOT ( slotDestroyed ( ) ) ) ;
//kdDebug(129) << "TDEAction::insertTDEAccel( " << tde accel << " ): this = " << this << endl;
if ( ! tde accel- > actions ( ) . actionPtr ( name ( ) ) ) {
if ( updateTDEAccelShortcut ( tde accel ) ) {
d - > m_ tdeaccelList. append ( tde accel ) ;
connect ( tde accel, TQT_SIGNAL ( destroyed ( ) ) , this , TQT_SLOT ( slotDestroyed ( ) ) ) ;
}
}
else
kdWarning ( 129 ) < < " TDEAction::insertTDEAccel( kaccel = " < < k accel < < " ): TDEAccel object already contains an action name \" " < < name ( ) < < " \" " < < endl ; // -- ellis
kdWarning ( 129 ) < < " TDEAction::insertTDEAccel( tdeaccel = " < < tde accel < < " ): TDEAccel object already contains an action name \" " < < name ( ) < < " \" " < < endl ; // -- ellis
}
void TDEAction : : removeTDEAccel ( TDEAccel * k accel )
void TDEAction : : removeTDEAccel ( TDEAccel * tde accel )
{
//kdDebug(129) << "TDEAction::removeTDEAccel( " << i << " ): this = " << this << endl;
TQValueList < TDEAccel * > & accelList = d - > m_ k accelList;
TQValueList < TDEAccel * > & accelList = d - > m_ tde accelList;
TQValueList < TDEAccel * > : : iterator itr = accelList . begin ( ) ;
const TQValueList < TDEAccel * > : : iterator itrEnd = accelList . end ( ) ;
for ( ; itr ! = itrEnd ; + + itr ) {
if ( ( * itr ) = = k accel ) {
k accel- > remove ( name ( ) ) ;
if ( ( * itr ) = = tde accel ) {
tde accel- > remove ( name ( ) ) ;
accelList . remove ( itr ) ;
disconnect ( k accel, TQT_SIGNAL ( destroyed ( ) ) , this , TQT_SLOT ( slotDestroyed ( ) ) ) ;
disconnect ( tde accel, TQT_SIGNAL ( destroyed ( ) ) , this , TQT_SLOT ( slotDestroyed ( ) ) ) ;
break ;
}
}
@ -525,10 +525,10 @@ void TDEAction::updateShortcut( int i )
void TDEAction : : updateShortcut ( TQPopupMenu * menu , int id )
{
//kdDebug(129) << "TDEAction::updateShortcut(): this = " << this << " d->m_ kaccelList.count() = " << d->m_k accelList.count() << endl;
//kdDebug(129) << "TDEAction::updateShortcut(): this = " << this << " d->m_ tdeaccelList.count() = " << d->m_tde accelList.count() << endl;
// If the action has a TDEAccel object,
// show the string representation of its shortcut.
if ( d - > m_ kaccel | | d - > m_k accelList. count ( ) ) {
if ( d - > m_ tdeaccel | | d - > m_tde accelList. count ( ) ) {
TQString s = menu - > text ( id ) ;
int i = s . find ( ' \t ' ) ;
if ( i > = 0 )
@ -637,8 +637,8 @@ int TDEAction::plug( TQWidget *w, int index )
// David: Well, it doesn't matter much, things still work (e.g. Undo in koffice) via TQAccel.
// We should probably re-enable the warning for things that only TDEAccel can do, though - e.g. WIN key (mapped to Meta).
#if 0 //ndef NDEBUG
TDEAccel * kaccel = k accelCurrent( ) ;
if ( ! d - > m_cut . isNull ( ) & & ! k accel ) {
TDEAccel * tdeaccel = tde accelCurrent( ) ;
if ( ! d - > m_cut . isNull ( ) & & ! tde accel ) {
kdDebug ( 129 ) < < " TDEAction::plug(): has no TDEAccel object; this = " < < this < < " name = " < < name ( ) < < " parentCollection = " < < m_parentCollection < < endl ; // ellis
}
# endif
@ -654,7 +654,7 @@ int TDEAction::plug( TQWidget *w, int index )
TQPopupMenu * menu = static_cast < TQPopupMenu * > ( w ) ;
int id ;
// Don't insert shortcut into menu if it's already in a TDEAccel object.
int keyQt = ( d - > m_ k accelList. count ( ) | | d - > m_ k accel) ? 0 : d - > m_cut . keyCodeQt ( ) ;
int keyQt = ( d - > m_ tde accelList. count ( ) | | d - > m_ tde accel) ? 0 : d - > m_cut . keyCodeQt ( ) ;
if ( d - > hasIcon ( ) )
{
@ -674,7 +674,7 @@ int TDEAction::plug( TQWidget *w, int index )
// If the shortcut is already in a TDEAccel object, then
// we need to set the menu item's shortcut text.
if ( d - > m_ k accelList. count ( ) | | d - > m_ k accel )
if ( d - > m_ tde accelList. count ( ) | | d - > m_ tde accel )
updateShortcut ( menu , id ) ;
// call setItemEnabled only if the item really should be disabled,
@ -775,7 +775,7 @@ void TDEAction::plugAccel(TDEAccel *kacc, bool configurable)
kdWarning ( 129 ) < < " TDEAction::plugAccel(): call to deprecated action. " < < endl ;
kdDebug ( 129 ) < < kdBacktrace ( ) < < endl ;
//kdDebug(129) << "TDEAction::plugAccel( kacc = " << kacc << " ): name \"" << name() << "\"" << endl;
if ( d - > m_ k accel )
if ( d - > m_ tde accel )
unplugAccel ( ) ;
// If the parent collection's accel ptr isn't set yet
@ -786,13 +786,13 @@ void TDEAction::plugAccel(TDEAccel *kacc, bool configurable)
// if it does not already contain an action with the same name.
if ( ! kacc - > actions ( ) . actionPtr ( name ( ) ) )
{
d - > m_ k accel = kacc ;
d - > m_ k accel- > insert ( name ( ) , d - > plainText ( ) , TQString : : null ,
d - > m_ tde accel = kacc ;
d - > m_ tde accel- > insert ( name ( ) , d - > plainText ( ) , TQString : : null ,
TDEShortcut ( d - > m_cut ) ,
this , TQT_SLOT ( slotActivated ( ) ) ,
configurable , isEnabled ( ) ) ;
connect ( d - > m_ k accel, TQT_SIGNAL ( destroyed ( ) ) , this , TQT_SLOT ( slotDestroyed ( ) ) ) ;
//connect(d->m_ k accel, TQT_SIGNAL(keycodeChanged()), this, TQT_SLOT(slotKeycodeChanged()));
connect ( d - > m_ tde accel, TQT_SIGNAL ( destroyed ( ) ) , this , TQT_SLOT ( slotDestroyed ( ) ) ) ;
//connect(d->m_ tde accel, TQT_SIGNAL(keycodeChanged()), this, TQT_SLOT(slotKeycodeChanged()));
}
else
kdWarning ( 129 ) < < " TDEAction::plugAccel( kacc = " < < kacc < < " ): TDEAccel object already contains an action name \" " < < name ( ) < < " \" " < < endl ; // -- ellis
@ -801,10 +801,10 @@ void TDEAction::plugAccel(TDEAccel *kacc, bool configurable)
void TDEAction : : unplugAccel ( )
{
//kdDebug(129) << "TDEAction::unplugAccel() " << this << " " << name() << endl;
if ( d - > m_ k accel )
if ( d - > m_ tde accel )
{
d - > m_ k accel- > remove ( name ( ) ) ;
d - > m_ k accel = 0 ;
d - > m_ tde accel- > remove ( name ( ) ) ;
d - > m_ tde accel = 0 ;
}
}
@ -816,7 +816,7 @@ void TDEAction::plugMainWindowAccel( TQWidget *w )
while ( ! tl - > isDialog ( ) & & ( n = tl - > parentWidget ( ) ) ) // lookup parent and store
tl = n ;
TDEMainWindow * mw = tqt_dynamic_cast < TDEMainWindow * > ( tl ) ; // try to see if it's a k mainwindow
TDEMainWindow * mw = tqt_dynamic_cast < TDEMainWindow * > ( tl ) ; // try to see if it's a tde mainwindow
if ( mw )
plugAccel ( mw - > accel ( ) ) ;
else
@ -825,17 +825,17 @@ void TDEAction::plugMainWindowAccel( TQWidget *w )
void TDEAction : : setEnabled ( bool enable )
{
//kdDebug(129) << "TDEAction::setEnabled( " << enable << " ): this = " << this << " d->m_ kaccelList.count() = " << d->m_k accelList.count() << endl;
//kdDebug(129) << "TDEAction::setEnabled( " << enable << " ): this = " << this << " d->m_ tdeaccelList.count() = " << d->m_tde accelList.count() << endl;
if ( enable = = d - > isEnabled ( ) )
return ;
# ifndef KDE_NO_COMPAT
// KDE 4: remove
if ( d - > m_ k accel)
d - > m_ k accel- > setEnabled ( name ( ) , enable ) ;
if ( d - > m_ tde accel)
d - > m_ tde accel- > setEnabled ( name ( ) , enable ) ;
# endif // KDE 4: remove end
const TQValueList < TDEAccel * > & accelList = d - > m_ k accelList;
const TQValueList < TDEAccel * > & accelList = d - > m_ tde accelList;
TQValueList < TDEAccel * > : : const_iterator itr = accelList . constBegin ( ) ;
const TQValueList < TDEAccel * > : : const_iterator itrEnd = accelList . constEnd ( ) ;
@ -874,13 +874,13 @@ void TDEAction::setText( const TQString& text )
{
# ifndef KDE_NO_COMPAT
// KDE 4: remove
if ( d - > m_ k accel) {
TDEAccelAction * pAction = d - > m_ k accel- > actions ( ) . actionPtr ( name ( ) ) ;
if ( d - > m_ tde accel) {
TDEAccelAction * pAction = d - > m_ tde accel- > actions ( ) . actionPtr ( name ( ) ) ;
if ( pAction )
pAction - > setLabel ( text ) ;
}
# endif // KDE 4: remove end
const TQValueList < TDEAccel * > & accelList = d - > m_ k accelList;
const TQValueList < TDEAccel * > & accelList = d - > m_ tde accelList;
TQValueList < TDEAccel * > : : const_iterator itr = accelList . constBegin ( ) ;
const TQValueList < TDEAccel * > : : const_iterator itrEnd = accelList . constEnd ( ) ;
@ -1074,9 +1074,9 @@ int TDEAction::containerCount() const
return d - > m_containers . count ( ) ;
}
uint TDEAction : : k accelCount( ) const
uint TDEAction : : tde accelCount( ) const
{
return d - > m_ k accelList. count ( ) ;
return d - > m_ tde accelList. count ( ) ;
}
void TDEAction : : addContainer ( TQWidget * c , int id )
@ -1164,13 +1164,13 @@ void TDEAction::slotDestroyed()
const TQObject * const o = TQT_TQOBJECT_CONST ( sender ( ) ) ;
# ifndef KDE_NO_COMPAT // KDE 4: remove
if ( o = = d - > m_ k accel )
if ( o = = d - > m_ tde accel )
{
d - > m_ k accel = 0 ;
d - > m_ tde accel = 0 ;
return ;
}
# endif // KDE 4: remove end
TQValueList < TDEAccel * > & accelList = d - > m_ k accelList;
TQValueList < TDEAccel * > & accelList = d - > m_ tde accelList;
TQValueList < TDEAccel * > : : iterator itr = accelList . begin ( ) ;
const TQValueList < TDEAccel * > : : iterator itrEnd = accelList . end ( ) ;
@ -1258,7 +1258,7 @@ void TDEAction::removeContainer( int index )
void TDEAction : : slotKeycodeChanged ( )
{
kdDebug ( 129 ) < < " TDEAction::slotKeycodeChanged() " < < endl ; // -- ellis
TDEAccelAction * pAction = d - > m_ k accel- > actions ( ) . actionPtr ( name ( ) ) ;
TDEAccelAction * pAction = d - > m_ tde accel- > actions ( ) . actionPtr ( name ( ) ) ;
if ( pAction )
setShortcut ( pAction - > shortcut ( ) ) ;
}
@ -1285,4 +1285,4 @@ void TDEAction::virtual_hook( int, void* )
/* vim: et sw=2 ts=2
*/
# include " k action.moc"
# include " tde action.moc"