diff --git a/src/kgesture_p.h b/src/kgesture_p.h index 7829ff3..ba97d7a 100644 --- a/src/kgesture_p.h +++ b/src/kgesture_p.h @@ -1,246 +1,246 @@ /* This file is part of the KDE libraries Copyright (C) 2006,2007 Andreas Hartmetz (ahartmetz@gmail.com) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KGESTURE_H #define KGESTURE_H #include #include #include #include /* kinds of gestures: -shapes like triangle, right angle, line -"rocker" (i.e. two mouse button) gestures */ class KShapeGesturePrivate; //TODO: implement operator== for special situations like in KKeyChooser. class KXMLGUI_EXPORT KShapeGesture { public: /** * Create a new invalid shape gesture. */ KShapeGesture(); /** * Creates a new gesture consisting of given shape. - * If the gesture belongs to a KAction, and the user draws approximately the same shape + * If the gesture belongs to a QAction, and the user draws approximately the same shape * on the screen while holding down the right mouse button, the action will trigger. * @p shape must be a "reasonable" polygon. It must contain at least two points * and it should contain at most 50 for performance reasons. No two consecutive points * are allowed to be at the same position. * @param shape shape to draw to trigger this gesture */ KShapeGesture(const QPolygon &shape); /** * Creates a new gesture from a string description. * @param description create gesture according to this */ KShapeGesture(const QString &description); /** * Copies the given gesture. * @param other gesture to copy */ KShapeGesture(const KShapeGesture &other); /** * Destructor. */ ~KShapeGesture(); /** * Set the shape to draw to trigger this gesture. */ void setShape(const QPolygon &shape); /** * set a user-visible name for this gesture's shape, like "triangle" or "line". */ void setShapeName(const QString &friendlyName); /** * Return the user-visible name for this gesture's shape, like "triangle" or "line". */ QString shapeName() const; /** * Return true if this gesture is valid. * */ bool isValid() const; /** * Return a string representation of this gesture. * Return empty string if invalid. * This function is mainly for use with config files. * * @see shapeName() */ QString toString() const; /** * Return an idealized SVG image of this gesture. * Return an empty image if invalid. * @param attributes SVG attributes to apply to the SVG "path" element that * makes up the drawing of the gesture. By default, only a 'fill="none"' * attribute will be set. */ QByteArray toSvg(const QString &attributes = QString()) const; /** * Return a difference measurement betwenn this gesture and the @p other * gesture. Abort comparison if difference is larger than @p abortThreshold * and return a very large difference in that case. * Usual return values range from x to y //TODO: fill in x and y */ float distance(const KShapeGesture &other, float abortThreshold) const; /** * Set this gesture to the other gesture. */ KShapeGesture &operator=(const KShapeGesture &other); /** * Return whether this gesture is equal to the other gesture. */ bool operator==(const KShapeGesture &other) const; /** * Return the opposite of operator==() */ bool operator!=(const KShapeGesture &other) const; /** * Return an opaque value for use in hash tables */ uint hashable() const; private: KShapeGesturePrivate *const d; }; inline uint qHash(const KShapeGesture &key) { return qHash(key.hashable()); } class KRockerGesturePrivate; class KXMLGUI_EXPORT KRockerGesture { public: /** * Create a new invalid rocker gesture. */ KRockerGesture(); /** * Creates a new gesture consisting of given buttons. * @param description create gesture according to this */ KRockerGesture(enum Qt::MouseButton hold, enum Qt::MouseButton thenPush); /** * Creates a new gesture from a string description. * @param description create gesture according to this */ KRockerGesture(const QString &description); /** * Copies the given gesture. * @param other gesture to copy */ KRockerGesture(const KRockerGesture &other); /** * Destructor. */ ~KRockerGesture(); /** * set button combination to trigger */ void setButtons(Qt::MouseButton hold, Qt::MouseButton thenPush); /** * Write the button combination to hold and thenPush */ void getButtons(Qt::MouseButton *hold, Qt::MouseButton *thenPush) const; /** * Return a user-friendly name of the button combination. */ QString rockerName() const; /** * Return a user-friendly name for the mouse button button */ static QString mouseButtonName(Qt::MouseButton button); /** * Return true if this gesture is valid. */ bool isValid() const; /** * Return a string representation of this gesture. * Return an empty string if invalid. * This function is mainly for use with config files. * * @see rockerName() */ QString toString() const; /** * Set this gesture to the other gesture. */ KRockerGesture &operator=(const KRockerGesture &other); /** * Return whether this gesture is equal to the other gesture. */ bool operator==(const KRockerGesture &other) const; /** * Return the opposite of operator==() */ bool operator!=(const KRockerGesture &other) const; /** * Return an opaque value for use in hash tables */ uint hashable() const; private: KRockerGesturePrivate *const d; }; inline uint qHash(const KRockerGesture &key) { return qHash(key.hashable()); } //KGESTURE_H #endif diff --git a/src/kkeysequencewidget.h b/src/kkeysequencewidget.h index 81dac2d..25b26e2 100644 --- a/src/kkeysequencewidget.h +++ b/src/kkeysequencewidget.h @@ -1,310 +1,310 @@ /* This file is part of the KDE libraries Copyright (C) 2001, 2002 Ellis Whitehead Copyright (C) 2007 Andreas Hartmetz This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KKEYSEQUENCEWIDGET_H #define KKEYSEQUENCEWIDGET_H #include #include #include class KKeySequenceWidgetPrivate; class QAction; class KActionCollection; /** * @short A widget to input a QKeySequence. * * This widget lets the user choose a QKeySequence, which is usually used as a * shortcut key. The recording is initiated by calling captureKeySequence() or * the user clicking into the widget. * * The widgets provides support for conflict handling. See * setCheckForConflictsAgainst() for more information. * * \image html kkeysequencewidget.png "KKeySequenceWidget" * * @author Mark Donohoe * @internal */ class KXMLGUI_EXPORT KKeySequenceWidget: public QWidget { Q_OBJECT Q_PROPERTY( bool multiKeyShortcutsAllowed READ multiKeyShortcutsAllowed WRITE setMultiKeyShortcutsAllowed) Q_PROPERTY( ShortcutTypes checkForConflictsAgainst READ checkForConflictsAgainst WRITE setCheckForConflictsAgainst) Q_PROPERTY( bool modifierlessAllowed READ isModifierlessAllowed WRITE setModifierlessAllowed) public: ///An enum about validation when setting a key sequence. ///@see setKeySequence() enum Validation { ///Validate key sequence Validate = 0, ///Use key sequence without validation NoValidate = 1 }; /** * Constructor. */ explicit KKeySequenceWidget(QWidget *parent = nullptr); /** * Destructs the widget. */ virtual ~KKeySequenceWidget(); /** * \name Configuration * * Configuration options for the widget. */ //@{ enum ShortcutType { None = 0x00, //!< No checking for conflicts LocalShortcuts = 0x01, //!< Check with local shortcuts. @see setCheckActionCollections() StandardShortcuts = 0x02, //!< Check against standard shortcuts. @see KStandardShortcut GlobalShortcuts = 0x04 //!< Check against global shortcuts. @see KGlobalAccel }; Q_DECLARE_FLAGS(ShortcutTypes, ShortcutType) Q_FLAG(ShortcutTypes) /** * Configure if the widget should check for conflicts with existing * shortcuts. * * When capturing a key sequence for local shortcuts you should check * against GlobalShortcuts and your other local shortcuts. This is the * default. * * You have to provide the local actions to check against with * setCheckActionCollections(). * * When capturing a key sequence for a global shortcut you should * check against StandardShortcuts, GlobalShortcuts and your local * shortcuts. * * There are two ways to react to a user agreeing to steal a shortcut: * * 1. Listen to the stealShortcut() signal and steal the shortcuts * manually. It's your responsibility to save that change later when * you think it is appropriate. * * 2. Call applyStealShortcut() and KKeySequenceWidget will steal the * shortcut. This will save the actionCollections the shortcut is part * of so make sure it doesn't inadvertly save some unwanted changes * too. Read its documentation for some limitation when handling * global shortcuts. * * If you want to do the conflict checking yourself here are some code * snippets for global ... * * \code * QStringList conflicting = KGlobalAccel::findActionNameSystemwide(keySequence); * if (!conflicting.isEmpty()) { * // Inform and ask the user about the conflict and reassigning * // the keys sequence * if (!KGlobalAccel::promptStealShortcutSystemwide(q, conflicting, keySequence)) { * return true; * } * KGlobalAccel::stealShortcutSystemwide(keySequence); * } * \endcode * * ... and standard shortcuts * * \code * KStandardShortcut::StandardShortcut ssc = KStandardShortcut::find(keySequence); * if (ssc != KStandardShortcut::AccelNone) { * // We have a conflict * } * \endcode * * * @since 4.2 */ void setCheckForConflictsAgainst(ShortcutTypes types); /** * The shortcut types we check for conflicts. * * @see setCheckForConflictsAgainst() * @since 4.2 */ ShortcutTypes checkForConflictsAgainst() const; /** * Allow multikey shortcuts? */ void setMultiKeyShortcutsAllowed(bool); bool multiKeyShortcutsAllowed() const; /** * This only applies to user input, not to setShortcut(). * Set whether to accept "plain" keys without modifiers (like Ctrl, Alt, Meta). * Plain keys by our definition include letter and symbol keys and * text editing keys (Return, Space, Tab, Backspace, Delete). * "Special" keys like F1, Cursor keys, Insert, PageDown will always work. */ void setModifierlessAllowed(bool allow); /** * @see setModifierlessAllowed() */ bool isModifierlessAllowed(); /** * Set whether a small button to set an empty key sequence should be displayed next to the * main input widget. The default is to show the clear button. */ void setClearButtonShown(bool show); //@} /** * Checks whether the key sequence @p seq is available to grab. * * The sequence is checked under the same rules as if it has been typed by * the user. This method is useful if you get key sequences from another * input source and want to check if it is save to set them. * * @since 4.2 */ bool isKeySequenceAvailable(const QKeySequence &seq) const; /** * Return the currently selected key sequence. */ QKeySequence keySequence() const; /** * Set a list of action collections to check against for conflictuous shortcut. * * @see setCheckForConflictsAgainst() * - * If a KAction with a conflicting shortcut is found inside this list and - * its shortcut can be configured (KAction::isShortcutConfigurable() + * If a QAction with a conflicting shortcut is found inside this list and + * its shortcut can be configured (KActionCollection::isShortcutConfigurable() * returns true) the user will be prompted whether to steal the shortcut * from this action. * * @since 4.1 */ void setCheckActionCollections(const QList &actionCollections); /** * @deprecated since 4.1 * use setCheckActionCollections so that KKeySequenceWidget knows * in which action collection to call the writeSettings method after stealing * a shortcut from an action. */ #ifndef KXMLGUI_NO_DEPRECATED KXMLGUI_DEPRECATED void setCheckActionList(const QList &checkList); #endif /** * If the component using this widget supports shortcuts contexts, it has * to set its component name so we can check conflicts correctly. */ void setComponentName(const QString &componentName); Q_SIGNALS: /** * This signal is emitted when the current key sequence has changed, be it by user * input or programmatically. */ void keySequenceChanged(const QKeySequence &seq); /** * This signal is emitted after the user agreed to steal a shortcut from * an action. This is only done for local shortcuts. So you can be sure \a * action is one of the actions you provided with setCheckActionList() or * setCheckActionCollections(). * * If you listen to that signal and don't call applyStealShortcut() you * are supposed to steal the shortcut and save this change. */ void stealShortcut(const QKeySequence &seq, QAction *action); public Q_SLOTS: /** * Capture a shortcut from the keyboard. This call will only return once a key sequence * has been captured or input was aborted. * If a key sequence was input, keySequenceChanged() will be emitted. * * @see setModifierlessAllowed() */ void captureKeySequence(); /** * Set the key sequence. * * If @p val == Validate, and the call is actually changing the key sequence, * conflictuous shortcut will be checked. */ void setKeySequence(const QKeySequence &seq, Validation val = NoValidate); /** * Clear the key sequence. */ void clearKeySequence(); /** * Actually remove the shortcut that the user wanted to steal, from the * action that was using it. This only applies to actions provided to us * by setCheckActionCollections() and setCheckActionList(). * * Global and Standard Shortcuts have to be stolen immediately when the * user gives his consent (technical reasons). That means those changes * will be active even if you never call applyStealShortcut(). * * To be called before you apply your changes. No local shortcuts are * stolen until this function is called. */ void applyStealShortcut(); private: Q_PRIVATE_SLOT(d, void doneRecording()) private: friend class KKeySequenceWidgetPrivate; KKeySequenceWidgetPrivate *const d; Q_DISABLE_COPY(KKeySequenceWidget) }; Q_DECLARE_OPERATORS_FOR_FLAGS(KKeySequenceWidget::ShortcutTypes) #endif //KKEYSEQUENCEWIDGET_H diff --git a/src/kmainwindowiface_p.h b/src/kmainwindowiface_p.h index 4e1dbed..99887b0 100644 --- a/src/kmainwindowiface_p.h +++ b/src/kmainwindowiface_p.h @@ -1,119 +1,119 @@ /* This file is part of the KDE project Copyright (C) 2001 Ian Reinhart Geiser Copyright (C) 2006 Thiago Macieira This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Library General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KMAINWINDOWIFACE_P_H #define KMAINWINDOWIFACE_P_H #include #include class KXmlGuiWindow; /** * @short D-Bus interface to KMainWindow. * * This is the main interface to the KMainWindow. This will provide a consistent * D-Bus interface to all KDE applications that use it. * * @author Ian Reinhart Geiser */ class KMainWindowInterface : public QDBusAbstractAdaptor { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.kde.KMainWindow") public: /** Construct a new interface object. @param mainWindow - The parent KMainWindow object - that will provide us with the KAction objects. + that will provide us with the QAction objects. */ KMainWindowInterface(KXmlGuiWindow *mainWindow); /** Destructor Cleans up the dcop action proxy object. **/ ~KMainWindowInterface(); public Q_SLOTS: /** Return a list of actions available to the application's window. @return A QStringList containing valid names actions. */ QStringList actions(); /** Activates the requested action. @param action The name of the action to activate. The names of valid actions can be found by calling actions(). @return The success of the operation. */ bool activateAction(const QString &action); /** Disables the requested action. @param action The name of the action to disable. The names of valid actions can be found by calling actions(). @return The success of the operation. */ bool disableAction(const QString &action); /** Enables the requested action. @param action The name of the action to enable. The names of valid actions can be found by calling actions(). @return The success of the operation. */ bool enableAction(const QString &action); /** Returns the status of the requested action. @param action The name of the action. The names of valid actions can be found by calling actions(). @returns The state of the action, true - enabled, false - disabled. */ bool actionIsEnabled(const QString &action); /** Returns the tool tip text of the requested action. @param action The name of the action to activate. The names of valid actions can be found by calling actions(). @return A QString containing the text of the action's tool tip. */ QString actionToolTip(const QString &action); /** Returns the ID of the current main window. This is useful for automated screen captures or other evil widget fun. @return A integer value of the main window's ID. **/ qlonglong winId(); /** Copies a pixmap representation of the current main window to the clipboard. **/ void grabWindowToClipBoard(); private: KXmlGuiWindow *m_MainWindow; }; #endif // KMAINWINDOWIFACE_P_H diff --git a/src/kshortcutseditor.h b/src/kshortcutseditor.h index ca361c9..a5da6a5 100644 --- a/src/kshortcutseditor.h +++ b/src/kshortcutseditor.h @@ -1,257 +1,257 @@ /* This file is part of the KDE libraries Copyright (C) 1997 Nicolas Hadacek Copyright (C) 2001,2001 Ellis Whitehead Copyright (C) 2006 Hamish Rodda Copyright (C) 2007 Roberto Raggi Copyright (C) 2007 Andreas Hartmetz Copyright (C) 2008 Michael Jansen This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KSHORTCUTSEDITOR_H #define KSHORTCUTSEDITOR_H #include #include #if 0 #include #endif class KActionCollection; class KConfig; class KConfigBase; class KConfigGroup; class KGlobalAccel; class KShortcutsEditorPrivate; // KShortcutsEditor expects that the list of existing shortcuts is already // free of conflicts. If it is not, nothing will crash, but your users // won't like the resulting behavior. /** * @class KShortcutsEditor kshortcutseditor.h KShortcutsEditor * * @short Widget for configuration of KAccel and KGlobalAccel. * - * Configure dictionaries of key/action associations for KActions, + * Configure dictionaries of key/action associations for QActions, * including global shortcuts. * * The class takes care of all aspects of configuration, including * handling key conflicts internally. Connect to the allDefault() * slot if you want to set all configurable shortcuts to their * default values. * * @see KShortcutsDialog * @author Nicolas Hadacek * @author Hamish Rodda (KDE 4 porting) * @author Michael Jansen */ class KXMLGUI_EXPORT KShortcutsEditor : public QWidget { Q_OBJECT Q_PROPERTY(ActionTypes actionTypes READ actionTypes WRITE setActionTypes) public: enum ActionType { /// Actions which are triggered by any keypress in a widget which has the action added to it WidgetAction = Qt::WidgetShortcut /*0*/, /// Actions which are triggered by any keypress in a window which has the action added to it or its child widget(s) WindowAction = Qt::WindowShortcut /*1*/, /// Actions which are triggered by any keypress in the application ApplicationAction = Qt::ApplicationShortcut /*2*/, /// Actions which are triggered by any keypress in the windowing system GlobalAction = 4, /// All actions AllActions = 0xffffffff }; Q_DECLARE_FLAGS(ActionTypes, ActionType) enum LetterShortcuts { /// Shortcuts without a modifier are not allowed, /// so 'A' would not be valid, whereas 'Ctrl+A' would be. /// This only applies to printable characters, however. /// 'F1', 'Insert' etc. could still be used. LetterShortcutsDisallowed = 0, /// Letter shortcuts are allowed LetterShortcutsAllowed }; /** * Constructor. * * @param collection the KActionCollection to configure * @param parent parent widget * @param actionTypes types of actions to display in this widget. * @param allowLetterShortcuts set to LetterShortcutsDisallowed if unmodified alphanumeric * keys ('A', '1', etc.) are not permissible shortcuts. */ KShortcutsEditor(KActionCollection *collection, QWidget *parent, ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed); /** * \overload * * Creates a key chooser without a starting action collection. * * @param parent parent widget * @param actionTypes types of actions to display in this widget. * @param allowLetterShortcuts set to LetterShortcutsDisallowed if unmodified alphanumeric * keys ('A', '1', etc.) are not permissible shortcuts. */ explicit KShortcutsEditor(QWidget *parent, ActionTypes actionTypes = AllActions, LetterShortcuts allowLetterShortcuts = LetterShortcutsAllowed); /// Destructor virtual ~KShortcutsEditor(); /** * Are the unsaved changes? */ bool isModified() const; /** * Removes all action collections from the editor */ void clearCollections(); /** * Insert an action collection, i.e. add all its actions to the ones * already associated with the KShortcutsEditor object. * @param title subtree title of this collection of shortcut. */ void addCollection(KActionCollection *, const QString &title = QString()); /** * Undo all change made since the last commit(). */ void undoChanges(); /** * Save the changes. * * Before saving the changes are committed. This saves the actions to disk. * Any KActionCollection objects with the xmlFile() value set will be * written to an XML file. All other will be written to the application's * rc file. */ void save(); /** * Commit the changes without saving. * * This commits the changes without saving. * * @since 4.2 */ void commit(); /** * Removes all configured shortcuts. */ void clearConfiguration(); /** * Write the current settings to the \p config object. * * This does not initialize the \p config object. It adds the * configuration. * * @note This will not save the global configuration! globalaccel holds * that part of the configuration. * @see writeGlobalConfig() * * @param config Config object to save to or, or null to use the * applications config object * */ void writeConfiguration(KConfigGroup *config = nullptr) const; /** * Export the current setting to configuration @p config. * * This initializes the configuration object. This will export the global * configuration too. * * @param config Config object */ #ifndef KXMLGUI_NO_DEPRECATED KXMLGUI_DEPRECATED void exportConfiguration(KConfig *config) const; #endif void exportConfiguration(KConfigBase *config) const; /** * Import the settings from configuration @p config. * * This will remove all current setting before importing. All shortcuts * are set to QList() prior to importing from @p config! * * @param config Config object */ #ifndef KXMLGUI_NO_DEPRECATED KXMLGUI_DEPRECATED void importConfiguration(KConfig *config); #endif void importConfiguration(KConfigBase *config); /** * Sets the types of actions to display in this widget. * * @param actionTypes New types of actions * @since 5.0 */ void setActionTypes(ActionTypes actionTypes); /** * * @return The types of actions currently displayed in this widget. * @since 5.0 */ ActionTypes actionTypes() const; Q_SIGNALS: /** * Emitted when an action's shortcut has been changed. **/ void keyChange(); public Q_SLOTS: /** * Resize columns to width required */ void resizeColumns(); /** * Set all shortcuts to their default values (bindings). **/ void allDefault(); /** * Opens a printing dialog to print all the shortcuts */ void printShortcuts() const; private: Q_PRIVATE_SLOT(d, void capturedShortcut(QVariant, const QModelIndex &)) private: friend class KShortcutsDialog; friend class KShortcutsEditorPrivate; KShortcutsEditorPrivate *const d; Q_DISABLE_COPY(KShortcutsEditor) }; Q_DECLARE_OPERATORS_FOR_FLAGS(KShortcutsEditor::ActionTypes) #endif // KSHORTCUTSEDITOR_H diff --git a/src/kshortcutwidget.h b/src/kshortcutwidget.h index a7e135b..46fcc61 100644 --- a/src/kshortcutwidget.h +++ b/src/kshortcutwidget.h @@ -1,101 +1,101 @@ /* This file is part of the KDE libraries Copyright (C) 2007 Andreas Hartmetz This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KSHORTCUTWIDGET_H #define KSHORTCUTWIDGET_H #include #include #include #include class KActionCollection; class KShortcutWidgetPrivate; /** * @class KShortcutWidget kshortcutwidget.h KShortcutWidget * * \image html kshortcutwidget.png "KShortcutWidget" */ class KXMLGUI_EXPORT KShortcutWidget : public QWidget { Q_OBJECT Q_PROPERTY(bool modifierlessAllowed READ isModifierlessAllowed WRITE setModifierlessAllowed) public: KShortcutWidget(QWidget *parent = nullptr); ~KShortcutWidget(); void setModifierlessAllowed(bool allow); bool isModifierlessAllowed(); void setClearButtonsShown(bool show); QList shortcut() const; /** * Set a list of action collections to check against for conflictuous shortcut. * - * If there is a conflictuous shortcut with a KAction, and that his shortcut can be configured - * (KAction::isShortcutConfigurable() returns true) the user will be prompted for eventually steal + * If there is a conflictuous shortcut with a QAction, and that his shortcut can be configured + * (KActionCollection::isShortcutConfigurable() returns true) the user will be prompted for eventually steal * the shortcut from this action * * Global shortcuts are automatically checked for conflicts * * Don't forget to call applyStealShortcut to actually steal the shortcut. * * @since 4.1 */ void setCheckActionCollections(const QList &actionCollections); /** * @deprecated since 4.1 * Use setCheckActionCollections so that KShortcutWidget knows * in which action collection to call the writeSettings method after stealing * a shortcut from an action. */ #ifndef KXMLGUI_NO_DEPRECATED KXMLGUI_DEPRECATED void setCheckActionList(const QList &checkList); #endif Q_SIGNALS: void shortcutChanged(const QList &cut); public Q_SLOTS: void setShortcut(const QList &cut); void clearShortcut(); /** * Actually remove the shortcut that the user wanted to steal, from the * action that was using it. * * To be called before you apply your changes. * No shortcuts are stolen until this function is called. */ void applyStealShortcut(); private: Q_PRIVATE_SLOT(d, void priKeySequenceChanged(const QKeySequence &)) Q_PRIVATE_SLOT(d, void altKeySequenceChanged(const QKeySequence &)) private: friend class KShortcutWidgetPrivate; KShortcutWidgetPrivate *const d; }; #endif //KSHORTCUTWIDGET_H