Warning, file /frameworks/kglobalaccel/src/runtime/globalshortcutcontext.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef GLOBALSHORTCUTCONTEXT_H
0008 #define GLOBALSHORTCUTCONTEXT_H
0009 
0010 #include "kglobalshortcutinfo.h"
0011 
0012 #include <QHash>
0013 #include <QString>
0014 
0015 #include <kglobalaccel.h>
0016 
0017 namespace KdeDGlobalAccel
0018 {
0019 class Component;
0020 }
0021 
0022 class GlobalShortcut;
0023 
0024 /**
0025  * @author Michael Jansen <kde@michael-jansen.biz>
0026  */
0027 class GlobalShortcutContext
0028 {
0029 public:
0030     /**
0031      * Default constructor
0032      */
0033     GlobalShortcutContext(const QString &uniqueName, const QString &friendlyName, KdeDGlobalAccel::Component *component);
0034 
0035     /**
0036      * Destructor
0037      */
0038     virtual ~GlobalShortcutContext();
0039 
0040     //! Adds @p shortcut to the context
0041     void addShortcut(GlobalShortcut *shortcut);
0042 
0043     //! Return KGlobalShortcutInfos for all shortcuts
0044     QList<KGlobalShortcutInfo> allShortcutInfos() const;
0045 
0046     /**
0047      * Get the name for the context
0048      */
0049     QString uniqueName() const;
0050     QString friendlyName() const;
0051 
0052     KdeDGlobalAccel::Component *component();
0053     KdeDGlobalAccel::Component const *component() const;
0054 
0055     //! Get shortcut for @p key or nullptr
0056     GlobalShortcut *getShortcutByKey(const QKeySequence &key, KGlobalAccel::MatchType type) const;
0057 
0058     //! Remove @p shortcut from the context. The shortcut is not deleted.
0059     GlobalShortcut *takeShortcut(GlobalShortcut *shortcut);
0060 
0061 private:
0062     friend class KdeDGlobalAccel::Component;
0063 
0064     //! The unique name for this context
0065     QString _uniqueName;
0066 
0067     //! The unique name for this context
0068     QString _friendlyName;
0069 
0070     //! The component the context belongs to
0071     KdeDGlobalAccel::Component *_component = nullptr;
0072 
0073     //! The actions associated with this context
0074     QHash<QString, GlobalShortcut *> _actions;
0075 };
0076 
0077 #endif /* #ifndef GLOBALSHORTCUTCONTEXT_H */