File indexing completed on 2024-04-21 16:12:54

0001 #ifndef HOTKEYS_CONTEXT_MENU_H
0002 #define HOTKEYS_CONTEXT_MENU_H
0003 /**
0004  * SPDX-FileCopyrightText: 2009 Michael Jansen <kde@michael-jansen.biz>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.0-or-later
0007  */
0008 
0009 #include "actions/actions.h"
0010 #include "triggers/triggers.h"
0011 
0012 #include "libkhotkeysfwd.h"
0013 
0014 #include <QMenu>
0015 #include <QModelIndex>
0016 
0017 class HotkeysTreeView;
0018 
0019 class QModelIndex;
0020 class QSignalMapper;
0021 
0022 class HotkeysTreeViewContextMenu : public QMenu
0023 {
0024     Q_OBJECT
0025 
0026 public:
0027     HotkeysTreeViewContextMenu(const QModelIndex &index, HotkeysTreeView *parent = nullptr);
0028     HotkeysTreeViewContextMenu(HotkeysTreeView *parent = nullptr);
0029 
0030     ~HotkeysTreeViewContextMenu() override;
0031 
0032     //! Create a submenu per allowed trigger type
0033     void createTriggerMenus(KHotKeys::Trigger::TriggerTypes triggerTypes, KHotKeys::Action::ActionTypes actionTypes);
0034 
0035     //! Populate a trigger menu
0036     void populateTriggerMenu(QMenu *menu, QSignalMapper *mapper, KHotKeys::Action::ActionTypes types);
0037 
0038 private Q_SLOTS:
0039 
0040     void slotAboutToShow();
0041     void slotAboutToShowForCurrent();
0042     void deleteAction();
0043 
0044     void exportAction();
0045     void importAction();
0046 
0047     void newGlobalShortcutActionAction(int);
0048     void newWindowTriggerActionAction(int);
0049     void newMouseGestureTriggerActionAction(int);
0050     void newGroupAction();
0051 
0052 private:
0053     KHotKeys::Action *createActionFromType(int type, KHotKeys::SimpleActionData *data) const;
0054 
0055     QModelIndex _index;
0056     HotkeysTreeView *_view;
0057 };
0058 
0059 #endif /* HOTKEYS_CONTEXT_MENU_H */