diff --git a/dolphin/src/dolphinmainwindow.cpp b/dolphin/src/dolphinmainwindow.cpp index d09b01b3..db2acdd3 100644 --- a/dolphin/src/dolphinmainwindow.cpp +++ b/dolphin/src/dolphinmainwindow.cpp @@ -1260,7 +1260,7 @@ void DolphinMainWindow::setupActions() KAction* newTab = actionCollection()->addAction("new_tab"); newTab->setIcon(KIcon("tab-new")); newTab->setText(i18nc("@action:inmenu File", "New Tab")); - newTab->setShortcut(KShortcut(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N)); + newTab->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N)); connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab())); KAction* closeTab = actionCollection()->addAction("close_tab"); @@ -1280,8 +1280,14 @@ void DolphinMainWindow::setupActions() // need to remove shift+del from cut action, else the shortcut for deletejob // doesn't work KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection()); - KShortcut cutShortcut = cut->shortcut(); - cutShortcut.remove(Qt::SHIFT | Qt::Key_Delete, KShortcut::KeepEmpty); + QKeySequence cutShortcut = cut->shortcut(); + static const int shiftdelete = (Qt::SHIFT | Qt::Key_Delete); + if (cutShortcut[0] == shiftdelete) { + cutShortcut = QKeySequence(cutShortcut[1]); + } + if (cutShortcut[0] == shiftdelete) { + cutShortcut = QKeySequence(); + } cut->setShortcut(cutShortcut); KStandardAction::copy(this, SLOT(copy()), actionCollection()); KAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection()); @@ -1334,8 +1340,8 @@ void DolphinMainWindow::setupActions() // setup 'Go' menu KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection()); connect(backAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons))); - KShortcut backShortcut = backAction->shortcut(); - backShortcut.setAlternate(Qt::Key_Backspace); + QKeySequence backShortcut = backAction->shortcut(); + backShortcut = QKeySequence(backShortcut[0], Qt::Key_Backspace); backAction->setShortcut(backShortcut); DolphinRecentTabsMenu* recentTabsMenu = new DolphinRecentTabsMenu(this); @@ -1375,12 +1381,12 @@ void DolphinMainWindow::setupActions() // not in menu actions const QKeySequence nextTabKeys = QKeySequence( - KStandardShortcut::tabNext().primary(), + KStandardShortcut::tabNext()[0], Qt::CTRL | Qt::Key_Tab ); const QKeySequence prevTabKeys = QKeySequence( - KStandardShortcut::tabPrev().primary(), + KStandardShortcut::tabPrev()[0], Qt::CTRL | Qt::SHIFT | Qt::Key_Tab ); diff --git a/kate/part/dialogs/katedialogs.cpp b/kate/part/dialogs/katedialogs.cpp index 6fd0ff32..f99d6d74 100644 --- a/kate/part/dialogs/katedialogs.cpp +++ b/kate/part/dialogs/katedialogs.cpp @@ -68,7 +68,6 @@ #include #include #include -#include #include #include #include diff --git a/kate/part/dialogs/katedialogs.h b/kate/part/dialogs/katedialogs.h index f36704c2..7ec1591b 100644 --- a/kate/part/dialogs/katedialogs.h +++ b/kate/part/dialogs/katedialogs.h @@ -66,7 +66,6 @@ namespace KIO } class KComboBox; -class KShortcutsEditor; class KTemporaryFile; class KIntNumInput; class KIntSpinBox; diff --git a/kate/src/app/katemdi.cpp b/kate/src/app/katemdi.cpp index 6ecbd868..734b1b0c 100644 --- a/kate/src/app/katemdi.cpp +++ b/kate/src/app/katemdi.cpp @@ -154,9 +154,8 @@ namespace KateMDI QString aname = QString("kate_mdi_toolview_") + tv->id; // try to read the action shortcut - KShortcut sc; KSharedConfig::Ptr cfg = KGlobal::config(); - sc = KShortcut( cfg->group("Shortcuts").readEntry( aname, QString() ) ); + QKeySequence sc = QKeySequence( cfg->group("Shortcuts").readEntry( aname, QString() ) ); KToggleAction *a = new ToggleToolViewAction(i18n("Show %1", tv->text), tv, this ); a->setShortcut(sc, KAction::ActiveShortcut); // no DefaultShortcut! see bug #144945 diff --git a/kcontrol/access/kaccess.cpp b/kcontrol/access/kaccess.cpp index 4fb38b30..46846f67 100644 --- a/kcontrol/access/kaccess.cpp +++ b/kcontrol/access/kaccess.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/kcontrol/access/kcmaccess.cpp b/kcontrol/access/kcmaccess.cpp index 58849dd1..91fa631d 100644 --- a/kcontrol/access/kcmaccess.cpp +++ b/kcontrol/access/kcmaccess.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/kcontrol/standard_actions/standard_actions_module.cpp b/kcontrol/standard_actions/standard_actions_module.cpp index 72a524b1..7ad384af 100644 --- a/kcontrol/standard_actions/standard_actions_module.cpp +++ b/kcontrol/standard_actions/standard_actions_module.cpp @@ -43,16 +43,16 @@ static void dressUpAction(KAction *action, KStandardShortcut::StandardShortcut s // hardcoded default and the user set shortcut. But action currently // only contain the active shortcuts as default shortcut. So we // have to fill it correctly - KShortcut hardcoded = KStandardShortcut::hardcodedDefaultShortcut(shortcutId); - KShortcut active = KStandardShortcut::shortcut(shortcutId); + QKeySequence hardcoded = KStandardShortcut::hardcodedDefaultShortcut(shortcutId); + QKeySequence active = KStandardShortcut::shortcut(shortcutId); // Set the hardcoded default shortcut as default shortcut action->setShortcut(hardcoded, KAction::DefaultShortcut); // Set the user defined values as active shortcuts. If the user only // has overwritten the primary shortcut make sure the alternate one // still get's shown - if (active.alternate()==QKeySequence()) + if (active[1] == 0) { - active.setAlternate(hardcoded.alternate()); + active = QKeySequence(active[0], hardcoded[1]); } action->setShortcut(active, KAction::ActiveShortcut); } diff --git a/kinfocenter/infocenter.cpp b/kinfocenter/infocenter.cpp index 26a5167a..13c7e2fd 100644 --- a/kinfocenter/infocenter.cpp +++ b/kinfocenter/infocenter.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include //QT @@ -190,7 +189,7 @@ void KInfoCenter::createMenuFrame() m_searchText->completionObject()->setIgnoreCase(true); m_searchAction = new KAction(this); - m_searchAction->setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_F))); + m_searchAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F)); m_searchAction->setText(i18nc("Kaction search label", "Search Modules")); m_searchAction->setIcon(KIcon("edit-find")); diff --git a/kmenuedit/basictab.h b/kmenuedit/basictab.h index 3f32c3fc..89cc7002 100644 --- a/kmenuedit/basictab.h +++ b/kmenuedit/basictab.h @@ -21,7 +21,6 @@ #define BASICTAB_H #include -#include #include #include #include diff --git a/kmenuedit/menuinfo.h b/kmenuedit/menuinfo.h index f2c6ab51..1d65aa8b 100644 --- a/kmenuedit/menuinfo.h +++ b/kmenuedit/menuinfo.h @@ -23,7 +23,6 @@ #include -#include #include class MenuFile; diff --git a/kmenuedit/treeview.h b/kmenuedit/treeview.h index e589e45a..ced054df 100644 --- a/kmenuedit/treeview.h +++ b/kmenuedit/treeview.h @@ -39,7 +39,6 @@ class MenuFile; class MenuFolderInfo; class MenuEntryInfo; class MenuSeparatorInfo; -class KShortcut; static const QString SAVE_ACTION_NAME = "file_save"; static const QString NEW_ITEM_ACTION_NAME = "new_item"; diff --git a/konsole/src/Application.cpp b/konsole/src/Application.cpp index ea870f74..52eba6c0 100644 --- a/konsole/src/Application.cpp +++ b/konsole/src/Application.cpp @@ -414,7 +414,7 @@ void Application::startBackgroundMode(MainWindow* window) KAction* action = window->actionCollection()->addAction("toggle-background-window"); action->setObjectName(QLatin1String("Konsole Background Mode")); action->setText(i18n("Toggle Background Window")); - action->setGlobalShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F12))); + action->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F12)); connect(action, SIGNAL(triggered()), this, SLOT(toggleBackgroundInstance())); diff --git a/konsole/src/SessionController.cpp b/konsole/src/SessionController.cpp index c432f848..7cd07f24 100644 --- a/konsole/src/SessionController.cpp +++ b/konsole/src/SessionController.cpp @@ -626,10 +626,7 @@ void SessionController::setupCommonActions() action->setEnabled(false); action = KStandardAction::paste(this, SLOT(paste()), collection); - KShortcut pasteShortcut = action->shortcut(); - pasteShortcut.setPrimary(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V)); - pasteShortcut.setAlternate(QKeySequence(Qt::SHIFT + Qt::Key_Insert)); - action->setShortcut(pasteShortcut); + action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V, Qt::SHIFT + Qt::Key_Insert)); action = collection->addAction("paste-selection", this, SLOT(pasteFromX11Selection())); action->setText(i18n("Paste Selection")); @@ -762,15 +759,12 @@ void SessionController::setupExtraActions() action = collection->addAction("enlarge-font", this, SLOT(increaseFontSize())); action->setText(i18n("Enlarge Font")); action->setIcon(KIcon("format-font-size-more")); - KShortcut enlargeFontShortcut = action->shortcut(); - enlargeFontShortcut.setPrimary(QKeySequence(Qt::CTRL + Qt::Key_Plus)); - enlargeFontShortcut.setAlternate(QKeySequence(Qt::CTRL + Qt::Key_Equal)); - action->setShortcut(enlargeFontShortcut); + action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus, Qt::CTRL + Qt::Key_Equal)); action = collection->addAction("shrink-font", this, SLOT(decreaseFontSize())); action->setText(i18n("Shrink Font")); action->setIcon(KIcon("format-font-size-less")); - action->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Minus)); + action->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); // Send signal KSelectAction* sendSignalActions = collection->add("send-signal"); diff --git a/ksmserver/server.cpp b/ksmserver/server.cpp index 39ff9969..01f475f4 100644 --- a/ksmserver/server.cpp +++ b/ksmserver/server.cpp @@ -999,22 +999,22 @@ void KSMServer::setupShortcuts() KAction* a; a = actionCollection->addAction("Log Out"); a->setText(i18n("Log Out")); - a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_Delete)); + a->setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_Delete)); connect(a, SIGNAL(triggered(bool)), SLOT(defaultLogout())); a = actionCollection->addAction("Log Out Without Confirmation"); a->setText(i18n("Log Out Without Confirmation")); - a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_Delete)); + a->setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_Delete)); connect(a, SIGNAL(triggered(bool)), SLOT(logoutWithoutConfirmation())); a = actionCollection->addAction("Halt Without Confirmation"); a->setText(i18n("Halt Without Confirmation")); - a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageDown)); + a->setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageDown)); connect(a, SIGNAL(triggered(bool)), SLOT(haltWithoutConfirmation())); a = actionCollection->addAction("Reboot Without Confirmation"); a->setText(i18n("Reboot Without Confirmation")); - a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageUp)); + a->setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::SHIFT+Qt::Key_PageUp)); connect(a, SIGNAL(triggered(bool)), SLOT(rebootWithoutConfirmation())); } diff --git a/kstyles/oxygen/config/oxygenconfigdialog.cpp b/kstyles/oxygen/config/oxygenconfigdialog.cpp index 2452065f..5a2594ca 100644 --- a/kstyles/oxygen/config/oxygenconfigdialog.cpp +++ b/kstyles/oxygen/config/oxygenconfigdialog.cpp @@ -56,8 +56,7 @@ namespace Oxygen setWindowTitle( i18n( "Oxygen Settings" ) ); // install Quit shortcut - connect( new QShortcut( KStandardShortcut::quit().primary(), this ), SIGNAL(activated()), SLOT(close()) ); - connect( new QShortcut( KStandardShortcut::quit().alternate(), this ), SIGNAL(activated()), SLOT(close()) ); + connect( new QShortcut( KStandardShortcut::quit(), this ), SIGNAL(activated()), SLOT(close()) ); // tab widget pageWidget_ = new KPageWidget( this ); diff --git a/kstyles/oxygen/demo/oxygendemodialog.cpp b/kstyles/oxygen/demo/oxygendemodialog.cpp index 8470eb5d..64c3d3ee 100644 --- a/kstyles/oxygen/demo/oxygendemodialog.cpp +++ b/kstyles/oxygen/demo/oxygendemodialog.cpp @@ -56,8 +56,7 @@ namespace Oxygen setWindowTitle( i18n( "Oxygen Demo" ) ); // install Quit shortcut - connect( new QShortcut( KStandardShortcut::quit().primary(), this ), SIGNAL(activated()), SLOT(close()) ); - connect( new QShortcut( KStandardShortcut::quit().alternate(), this ), SIGNAL(activated()), SLOT(close()) ); + connect( new QShortcut( KStandardShortcut::quit(), this ), SIGNAL(activated()), SLOT(close()) ); // customize button box QList children( findChildren() ); diff --git a/kwin/client.h b/kwin/client.h index 85c7b347..762af7fb 100644 --- a/kwin/client.h +++ b/kwin/client.h @@ -29,10 +29,10 @@ along with this program. If not, see . #include "toplevel.h" #include "xcbutils.h" // KDE -#include #include -// Qt +// Katie #include +#include // X #ifdef HAVE_XSYNC #include @@ -457,7 +457,7 @@ public: void shrinkVertical(); bool providesContextHelp() const; - KShortcut shortcut() const; + QKeySequence shortcut() const; void setShortcut(const QString& cut); WindowOperation mouseButtonToWindowOperation(Qt::MouseButtons button); @@ -728,7 +728,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); void configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool); NETExtendedStrut strut() const; @@ -910,7 +910,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; @@ -1178,7 +1178,7 @@ inline xcb_window_t Client::moveResizeGrabWindow() const return m_moveResizeGrabWindow; } -inline KShortcut Client::shortcut() const +inline QKeySequence Client::shortcut() const { return _shortcut; } diff --git a/kwin/composite.cpp b/kwin/composite.cpp index 10555212..8bad1d3f 100644 --- a/kwin/composite.cpp +++ b/kwin/composite.cpp @@ -333,7 +333,7 @@ void Compositor::toggleCompositing() // when disabled show a shortcut how the user can get back compositing QString shortcut, message; if (KAction* action = qobject_cast(Workspace::self()->actionCollection()->action("Suspend Compositing"))) - shortcut = action->globalShortcut().primary().toString(QKeySequence::NativeText); + shortcut = action->globalShortcut().toString(QKeySequence::NativeText); if (!shortcut.isEmpty()) { // display notification only if there is the shortcut message = i18n("Desktop effects have been suspended by another application.
" diff --git a/kwin/effects/magnifier/magnifier.cpp b/kwin/effects/magnifier/magnifier.cpp index b256b3a0..167d81cc 100644 --- a/kwin/effects/magnifier/magnifier.cpp +++ b/kwin/effects/magnifier/magnifier.cpp @@ -52,11 +52,11 @@ MagnifierEffect::MagnifierEffect() KActionCollection* actionCollection = new KActionCollection(this); KAction* a; a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn()))); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Equal)); a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut()))); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Minus)); a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(toggle()))); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_0)); connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)), this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers))); reconfigure(ReconfigureAll); diff --git a/kwin/effects/magnifier/magnifier_config.cpp b/kwin/effects/magnifier/magnifier_config.cpp index a7d4621d..8c18f42e 100644 --- a/kwin/effects/magnifier/magnifier_config.cpp +++ b/kwin/effects/magnifier/magnifier_config.cpp @@ -66,15 +66,15 @@ MagnifierEffectConfig::MagnifierEffectConfig(QWidget* parent, const QVariantList KAction* a; a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomIn)); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Plus)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Plus)); a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ZoomOut)); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Minus)); a = static_cast< KAction* >(m_actionCollection->addAction(KStandardAction::ActualSize)); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_0)); m_ui->editor->addCollection(m_actionCollection); load(); diff --git a/kwin/effects/mousemark/mousemark.cpp b/kwin/effects/mousemark/mousemark.cpp index 69934dd0..36904661 100644 --- a/kwin/effects/mousemark/mousemark.cpp +++ b/kwin/effects/mousemark/mousemark.cpp @@ -48,11 +48,11 @@ MouseMarkEffect::MouseMarkEffect() KActionCollection* actionCollection = new KActionCollection(this); KAction* a = static_cast< KAction* >(actionCollection->addAction("ClearMouseMarks")); a->setText(i18n("Clear All Mouse Marks")); - a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11)); + a->setGlobalShortcut(QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_F11)); connect(a, SIGNAL(triggered(bool)), this, SLOT(clear())); a = static_cast< KAction* >(actionCollection->addAction("ClearLastMouseMark")); a->setText(i18n("Clear Last Mouse Mark")); - a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12)); + a->setGlobalShortcut(QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_F12)); connect(a, SIGNAL(triggered(bool)), this, SLOT(clearLast())); connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)), this, SLOT(slotMouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers))); diff --git a/kwin/effects/mousemark/mousemark_config.cpp b/kwin/effects/mousemark/mousemark_config.cpp index acb9d3ae..4677d6d6 100644 --- a/kwin/effects/mousemark/mousemark_config.cpp +++ b/kwin/effects/mousemark/mousemark_config.cpp @@ -62,12 +62,12 @@ MouseMarkEffectConfig::MouseMarkEffectConfig(QWidget* parent, const QVariantList KAction* a = static_cast< KAction* >(m_actionCollection->addAction("ClearMouseMarks")); a->setText(i18n("Clear Mouse Marks")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F11)); + a->setGlobalShortcut(QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_F11)); a = static_cast< KAction* >(m_actionCollection->addAction("ClearLastMouseMark")); a->setText(i18n("Clear Last Mouse Mark")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::META + Qt::Key_F12)); + a->setGlobalShortcut(QKeySequence(Qt::SHIFT + Qt::META + Qt::Key_F12)); m_ui->editor->addCollection(m_actionCollection); diff --git a/kwin/effects/presentwindows/presentwindows.cpp b/kwin/effects/presentwindows/presentwindows.cpp index c1657b9d..44d50ae6 100755 --- a/kwin/effects/presentwindows/presentwindows.cpp +++ b/kwin/effects/presentwindows/presentwindows.cpp @@ -68,19 +68,19 @@ PresentWindowsEffect::PresentWindowsEffect() KActionCollection* actionCollection = new KActionCollection(this); KAction* a = (KAction*)actionCollection->addAction("Expose"); a->setText(i18n("Toggle Present Windows (Current desktop)")); - a->setGlobalShortcut(KShortcut(Qt::ALT + Qt::Key_Tab)); + a->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab)); shortcut = a->globalShortcut(); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleActive())); connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChanged(QKeySequence))); KAction* b = (KAction*)actionCollection->addAction("ExposeAll"); b->setText(i18n("Toggle Present Windows (All desktops)")); - // b->setGlobalShortcut(KShortcut(Qt::ALT + Qt::CTRL + Qt::Key_Tab)); + // b->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::CTRL + Qt::Key_Tab)); shortcutAll = b->globalShortcut(); connect(b, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops())); connect(b, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedAll(QKeySequence))); KAction* c = (KAction*)actionCollection->addAction("ExposeClass"); c->setText(i18n("Toggle Present Windows (Window class)")); - c->setGlobalShortcut(KShortcut(Qt::ALT + Qt::SHIFT + Qt::Key_Tab)); + c->setGlobalShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab)); connect(c, SIGNAL(triggered(bool)), this, SLOT(toggleActiveClass())); connect(c, SIGNAL(globalShortcutChanged(QKeySequence)), this, SLOT(globalShortcutChangedClass(QKeySequence))); shortcutClass = c->globalShortcut(); @@ -666,15 +666,16 @@ void PresentWindowsEffect::grabbedKeyboardEvent(QKeyEvent *e) if (e->type() == QEvent::KeyPress) { // check for global shortcuts // HACK: keyboard grab disables the global shortcuts so we have to check for global shortcut (bug 156155) - if (m_mode == ModeCurrentDesktop && shortcut.contains(e->key() + e->modifiers())) { + const int eventkey = (e->key() + e->modifiers()); + if (m_mode == ModeCurrentDesktop && shortcut.matches(eventkey) != QKeySequence::NoMatch) { toggleActive(); return; } - if (m_mode == ModeAllDesktops && shortcutAll.contains(e->key() + e->modifiers())) { + if (m_mode == ModeAllDesktops && shortcutAll.matches(eventkey) != QKeySequence::NoMatch) { toggleActiveAllDesktops(); return; } - if (m_mode == ModeWindowClass && shortcutClass.contains(e->key() + e->modifiers())) { + if (m_mode == ModeWindowClass && shortcutClass.matches(eventkey) != QKeySequence::NoMatch) { toggleActiveClass(); return; } @@ -1778,17 +1779,17 @@ EffectWindow* PresentWindowsEffect::findFirstWindow() const void PresentWindowsEffect::globalShortcutChanged(const QKeySequence& seq) { - shortcut = KShortcut(seq); + shortcut = seq; } void PresentWindowsEffect::globalShortcutChangedAll(const QKeySequence& seq) { - shortcutAll = KShortcut(seq); + shortcutAll = seq; } void PresentWindowsEffect::globalShortcutChangedClass(const QKeySequence& seq) { - shortcutClass = KShortcut(seq); + shortcutClass = seq; } bool PresentWindowsEffect::isActive() const diff --git a/kwin/effects/presentwindows/presentwindows.h b/kwin/effects/presentwindows/presentwindows.h index cbd1d71b..2c3cec16 100644 --- a/kwin/effects/presentwindows/presentwindows.h +++ b/kwin/effects/presentwindows/presentwindows.h @@ -25,7 +25,7 @@ along with this program. If not, see . #include "presentwindows_proxy.h" #include -#include +#include #include #include @@ -271,9 +271,9 @@ private: QString m_windowFilter; // Shortcut - needed to toggle the effect - KShortcut shortcut; - KShortcut shortcutAll; - KShortcut shortcutClass; + QKeySequence shortcut; + QKeySequence shortcutAll; + QKeySequence shortcutClass; // Atoms // Present windows for all windows of given desktop diff --git a/kwin/effects/presentwindows/presentwindows_config.cpp b/kwin/effects/presentwindows/presentwindows_config.cpp index 6f711fbe..88428db8 100644 --- a/kwin/effects/presentwindows/presentwindows_config.cpp +++ b/kwin/effects/presentwindows/presentwindows_config.cpp @@ -59,17 +59,17 @@ PresentWindowsEffectConfig::PresentWindowsEffectConfig(QWidget* parent, const QV KAction* a = (KAction*) m_actionCollection->addAction("ExposeAll"); a->setText(i18n("Toggle Present Windows (All desktops)")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F10)); + a->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::Key_F10)); KAction* b = (KAction*) m_actionCollection->addAction("Expose"); b->setText(i18n("Toggle Present Windows (Current desktop)")); b->setProperty("isConfigurationAction", true); - b->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F9)); + b->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::Key_F9)); KAction* c = (KAction*)m_actionCollection->addAction("ExposeClass"); c->setText(i18n("Toggle Present Windows (Window class)")); c->setProperty("isConfigurationAction", true); - c->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::Key_F7)); + c->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::Key_F7)); m_ui->shortcutEditor->addCollection(m_actionCollection); diff --git a/kwin/effects/thumbnailaside/thumbnailaside.cpp b/kwin/effects/thumbnailaside/thumbnailaside.cpp index 8c837515..930aad2e 100644 --- a/kwin/effects/thumbnailaside/thumbnailaside.cpp +++ b/kwin/effects/thumbnailaside/thumbnailaside.cpp @@ -35,7 +35,7 @@ ThumbnailAsideEffect::ThumbnailAsideEffect() KActionCollection* actionCollection = new KActionCollection(this); KAction* a = (KAction*)actionCollection->addAction("ToggleCurrentThumbnail"); a->setText(i18n("Toggle Thumbnail for Current Window")); - a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::META + Qt::Key_T)); + a->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::META + Qt::Key_T)); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggleCurrentThumbnail())); connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*))); connect(effects, SIGNAL(windowGeometryShapeChanged(KWin::EffectWindow*,QRect)), this, SLOT(slotWindowGeometryShapeChanged(KWin::EffectWindow*,QRect))); diff --git a/kwin/effects/thumbnailaside/thumbnailaside_config.cpp b/kwin/effects/thumbnailaside/thumbnailaside_config.cpp index 0f605f93..bf46a5d5 100644 --- a/kwin/effects/thumbnailaside/thumbnailaside_config.cpp +++ b/kwin/effects/thumbnailaside/thumbnailaside_config.cpp @@ -66,7 +66,7 @@ ThumbnailAsideEffectConfig::ThumbnailAsideEffectConfig(QWidget* parent, const QV KAction* a = (KAction*)m_actionCollection->addAction("ToggleCurrentThumbnail"); a->setText(i18n("Toggle Thumbnail for Current Window")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::CTRL + Qt::Key_T)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::CTRL + Qt::Key_T)); m_ui->editor->addCollection(m_actionCollection); diff --git a/kwin/effects/trackmouse/trackmouse.cpp b/kwin/effects/trackmouse/trackmouse.cpp index e72c7a03..d8d8fb37 100644 --- a/kwin/effects/trackmouse/trackmouse.cpp +++ b/kwin/effects/trackmouse/trackmouse.cpp @@ -56,7 +56,7 @@ TrackMouseEffect::TrackMouseEffect() KActionCollection *actionCollection = new KActionCollection(this); m_action = static_cast< KAction* >(actionCollection->addAction("TrackMouse")); m_action->setText(i18n("Track mouse")); - m_action->setGlobalShortcut(KShortcut()); + m_action->setGlobalShortcut(QKeySequence()); connect(m_action, SIGNAL(triggered(bool)), this, SLOT(toggle())); connect(effects, SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)), diff --git a/kwin/effects/trackmouse/trackmouse_config.cpp b/kwin/effects/trackmouse/trackmouse_config.cpp index 9c1e5b2d..67974221 100644 --- a/kwin/effects/trackmouse/trackmouse_config.cpp +++ b/kwin/effects/trackmouse/trackmouse_config.cpp @@ -62,7 +62,7 @@ TrackMouseEffectConfig::TrackMouseEffectConfig(QWidget* parent, const QVariantLi KAction *a = static_cast< KAction* >(m_actionCollection->addAction("TrackMouse")); a->setText(i18n("Track mouse")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut()); + a->setGlobalShortcut(QKeySequence()); connect(m_ui->shortcut, SIGNAL(keySequenceChanged(QKeySequence)), SLOT(shortcutChanged(QKeySequence))); @@ -85,7 +85,7 @@ void TrackMouseEffectConfig::load() { KCModule::load(); if (KAction *a = qobject_cast(m_actionCollection->action("TrackMouse"))) - m_ui->shortcut->setKeySequence(a->globalShortcut().primary()); + m_ui->shortcut->setKeySequence(a->globalShortcut()); checkModifiers(); emit changed(false); @@ -108,7 +108,7 @@ void TrackMouseEffectConfig::defaults() void TrackMouseEffectConfig::shortcutChanged(const QKeySequence &seq) { if (KAction *a = qobject_cast(m_actionCollection->action("TrackMouse"))) - a->setGlobalShortcut(KShortcut(seq), KAction::ActiveShortcut); + a->setGlobalShortcut(seq, KAction::ActiveShortcut); // m_actionCollection->writeSettings(); emit changed(true); } diff --git a/kwin/effects/windowgeometry/windowgeometry.cpp b/kwin/effects/windowgeometry/windowgeometry.cpp index 509b8d67..aa013b46 100644 --- a/kwin/effects/windowgeometry/windowgeometry.cpp +++ b/kwin/effects/windowgeometry/windowgeometry.cpp @@ -59,7 +59,7 @@ WindowGeometryEffect::WindowGeometryEffect() KActionCollection* actionCollection = new KActionCollection(this); KAction* a = static_cast< KAction* >(actionCollection->addAction("WindowGeometry")); a->setText(i18n("Toggle window geometry display (effect only)")); - a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11)); + a->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F11)); connect(a, SIGNAL(triggered(bool)), this, SLOT(toggle())); connect(effects, SIGNAL(windowStartUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowStartUserMovedResized(KWin::EffectWindow*))); connect(effects, SIGNAL(windowFinishUserMovedResized(KWin::EffectWindow*)), this, SLOT(slotWindowFinishUserMovedResized(KWin::EffectWindow*))); diff --git a/kwin/effects/windowgeometry/windowgeometry_config.cpp b/kwin/effects/windowgeometry/windowgeometry_config.cpp index 7128c0bb..740f4329 100644 --- a/kwin/effects/windowgeometry/windowgeometry_config.cpp +++ b/kwin/effects/windowgeometry/windowgeometry_config.cpp @@ -48,7 +48,7 @@ WindowGeometryConfig::WindowGeometryConfig(QWidget* parent, const QVariantList& KAction* a = (KAction*)myActionCollection->addAction("WindowGeometry"); a->setText(i18n("Toggle KWin composited geometry display")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_F11)); + a->setGlobalShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_F11)); myUi->shortcuts->addCollection(myActionCollection); connect(myUi->shortcuts, SIGNAL(keyChange()), this, SLOT(changed())); diff --git a/kwin/effects/zoom/zoom.cpp b/kwin/effects/zoom/zoom.cpp index 783b6ea5..158cbbec 100644 --- a/kwin/effects/zoom/zoom.cpp +++ b/kwin/effects/zoom/zoom.cpp @@ -63,35 +63,35 @@ ZoomEffect::ZoomEffect() KActionCollection* actionCollection = new KActionCollection(this); KAction* a = 0; a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn()))); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Equal)); a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut()))); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Minus)); a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize, this, SLOT(actualSize()))); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_0)); a = static_cast< KAction* >(actionCollection->addAction("MoveZoomLeft")); a->setText(i18n("Move Zoomed Area to Left")); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Left)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Left)); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomLeft())); a = static_cast< KAction* >(actionCollection->addAction("MoveZoomRight")); a->setText(i18n("Move Zoomed Area to Right")); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Right)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Right)); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomRight())); a = static_cast< KAction* >(actionCollection->addAction("MoveZoomUp")); a->setText(i18n("Move Zoomed Area Upwards")); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Up)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Up)); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomUp())); a = static_cast< KAction* >(actionCollection->addAction("MoveZoomDown")); a->setText(i18n("Move Zoomed Area Downwards")); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Down)); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveZoomDown())); a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToCenter")); a->setText(i18n("Move Mouse to Center")); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_F6)); connect(a, SIGNAL(triggered(bool)), this, SLOT(moveMouseToCenter())); timeline.setDuration(350); diff --git a/kwin/effects/zoom/zoom_config.cpp b/kwin/effects/zoom/zoom_config.cpp index 61bd5f48..df261186 100644 --- a/kwin/effects/zoom/zoom_config.cpp +++ b/kwin/effects/zoom/zoom_config.cpp @@ -64,45 +64,45 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) : KAction* a; a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomIn)); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Equal)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Equal)); a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ZoomOut)); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Minus)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Minus)); a = static_cast< KAction* >(actionCollection->addAction(KStandardAction::ActualSize)); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_0)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_0)); a = static_cast< KAction* >(actionCollection->addAction("MoveZoomLeft")); a->setIcon(KIcon("go-previous")); a->setText(i18n("Move Left")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Left)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Left)); a = static_cast< KAction* >(actionCollection->addAction("MoveZoomRight")); a->setIcon(KIcon("go-next")); a->setText(i18n("Move Right")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Right)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Right)); a = static_cast< KAction* >(actionCollection->addAction("MoveZoomUp")); a->setIcon(KIcon("go-up")); a->setText(i18n("Move Up")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Up)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Up)); a = static_cast< KAction* >(actionCollection->addAction("MoveZoomDown")); a->setIcon(KIcon("go-down")); a->setText(i18n("Move Down")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_Down)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_Down)); a = static_cast< KAction* >(actionCollection->addAction("MoveMouseToCenter")); a->setIcon(KIcon("view-restore")); a->setText(i18n("Move Mouse to Center")); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut(KShortcut(Qt::META + Qt::Key_F6)); + a->setGlobalShortcut(QKeySequence(Qt::META + Qt::Key_F6)); m_ui->editor->addCollection(actionCollection); load(); diff --git a/kwin/kcmkwin/kwincompositing/main.cpp b/kwin/kcmkwin/kwincompositing/main.cpp index cb874a82..1aa4d177 100644 --- a/kwin/kcmkwin/kwincompositing/main.cpp +++ b/kwin/kcmkwin/kwincompositing/main.cpp @@ -150,7 +150,7 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList KAction* a = static_cast(m_actionCollection->addAction( "Suspend Compositing" )); a->setProperty("isConfigurationAction", true); - a->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_F12 )); + a->setGlobalShortcut( QKeySequence( Qt::ALT + Qt::SHIFT + Qt::Key_F12 )); connect(ui.toggleEffectsShortcut, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(toggleEffectShortcutChanged(QKeySequence))); // Initialize the user interface with the config loaded from kwinrc. @@ -233,7 +233,7 @@ void KWinCompositingConfig::loadGeneralTab() // this works by global shortcut magics - it will pick the current sc // but the constructor line that adds the default alt+shift+f12 gsc is IMPORTANT! if (KAction *a = qobject_cast(m_actionCollection->action("Suspend Compositing"))) - ui.toggleEffectsShortcut->setKeySequence(a->globalShortcut().primary()); + ui.toggleEffectsShortcut->setKeySequence(a->globalShortcut()); ui.animationSpeedCombo->setCurrentIndex(config.readEntry("AnimationSpeed", 3)); @@ -270,7 +270,7 @@ void KWinCompositingConfig::alignGuiToCompositingType(int compositingType) void KWinCompositingConfig::toggleEffectShortcutChanged(const QKeySequence &seq) { if (KAction *a = qobject_cast(m_actionCollection->action("Suspend Compositing"))) - a->setGlobalShortcut(KShortcut(seq), KAction::ActiveShortcut); + a->setGlobalShortcut(seq, KAction::ActiveShortcut); m_actionCollection->writeSettings(); } diff --git a/kwin/kcmkwin/kwindesktop/main.cpp b/kwin/kcmkwin/kwindesktop/main.cpp index 87f93596..f4c66dbd 100644 --- a/kwin/kcmkwin/kwindesktop/main.cpp +++ b/kwin/kcmkwin/kwindesktop/main.cpp @@ -109,7 +109,7 @@ void KWinDesktopConfig::init() KAction* a = qobject_cast(m_actionCollection->addAction(QString("Switch to Desktop %1").arg(i))); a->setProperty("isConfigurationAction", true); a->setText(i18n("Switch to Desktop %1", i)); - a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); + a->setGlobalShortcut(QKeySequence(), KAction::ActiveShortcut); } // This should be after the "Switch to Desktop %1" loop. It HAS to be @@ -186,7 +186,7 @@ void KWinDesktopConfig::addAction(const QString &name, const QString &label) KAction* a = qobject_cast(m_switchDesktopCollection->addAction(name)); a->setProperty("isConfigurationAction", true); a->setText(label); - a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); + a->setGlobalShortcut(QKeySequence(), KAction::ActiveShortcut); } void KWinDesktopConfig::defaults() @@ -402,7 +402,7 @@ void KWinDesktopConfig::slotChangeShortcuts(int number) m_actionCollection->takeAction(m_actionCollection->actions().last())); // Remove any associated global shortcut. Set it to "" a->setGlobalShortcut( - KShortcut(), + QKeySequence(), KAction::ActiveShortcut ); m_ui->messageLabel->hide(); @@ -413,14 +413,14 @@ void KWinDesktopConfig::slotChangeShortcuts(int number) KAction* action = qobject_cast(m_actionCollection->addAction(QString("Switch to Desktop %1").arg(desktop))); action->setProperty("isConfigurationAction", true); action->setText(i18n("Switch to Desktop %1", desktop)); - action->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); + action->setGlobalShortcut(QKeySequence(), KAction::ActiveShortcut); QString shortcutString = extrapolatedShortcut(desktop); if (shortcutString.isEmpty()) { m_ui->messageLabel->setText(i18n("No suitable Shortcut for Desktop %1 found", desktop)); m_ui->messageLabel->show(); } else { - KShortcut shortcut(shortcutString); - if (!shortcut.primary().isEmpty() || KGlobalAccel::self()->isGlobalShortcutAvailable(shortcut.primary())) { + QKeySequence shortcut(shortcutString); + if (!shortcut.isEmpty() || KGlobalAccel::self()->isGlobalShortcutAvailable(shortcut)) { action->setGlobalShortcut(shortcut, KAction::ActiveShortcut); m_ui->messageLabel->setText(i18n("Assigned global Shortcut \"%1\" to Desktop %2", shortcutString, desktop)); m_ui->messageLabel->show(); diff --git a/kwin/kwinbindings.cpp b/kwin/kwinbindings.cpp index 9ca9319a..97254cc5 100644 --- a/kwin/kwinbindings.cpp +++ b/kwin/kwinbindings.cpp @@ -30,7 +30,7 @@ along with this program. If not, see . #define DEF2( name, descr, key, fnSlot ) \ a = actionCollection->addAction( name ); \ a->setText( i18n(descr) ); \ - qobject_cast( a )->setGlobalShortcut(KShortcut(key)); \ + qobject_cast( a )->setGlobalShortcut(QKeySequence(key)); \ connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); #define DEF( name, key, fnSlot ) \ @@ -39,7 +39,7 @@ along with this program. If not, see . #define DEF3( name, key, fnSlot, value ) \ a = actionCollection->addAction( QString(name).arg(value) ); \ a->setText( i18n(name, value) ); \ - qobject_cast( a )->setGlobalShortcut(KShortcut(key)); \ + qobject_cast( a )->setGlobalShortcut(QKeySequence(key)); \ a->setData(value); \ connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); diff --git a/kwin/useractions.cpp b/kwin/useractions.cpp index 3425c344..6cb11151 100755 --- a/kwin/useractions.cpp +++ b/kwin/useractions.cpp @@ -169,7 +169,7 @@ void UserActionsMenu::helperDialog(const QString& message, const QWeakPointer(keys->action("Window Operations Menu")); assert(action != NULL); QString shortcut = QString("%1 (%2)").arg(action->text()) - .arg(action->globalShortcut().primary().toString(QKeySequence::NativeText)); + .arg(action->globalShortcut().toString(QKeySequence::NativeText)); args << "--msgbox" << i18n( "You have selected to show a window without its border.\n" "Without the border, you will not be able to enable the border " @@ -181,7 +181,7 @@ void UserActionsMenu::helperDialog(const QString& message, const QWeakPointer(keys->action("Window Operations Menu")); assert(action != NULL); QString shortcut = QString("%1 (%2)").arg(action->text()) - .arg(action->globalShortcut().primary().toString(QKeySequence::NativeText)); + .arg(action->globalShortcut().toString(QKeySequence::NativeText)); args << "--msgbox" << i18n( "You have selected to show a window in fullscreen mode.\n" "If the application itself does not have an option to turn the fullscreen " @@ -244,20 +244,20 @@ void UserActionsMenu::init() KActionCollection *keys = Workspace::self()->actionCollection(); KAction *kaction = qobject_cast(keys->action("Window Move")); if (kaction != 0) - m_moveOperation->setShortcut(kaction->globalShortcut().primary()); + m_moveOperation->setShortcut(kaction->globalShortcut()); m_moveOperation->setData(Options::UnrestrictedMoveOp); m_resizeOperation = advancedMenu->addAction(i18n("Re&size")); kaction = qobject_cast(keys->action("Window Resize")); if (kaction != 0) - m_resizeOperation->setShortcut(kaction->globalShortcut().primary()); + m_resizeOperation->setShortcut(kaction->globalShortcut()); m_resizeOperation->setData(Options::ResizeOp); m_keepAboveOperation = advancedMenu->addAction(i18n("Keep &Above Others")); m_keepAboveOperation->setIcon(KIcon("go-up")); kaction = qobject_cast(keys->action("Window Above Other Windows")); if (kaction != 0) - m_keepAboveOperation->setShortcut(kaction->globalShortcut().primary()); + m_keepAboveOperation->setShortcut(kaction->globalShortcut()); m_keepAboveOperation->setCheckable(true); m_keepAboveOperation->setData(Options::KeepAboveOp); @@ -265,7 +265,7 @@ void UserActionsMenu::init() m_keepBelowOperation->setIcon(KIcon("go-down")); kaction = qobject_cast(keys->action("Window Below Other Windows")); if (kaction != 0) - m_keepBelowOperation->setShortcut(kaction->globalShortcut().primary()); + m_keepBelowOperation->setShortcut(kaction->globalShortcut()); m_keepBelowOperation->setCheckable(true); m_keepBelowOperation->setData(Options::KeepBelowOp); @@ -273,21 +273,21 @@ void UserActionsMenu::init() m_fullScreenOperation->setIcon(KIcon("view-fullscreen")); kaction = qobject_cast(keys->action("Window Fullscreen")); if (kaction != 0) - m_fullScreenOperation->setShortcut(kaction->globalShortcut().primary()); + m_fullScreenOperation->setShortcut(kaction->globalShortcut()); m_fullScreenOperation->setCheckable(true); m_fullScreenOperation->setData(Options::FullScreenOp); m_shadeOperation = advancedMenu->addAction(i18n("Sh&ade")); kaction = qobject_cast(keys->action("Window Shade")); if (kaction != 0) - m_shadeOperation->setShortcut(kaction->globalShortcut().primary()); + m_shadeOperation->setShortcut(kaction->globalShortcut()); m_shadeOperation->setCheckable(true); m_shadeOperation->setData(Options::ShadeOp); m_noBorderOperation = advancedMenu->addAction(i18n("&No Border")); kaction = qobject_cast(keys->action("Window No Border")); if (kaction != 0) - m_noBorderOperation->setShortcut(kaction->globalShortcut().primary()); + m_noBorderOperation->setShortcut(kaction->globalShortcut()); m_noBorderOperation->setCheckable(true); m_noBorderOperation->setData(Options::NoBorderOp); @@ -297,7 +297,7 @@ void UserActionsMenu::init() action->setIcon(KIcon("configure-shortcuts")); kaction = qobject_cast(keys->action("Setup Window Shortcut")); if (kaction != 0) - action->setShortcut(kaction->globalShortcut().primary()); + action->setShortcut(kaction->globalShortcut()); action->setData(Options::SetupWindowShortcutOp); action = advancedMenu->addAction(i18n("&Special Window Settings...")); @@ -318,13 +318,13 @@ void UserActionsMenu::init() m_minimizeOperation = m_menu->addAction(i18n("Mi&nimize")); kaction = qobject_cast(keys->action("Window Minimize")); if (kaction != 0) - m_minimizeOperation->setShortcut(kaction->globalShortcut().primary()); + m_minimizeOperation->setShortcut(kaction->globalShortcut()); m_minimizeOperation->setData(Options::MinimizeOp); m_maximizeOperation = m_menu->addAction(i18n("Ma&ximize")); kaction = qobject_cast(keys->action("Window Maximize")); if (kaction != 0) - m_maximizeOperation->setShortcut(kaction->globalShortcut().primary()); + m_maximizeOperation->setShortcut(kaction->globalShortcut()); m_maximizeOperation->setCheckable(true); m_maximizeOperation->setData(Options::MaximizeOp); @@ -335,14 +335,14 @@ void UserActionsMenu::init() m_removeFromTabGroup = m_menu->addAction(i18n("&Untab")); kaction = qobject_cast(keys->action("Untab")); if (kaction != 0) - m_removeFromTabGroup->setShortcut(kaction->globalShortcut().primary()); + m_removeFromTabGroup->setShortcut(kaction->globalShortcut()); m_removeFromTabGroup->setData(Options::RemoveTabFromGroupOp); m_closeTabGroup = m_menu->addAction(i18n("Close Entire &Group")); m_closeTabGroup->setIcon(KIcon("window-close")); kaction = qobject_cast(keys->action("Close TabGroup")); if (kaction != 0) - m_closeTabGroup->setShortcut(kaction->globalShortcut().primary()); + m_closeTabGroup->setShortcut(kaction->globalShortcut()); m_closeTabGroup->setData(Options::CloseTabGroupOp); m_menu->addSeparator(); @@ -359,7 +359,7 @@ void UserActionsMenu::init() m_closeOperation->setIcon(KIcon("window-close")); kaction = qobject_cast(keys->action("Window Close")); if (kaction != 0) - m_closeOperation->setShortcut(kaction->globalShortcut().primary()); + m_closeOperation->setShortcut(kaction->globalShortcut()); m_closeOperation->setData(Options::CloseOp); } @@ -826,7 +826,7 @@ void Workspace::initShortcuts() void Workspace::setupWindowShortcut(Client* c) { assert(client_keys_dialog == NULL); - 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); @@ -848,7 +848,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; @@ -1755,7 +1755,7 @@ void Client::setShortcut(const QString& _cut) { QString cut = rules()->checkShortcut(_cut); if (cut.isEmpty()) - return setShortcutInternal(KShortcut()); + return setShortcutInternal(QKeySequence()); if (cut == shortcut().toString()) { return; // no change } @@ -1763,13 +1763,13 @@ void Client::setShortcut(const QString& _cut) // base+(abcdef)base+(abcdef) // E.g. Alt+Ctrl+(ABCDEF);Meta+X,Meta+(ABCDEF) if (!cut.contains('(') && !cut.contains(')') && !cut.contains(" - ")) { - if (workspace()->shortcutAvailable(KShortcut(cut), this)) - setShortcutInternal(KShortcut(cut)); + if (workspace()->shortcutAvailable(QKeySequence(cut), this)) + setShortcutInternal(QKeySequence(cut)); else - setShortcutInternal(KShortcut()); + setShortcutInternal(QKeySequence()); return; } - QList< KShortcut > keys; + QList< QKeySequence > keys; QStringList groups = cut.split(" - "); foreach (const QString &it, groups) { QRegExp reg("(.*\\+)\\((.*)\\)"); @@ -1779,19 +1779,19 @@ 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); } } } - foreach (const KShortcut &it, keys) { + foreach (const QKeySequence &it, keys) { if (_shortcut == it) // current one is in the list return; if (workspace()->shortcutAvailable(it, this)) { @@ -1799,10 +1799,10 @@ void Client::setShortcut(const QString& _cut) return; } } - setShortcutInternal(KShortcut()); + setShortcutInternal(QKeySequence()); } -void Client::setShortcutInternal(const KShortcut& cut) +void Client::setShortcutInternal(const QKeySequence& cut) { if (_shortcut == cut) return; @@ -1823,14 +1823,13 @@ void Client::delayedSetShortcut() workspace()->clientShortcutUpdated(this); } -bool Workspace::shortcutAvailable(const KShortcut& cut, Client* ignore) const +bool Workspace::shortcutAvailable(const QKeySequence& cut, Client* ignore) const { - if (ignore && cut == ignore->shortcut()) + if (ignore && cut == ignore->shortcut()) { return true; - foreach (const QKeySequence &seq, cut.toList()) { - if (!KGlobalAccel::self()->getGlobalShortcutsByKey(seq).isEmpty()) { - return false; - } + } + if (!KGlobalAccel::self()->getGlobalShortcutsByKey(cut).isEmpty()) { + return false; } foreach (const Client* it, clients) { if (it != ignore && it->shortcut() == cut) diff --git a/kwin/virtualdesktops.cpp b/kwin/virtualdesktops.cpp index a4262aa0..1c6e7a1a 100644 --- a/kwin/virtualdesktops.cpp +++ b/kwin/virtualdesktops.cpp @@ -436,17 +436,17 @@ void VirtualDesktopManager::initSwitchToShortcuts(KActionCollection *keys) { const QString toDesktop = "Switch to Desktop %1"; const KLocalizedString toDesktopLabel = ki18n("Switch to Desktop %1"); - addAction(keys, toDesktop, toDesktopLabel, 1, KShortcut(Qt::CTRL + Qt::Key_F1), SLOT(slotSwitchTo())); - addAction(keys, toDesktop, toDesktopLabel, 2, KShortcut(Qt::CTRL + Qt::Key_F2), SLOT(slotSwitchTo())); - addAction(keys, toDesktop, toDesktopLabel, 3, KShortcut(Qt::CTRL + Qt::Key_F3), SLOT(slotSwitchTo())); - addAction(keys, toDesktop, toDesktopLabel, 4, KShortcut(Qt::CTRL + Qt::Key_F4), SLOT(slotSwitchTo())); + addAction(keys, toDesktop, toDesktopLabel, 1, QKeySequence(Qt::CTRL + Qt::Key_F1), SLOT(slotSwitchTo())); + addAction(keys, toDesktop, toDesktopLabel, 2, QKeySequence(Qt::CTRL + Qt::Key_F2), SLOT(slotSwitchTo())); + addAction(keys, toDesktop, toDesktopLabel, 3, QKeySequence(Qt::CTRL + Qt::Key_F3), SLOT(slotSwitchTo())); + addAction(keys, toDesktop, toDesktopLabel, 4, QKeySequence(Qt::CTRL + Qt::Key_F4), SLOT(slotSwitchTo())); for (uint i = 5; i <= maximum(); ++i) { - addAction(keys, toDesktop, toDesktopLabel, i, KShortcut(), SLOT(slotSwitchTo())); + addAction(keys, toDesktop, toDesktopLabel, i, QKeySequence(), SLOT(slotSwitchTo())); } } -void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const KShortcut &key, const char *slot) +void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const QKeySequence &key, const char *slot) { KAction *a = keys->addAction(name.arg(value), this, slot); a->setText(label.subs(value).toString()); @@ -457,7 +457,7 @@ void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &na void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const QString &label, const char *slot) { KAction *a = keys->addAction(name, this, slot); - a->setGlobalShortcut(KShortcut()); + a->setGlobalShortcut(QKeySequence()); a->setText(label); } diff --git a/kwin/virtualdesktops.h b/kwin/virtualdesktops.h index a1c4f3da..39c68583 100644 --- a/kwin/virtualdesktops.h +++ b/kwin/virtualdesktops.h @@ -30,7 +30,6 @@ along with this program. If not, see . class KActionCollection; class KLocalizedString; -class KShortcut; class NETRootInfo; namespace KWin { @@ -341,7 +340,7 @@ private: * @param key The global shortcut for the action * @param slot The slot to invoke when the action is triggered **/ - void addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const KShortcut &key, const char *slot); + void addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const QKeySequence &key, const char *slot); /** * Creates an action and connects it to the @p slot in this Manager. * Overloaded method for the case that no additional value needs to be passed to the action and diff --git a/kwin/workspace.h b/kwin/workspace.h index 4d03d3bf..a3f6a702 100644 --- a/kwin/workspace.h +++ b/kwin/workspace.h @@ -27,18 +27,16 @@ along with this program. If not, see . #include #include "sm.h" #include "utils.h" -// Qt +// Katie +#include #include #include +#include // X #include -// TODO: Cleanup the order of things in this .h file - -#include class KConfig; class KActionCollection; -class KShortcut; class KStartupInfo; class KStartupInfoId; class KStartupInfoData; @@ -264,7 +262,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); diff --git a/libs/konq/konq_operations.cpp b/libs/konq/konq_operations.cpp index ae8633e2..999aae21 100644 --- a/libs/konq/konq_operations.cpp +++ b/libs/konq/konq_operations.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/plasma/applets/folderview/folderview.cpp b/plasma/applets/folderview/folderview.cpp index a0f1bae3..b06467ec 100644 --- a/plasma/applets/folderview/folderview.cpp +++ b/plasma/applets/folderview/folderview.cpp @@ -1506,9 +1506,15 @@ void FolderView::createActions() // Remove the Shift+Delete shortcut from the cut action, since it's used for deleting files KAction *cut = KStandardAction::cut(this, SLOT(cut()), this); - KShortcut cutShortCut = cut->shortcut(); - cutShortCut.remove(Qt::SHIFT + Qt::Key_Delete); - cut->setShortcut(cutShortCut); + QKeySequence cutShortcut = cut->shortcut(); + static const int shiftdelete = (Qt::SHIFT | Qt::Key_Delete); + if (cutShortcut[0] == shiftdelete) { + cutShortcut = QKeySequence(cutShortcut[1]); + } + if (cutShortcut[0] == shiftdelete) { + cutShortcut = QKeySequence(); + } + cut->setShortcut(cutShortcut); cut->setShortcutContext(Qt::WidgetShortcut); KAction *copy = KStandardAction::copy(this, SLOT(copy()), this); diff --git a/plasma/applets/folderview/popupview.cpp b/plasma/applets/folderview/popupview.cpp index 5265001c..d90a2169 100644 --- a/plasma/applets/folderview/popupview.cpp +++ b/plasma/applets/folderview/popupview.cpp @@ -243,9 +243,15 @@ void PopupView::createActions() { // Remove the Shift+Delete shortcut from the cut action, since it's used for deleting files KAction *cut = KStandardAction::cut(this, SLOT(cut()), this); - KShortcut cutShortCut = cut->shortcut(); - cutShortCut.remove(Qt::SHIFT + Qt::Key_Delete); - cut->setShortcut(cutShortCut); + QKeySequence cutShortcut = cut->shortcut(); + static const int shiftdelete = (Qt::SHIFT | Qt::Key_Delete); + if (cutShortcut[0] == shiftdelete) { + cutShortcut = QKeySequence(cutShortcut[1]); + } + if (cutShortcut[0] == shiftdelete) { + cutShortcut = QKeySequence(); + } + cut->setShortcut(cutShortcut); KAction *copy = KStandardAction::copy(this, SLOT(copy()), this); diff --git a/plasma/applets/keyboard/keyboard.cpp b/plasma/applets/keyboard/keyboard.cpp index 7f89b932..58f27848 100644 --- a/plasma/applets/keyboard/keyboard.cpp +++ b/plasma/applets/keyboard/keyboard.cpp @@ -54,7 +54,7 @@ void KeyboardApplet::init() m_showflag = configgroup.readEntry("showFlag", false); m_showtext = configgroup.readEntry("showText", true); - setGlobalShortcut(KShortcut(Qt::ALT+Qt::CTRL+Qt::Key_K)); + setGlobalShortcut(QKeySequence(Qt::ALT+Qt::CTRL+Qt::Key_K)); connect( this, SIGNAL(activate()), this, SLOT(slotNextLayout()) diff --git a/plasma/applets/launcher/launcher.cpp b/plasma/applets/launcher/launcher.cpp index e6c58462..ed739c30 100644 --- a/plasma/applets/launcher/launcher.cpp +++ b/plasma/applets/launcher/launcher.cpp @@ -1728,7 +1728,7 @@ void LauncherApplet::init() { Plasma::PopupApplet::init(); - setGlobalShortcut(KShortcut(Qt::ALT+Qt::Key_F2)); + setGlobalShortcut(QKeySequence(Qt::ALT+Qt::Key_F2)); m_shareconfig = KSharedConfig::openConfig(globalConfig().config()->name()); m_configgroup = m_shareconfig->group("Plugins"); diff --git a/plasma/shells/plasma-desktop/plasmaapp.cpp b/plasma/shells/plasma-desktop/plasmaapp.cpp index 2072e513..01d225bd 100644 --- a/plasma/shells/plasma-desktop/plasmaapp.cpp +++ b/plasma/shells/plasma-desktop/plasmaapp.cpp @@ -123,12 +123,12 @@ PlasmaApp::PlasmaApp() KActionCollection* actionCollection = new KActionCollection(this); KAction* action = actionCollection->addAction("Capture the desktop"); action->setText(i18n("Capture the desktop")); - action->setGlobalShortcut(KShortcut(Qt::Key_Print)); + action->setGlobalShortcut(QKeySequence(Qt::Key_Print)); connect(action, SIGNAL(triggered(bool)), SLOT(captureDesktop())); action = actionCollection->addAction("Capture the current window"); action->setText(i18n("Capture the current window")); - action->setGlobalShortcut(KShortcut(Qt::CTRL+Qt::Key_Print)); + action->setGlobalShortcut(QKeySequence(Qt::CTRL+Qt::Key_Print)); connect(action, SIGNAL(triggered(bool)), SLOT(captureCurrentWindow())); QTimer::singleShot(0, this, SLOT(setupDesktop())); diff --git a/systemsettings/app/SettingsBase.cpp b/systemsettings/app/SettingsBase.cpp index f042088e..832757fa 100644 --- a/systemsettings/app/SettingsBase.cpp +++ b/systemsettings/app/SettingsBase.cpp @@ -122,7 +122,7 @@ void SettingsBase::initToolBar() quitAction = actionCollection()->addAction( KStandardAction::Quit, "quit_action", this, SLOT(close()) ); // Configure goes at the end configureAction = actionCollection()->addAction( KStandardAction::Preferences, this, SLOT(configShow()) ); - configureAction->setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_M))); + configureAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); configureAction->setText( i18n("Configure") ); // Help after it initHelpMenu(); @@ -133,7 +133,7 @@ void SettingsBase::initToolBar() // Finally the search line-edit searchAction = new KAction( this ); searchAction->setDefaultWidget(searchText); - searchAction->setShortcut(KShortcut(QKeySequence(Qt::CTRL + Qt::Key_F))); + searchAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F)); connect( searchAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), searchText, SLOT(setFocus())); actionCollection()->addAction( "searchText", searchAction ); diff --git a/systemsettings/icons/IconMode.cpp b/systemsettings/icons/IconMode.cpp index 7897a97c..f340667d 100644 --- a/systemsettings/icons/IconMode.cpp +++ b/systemsettings/icons/IconMode.cpp @@ -68,7 +68,7 @@ IconMode::IconMode( QObject *parent, const QVariantList& ) d->backAction = KStandardAction::back( this, SLOT(backToOverview()), this ); d->backAction->setText( i18n( "Overview" ) ); - d->backAction->setToolTip( i18n("Keyboard Shortcut: %1", d->backAction->shortcut().primary().toString( QKeySequence::NativeText )) ); + d->backAction->setToolTip( i18n("Keyboard Shortcut: %1", d->backAction->shortcut().toString( QKeySequence::NativeText )) ); d->backAction->setEnabled( false ); actionsList() << d->backAction; }