• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KDECore

kshortcutlist.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE libraries
00002     Copyright (C) 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 #ifndef __KSHORTCUTLIST_H
00021 #define __KSHORTCUTLIST_H
00022 
00023 #include <qglobal.h>    // For uint
00024 #include <qstring.h>
00025 #include "kdelibs_export.h"
00026 
00027 class QVariant;
00028 class KConfigBase;
00029 class KInstance;
00030 class KKeySequence;
00031 class KShortcut;
00032 
00033 /**********************************************************************
00034 * This is a wrapper class which allows a function to use one interface
00035 * to KActionCollection, KAccelActions, and KActionPtrList.
00036 **********************************************************************/
00037 
00048 class KDECORE_EXPORT KShortcutList
00049 {
00050  public:
00054     KShortcutList();
00055     virtual ~KShortcutList();
00056 
00061     virtual uint count() const = 0;
00062 
00068     virtual QString name( uint index ) const = 0;
00069 
00075     virtual QString label( uint index ) const = 0;
00076 
00082     virtual QString whatsThis( uint index ) const = 0;
00083 
00084     // TODO KDE4: add virtual QString toolTip( uint index ) const = 0
00085     // Will then be used by the listview in kkeydialog
00086 
00093     virtual const KShortcut& shortcut( uint index ) const = 0;
00094 
00101     virtual const KShortcut& shortcutDefault( uint index ) const = 0;
00102 
00108     virtual bool isConfigurable( uint index ) const = 0;
00109 
00115     virtual bool setShortcut( uint index, const KShortcut &shortcut ) = 0;
00116 
00123     virtual bool isGlobal( uint index ) const;
00124 
00130     virtual int index( const QString& sName ) const;
00131 
00137     virtual int index( const KKeySequence& keySeq ) const;
00138 
00143     virtual const KInstance* instance() const;
00144 
00145     // These are here in order to handle expansion.
00146     enum Other { };
00148     virtual QVariant getOther( Other, uint index ) const = 0;
00150     virtual bool setOther( Other, uint index, QVariant ) = 0;
00151 
00156     virtual bool save() const = 0;
00157 
00165     virtual bool readSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0 );
00166 
00176     virtual bool writeSettings( const QString& sConfigGroup = QString::null, KConfigBase* pConfig = 0,
00177             bool bWriteAll = false, bool bGlobal = false ) const;
00178 
00179  protected:
00181         virtual void virtual_hook( int id, void* data );
00182  private:
00183     class KShortcutListPrivate* d;
00184 };
00185 
00186 //---------------------------------------------------------------------
00187 // KAccelShortcutList
00188 //---------------------------------------------------------------------
00189 
00190 class KAccel;
00191 class KAccelActions;
00192 class KGlobalAccel;
00193 
00198 class KDECORE_EXPORT KAccelShortcutList : public KShortcutList
00199 {
00200  public:
00205     KAccelShortcutList( KAccel* accel );
00206 
00212     KAccelShortcutList( KGlobalAccel* accel );
00213 
00222     KAccelShortcutList( KAccelActions &actions, bool bGlobal );
00223     virtual ~KAccelShortcutList();
00224 
00225     virtual uint count() const;
00226     virtual QString name( uint index ) const;
00227     virtual QString label( uint index ) const;
00228     virtual QString whatsThis( uint index ) const;
00229     virtual const KShortcut& shortcut( uint index ) const;
00230     virtual const KShortcut& shortcutDefault( uint index ) const;
00231     virtual bool isConfigurable( uint index ) const;
00232     virtual bool setShortcut( uint index , const KShortcut& shortcut );
00233     virtual bool isGlobal( uint index ) const;
00234 
00236     virtual QVariant getOther( Other, uint index ) const;
00238     virtual bool setOther( Other, uint index, QVariant );
00239 
00240     virtual bool save() const;
00241 
00242  protected:
00244     KAccelActions& m_actions;
00246     bool m_bGlobal;
00247 
00248  protected:
00249     virtual void virtual_hook( int id, void* data );
00250  private:
00251     class KAccelShortcutListPrivate* d;
00252 };
00253 
00254 namespace KStdAccel {
00255 //---------------------------------------------------------------------
00256 // ShortcutList
00257 //---------------------------------------------------------------------
00258 
00263 class KDECORE_EXPORT ShortcutList : public KShortcutList
00264 {
00265  public:
00269     ShortcutList();
00270     virtual ~ShortcutList();
00271 
00272     virtual uint count() const;
00273     virtual QString name( uint index ) const;
00274     virtual QString label( uint index ) const;
00275     virtual QString whatsThis( uint index ) const;
00276     virtual const KShortcut& shortcut( uint index ) const;
00277     virtual const KShortcut& shortcutDefault( uint index ) const;
00278     virtual bool isConfigurable( uint index ) const;
00279     virtual bool setShortcut( uint index , const KShortcut& shortcut );
00280 
00282     virtual QVariant getOther( Other, uint index ) const;
00284     virtual bool setOther( Other, uint index, QVariant );
00285 
00286     virtual bool save() const;
00287 
00288  protected:
00289     virtual void virtual_hook( int id, void* data );
00290  private:
00291     class ShortcutListPrivate* d;
00292 };
00293 }
00294 
00295 #endif // __KSHORTCUTLIST_H

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal