Add walk through desktops shortcuts to Virtual Desktops KCM

BUG: 306404
FIXED-IN: 4.11
REVIEW: 108287
icc-effect-5.14.5
Martin Gräßlin 2013-01-09 08:50:58 +01:00
parent 11f9d9f5c1
commit be30716c97
2 changed files with 19 additions and 29 deletions

View File

@ -91,35 +91,16 @@ void KWinDesktopConfig::init()
m_switchDesktopCollection->setConfigGlobal(true); m_switchDesktopCollection->setConfigGlobal(true);
// actions for switch desktop collection - other action is filled dynamically // actions for switch desktop collection - other action is filled dynamically
KAction* a = qobject_cast<KAction*>(m_switchDesktopCollection->addAction("Switch to Next Desktop")); addAction("Switch to Next Desktop", i18n("Switch to Next Desktop"));
a->setProperty("isConfigurationAction", true); addAction("Switch to Previous Desktop", i18n("Switch to Previous Desktop"));
a->setText(i18n("Switch to Next Desktop")); addAction("Switch One Desktop to the Right", i18n("Switch One Desktop to the Right"));
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); addAction("Switch One Desktop to the Left", i18n("Switch One Desktop to the Left"));
addAction("Switch One Desktop Up", i18n("Switch One Desktop Up"));
a = qobject_cast<KAction*>(m_switchDesktopCollection->addAction("Switch to Previous Desktop")); addAction("Switch One Desktop Down", i18n("Switch One Desktop Down"));
a->setProperty("isConfigurationAction", true); addAction("Walk Through Desktops", i18n("Walk Through Desktops"));
a->setText(i18n("Switch to Previous Desktop")); addAction("Walk Through Desktops (Reverse)", i18n("Walk Through Desktops (Reverse)"));
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut); addAction("Walk Through Desktop List", i18n("Walk Through Desktop List"));
addAction("Walk Through Desktop List (Reverse)", i18n("Walk Through Desktop List (Reverse)"));
a = qobject_cast<KAction*>(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<KAction*>(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<KAction*>(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<KAction*>(m_switchDesktopCollection->addAction("Switch One Desktop Down"));
a->setProperty("isConfigurationAction", true);
a->setText(i18n("Switch One Desktop Down"));
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
m_editor->addCollection(m_switchDesktopCollection, i18n("Desktop Switching")); m_editor->addCollection(m_switchDesktopCollection, i18n("Desktop Switching"));
@ -223,6 +204,14 @@ KWinDesktopConfig::~KWinDesktopConfig()
undo(); undo();
} }
void KWinDesktopConfig::addAction(const QString &name, const QString &label)
{
KAction* a = qobject_cast<KAction*>(m_switchDesktopCollection->addAction(name));
a->setProperty("isConfigurationAction", true);
a->setText(label);
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
}
void KWinDesktopConfig::defaults() void KWinDesktopConfig::defaults()
{ {
// TODO: plasma stuff // TODO: plasma stuff

View File

@ -70,6 +70,7 @@ private slots:
private: private:
void init(); void init();
void addAction(const QString &name, const QString &label);
bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const; bool effectEnabled(const QString& effect, const KConfigGroup& cfg) const;
QString extrapolatedShortcut(int desktop) const; QString extrapolatedShortcut(int desktop) const;