[kwin] Clean up data directory
We do not provide a config update path from anything older than 4.11 to 5.0. This means we can remove all the kconfig update tools leading to 4.11.master
parent
544820793e
commit
8c0fe2ad41
@ -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
|
@ -1,2 +0,0 @@
|
||||
Id=Kwin-4.8
|
||||
Script=kwin_remove_delay_focus.sh
|
@ -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
|
@ -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
|
@ -1,2 +0,0 @@
|
||||
Id=Kwin-4.10
|
||||
Script=kwin_translate_activity_rule.sh
|
@ -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
|
@ -1,2 +0,0 @@
|
||||
Id=Kwin-4.11
|
||||
Script=kwin_translate_confrequest_rule.sh
|
@ -1,2 +0,0 @@
|
||||
Id=Kwin-4.10_1
|
||||
Script=kwin_update_settings_410
|
@ -1,2 +0,0 @@
|
||||
Id=Kwin-4.11_0
|
||||
Script=kwin_update_settings_411
|
@ -1,2 +0,0 @@
|
||||
Id=Kwin-4.9
|
||||
Script=kwin_update_settings_49
|
@ -1,2 +0,0 @@
|
||||
Id=Kwin-4.8
|
||||
Script=kwin_update_tabbox_qml_settings
|
@ -1,2 +0,0 @@
|
||||
Id=Kwin-4.4
|
||||
Script=kwin_update_tabbox_settings
|
@ -1,155 +0,0 @@
|
||||
/********************************************************************
|
||||
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 <KDE/KAboutData>
|
||||
#include <KDE/KCmdLineArgs>
|
||||
#include <KDE/KComponentData>
|
||||
#include <KDE/KConfig>
|
||||
#include <KDE/KConfigGroup>
|
||||
#include <KDE/KGlobal>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
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<int>(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);
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2013 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 <KDE/KAboutData>
|
||||
#include <KDE/KCmdLineArgs>
|
||||
#include <KDE/KComponentData>
|
||||
#include <KDE/KConfigGroup>
|
||||
#include <KDE/KGlobal>
|
||||
#include <KDE/KLocalizedString>
|
||||
// Qt
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
|
||||
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<shortcuts.length(); ++i) {
|
||||
const QString &cs = shortcuts.at(i);
|
||||
if (cs.contains('+') && (cs.contains(ALT) || cs.contains(CTRL) || cs.contains(META) || cs.contains(SHIFT))) {
|
||||
// our shortcuts consist of at least one modifier and a key, so having a plus and a modifier means it's a shortcut
|
||||
newValue.append(" - ");
|
||||
} else {
|
||||
// otherwise it's part of a key like "Volume Up"
|
||||
newValue.append(' ');
|
||||
}
|
||||
newValue.append(cs);
|
||||
}
|
||||
group.writeEntry(KEY, newValue);
|
||||
group.sync();
|
||||
updated = true;
|
||||
}
|
||||
if (updated) {
|
||||
config.sync();
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
KAboutData about( "kwin_update_settings_4_11", "kwin", KLocalizedString(), 0 );
|
||||
KCmdLineArgs::init( argc, argv, &about );
|
||||
KComponentData inst( &about );
|
||||
Q_UNUSED( KGlobal::locale() ); // jump-start locales to get to translated descriptions
|
||||
bool reload = migrateRulesShortcut();
|
||||
// Send signal to all kwin instances
|
||||
if (reload) {
|
||||
QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
||||
QDBusConnection::sessionBus().send(message);
|
||||
}
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
/********************************************************************
|
||||
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();
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/********************************************************************
|
||||
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
|
@ -1,45 +0,0 @@
|
||||
/********************************************************************
|
||||
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);
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2011 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 <kconfig.h>
|
||||
#include <kconfiggroup.h>
|
||||
#include <kcomponentdata.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kglobal.h>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
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<bool>("kwin4_effect_boxswitchEnabled", true);
|
||||
KConfigGroup boxswitch = config.group("Effect-BoxSwitch");
|
||||
const bool boxSwitchPrimary = boxSwitchEnabled && boxswitch.hasKey("TabBox") && boxswitch.readEntry<bool>("TabBox", true);
|
||||
const bool boxSwitchAlternative = boxSwitchEnabled && boxswitch.hasKey("TabBoxAlternative") && boxswitch.readEntry<bool>("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);
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/********************************************************************
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
Copyright (C) 2005 Lubos Lunak <l.lunak@kde.org>
|
||||
Copyright (C) 2009 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/>.
|
||||
*********************************************************************/
|
||||
|
||||
// read additional window rules and add them to kwinrulesrc
|
||||
|
||||
#include <kconfig.h>
|
||||
#include <kconfiggroup.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_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<bool>("TraverseAll", false);
|
||||
const QString style = windows.readEntry<QString>("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);
|
||||
|
||||
}
|
@ -1,543 +0,0 @@
|
||||
/********************************************************************
|
||||
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 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<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 New Issue