KDEUI
kshortcutseditor.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1997 Nicolas Hadacek <hadacek@kde.org> 00003 Copyright (C) 2001,2001 Ellis Whitehead <ellis@kde.org> 00004 Copyright (C) 2006 Hamish Rodda <rodda@kde.org> 00005 Copyright (C) 2007 Roberto Raggi <roberto@kdevelop.org> 00006 Copyright (C) 2007 Andreas Hartmetz <ahartmetz@gmail.com> 00007 Copyright (C) 2008 Michael Jansen <kde@michael-jansen.biz> 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Library General Public 00011 License as published by the Free Software Foundation; either 00012 version 2 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Library General Public License for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with this library; see the file COPYING.LIB. If not, write to 00021 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00022 Boston, MA 02110-1301, USA. 00023 */ 00024 00025 #ifndef KSHORTCUTSEDITOR_H 00026 #define KSHORTCUTSEDITOR_H 00027 00028 #include <QtGui/QWidget> 00029 #include "kgesture.h" 00030 00031 class KActionCollection; 00032 class KConfig; 00033 class KConfigBase; 00034 class KConfigGroup; 00035 class KGlobalAccel; 00036 class KShortcut; 00037 class KShortcutsEditorPrivate; 00038 00039 // KShortcutsEditor expects that the list of existing shortcuts is already 00040 // free of conflicts. If it is not, nothing will crash, but your users 00041 // won't like the resulting behavior. 00042 00043 00060 class KDEUI_EXPORT KShortcutsEditor : public QWidget 00061 { 00062 Q_OBJECT 00063 00064 public: 00065 enum ActionType { 00067 WidgetAction = Qt::WidgetShortcut /*0*/, 00069 WindowAction = Qt::WindowShortcut /*1*/, 00071 ApplicationAction = Qt::ApplicationShortcut /*2*/, 00073 GlobalAction = 4, 00075 AllActions = 0xffffffff 00076 }; 00077 Q_DECLARE_FLAGS(ActionTypes, ActionType) 00078 00079 enum LetterShortcuts { 00084 LetterShortcutsDisallowed = 0, 00086 LetterShortcutsAllowed 00087 }; 00088 00098 KShortcutsEditor(KActionCollection *collection, QWidget *parent, ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed); 00099 00110 explicit KShortcutsEditor( QWidget* parent, ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed ); 00111 00113 virtual ~KShortcutsEditor(); 00114 00118 bool isModified() const; 00119 00123 void clearCollections(); 00124 00130 void addCollection(KActionCollection *, const QString &title = QString()); 00131 00132 00136 void undoChanges(); 00137 00146 void save(); 00147 00155 void commit(); 00156 00157 00161 void clearConfiguration(); 00162 00177 void writeConfiguration( KConfigGroup* config = 0 ) const; 00178 00187 #ifndef KDE_NO_DEPRECATED 00188 KDE_DEPRECATED void exportConfiguration( KConfig *config) const; 00189 #endif 00190 void exportConfiguration( KConfigBase *config) const; 00191 00200 #ifndef KDE_NO_DEPRECATED 00201 KDE_DEPRECATED void importConfiguration( KConfig *config); 00202 #endif 00203 void importConfiguration( KConfigBase *config); 00204 00205 00206 Q_SIGNALS: 00210 void keyChange(); 00211 00212 public Q_SLOTS: 00216 void resizeColumns(); 00217 00221 void allDefault(); 00222 00226 void printShortcuts() const; 00227 00228 private: 00229 Q_PRIVATE_SLOT(d, void capturedShortcut(QVariant, const QModelIndex &)) 00230 00231 private: 00232 friend class KShortcutsDialog; 00233 friend class KShortcutsEditorPrivate; 00234 KShortcutsEditorPrivate *const d; 00235 Q_DISABLE_COPY(KShortcutsEditor) 00236 }; 00237 00238 Q_DECLARE_OPERATORS_FOR_FLAGS(KShortcutsEditor::ActionTypes) 00239 00240 #endif // KSHORTCUTSEDITOR_H
KDE 4.6 API Reference