From 17c6b3b2dbe9826170106b7b313dd10782311b4b Mon Sep 17 00:00:00 2001 From: Jonathan Marten Date: Sat, 10 Sep 2011 11:39:10 +0100 Subject: [PATCH] Make the Walk Through Desktop List and Reverse actions work again With a comment to explain the non-obvious global shortcut setting. BUG:279638 REVIEW:102558 --- tabbox/tabbox.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index eb75efdb31..f75f81fa28 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -330,11 +330,16 @@ void TabBox::handlerReady() void TabBox::initShortcuts(KActionCollection* keys) { KAction *a = NULL; + + // The setGlobalShortcut(shortcut); shortcut = a->globalShortcut() + // sequence is necessary in the case where the user has defined a + // custom key binding which KAction::setGlobalShortcut autoloads. #define KEY( name, key, fnSlot, shortcut, shortcutSlot ) \ a = keys->addAction( name ); \ a->setText( i18n(name) ); \ shortcut = KShortcut(key); \ qobject_cast( a )->setGlobalShortcut(shortcut); \ + shortcut = a->globalShortcut(); \ connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); \ connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), SLOT(shortcutSlot)); @@ -342,7 +347,7 @@ void TabBox::initShortcuts(KActionCollection* keys) KEY(I18N_NOOP("Walk Through Windows (Reverse)"), Qt::ALT + Qt::SHIFT + Qt::Key_Backtab, slotWalkBackThroughWindows(), m_cutWalkThroughWindowsReverse, slotWalkBackThroughWindowsKeyChanged(QKeySequence)) KEY(I18N_NOOP("Walk Through Windows Alternative"), 0, slotWalkThroughWindowsAlternative(), m_cutWalkThroughWindowsAlternative, slotWalkThroughWindowsAlternativeKeyChanged(QKeySequence)) KEY(I18N_NOOP("Walk Through Windows Alternative (Reverse)"), 0, slotWalkBackThroughWindowsAlternative(), m_cutWalkThroughWindowsAlternativeReverse, slotWalkBackThroughWindowsAlternativeKeyChanged(QKeySequence)) - KEY(I18N_NOOP("Walk Through Desktops"), 0, slotWalkThroughDesktops(), m_cutWalkThroughDesktops, slotWalkBackThroughDesktopsKeyChanged(QKeySequence)) + KEY(I18N_NOOP("Walk Through Desktops"), 0, slotWalkThroughDesktops(), m_cutWalkThroughDesktops, slotWalkThroughDesktopsKeyChanged(QKeySequence)) KEY(I18N_NOOP("Walk Through Desktops (Reverse)"), 0, slotWalkBackThroughDesktops(), m_cutWalkThroughDesktopsReverse, slotWalkBackThroughDesktopsKeyChanged(QKeySequence)) KEY(I18N_NOOP("Walk Through Desktop List"), 0, slotWalkThroughDesktopList(), m_cutWalkThroughDesktopList, slotWalkThroughDesktopListKeyChanged(QKeySequence)) KEY(I18N_NOOP("Walk Through Desktop List (Reverse)"), 0, slotWalkBackThroughDesktopList(), m_cutWalkThroughDesktopListReverse, slotWalkBackThroughDesktopListKeyChanged(QKeySequence)) @@ -484,7 +489,7 @@ void TabBox::setCurrentDesktop(int newDesktop) setCurrentIndex(m_tabBox->desktopIndex(newDesktop)); } -void TabBox::TabBox::setCurrentIndex(QModelIndex index, bool notifyEffects) +void TabBox::setCurrentIndex(QModelIndex index, bool notifyEffects) { if (!index.isValid()) return; @@ -1150,6 +1155,7 @@ void TabBox::keyRelease(const XKeyEvent& ev) m_tabGrab = old_tab_grab; if (desktop != -1) { setCurrentDesktop(desktop); + Workspace::self()->setCurrentDesktop(desktop); } } }