diff --git a/client.h b/client.h index ba387b276..aff8de623 100644 --- a/client.h +++ b/client.h @@ -29,7 +29,6 @@ along with this program. If not, see . #include "toplevel.h" #include "xcbutils.h" // KDE -#include #include // Qt #include @@ -461,7 +460,7 @@ public: void shrinkVertical(); bool providesContextHelp() const; - KShortcut shortcut() const; + const QKeySequence &shortcut() const; void setShortcut(const QString& cut); WindowOperation mouseButtonToWindowOperation(Qt::MouseButtons button); @@ -778,7 +777,7 @@ private: void setCaption(const QString& s, bool force = false); bool hasTransientInternal(const Client* c, bool indirect, ConstClientList& set) const; void finishWindowRules(); - void setShortcutInternal(const KShortcut& cut); + void setShortcutInternal(const QKeySequence &cut = QKeySequence()); void configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool); NETExtendedStrut strut() const; @@ -962,7 +961,7 @@ private: int padding_left, padding_right, padding_top, padding_bottom; QRegion _mask; static bool check_active_modal; ///< \see Client::checkActiveModal() - KShortcut _shortcut; + QKeySequence _shortcut; int sm_stacking_order; friend struct FetchNameInternalPredicate; friend struct ResetupRulesProcedure; @@ -1240,7 +1239,7 @@ inline xcb_window_t Client::moveResizeGrabWindow() const return m_moveResizeGrabWindow; } -inline KShortcut Client::shortcut() const +inline const QKeySequence &Client::shortcut() const { return _shortcut; } diff --git a/useractions.cpp b/useractions.cpp index 5b3b07e5e..894bd8ef7 100755 --- a/useractions.cpp +++ b/useractions.cpp @@ -985,7 +985,7 @@ void Workspace::setupWindowShortcut(Client* c) //keys->setEnabled( false ); //disable_shortcuts_keys->setEnabled( false ); //client_keys->setEnabled( false ); - client_keys_dialog = new ShortcutDialog(c->shortcut().primary()); + client_keys_dialog = new ShortcutDialog(c->shortcut()); client_keys_client = c; connect(client_keys_dialog, SIGNAL(dialogDone(bool)), SLOT(setupWindowShortcutDone(bool))); QRect r = clientArea(ScreenArea, c); @@ -1007,7 +1007,7 @@ void Workspace::setupWindowShortcutDone(bool ok) // disable_shortcuts_keys->setEnabled( true ); // client_keys->setEnabled( true ); if (ok) - client_keys_client->setShortcut(KShortcut(client_keys_dialog->shortcut()).toString()); + client_keys_client->setShortcut(client_keys_dialog->shortcut().toString()); closeActivePopup(); client_keys_dialog->deleteLater(); client_keys_dialog = NULL; @@ -1029,7 +1029,7 @@ void Workspace::clientShortcutUpdated(Client* c) // no autoloading, since it's configured explicitly here and is not meant to be reused // (the key is the window id anyway, which is kind of random) - KGlobalAccel::self()->setShortcut(action, QList() << c->shortcut().primary(), + KGlobalAccel::self()->setShortcut(action, QList() << c->shortcut(), KGlobalAccel::NoAutoloading); action->setEnabled(true); } else { @@ -1925,18 +1925,18 @@ void Client::setShortcut(const QString& _cut) { QString cut = rules()->checkShortcut(_cut); if (cut.isEmpty()) - return setShortcutInternal(KShortcut()); + return setShortcutInternal(); // Format: // base+(abcdef)base+(abcdef) // E.g. Alt+Ctrl+(ABCDEF);Meta+X,Meta+(ABCDEF) if (!cut.contains(QStringLiteral("(")) && !cut.contains(QStringLiteral(")")) && !cut.contains(QStringLiteral(" - "))) { - if (workspace()->shortcutAvailable(KShortcut(cut), this)) - setShortcutInternal(KShortcut(cut)); + if (workspace()->shortcutAvailable(cut, this)) + setShortcutInternal(QKeySequence(cut)); else - setShortcutInternal(KShortcut()); + setShortcutInternal(); return; } - QList< KShortcut > keys; + QList< QKeySequence > keys; QStringList groups = cut.split(QStringLiteral(" - ")); for (QStringList::ConstIterator it = groups.constBegin(); it != groups.constEnd(); @@ -1948,25 +1948,25 @@ void Client::setShortcut(const QString& _cut) for (int i = 0; i < list.length(); ++i) { - KShortcut c(base + list[ i ]); + QKeySequence c(base + list[ i ]); if (!c.isEmpty()) keys.append(c); } } else { // regexp doesn't match, so it should be a normal shortcut - KShortcut c(*it); + QKeySequence c(*it); if (!c.isEmpty()) { keys.append(c); } } } - for (QList< KShortcut >::ConstIterator it = keys.constBegin(); + for (auto it = keys.constBegin(); it != keys.constEnd(); ++it) { if (_shortcut == *it) // current one is in the list return; } - for (QList< KShortcut >::ConstIterator it = keys.constBegin(); + for (auto it = keys.constBegin(); it != keys.constEnd(); ++it) { if (workspace()->shortcutAvailable(*it, this)) { @@ -1974,10 +1974,10 @@ void Client::setShortcut(const QString& _cut) return; } } - setShortcutInternal(KShortcut()); + setShortcutInternal(); } -void Client::setShortcutInternal(const KShortcut& cut) +void Client::setShortcutInternal(const QKeySequence &cut) { if (_shortcut == cut) return; @@ -1998,13 +1998,11 @@ void Client::delayedSetShortcut() workspace()->clientShortcutUpdated(this); } -bool Workspace::shortcutAvailable(const KShortcut& cut, Client* ignore) const +bool Workspace::shortcutAvailable(const QKeySequence &cut, Client* ignore) const { - Q_FOREACH (const QKeySequence &seq, cut.toList()) { - if (!KGlobalAccel::getGlobalShortcutsByKey(seq).isEmpty()) { - return false; - } + if (!KGlobalAccel::getGlobalShortcutsByKey(cut).isEmpty()) { + return false; } for (ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); diff --git a/workspace.h b/workspace.h index c4206ca26..2d693fb8b 100644 --- a/workspace.h +++ b/workspace.h @@ -39,7 +39,6 @@ class QStringList; class KConfig; class KConfigGroup; class KActionCollection; -class KShortcut; class KStartupInfo; class KStartupInfoId; class KStartupInfoData; @@ -268,7 +267,7 @@ public: bool forcedGlobalMouseGrab() const; void clientShortcutUpdated(Client* c); - bool shortcutAvailable(const KShortcut& cut, Client* ignore = NULL) const; + bool shortcutAvailable(const QKeySequence &cut, Client* ignore = NULL) const; bool globalShortcutsDisabled() const; void disableGlobalShortcutsForClient(bool disable);