add more spacing
[personal-kdebase.git] / workspace / khotkeys / libkhotkeysprivate / shortcuts_handler.h
blobb503013f34055a9bec9310d263774f3acd8753ef
1 /*
2 Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
19 #ifndef SHORTCUTACTIONS_H
20 #define SHORTCUTACTIONS_H
23 #include <KDE/KActionCollection>
25 #include <X11/X.h>
28 class KAction;
29 class KShortcut;
31 namespace KHotKeys {
33 /**
34 * @author Michael Jansen <kde@michael-jansen.biz>
36 class ShortcutsHandler : public QObject
38 Q_OBJECT
40 public:
42 enum HandlerType {
43 Active, //!< Create real actions
44 Configuration }; //!< Create configuration actions ( not active )
46 /**
47 * Default constructor
49 * \param Should
51 ShortcutsHandler( HandlerType type = Active, QObject *parent = 0 );
53 /**
54 * Destructor
56 ~ShortcutsHandler();
58 /**
59 * Create a action.
61 * The action stays in the ownership of this class. Do not delete.
63 * \param id Persistent id for the action
64 * \param name Name for the action. Is used in the global shortcut
65 * configuration dialog
66 * \param shortcut Shortcut that triggers the action
68 * \return The new action or 0 if an error occurred.
70 * \see KAction::registerGlobalShortcut()
72 KAction *addAction(
73 const QString &id,
74 const QString &text,
75 const KShortcut &shortcut );
77 /**
78 * Remove a action from the collection.
80 * \param id Persistent id for the action
82 * \return The action or 0 if not found.
84 QAction *getAction( const QString &id );
86 /**
87 * Remove a action from the collection.
89 * \param id Persistent id for the action
91 * \return true if the action was removed.
93 bool removeAction( const QString &id );
95 /**
96 * From Kbd.
98 * \warning Does nothing, returns false
100 bool send_macro_key( const QString& key, Window window_P );
102 private:
104 HandlerType _type;
106 KActionCollection *_actions;
110 } // namespace KHotKeys
112 #endif /* #ifndef SHORTCUTACTIONS_H */