diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index fed81f2273..46decee122 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,6 +1,3 @@ - -set(kwin_xml ${CMAKE_CURRENT_SOURCE_DIR}/../org.kde.KWin.xml) - ########### next target ############### set(kwin_update_default_rules_SRCS update_default_rules.cpp) @@ -11,57 +8,11 @@ target_link_libraries( kwin_update_default_rules ) install(TARGETS kwin_update_default_rules DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ ) -########### next target ############### -set( kwin_update_tabbox_settings_SRCS update_tabbox_settings.cpp ) - -add_executable( kwin_update_tabbox_settings ${kwin_update_tabbox_settings_SRCS} ) - -target_link_libraries( kwin_update_tabbox_settings ) - -install( TARGETS kwin_update_tabbox_settings DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ ) -########### next target ############### -set( kwin_update_tabbox_qml_settings_SRCS update_tabbox_qml_settings.cpp ) - -add_executable( kwin_update_tabbox_qml_settings ${kwin_update_tabbox_qml_settings_SRCS} ) - -target_link_libraries( kwin_update_tabbox_qml_settings ) - -install( TARGETS kwin_update_tabbox_qml_settings DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ ) - -########### next target ############### -set( kwin_update_settings_49_SRCS update_kwin_49.cpp update_kwin_49_main.cpp ) - -add_executable( kwin_update_settings_49 ${kwin_update_settings_49_SRCS} ) - -target_link_libraries( kwin_update_settings_49 ) - -install( TARGETS kwin_update_settings_49 DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ ) - -########### next target ############### -set( kwin_update_settings_410_SRCS update_kwin_410.cpp ) - -add_executable( kwin_update_settings_410 ${kwin_update_settings_410_SRCS} ) - -target_link_libraries( kwin_update_settings_410 ) - -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 ) - -add_executable( kwin_update_settings_411 ${kwin_update_settings_411_SRCS} ) - -target_link_libraries( kwin_update_settings_411 ) - -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 kwin_translate_confrequest_rule.upd - kwin_update_411.upd +install( FILES kwin_fsp_workarounds_1.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) -install( PROGRAMS kwin_remove_delay_focus.sh kwin_translate_activity_rule.sh kwin_translate_confrequest_rule.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( FILES stripTitle.js DESTINATION ${DATA_INSTALL_DIR}/kwin ) diff --git a/data/kwin_remove_delay_focus.sh b/data/kwin_remove_delay_focus.sh deleted file mode 100755 index 6f4d61baab..0000000000 --- a/data/kwin_remove_delay_focus.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -if ! `kreadconfig --file kwinrc --group Windows --key DelayFocus --default false` && [ `kreadconfig --file kwinrc --group Windows --key DelayFocusInterval --default 0` != 0 ]; then - kwriteconfig --file kwinrc --group Windows --key DelayFocusInterval 0 -fi \ No newline at end of file diff --git a/data/kwin_remove_delay_focus.upd b/data/kwin_remove_delay_focus.upd deleted file mode 100644 index 4d6f677ad0..0000000000 --- a/data/kwin_remove_delay_focus.upd +++ /dev/null @@ -1,2 +0,0 @@ -Id=Kwin-4.8 -Script=kwin_remove_delay_focus.sh diff --git a/data/kwin_remove_effects.upd b/data/kwin_remove_effects.upd deleted file mode 100644 index 6a7d54cc59..0000000000 --- a/data/kwin_remove_effects.upd +++ /dev/null @@ -1,9 +0,0 @@ -# This update file removes the effects snow, shadow and sharpen -# from the kconf settings - -Id=kwin4.7_effects -File=kwinrc -Group=Plugins -RemoveKey=kwin4_effect_snowEnabled -RemoveKey=kwin4_effect_shadowEnabled -RemoveKey=kwin4_effect_sharpenEnabled diff --git a/data/kwin_translate_activity_rule.sh b/data/kwin_translate_activity_rule.sh deleted file mode 100755 index 0c5b26bd31..0000000000 --- a/data/kwin_translate_activity_rule.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -COUNT=`kreadconfig --file kwinrulesrc --group General --key count` -if [ -z "$COUNT" ]; then - exit 0 # nothing to do for us -fi - -# can you imaging how *much* faster sed is? -# it's however less reliable (installation, ini config, etc.) - -for i in `seq 1 $COUNT`; do - if [ "`kreadconfig --file kwinrulesrc --group $i --key activity`" = "ALL" ]; then - kwriteconfig --file kwinrulesrc --group $i --key activity "00000000-0000-0000-0000-000000000000" - fi -done \ No newline at end of file diff --git a/data/kwin_translate_activity_rule.upd b/data/kwin_translate_activity_rule.upd deleted file mode 100644 index b0f0ac651e..0000000000 --- a/data/kwin_translate_activity_rule.upd +++ /dev/null @@ -1,2 +0,0 @@ -Id=Kwin-4.10 -Script=kwin_translate_activity_rule.sh \ No newline at end of file diff --git a/data/kwin_translate_confrequest_rule.sh b/data/kwin_translate_confrequest_rule.sh deleted file mode 100755 index 62587a4e93..0000000000 --- a/data/kwin_translate_confrequest_rule.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -COUNT=`kreadconfig --file kwinrulesrc --group General --key count` -if [ -z "$COUNT" ]; then - exit 0 # nothing to do for us -fi - -# can you imaging how *much* faster sed is? -# it's however less reliable (installation, ini config, etc.) - -for i in `seq 1 $COUNT`; do - if [ "`kreadconfig --file kwinrulesrc --group $i --key ignoregeometryrule`" = "2" ]; then - kwriteconfig --file kwinrulesrc --group $i --key ignoregeometryrule "3" - fi -done \ No newline at end of file diff --git a/data/kwin_translate_confrequest_rule.upd b/data/kwin_translate_confrequest_rule.upd deleted file mode 100644 index edbd271109..0000000000 --- a/data/kwin_translate_confrequest_rule.upd +++ /dev/null @@ -1,2 +0,0 @@ -Id=Kwin-4.11 -Script=kwin_translate_confrequest_rule.sh \ No newline at end of file diff --git a/data/kwin_update_410.upd b/data/kwin_update_410.upd deleted file mode 100644 index 1d643ec95e..0000000000 --- a/data/kwin_update_410.upd +++ /dev/null @@ -1,2 +0,0 @@ -Id=Kwin-4.10_1 -Script=kwin_update_settings_410 diff --git a/data/kwin_update_411.upd b/data/kwin_update_411.upd deleted file mode 100644 index 40363d5670..0000000000 --- a/data/kwin_update_411.upd +++ /dev/null @@ -1,2 +0,0 @@ -Id=Kwin-4.11_0 -Script=kwin_update_settings_411 diff --git a/data/kwin_update_49.upd b/data/kwin_update_49.upd deleted file mode 100644 index 1c45598471..0000000000 --- a/data/kwin_update_49.upd +++ /dev/null @@ -1,2 +0,0 @@ -Id=Kwin-4.9 -Script=kwin_update_settings_49 diff --git a/data/kwin_update_tabbox_qml_settings.upd b/data/kwin_update_tabbox_qml_settings.upd deleted file mode 100644 index 2fd80668ca..0000000000 --- a/data/kwin_update_tabbox_qml_settings.upd +++ /dev/null @@ -1,2 +0,0 @@ -Id=Kwin-4.8 -Script=kwin_update_tabbox_qml_settings diff --git a/data/kwin_update_tabbox_settings.upd b/data/kwin_update_tabbox_settings.upd deleted file mode 100644 index 11957fab9b..0000000000 --- a/data/kwin_update_tabbox_settings.upd +++ /dev/null @@ -1,2 +0,0 @@ -Id=Kwin-4.4 -Script=kwin_update_tabbox_settings diff --git a/data/update_kwin_410.cpp b/data/update_kwin_410.cpp deleted file mode 100644 index 30e234c44d..0000000000 --- a/data/update_kwin_410.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 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 -#include - -void migratePlastikToAurorae(KConfig &config) -{ - // migrates selected window decoration from Plastik to Aurorae theme of Plastik - if (!config.hasGroup("Style")) { - return; - } - KConfigGroup style = config.group("Style"); - if (!style.hasKey("PluginLib")) { - return; - } - if (style.readEntry("PluginLib", "kwin3_oxygen") != "kwin3_plastik") { - return; - } - style.writeEntry("PluginLib", "kwin3_aurorae"); - style.sync(); - - // And the Aurorae config - KConfig aurorae("auroraerc"); - KConfigGroup engine = aurorae.group("Engine"); - engine.writeEntry("EngineType", "qml"); - engine.writeEntry("ThemeName", "kwin4_decoration_qml_plastik"); - engine.sync(); - aurorae.sync(); -} - -void migratePlastikSettings() -{ - KConfig aurorae("auroraerc"); - if (aurorae.hasGroup("kwin4_decoration_qml_plastik")) { - // already migrated - return; - } - - // read the Plastik configuration - KConfig plastik("kwinplastikrc"); - if (!plastik.hasGroup("General")) { - // nothing to migrate - return; - } - KConfigGroup cg = plastik.group("General"); - KConfigGroup auroraePlastik = aurorae.group("kwin4_decoration_qml_plastik"); - if (cg.hasKey("CloseOnMenuDoubleClick")) { - auroraePlastik.writeEntry("CloseOnDoubleClickMenuButton", cg.readEntry("CloseOnMenuDoubleClick", true)); - } - // everything else is in a general group - KConfigGroup general = auroraePlastik.group("General"); - if (cg.hasKey("AnimateButtons")) { - general.writeEntry("animateButtons", cg.readEntry("AnimateButtons", true)); - } - if (cg.hasKey("TitleShadow")) { - general.writeEntry("titleShadow", cg.readEntry("TitleShadow", true)); - } - if (cg.hasKey("ColoredBorder")) { - general.writeEntry("coloredBorder", cg.readEntry("ColoredBorder", true)); - } - if (cg.hasKey("TitleAlignment")) { - bool left, center, right; - left = center = right = false; - const QString titleAlignment = cg.readEntry("TitleAlignment", "AlignLeft"); - if (titleAlignment == "AlignLeft") { - left = true; - } else if (titleAlignment == "AlignHCenter") { - center = true; - } else if (titleAlignment == "AlignRight") { - right = true; - } - general.writeEntry("titleAlignLeft", left); - general.writeEntry("titleAlignCenter", center); - general.writeEntry("titleAlignRight", right); - } - - general.sync(); - auroraePlastik.sync(); - aurorae.sync(); -} - -void migrateTranslucencySetting(KConfigGroup &group, const QString &key, qreal oldDefault) -{ - if (!group.hasKey(key)) { - return; - } - const qreal value = group.readEntry(key, oldDefault); - if (value == oldDefault) { - group.deleteEntry(key); - return; - } - if (value > 1.0) { - // already migrated to new settings - return; - } - const int newValue = qBound(0, qRound(value * 100), 100); - group.writeEntry(key, newValue); -} - -void migrateTranslucencySettings(KConfig &config) -{ - if (!config.hasGroup("Effect-Translucency")) { - return; - } - KConfigGroup cg = config.group("Effect-Translucency"); - migrateTranslucencySetting(cg, "Decoration", 1.0); - migrateTranslucencySetting(cg, "MoveResize", 0.8); - migrateTranslucencySetting(cg, "Dialogs", 1.0); - migrateTranslucencySetting(cg, "Inactive", 1.0); - migrateTranslucencySetting(cg, "ComboboxPopups", 1.0); - migrateTranslucencySetting(cg, "Menus", 1.0); - migrateTranslucencySetting(cg, "DropdownMenus", 1.0); - migrateTranslucencySetting(cg, "PopupMenus", 1.0); - migrateTranslucencySetting(cg, "TornOffMenus", 1.0); - cg.sync(); -} - -int main( int argc, char* argv[] ) -{ - KAboutData about( "kwin_update_settings_4_10", "kwin", KLocalizedString(), 0 ); - KCmdLineArgs::init( argc, argv, &about ); - KComponentData inst( &about ); - Q_UNUSED( KGlobal::locale() ); // jump-start locales to get to translated descriptions - KConfig config("kwinrc"); - migratePlastikToAurorae(config); - migratePlastikSettings(); - migrateTranslucencySettings(config); - config.sync(); - // Send signal to all kwin instances - QDBusMessage message = - QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); - QDBusConnection::sessionBus().send(message); -} diff --git a/data/update_kwin_411.cpp b/data/update_kwin_411.cpp deleted file mode 100644 index 20c25a488e..0000000000 --- a/data/update_kwin_411.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************** -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; - for (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 - -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 "update_kwin_49.h" -#include - -void migratePresentWindowsTabBox(KConfig &config) -{ - KConfigGroup plugins = config.group("Plugins"); - const bool presentWindowsEnabled = plugins.readEntry("kwin4_effect_presentwindowsEnabled", true); - if (!presentWindowsEnabled) { - // nothing to migrate - return; - } - KConfigGroup presentWindows = config.group("Effect-PresentWindows"); - const bool presentWindowsPrimary = presentWindows.readEntry("TabBox", false); - const bool presentWindowsAlternative = presentWindows.readEntry("TabBoxAlternative", false); - if (presentWindowsPrimary) { - KConfigGroup tabbox = config.group("TabBox"); - tabbox.writeEntry("LayoutName", "present_windows"); - tabbox.sync(); - } - if (presentWindowsAlternative) { - KConfigGroup tabbox = config.group("TabBoxAlternative"); - tabbox.writeEntry("LayoutName", "present_windows"); - tabbox.sync(); - } - presentWindows.deleteEntry("TabBox"); - presentWindows.deleteEntry("TabBoxAlternative"); - presentWindows.sync(); -} - -void migrateDesktopChangeOSD(KConfig &config) -{ - if (!config.hasGroup("PopupInfo")) { - return; - } - KConfigGroup popupInfo = config.group("PopupInfo"); - const bool shown = popupInfo.readEntry("ShowPopup", false); - const bool textOnly = popupInfo.readEntry("TextOnly", false); - const int delayTime = popupInfo.readEntry("PopupHideDelay", 1000); - - KConfigGroup plugins = config.group("Plugins"); - if (shown && !plugins.hasKey("desktopchangeosdEnabled")) { - plugins.writeEntry("desktopchangeosdEnabled", true); - plugins.sync(); - } - KConfigGroup osd = config.group("Script-desktopchangeosd"); - if (popupInfo.hasKey("TextOnly") && !osd.hasKey("TextOnly")) { - osd.writeEntry("TextOnly", textOnly); - } - if (popupInfo.hasKey("PopupHideDelay") && !osd.hasKey("PopupHideDelay")) { - osd.writeEntry("PopupHideDelay", delayTime); - } - osd.sync(); - config.deleteGroup("PopupInfo"); -} - -void migrateTabBoxConfig(KConfigGroup tabbox) -{ - if (tabbox.hasKey("ListMode") && !tabbox.hasKey("DesktopMode")) { - const int oldValue = tabbox.readEntry("ListMode", 0); - switch (oldValue) { - case 0: // Current Desktop Client List - case 2: // Current Desktop Application List - tabbox.writeEntry("DesktopMode", 1); - break; - case 1: // All Desktops Client List - case 3: // All Desktops Application List - tabbox.writeEntry("DesktopMode", 0); - break; - } - } - tabbox.deleteEntry("ListMode"); - if (tabbox.hasKey("ShowDesktop") && !tabbox.hasKey("ShowDesktopMode")) { - const bool showDesktop = tabbox.readEntry("ShowDesktop", false); - tabbox.writeEntry("ShowDesktopMode", showDesktop ? 1 : 0); - } - tabbox.deleteEntry("ShowDesktop"); - tabbox.sync(); -} diff --git a/data/update_kwin_49.h b/data/update_kwin_49.h deleted file mode 100644 index f70da29f94..0000000000 --- a/data/update_kwin_49.h +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 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 . -*********************************************************************/ -#ifndef UPDATE_KWIN_49_H -#define UPDATE_KWIN_49_H -#include - -class KConfig; - -void migratePresentWindowsTabBox(KConfig &config); -void migrateDesktopChangeOSD(KConfig &config); -void migrateTabBoxConfig(KConfigGroup tabbox); - -#endif diff --git a/data/update_kwin_49_main.cpp b/data/update_kwin_49_main.cpp deleted file mode 100644 index 33204afe27..0000000000 --- a/data/update_kwin_49_main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 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 "update_kwin_49.h" - -#include -#include -#include -#include -#include -#include - -int main( int argc, char* argv[] ) -{ - KAboutData about( "kwin_update_tabbox_qml_settings", "kwin", KLocalizedString(), 0 ); - KCmdLineArgs::init( argc, argv, &about ); - KComponentData inst( &about ); - Q_UNUSED( KGlobal::locale() ); // jump-start locales to get to translated descriptions - KConfig config("kwinrc"); - migratePresentWindowsTabBox(config); - migrateDesktopChangeOSD(config); - migrateTabBoxConfig(config.group("TabBox")); - migrateTabBoxConfig(config.group("TabBoxAlternative")); - config.sync(); - // Send signal to all kwin instances - QDBusMessage message = - QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); - QDBusConnection::sessionBus().send(message); -} diff --git a/data/update_tabbox_qml_settings.cpp b/data/update_tabbox_qml_settings.cpp deleted file mode 100644 index 7297ffff7a..0000000000 --- a/data/update_tabbox_qml_settings.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2011 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 -#include - -void updateTabBoxConfig(KConfigGroup &tabbox, bool migrate) -{ - tabbox.deleteEntry("LayoutMode"); - tabbox.deleteEntry("SelectedItem"); - tabbox.deleteEntry("MinWidth"); - tabbox.deleteEntry("MinHeight"); - tabbox.deleteEntry("SelectedLayoutName"); - if (migrate) { - tabbox.writeEntry("LayoutName", "thumbnails"); - } - tabbox.sync(); -} - -int main( int argc, char* argv[] ) -{ - KAboutData about( "kwin_update_tabbox_qml_settings", "kwin", KLocalizedString(), 0 ); - KCmdLineArgs::init( argc, argv, &about ); - KComponentData inst( &about ); - Q_UNUSED( KGlobal::locale() ); // jump-start locales to get to translated descriptions - KConfig config("kwinrc"); - KConfigGroup plugins = config.group("Plugins"); - const bool boxSwitchEnabled = plugins.readEntry("kwin4_effect_boxswitchEnabled", true); - KConfigGroup boxswitch = config.group("Effect-BoxSwitch"); - const bool boxSwitchPrimary = boxSwitchEnabled && boxswitch.hasKey("TabBox") && boxswitch.readEntry("TabBox", true); - const bool boxSwitchAlternative = boxSwitchEnabled && boxswitch.hasKey("TabBoxAlternative") && boxswitch.readEntry("TabBoxAlternative", false); - boxswitch.writeEntry("TabBox", false); - boxswitch.writeEntry("TabBoxAlternative", false); - boxswitch.sync(); - KConfigGroup tabbox = config.group("TabBox"); - updateTabBoxConfig(tabbox, boxSwitchPrimary); - KConfigGroup tabboxAlternative = config.group("TabBoxAlternative"); - updateTabBoxConfig(tabboxAlternative, boxSwitchAlternative); - config.sync(); - // Send signal to all kwin instances - QDBusMessage message = - QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); - QDBusConnection::sessionBus().send(message); -} diff --git a/data/update_tabbox_settings.cpp b/data/update_tabbox_settings.cpp deleted file mode 100644 index 5d70781ff9..0000000000 --- a/data/update_tabbox_settings.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2005 Lubos Lunak -Copyright (C) 2009 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 . -*********************************************************************/ - -// read additional window rules and add them to kwinrulesrc - -#include -#include -#include -#include -#include -#include -#include - -int main( int argc, char* argv[] ) -{ - KAboutData about( "kwin_update_tabbox_settings", "kwin", KLocalizedString(), 0 ); - KCmdLineArgs::init( argc, argv, &about ); - KComponentData inst( &about ); - Q_UNUSED( KGlobal::locale() ); // jump-start locales to get to translated descriptions - KConfig config( "kwinrc" ); - KConfigGroup windows(&config, "Windows"); - KConfigGroup tabbox(&config, "TabBox"); - const bool traverse = tabbox.readEntry("TraverseAll", false); - const QString style = windows.readEntry("AltTabStyle", "KDE"); - if( !tabbox.hasKey("ListMode") ) - tabbox.writeEntry("ListMode", traverse?1:0); - if( !tabbox.hasKey("ShowTabBox") ) - tabbox.writeEntry("ShowTabBox", (style.compare("KDE", Qt::CaseInsensitive) == 0)?true:false); - tabbox.sync(); - config.sync(); - // Send signal to all kwin instances - QDBusMessage message = - QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); - QDBusConnection::sessionBus().send(message); - -} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1c9404ef38..9c5663bc8e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,8 +1,3 @@ -set( testUpdateKWin49_SRCS test_update_kwin_49.cpp ../data/update_kwin_49.cpp ../tabbox/tabboxconfig.cpp ) -#kde4_add_unit_test( testUpdateKWin49 TESTNAME kwin-TestUpdateKWin49 ${testUpdateKWin49_SRCS} ) - -#target_link_libraries( testUpdateKWin49 Qt5::Test ) - ######################################################## # Test ScreenPaintData ######################################################## diff --git a/tests/test_update_kwin_49.cpp b/tests/test_update_kwin_49.cpp deleted file mode 100644 index 8b6bcd5e7d..0000000000 --- a/tests/test_update_kwin_49.cpp +++ /dev/null @@ -1,543 +0,0 @@ -/******************************************************************** -KWin - the KDE window manager -This file is part of the KDE project. - -Copyright (C) 2012 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 "../data/update_kwin_49.h" -#include "../tabbox/tabboxconfig.h" - -#include - -#include - -class TestUpdateKWin49 : public QObject -{ - Q_OBJECT -private Q_SLOTS: - /** - * Tests that migrating the Present Windows TabBox settings - * does not affect an empty configuration. - **/ - void testEmptyKConfigPW(); - /** - * Tests that the migration of Present Windows TabBox settings for a - * disabled Present Windows effect does not affect the configuration. - **/ - void testPWDisabled(); - /** - * Tests that the migration of Present Window TabBox settings for an - * enabled Present Windows effect with disabled TabBox does not affect the configuration. - **/ - void testPWEnabledTabBoxDisabled(); - /** - * Tests that the migration of Present Windows TabBox settings - * properly sets the layout in TabBox. - **/ - void testPWTabBoxEnabled(); - /** - * Tests that the migration of Present Windows TabBox settings - * properly sets the layout in TabBoxAlternative. - **/ - void testPWTabBoxAlternativeEnabled(); - /** - * Tests that the migration of Present Windows TabBox settings - * properly sets the layout in both TabBox and TabBoxAlternative. - **/ - void testPWBothEnabled(); - /** - * Test that migrating the Desktop Change OSD settings - * does not affect an empty configuration - **/ - void testEmptyKConfigOSD(); - /** - * Tests that migrating the Desktop Change OSD settings - * with a disabled PopupInfo does not affect KConfig. - **/ - void testPopupInfoDisabled(); - /** - * Tests that migrating the Desktop Change OSD settings - * with a disabled PopupInfo migrates only the config parameters. - **/ - void testPopupInfoDisabledAdditionalKeys(); - /** - * Tests that migrating the Desktop Change OSD settings - * with a disabled PopupInfo migrates only the config parameters which have default values. - **/ - void testPopupInfoDisabledAdditionalKeysDefault(); - /** - * Tests that migrating the Desktop Change OSD settings - * enables the script. - **/ - void testPopupInfoEnabled(); - /** - * Tests that migrating the Desktop Change OSD settings - * enables the script and migrates the settings. - **/ - void testPopupInfoEnabledAdditionalKeys(); - /** - * Tests that attempting to migrate Desktop Change OSD settings - * again will not overwrite existing settings. - **/ - void testPopupInfoAlreadyMigrated(); - /** - * Tests that migrating TabBox does not change an empty KConfig. - **/ - void testEmptyKConfigTabBox(); - /** - * Tests the migration of TabBox setting show desktop. - **/ - void testTabBoxShowDesktopEnabled(); - /** - * Tests the migration of TabBox setting show desktop. - **/ - void testTabBoxShowDesktopDisabled(); - /** - * Tests the migration of the various TabBox ListMode settings. - **/ - void testTabBoxCurrentDesktopClientList(); - void testTabBoxCurrentDesktopApplicationList(); - void testTabBoxAllDesktopsClientList(); - void testTabBoxAllDesktopsApplicationList(); - /** - * Tests that attempting to migrate TabBox settings again will not - * overwrite existing settings. - **/ - void testTabBoxAlreadyMigrated(); -}; - -void TestUpdateKWin49::testEmptyKConfigPW() -{ - KConfig config(QString(), KConfig::SimpleConfig); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); -} - -void TestUpdateKWin49::testPWDisabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup plugins = config.group("Plugins"); - plugins.writeEntry("kwin4_effect_presentwindowsEnabled", false); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(!plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(!plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); -} - -void TestUpdateKWin49::testPWEnabledTabBoxDisabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup plugins = config.group("Plugins"); - plugins.writeEntry("kwin4_effect_presentwindowsEnabled", true); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - // same with TabBox explicitly disabled - KConfigGroup pw = config.group("Effect-PresentWindows"); - pw.writeEntry("TabBox", false); - pw.writeEntry("TabBoxAlternative", false); - QVERIFY(pw.hasKey("TabBox")); - QVERIFY(pw.hasKey("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(plugins.readEntry("kwin4_effect_presentwindowsEnabled", true)); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); -} - -void TestUpdateKWin49::testPWTabBoxEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup pw = config.group("Effect-PresentWindows"); - pw.writeEntry("TabBox", true); - QVERIFY(pw.hasKey("TabBox")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(config.hasGroup("TabBox")); - KConfigGroup tabBox = config.group("TabBox"); - QVERIFY(tabBox.hasKey("LayoutName")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - // test same with an explicit layout set - tabBox.writeEntry("LayoutName", "informative"); - pw.writeEntry("TabBox", true); - migratePresentWindowsTabBox(config); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); -} - -void TestUpdateKWin49::testPWTabBoxAlternativeEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup pw = config.group("Effect-PresentWindows"); - pw.writeEntry("TabBoxAlternative", true); - QVERIFY(pw.hasKey("TabBoxAlternative")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migratePresentWindowsTabBox(config); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(config.hasGroup("TabBoxAlternative")); - KConfigGroup tabBox = config.group("TabBoxAlternative"); - QVERIFY(tabBox.hasKey("LayoutName")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); - QVERIFY(!config.hasGroup("TabBox")); - // test same with an explicit layout set - tabBox.writeEntry("LayoutName", "informative"); - pw.writeEntry("TabBoxAlternative", true); - migratePresentWindowsTabBox(config); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); -} - -void TestUpdateKWin49::testPWBothEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup pw = config.group("Effect-PresentWindows"); - pw.writeEntry("TabBox", true); - pw.writeEntry("TabBoxAlternative", true); - QVERIFY(pw.hasKey("TabBoxAlternative")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - QVERIFY(pw.hasKey("TabBox")); - migratePresentWindowsTabBox(config); - QVERIFY(!config.hasGroup("Effect-PresentWindows")); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(config.hasGroup("TabBox")); - QVERIFY(config.hasGroup("TabBoxAlternative")); - KConfigGroup tabBox = config.group("TabBox"); - QVERIFY(tabBox.hasKey("LayoutName")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - QVERIFY(tabBoxAlternative.hasKey("LayoutName")); - QVERIFY(tabBoxAlternative.readEntry("LayoutName", "thumbnails") == "present_windows"); - // test same with an explicit layout set - tabBox.writeEntry("LayoutName", "informative"); - tabBoxAlternative.writeEntry("LayoutName", "informative"); - pw.writeEntry("TabBox", true); - pw.writeEntry("TabBoxAlternative", true); - migratePresentWindowsTabBox(config); - QVERIFY(!pw.hasKey("TabBox")); - QVERIFY(!pw.hasKey("TabBoxAlternative")); - QVERIFY(tabBox.readEntry("LayoutName", "thumbnails") == "present_windows"); - QVERIFY(tabBoxAlternative.readEntry("LayoutName", "thumbnails") == "present_windows"); -} - -void TestUpdateKWin49::testEmptyKConfigOSD() -{ - KConfig config(QString(), KConfig::SimpleConfig); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); -} - -void TestUpdateKWin49::testPopupInfoDisabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("ShowPopup", false); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(popupInfo.hasKey("ShowPopup")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); -} - -void TestUpdateKWin49::testPopupInfoDisabledAdditionalKeys() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("TextOnly", false); - popupInfo.writeEntry("PopupHideDelay", 1000); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(popupInfo.hasKey("TextOnly")); - QVERIFY(popupInfo.hasKey("PopupHideDelay")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(!popupInfo.hasKey("TextOnly")); - QVERIFY(!popupInfo.hasKey("PopupHideDelay")); - KConfigGroup osd = config.group("Script-desktopchangeosd"); - QVERIFY(osd.hasKey("TextOnly")); - QVERIFY(osd.hasKey("PopupHideDelay")); - QVERIFY(!osd.readEntry("TextOnly", false)); - QVERIFY(osd.readEntry("PopupHideDelay", 1000) == 1000); -} - -void TestUpdateKWin49::testPopupInfoDisabledAdditionalKeysDefault() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("TextOnly", true); - popupInfo.writeEntry("PopupHideDelay", 200); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(popupInfo.hasKey("TextOnly")); - QVERIFY(popupInfo.hasKey("PopupHideDelay")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(!popupInfo.hasKey("TextOnly")); - QVERIFY(!popupInfo.hasKey("PopupHideDelay")); - KConfigGroup osd = config.group("Script-desktopchangeosd"); - QVERIFY(osd.hasKey("TextOnly")); - QVERIFY(osd.hasKey("PopupHideDelay")); - QVERIFY(osd.readEntry("TextOnly", false)); - QVERIFY(osd.readEntry("PopupHideDelay", 1000) == 200); -} - -void TestUpdateKWin49::testPopupInfoEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("ShowPopup", true); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(popupInfo.hasKey("ShowPopup")); - migrateDesktopChangeOSD(config); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - KConfigGroup plugins = config.group("Plugins"); - QVERIFY(plugins.hasKey("desktopchangeosdEnabled")); - QVERIFY(plugins.readEntry("desktopchangeosdEnabled", false)); -} - -void TestUpdateKWin49::testPopupInfoEnabledAdditionalKeys() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("ShowPopup", true); - popupInfo.writeEntry("TextOnly", true); - popupInfo.writeEntry("PopupHideDelay", 2000); - QVERIFY(!config.hasGroup("Plugins")); - QVERIFY(!config.hasGroup("Script-desktopchangeosd")); - QVERIFY(popupInfo.hasKey("ShowPopup")); - QVERIFY(popupInfo.hasKey("TextOnly")); - QVERIFY(popupInfo.hasKey("PopupHideDelay")); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(config.hasGroup("Plugins")); - QVERIFY(config.hasGroup("Script-desktopchangeosd")); - QVERIFY(!popupInfo.hasKey("ShowPopup")); - QVERIFY(!popupInfo.hasKey("TextOnly")); - QVERIFY(!popupInfo.hasKey("PopupHideDelay")); - KConfigGroup osd = config.group("Script-desktopchangeosd"); - QVERIFY(osd.hasKey("TextOnly")); - QVERIFY(osd.hasKey("PopupHideDelay")); - QVERIFY(osd.readEntry("TextOnly", false)); - QVERIFY(osd.readEntry("PopupHideDelay", 1000) == 2000); - KConfigGroup plugins = config.group("Plugins"); - QVERIFY(plugins.hasKey("desktopchangeosdEnabled")); - QVERIFY(plugins.readEntry("desktopchangeosdEnabled", false)); -} - -void TestUpdateKWin49::testPopupInfoAlreadyMigrated() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup popupInfo = config.group("PopupInfo"); - popupInfo.writeEntry("ShowPopup", true); - popupInfo.writeEntry("TextOnly", false); - popupInfo.writeEntry("PopupHideDelay", 2000); - KConfigGroup plugins = config.group("Plugins"); - plugins.writeEntry("desktopchangeosdEnabled", false); - KConfigGroup osd = config.group("Script-desktopchangeosd"); - osd.writeEntry("TextOnly", true); - osd.writeEntry("PopupHideDelay", 200); - migrateDesktopChangeOSD(config); - QVERIFY(!config.hasGroup("PopupInfo")); - QVERIFY(!plugins.readEntry("desktopchangeosdEnabled", false)); - QVERIFY(osd.readEntry("TextOnly", false)); - QVERIFY(osd.readEntry("PopupHideDelay", 1000) == 200); -} - -void TestUpdateKWin49::testEmptyKConfigTabBox() -{ - KConfig config(QString(), KConfig::SimpleConfig); - QVERIFY(!config.hasGroup("TabBox")); - migrateTabBoxConfig(config.group("TabBox")); - QVERIFY(!config.hasGroup("TabBox")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); - migrateTabBoxConfig(config.group("TabBoxAlternative")); - QVERIFY(!config.hasGroup("TabBoxAlternative")); -} - -void TestUpdateKWin49::testTabBoxShowDesktopDisabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ShowDesktop", false); - tabBoxAlternative.writeEntry("ShowDesktop", false); - QVERIFY(!tabBox.hasKey("ShowDesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("ShowDesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ShowDesktop")); - QVERIFY(tabBox.hasKey("ShowDesktopMode")); - QVERIFY(tabBox.readEntry("ShowDesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultShowDesktopMode())) == KWin::TabBox::TabBoxConfig::DoNotShowDesktopClient); - QVERIFY(tabBoxAlternative.hasKey("ShowDesktop")); - QVERIFY(!tabBoxAlternative.hasKey("ShowDesktopMode")); -} - -void TestUpdateKWin49::testTabBoxShowDesktopEnabled() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ShowDesktop", true); - tabBoxAlternative.writeEntry("ShowDesktop", true); - QVERIFY(!tabBox.hasKey("ShowDesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("ShowDesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ShowDesktop")); - QVERIFY(tabBox.hasKey("ShowDesktopMode")); - QVERIFY(tabBox.readEntry("ShowDesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultShowDesktopMode())) == KWin::TabBox::TabBoxConfig::ShowDesktopClient); - QVERIFY(tabBoxAlternative.hasKey("ShowDesktop")); - QVERIFY(!tabBoxAlternative.hasKey("ShowDesktopMode")); -} - -void TestUpdateKWin49::testTabBoxAllDesktopsApplicationList() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ListMode", 3); - tabBoxAlternative.writeEntry("ListMode", 3); - QVERIFY(!tabBox.hasKey("DesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(tabBox.hasKey("DesktopMode")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::AllDesktopsClients); - QVERIFY(tabBoxAlternative.hasKey("ListMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); -} - -void TestUpdateKWin49::testTabBoxAllDesktopsClientList() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ListMode", 1); - tabBoxAlternative.writeEntry("ListMode", 1); - QVERIFY(!tabBox.hasKey("DesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(tabBox.hasKey("DesktopMode")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::AllDesktopsClients); - QVERIFY(tabBoxAlternative.hasKey("ListMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); -} - -void TestUpdateKWin49::testTabBoxCurrentDesktopApplicationList() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ListMode", 2); - tabBoxAlternative.writeEntry("ListMode", 2); - QVERIFY(!tabBox.hasKey("DesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(tabBox.hasKey("DesktopMode")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::OnlyCurrentDesktopClients); - QVERIFY(tabBoxAlternative.hasKey("ListMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); -} - -void TestUpdateKWin49::testTabBoxCurrentDesktopClientList() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - KConfigGroup tabBoxAlternative = config.group("TabBoxAlternative"); - tabBox.writeEntry("ListMode", 0); - tabBoxAlternative.writeEntry("ListMode", 0); - QVERIFY(!tabBox.hasKey("DesktopMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(tabBox.hasKey("DesktopMode")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::OnlyCurrentDesktopClients); - QVERIFY(tabBoxAlternative.hasKey("ListMode")); - QVERIFY(!tabBoxAlternative.hasKey("DesktopMode")); -} - -void TestUpdateKWin49::testTabBoxAlreadyMigrated() -{ - KConfig config(QString(), KConfig::SimpleConfig); - KConfigGroup tabBox = config.group("TabBox"); - tabBox.writeEntry("ListMode", 0); - tabBox.writeEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::AllDesktopsClients)); - tabBox.writeEntry("ShowDesktop", true); - tabBox.writeEntry("ShowDesktopMode", static_cast(KWin::TabBox::TabBoxConfig::DoNotShowDesktopClient)); - migrateTabBoxConfig(tabBox); - QVERIFY(!tabBox.hasKey("ListMode")); - QVERIFY(!tabBox.hasKey("ShowDesktop")); - QVERIFY(tabBox.readEntry("DesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::AllDesktopsClients); - QVERIFY(tabBox.readEntry("ShowDesktopMode", static_cast(KWin::TabBox::TabBoxConfig::defaultShowDesktopMode())) == KWin::TabBox::TabBoxConfig::DoNotShowDesktopClient); -} - -QTEST_MAIN(TestUpdateKWin49) -#include "test_update_kwin_49.moc"