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

KDEUI

kaction.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
00003               (C) 1999 Simon Hausmann <hausmann@kde.org>
00004               (C) 2000 Nicolas Hadacek <haadcek@kde.org>
00005               (C) 2000 Kurt Granroth <granroth@kde.org>
00006               (C) 2000 Michael Koch <koch@kde.org>
00007               (C) 2001 Holger Freyther <freyther@kde.org>
00008               (C) 2002 Ellis Whitehead <ellis@kde.org>
00009               (C) 2005-2006 Hamish Rodda <rodda@kde.org>
00010 
00011     This library is free software; you can redistribute it and/or
00012     modify it under the terms of the GNU Library General Public
00013     License version 2 as published by the Free Software Foundation.
00014 
00015     This library is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Library General Public License for more details.
00019 
00020     You should have received a copy of the GNU Library General Public License
00021     along with this library; see the file COPYING.LIB.  If not, write to
00022     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00023     Boston, MA 02110-1301, USA.
00024 */
00025 
00026 #ifndef KACTION_H
00027 #define KACTION_H
00028 
00029 #include <kdeui_export.h>
00030 #include <kguiitem.h>
00031 #include <kshortcut.h>
00032 
00033 #include <QtGui/QWidgetAction>
00034 
00035 class KIcon;
00036 class KShapeGesture;
00037 class KRockerGesture;
00038 
00039 //TODO Reduce the word count. This is not very focused and takes too long to read.
00040 //Keep in mind that QAction also has documentation that we don't need to repeat here.
00211 class KDEUI_EXPORT KAction : public QWidgetAction
00212 {
00213   Q_OBJECT
00214 
00215   Q_PROPERTY( KShortcut shortcut READ shortcut WRITE setShortcut )
00216   Q_PROPERTY( bool shortcutConfigurable READ isShortcutConfigurable WRITE setShortcutConfigurable )
00217   Q_PROPERTY( KShortcut globalShortcut READ globalShortcut WRITE setGlobalShortcut )
00218   Q_PROPERTY( bool globalShortcutAllowed READ globalShortcutAllowed WRITE setGlobalShortcutAllowed )
00219   Q_PROPERTY( bool globalShortcutEnabled READ isGlobalShortcutEnabled )
00220   Q_FLAGS( ShortcutType )
00221 
00222 public:
00226     enum ShortcutType {
00228       ActiveShortcut = 0x1,
00231       DefaultShortcut = 0x2
00232     };
00233     Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType)
00234 
00235     
00238     //This enum will be ORed with ShortcutType in calls to KGlobalAccel, so it must not contain
00239     //any value equal to a value in ShortcutType.
00240     enum GlobalShortcutLoading {
00244       Autoloading = 0x0,
00246       NoAutoloading = 0x4
00247     };
00251     explicit KAction(QObject *parent);
00252 
00259     KAction(const QString& text, QObject *parent);
00260 
00272     KAction(const KIcon& icon, const QString& text, QObject *parent);
00273 
00277     virtual ~KAction();
00278 
00290     KShortcut shortcut(ShortcutTypes types = ActiveShortcut) const;
00291 
00302     void setShortcut(const KShortcut& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00303 
00316     void setShortcut(const QKeySequence& shortcut, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00317 
00330     void setShortcuts(const QList<QKeySequence>& shortcuts, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00331 
00335     bool isShortcutConfigurable() const;
00336 
00342     void setShortcutConfigurable(bool configurable);
00343 
00357     const KShortcut& globalShortcut(ShortcutTypes type = ActiveShortcut) const;
00358 
00395     void setGlobalShortcut(const KShortcut& shortcut, ShortcutTypes type =
00396                            ShortcutTypes(ActiveShortcut | DefaultShortcut),
00397                            GlobalShortcutLoading loading = Autoloading);
00398 
00404     KDE_DEPRECATED bool globalShortcutAllowed() const;
00405 
00414     KDE_DEPRECATED void setGlobalShortcutAllowed(bool allowed, GlobalShortcutLoading loading = Autoloading);
00415 
00421     bool isGlobalShortcutEnabled() const;
00422 
00432     void forgetGlobalShortcut();
00433 
00434     KShapeGesture shapeGesture(ShortcutTypes type = ActiveShortcut) const;
00435     KRockerGesture rockerGesture(ShortcutTypes type = ActiveShortcut) const;
00436 
00437     void setShapeGesture(const KShapeGesture& gest, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00438     void setRockerGesture(const KRockerGesture& gest, ShortcutTypes type = ShortcutTypes(ActiveShortcut | DefaultShortcut));
00439 
00443     bool event(QEvent*);
00444 
00445 
00446 Q_SIGNALS:
00447 #ifdef KDE3_SUPPORT
00448 
00453     QT_MOC_COMPAT void activated();
00454 #endif
00455 
00460     void triggered(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
00461 
00466     void globalShortcutChanged(const QKeySequence&);
00467 
00468 private:
00469     friend class KGlobalAccelPrivate; // Needs access to the component
00470     friend class KActionCollectionPrivate; // Needs access to the component
00471     friend class KShortcutsEditorDelegate; // Needs access to the component
00472     Q_PRIVATE_SLOT(d, void slotTriggered())
00473     class KActionPrivate* const d;
00474     friend class KActionPrivate;
00475     friend class KGlobalShortcutTest;
00476 };
00477 
00478 Q_DECLARE_OPERATORS_FOR_FLAGS(KAction::ShortcutTypes)
00479 
00480 #endif

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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