1 #ifndef GLOBALSHORTCUTCONTEXT_H
2 #define GLOBALSHORTCUTCONTEXT_H
3 /* Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #include "kglobalshortcutinfo.h"
23 #include <QtCore/QString>
24 #include <QtCore/QHash>
26 namespace KdeDGlobalAccel
{
33 * @author Michael Jansen <kde@michael-jansen.biz>
35 class GlobalShortcutContext
42 GlobalShortcutContext(
43 const QString
&uniqueName
,
44 const QString
&friendlyName
,
45 KdeDGlobalAccel::Component
*component
);
50 virtual ~GlobalShortcutContext();
52 //! Adds @p shortcut to the context
53 void addShortcut(GlobalShortcut
*shortcut
);
55 //! Return KGlobalShortcutInfos for all shortcuts
56 QList
<KGlobalShortcutInfo
> allShortcutInfos() const;
59 * Get the name for the context
61 QString
uniqueName() const;
62 QString
friendlyName() const;
64 KdeDGlobalAccel::Component
*component();
65 KdeDGlobalAccel::Component
const *component() const;
67 //! Get shortcut for @p key or NULL
68 GlobalShortcut
*getShortcutByKey(int key
) const;
70 //! Remove @p shortcut from the context. The shortcut is not deleted.
71 GlobalShortcut
*takeShortcut(GlobalShortcut
*shortcut
);
75 friend class KdeDGlobalAccel::Component
;
77 //! The unique name for this context
80 //! The unique name for this context
81 QString _friendlyName
;
83 //! The component the context belongs too
84 KdeDGlobalAccel::Component
*_component
;
86 //! The actions associated with this context
87 QHash
<QString
, GlobalShortcut
*> _actions
;
91 #endif /* #ifndef GLOBALSHORTCUTCONTEXT_H */