From be30716c97cdb8c60f5ce64fed6a49fcb90bab4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 9 Jan 2013 08:50:58 +0100 Subject: [PATCH] Add walk through desktops shortcuts to Virtual Desktops KCM BUG: 306404 FIXED-IN: 4.11 REVIEW: 108287 --- kcmkwin/kwindesktop/main.cpp | 47 ++++++++++++++---------------------- kcmkwin/kwindesktop/main.h | 1 + 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/kcmkwin/kwindesktop/main.cpp b/kcmkwin/kwindesktop/main.cpp index 92490b15cd..937d780a8c 100644 --- a/kcmkwin/kwindesktop/main.cpp +++ b/kcmkwin/kwindesktop/main.cpp @@ -91,35 +91,16 @@ void KWinDesktopConfig::init() m_switchDesktopCollection->setConfigGlobal(true); // actions for switch desktop collection - other action is filled dynamically - KAction* a = qobject_cast(m_switchDesktopCollection->addAction("Switch to Next Desktop")); - a->setProperty("isConfigurationAction", true); - a->setText(i18n("Switch to Next Desktop")); - a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); - - a = qobject_cast(m_switchDesktopCollection->addAction("Switch to Previous Desktop")); - a->setProperty("isConfigurationAction", true); - a->setText(i18n("Switch to Previous Desktop")); - a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); - - a = qobject_cast(m_switchDesktopCollection->addAction("Switch One Desktop to the Right")); - a->setProperty("isConfigurationAction", true); - a->setText(i18n("Switch One Desktop to the Right")); - a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); - - a = qobject_cast(m_switchDesktopCollection->addAction("Switch One Desktop to the Left")); - a->setProperty("isConfigurationAction", true); - a->setText(i18n("Switch One Desktop to the Left")); - a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); - - a = qobject_cast(m_switchDesktopCollection->addAction("Switch One Desktop Up")); - a->setProperty("isConfigurationAction", true); - a->setText(i18n("Switch One Desktop Up")); - a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); - - a = qobject_cast(m_switchDesktopCollection->addAction("Switch One Desktop Down")); - a->setProperty("isConfigurationAction", true); - a->setText(i18n("Switch One Desktop Down")); - a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); + addAction("Switch to Next Desktop", i18n("Switch to Next Desktop")); + addAction("Switch to Previous Desktop", i18n("Switch to Previous Desktop")); + addAction("Switch One Desktop to the Right", i18n("Switch One Desktop to the Right")); + addAction("Switch One Desktop to the Left", i18n("Switch One Desktop to the Left")); + addAction("Switch One Desktop Up", i18n("Switch One Desktop Up")); + addAction("Switch One Desktop Down", i18n("Switch One Desktop Down")); + addAction("Walk Through Desktops", i18n("Walk Through Desktops")); + addAction("Walk Through Desktops (Reverse)", i18n("Walk Through Desktops (Reverse)")); + addAction("Walk Through Desktop List", i18n("Walk Through Desktop List")); + addAction("Walk Through Desktop List (Reverse)", i18n("Walk Through Desktop List (Reverse)")); m_editor->addCollection(m_switchDesktopCollection, i18n("Desktop Switching")); @@ -223,6 +204,14 @@ KWinDesktopConfig::~KWinDesktopConfig() undo(); } +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); +} + void KWinDesktopConfig::defaults() { // TODO: plasma stuff diff --git a/kcmkwin/kwindesktop/main.h b/kcmkwin/kwindesktop/main.h index 969e9ff5dd..27fcba3ab5 100644 --- a/kcmkwin/kwindesktop/main.h +++ b/kcmkwin/kwindesktop/main.h @@ -70,6 +70,7 @@ private slots: private: void init(); + void addAction(const QString &name, const QString &label); bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const; QString extrapolatedShortcut(int desktop) const;