kglobalaccel.cpp

00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2001,2002 Ellis Whitehead <ellis@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "kglobalaccel.h"
00021 #ifdef Q_WS_X11
00022 #include "kglobalaccel_x11.h"
00023 #elif defined(Q_WS_WIN)
00024 #include "kglobalaccel_win.h"
00025 #elif defined(Q_WS_MACX)
00026 #include "kglobalaccel_mac.h"
00027 #else
00028 #include "kglobalaccel_emb.h"
00029 #endif
00030 
00031 #include <qstring.h>
00032 #include "kaccelbase.h"
00033 #include <kdebug.h>
00034 #include <kshortcut.h>
00035 #include <klocale.h>
00036 
00037 //----------------------------------------------------
00038 
00039 KGlobalAccel::KGlobalAccel( QObject* pParent, const char* psName )
00040 : QObject( pParent, psName )
00041 {
00042     kdDebug(125) << "KGlobalAccel(): this = " << this << endl;
00043     d = new KGlobalAccelPrivate();
00044 }
00045 
00046 KGlobalAccel::~KGlobalAccel()
00047 {
00048     kdDebug(125) << "~KGlobalAccel(): this = " << this << endl;
00049     delete d;
00050 }
00051 
00052 /*
00053 void KGlobalAccel::clear()
00054     { d->clearActions(); }
00055 */
00056 KAccelActions& KGlobalAccel::actions()
00057     { return d->actions(); }
00058 
00059 const KAccelActions& KGlobalAccel::actions() const
00060     { return d->actions(); }
00061 
00062 bool KGlobalAccel::isEnabled()
00063     { return ((KAccelBase*)d)->isEnabled(); }
00064 
00065 void KGlobalAccel::setEnabled( bool bEnabled )
00066     { d->setEnabled( bEnabled ); }
00067 
00068 void KGlobalAccel::blockShortcuts( bool block )
00069         { KGlobalAccelPrivate::blockShortcuts( block ); }
00070 
00071 void KGlobalAccel::disableBlocking( bool disable )
00072         { d->disableBlocking( disable ); }
00073 
00074 KAccelAction* KGlobalAccel::insert( const QString& sAction, const QString& sDesc, const QString& sHelp,
00075         const KShortcut& cutDef3, const KShortcut& cutDef4,
00076         const QObject* pObjSlot, const char* psMethodSlot,
00077         bool bConfigurable, bool bEnabled )
00078 {
00079     return d->insert( sAction, sDesc, sHelp,
00080         cutDef3, cutDef4,
00081         pObjSlot, psMethodSlot,
00082         bConfigurable, bEnabled );
00083 }
00084 
00085 KAccelAction* KGlobalAccel::insert( const QString& sName, const QString& sDesc )
00086     { return d->insert( sName, sDesc ); }
00087 bool KGlobalAccel::updateConnections()
00088     { return d->updateConnections(); }
00089 
00090 bool KGlobalAccel::remove( const QString& sAction )
00091         { return d->remove( sAction ); }
00092 
00093 const KShortcut& KGlobalAccel::shortcut( const QString& sAction ) const
00094 {
00095     const KAccelAction* pAction = d->actions().actionPtr( sAction );
00096     return (pAction) ? pAction->shortcut() : KShortcut::null();
00097 }
00098 
00099 bool KGlobalAccel::setShortcut( const QString& sAction, const KShortcut& cut )
00100     { return d->setShortcut( sAction, cut ); }
00101 bool KGlobalAccel::setSlot( const QString& sAction, const QObject* pObjSlot, const char* psMethodSlot )
00102     { return d->setActionSlot( sAction, pObjSlot, psMethodSlot ); }
00103 QString KGlobalAccel::label( const QString& sAction ) const
00104 {
00105     const KAccelAction* pAction = d->actions().actionPtr( sAction );
00106     return (pAction) ? pAction->label() : QString();
00107 }
00108 bool KGlobalAccel::setActionEnabled( const QString& sAction, bool bEnable )
00109 {
00110         return d->setActionEnabled( sAction, bEnable );
00111 }
00112 
00113 const QString& KGlobalAccel::configGroup() const
00114     { return d->configGroup(); }
00115 // for kdemultimedia/kmix
00116 void KGlobalAccel::setConfigGroup( const QString& s )
00117     { d->setConfigGroup( s ); }
00118 
00119 bool KGlobalAccel::readSettings( KConfigBase* pConfig )
00120     { d->readSettings( pConfig ); return true; }
00121 bool KGlobalAccel::writeSettings( KConfigBase* pConfig ) const
00122     { d->writeSettings( pConfig ); return true; }
00123 bool KGlobalAccel::writeSettings( KConfigBase* pConfig, bool bGlobal ) const
00124 {
00125     d->setConfigGlobal( bGlobal );
00126     d->writeSettings( pConfig );
00127     return true;
00128 }
00129 
00130 bool KGlobalAccel::useFourModifierKeys()
00131     { return KAccelAction::useFourModifierKeys(); }
00132 
00133 void KGlobalAccel::virtual_hook( int, void* )
00134 { /*BASE::virtual_hook( id, data );*/ }
00135 
00136 #include "kglobalaccel.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys