KGlobalAccel

globalshortcutcontext.h
1 /*
2  SPDX-FileCopyrightText: 2008 Michael Jansen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef GLOBALSHORTCUTCONTEXT_H
8 #define GLOBALSHORTCUTCONTEXT_H
9 
10 #include "kglobalshortcutinfo.h"
11 
12 #include <QHash>
13 #include <QString>
14 
15 namespace KdeDGlobalAccel
16 {
17 class Component;
18 }
19 
20 class GlobalShortcut;
21 
22 /**
23  * @author Michael Jansen <[email protected]>
24  */
26 {
27 public:
28  /**
29  * Default constructor
30  */
31  GlobalShortcutContext(const QString &uniqueName, const QString &friendlyName, KdeDGlobalAccel::Component *component);
32 
33  /**
34  * Destructor
35  */
36  virtual ~GlobalShortcutContext();
37 
38  //! Adds @p shortcut to the context
39  void addShortcut(GlobalShortcut *shortcut);
40 
41  //! Return KGlobalShortcutInfos for all shortcuts
42  QList<KGlobalShortcutInfo> allShortcutInfos() const;
43 
44  /**
45  * Get the name for the context
46  */
47  QString uniqueName() const;
48  QString friendlyName() const;
49 
50  KdeDGlobalAccel::Component *component();
51  KdeDGlobalAccel::Component const *component() const;
52 
53  //! Get shortcut for @p key or nullptr
54  GlobalShortcut *getShortcutByKey(int key) const;
55 
56  //! Remove @p shortcut from the context. The shortcut is not deleted.
57  GlobalShortcut *takeShortcut(GlobalShortcut *shortcut);
58 
59 private:
60  friend class KdeDGlobalAccel::Component;
61 
62  //! The unique name for this context
63  QString _uniqueName;
64 
65  //! The unique name for this context
66  QString _friendlyName;
67 
68  //! The component the context belongs too
69  KdeDGlobalAccel::Component *_component;
70 
71  //! The actions associated with this context
73 };
74 
75 #endif /* #ifndef GLOBALSHORTCUTCONTEXT_H */
Represents a global shortcut.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun May 16 2021 22:53:45 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.