KConf Update script for KWin 4.9
BUG: 296775 FIXED-IN: 4.9.0 REVIEW: 104984
This commit is contained in:
parent
33492358e5
commit
a65b86b5ae
8 changed files with 733 additions and 1 deletions
|
@ -253,3 +253,5 @@ if( KWIN_BUILD_SCRIPTING )
|
|||
endif( KWIN_BUILD_SCRIPTING )
|
||||
|
||||
kde4_install_icons( ${ICON_INSTALL_DIR} )
|
||||
|
||||
add_subdirectory(tests)
|
||||
|
|
|
@ -28,10 +28,19 @@ target_link_libraries( kwin_update_tabbox_qml_settings ${KDE4_KDECORE_LIBS} )
|
|||
|
||||
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 )
|
||||
|
||||
kde4_add_executable( kwin_update_settings_49 ${kwin_update_settings_49_SRCS} )
|
||||
|
||||
target_link_libraries( kwin_update_settings_49 ${KDE4_KDECORE_LIBS} )
|
||||
|
||||
install( TARGETS kwin_update_settings_49 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 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 DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
|
||||
install( PROGRAMS kwin_remove_delay_focus.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
|
||||
|
||||
|
|
2
data/kwin_update_49.upd
Normal file
2
data/kwin_update_49.upd
Normal file
|
@ -0,0 +1,2 @@
|
|||
Id=Kwin-4.9
|
||||
Script=kwin_update_settings_49
|
97
data/update_kwin_49.cpp
Normal file
97
data/update_kwin_49.cpp
Normal file
|
@ -0,0 +1,97 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "update_kwin_49.h"
|
||||
#include <KDE/KConfig>
|
||||
|
||||
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();
|
||||
}
|
30
data/update_kwin_49.h
Normal file
30
data/update_kwin_49.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#ifndef UPDATE_KWIN_49_H
|
||||
#define UPDATE_KWIN_49_H
|
||||
#include <KDE/KConfigGroup>
|
||||
|
||||
class KConfig;
|
||||
|
||||
void migratePresentWindowsTabBox(KConfig &config);
|
||||
void migrateDesktopChangeOSD(KConfig &config);
|
||||
void migrateTabBoxConfig(KConfigGroup tabbox);
|
||||
|
||||
#endif
|
45
data/update_kwin_49_main.cpp
Normal file
45
data/update_kwin_49_main.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "update_kwin_49.h"
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kglobal.h>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
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);
|
||||
}
|
4
tests/CMakeLists.txt
Normal file
4
tests/CMakeLists.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
set( testUpdateKWin49_SRCS test_update_kwin_49.cpp ../data/update_kwin_49.cpp ../tabbox/tabboxconfig.cpp )
|
||||
kde4_add_unit_test( testUpdateKWin49 TESTNAME TestUpdateKWin49 ${testUpdateKWin49_SRCS} )
|
||||
|
||||
target_link_libraries( testUpdateKWin49 ${KDE4_KDECORE_LIBS} ${QT_QTTEST_LIBRARY} )
|
543
tests/test_update_kwin_49.cpp
Normal file
543
tests/test_update_kwin_49.cpp
Normal file
|
@ -0,0 +1,543 @@
|
|||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*********************************************************************/
|
||||
#include "../data/update_kwin_49.h"
|
||||
#include "../tabbox/tabboxconfig.h"
|
||||
|
||||
#include <KDE/KConfig>
|
||||
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class TestUpdateKWin49 : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private 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<int>(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<int>(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<int>(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<int>(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<int>(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<int>(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<int>(KWin::TabBox::TabBoxConfig::AllDesktopsClients));
|
||||
tabBox.writeEntry("ShowDesktop", true);
|
||||
tabBox.writeEntry("ShowDesktopMode", static_cast<int>(KWin::TabBox::TabBoxConfig::DoNotShowDesktopClient));
|
||||
migrateTabBoxConfig(tabBox);
|
||||
QVERIFY(!tabBox.hasKey("ListMode"));
|
||||
QVERIFY(!tabBox.hasKey("ShowDesktop"));
|
||||
QVERIFY(tabBox.readEntry("DesktopMode", static_cast<int>(KWin::TabBox::TabBoxConfig::defaultDesktopMode())) == KWin::TabBox::TabBoxConfig::AllDesktopsClients);
|
||||
QVERIFY(tabBox.readEntry("ShowDesktopMode", static_cast<int>(KWin::TabBox::TabBoxConfig::defaultShowDesktopMode())) == KWin::TabBox::TabBoxConfig::DoNotShowDesktopClient);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestUpdateKWin49)
|
||||
#include "test_update_kwin_49.moc"
|
Loading…
Reference in a new issue