Add walk through desktops shortcuts to Virtual Desktops KCM

BUG: 306404
FIXED-IN: 4.11
REVIEW: 108287
This commit is contained in:
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);
// actions for switch desktop collection - other action is filled dynamically
KAction* a = qobject_cast<KAction*>(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<KAction*>(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<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);
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<KAction*>(m_switchDesktopCollection->addAction(name));
a->setProperty("isConfigurationAction", true);
a->setText(label);
a->setGlobalShortcut(KShortcut(), KAction::ActiveShortcut);
}
void KWinDesktopConfig::defaults()
{
// TODO: plasma stuff

View file

@ -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;