diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index df665e207c..322c27d750 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -46,11 +46,22 @@ target_link_libraries( kwin_update_settings_410 ${KDE4_KDECORE_LIBS} ) install( TARGETS kwin_update_settings_410 DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ ) +########### next target ############### +set( kwin_update_settings_411_SRCS update_kwin_411.cpp ) + +kde4_add_executable( kwin_update_settings_411 ${kwin_update_settings_411_SRCS} ) + +target_link_libraries( kwin_update_settings_411 ${KDE4_KDECORE_LIBS} ) + +install( TARGETS kwin_update_settings_411 DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ ) + ########### install files ############### install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules ) install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} ) -install( FILES kwin_fsp_workarounds_1.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd kwin_update_49.upd kwin_update_410.upd kwin_translate_activity_rule.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( FILES kwin_fsp_workarounds_1.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd kwin_update_49.upd kwin_update_410.upd kwin_translate_activity_rule.upd + kwin_update_411.upd + DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( PROGRAMS kwin_remove_delay_focus.sh kwin_translate_activity_rule.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( FILES stripTitle.js DESTINATION ${DATA_INSTALL_DIR}/kwin ) diff --git a/data/kwin_update_411.upd b/data/kwin_update_411.upd new file mode 100644 index 0000000000..40363d5670 --- /dev/null +++ b/data/kwin_update_411.upd @@ -0,0 +1,2 @@ +Id=Kwin-4.11_0 +Script=kwin_update_settings_411 diff --git a/data/update_kwin_411.cpp b/data/update_kwin_411.cpp new file mode 100644 index 0000000000..d81848d24f --- /dev/null +++ b/data/update_kwin_411.cpp @@ -0,0 +1,95 @@ +/******************************************************************** +KWin - the KDE window manager +This file is part of the KDE project. + +Copyright (C) 2013 Martin Gräßlin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +#include +#include +#include +#include +#include +#include +// Qt +#include +#include + +bool migrateRulesShortcut() +{ + const QString KEY = "shortcut"; + const QString ALT = "Alt"; + const QString CTRL = "Ctrl"; + const QString META = "Meta"; + const QString SHIFT = "Shift"; + + KConfig config("kwinrulesrc"); + if (config.groupList().isEmpty()) { + return false; + } + bool updated = false; + Q_FOREACH (const QString &groupName, config.groupList()) { + KConfigGroup group = config.group(groupName); + if (!group.hasKey(KEY)) { + continue; + } + const QString value = group.readEntry(KEY, QString()); + if (value.contains(" - ")) { + // already migrated + continue; + } + if (!value.contains(' ')) { + // nothing to migrate + continue; + } + // space might be either the shortcut separator or part of the shortcut + // let's try to detect it properly + const QStringList shortcuts = value.split(' '); + // let's take the first part as it is + QString newValue = shortcuts.first(); + for (int i=1; i A single shortcut can be easily assigned or cleared using the two buttons. Only shortcuts with modifiers can be used.<p> -It is possible to have several possible shortcuts, and the first available shortcut will be used. The shortcuts are specified using space-separated shortcut sets. One set is specified as <i>base</i>+(<i>list</i>), where base are modifiers and list is a list of keys.<br> +It is possible to have several possible shortcuts, and the first available shortcut will be used. The shortcuts are specified using shortcut sets separated by " - ". One set is specified as <i>base</i>+(<i>list</i>), where base are modifiers and list is a list of keys.<br> For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try <b>Shift+Alt+1</b>, then others with <b>Shift+Ctrl+C</b> as the last one. diff --git a/useractions.cpp b/useractions.cpp index 32b934945f..4824897e63 100755 --- a/useractions.cpp +++ b/useractions.cpp @@ -1795,8 +1795,8 @@ void Client::setShortcut(const QString& _cut) return setShortcutInternal(KShortcut()); // Format: // base+(abcdef)base+(abcdef) -// E.g. Alt+Ctrl+(ABCDEF) Win+X,Win+(ABCDEF) - if (!cut.contains('(') && !cut.contains(')') && !cut.contains(' ')) { +// 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)); else @@ -1804,7 +1804,7 @@ void Client::setShortcut(const QString& _cut) return; } QList< KShortcut > keys; - QStringList groups = cut.split(' '); + QStringList groups = cut.split(" - "); for (QStringList::ConstIterator it = groups.constBegin(); it != groups.constEnd(); ++it) {