KXmlGui

kshortcutseditor.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 1997 Nicolas Hadacek <[email protected]>
3  Copyright (C) 2001,2001 Ellis Whitehead <[email protected]>
4  Copyright (C) 2006 Hamish Rodda <[email protected]>
5  Copyright (C) 2007 Roberto Raggi <[email protected]>
6  Copyright (C) 2007 Andreas Hartmetz <[email protected]>
7  Copyright (C) 2008 Michael Jansen <[email protected]>
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License as published by the Free Software Foundation; either
12  version 2 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
24 
25 #ifndef KSHORTCUTSEDITOR_H
26 #define KSHORTCUTSEDITOR_H
27 
28 #include <kxmlgui_export.h>
29 
30 #include <QWidget>
31 
32 class KActionCollection;
33 class KConfig;
34 class KConfigBase;
35 class KConfigGroup;
36 class KGlobalAccel;
37 class KShortcutsEditorPrivate;
38 
39 // KShortcutsEditor expects that the list of existing shortcuts is already
40 // free of conflicts. If it is not, nothing will crash, but your users
41 // won't like the resulting behavior.
42 
61 class KXMLGUI_EXPORT KShortcutsEditor : public QWidget
62 {
63  Q_OBJECT
64  Q_PROPERTY(ActionTypes actionTypes READ actionTypes WRITE setActionTypes)
65 
66 public:
70  enum ActionType {
72  WidgetAction = Qt::WidgetShortcut /*0*/,
74  WindowAction = Qt::WindowShortcut /*1*/,
76  ApplicationAction = Qt::ApplicationShortcut /*2*/,
78  GlobalAction = 4,
80  AllActions = 0xffffffff
81  };
85  Q_DECLARE_FLAGS(ActionTypes, ActionType)
86 
92  LetterShortcutsDisallowed = 0,
94  LetterShortcutsAllowed
95  };
96 
106  KShortcutsEditor(KActionCollection *collection, QWidget *parent, ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed);
107 
118  explicit KShortcutsEditor(QWidget *parent, ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed);
119 
121  virtual ~KShortcutsEditor();
122 
126  bool isModified() const;
127 
131  void clearCollections();
132 
138  void addCollection(KActionCollection *, const QString &title = QString());
139 
143  void undoChanges();
144 
153  void save();
154 
162  void commit();
163 
167  void clearConfiguration();
168 
183  void writeConfiguration(KConfigGroup *config = nullptr) const;
184 
193  void exportConfiguration(KConfigBase *config) const;
194 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0)
195  KXMLGUI_DEPRECATED_VERSION(5, 0, "Use KShortcutsEditor::exportConfiguration(KConfigBase *config)")
196  void exportConfiguration(KConfig *config) const;
197 #endif
198 
207  void importConfiguration(KConfigBase *config);
208 #if KXMLGUI_ENABLE_DEPRECATED_SINCE(5, 0)
209  KXMLGUI_DEPRECATED_VERSION(5, 0, "Use KShortcutsEditor::importConfiguration(KConfigBase *config)")
210  void importConfiguration(KConfig *config);
211 #endif
212 
219  void setActionTypes(ActionTypes actionTypes);
225  ActionTypes actionTypes() const;
226 
227 Q_SIGNALS:
231  void keyChange();
232 
233 public Q_SLOTS:
237  void resizeColumns();
238 
242  void allDefault();
243 
247  void printShortcuts() const;
248 
249 private:
250  Q_PRIVATE_SLOT(d, void capturedShortcut(QVariant, const QModelIndex &))
251 
252 private:
253  friend class KShortcutsDialog;
254  friend class KShortcutsEditorPrivate;
255  KShortcutsEditorPrivate *const d;
256  Q_DISABLE_COPY(KShortcutsEditor)
257 };
258 
259 Q_DECLARE_OPERATORS_FOR_FLAGS(KShortcutsEditor::ActionTypes)
260 
261 #endif // KSHORTCUTSEDITOR_H
A container for a set of QAction objects.
WidgetShortcut
Widget for configuration of KAccel and KGlobalAccel.
Q_PROPERTY(...)
Dialog for configuration of KActionCollection and KGlobalAccel.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 6 2020 22:49:48 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.