From 219d0cc6a91315f9d2607ea940be6333bf2986d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 12 Nov 2011 21:45:14 +0100 Subject: [PATCH] KConf Update for TabBox QML * BoxSwitch users are migrated to new QML TabBox thumbnails layout * Thumbnail layout is new default (as before was BoxSwitch) * Removed obsoleted settings from TabBox config --- data/CMakeLists.txt | 10 +++- data/kwin_update_tabbox_qml_settings.upd | 2 + data/update_tabbox_qml_settings.cpp | 64 ++++++++++++++++++++++++ effects/boxswitch/boxswitch.cpp | 2 +- tabbox/tabbox.cpp | 10 ---- tabbox/tabboxconfig.h | 2 +- 6 files changed, 77 insertions(+), 13 deletions(-) create mode 100644 data/kwin_update_tabbox_qml_settings.upd create mode 100644 data/update_tabbox_qml_settings.cpp diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index e24f562f00..fadb274bc6 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -32,11 +32,19 @@ kde4_add_executable( kwin_update_tabbox_settings ${kwin_update_tabbox_settings_S target_link_libraries( kwin_update_tabbox_settings ${KDE4_KDECORE_LIBS} ) 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 ) + +kde4_add_executable( kwin_update_tabbox_qml_settings ${kwin_update_tabbox_qml_settings_SRCS} ) + +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/ ) ########### 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.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd kwin_on_off.upd kwin_window_shortcuts.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) +install( FILES kwin.upd kwinsticky.upd kwiniconify.upd kwin3_plugin.upd kwin_focus1.upd kwinupdatewindowsettings.upd kwin_focus2.upd kwin_fsp_workarounds_1.upd kwin_on_off.upd kwin_window_shortcuts.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) install( PROGRAMS pluginlibFix.pl kwin3_plugin.pl kwin_focus1.sh kwin_focus2.sh on-off_to_true-false.sh kwin_window_shortcuts.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} ) diff --git a/data/kwin_update_tabbox_qml_settings.upd b/data/kwin_update_tabbox_qml_settings.upd new file mode 100644 index 0000000000..2fd80668ca --- /dev/null +++ b/data/kwin_update_tabbox_qml_settings.upd @@ -0,0 +1,2 @@ +Id=Kwin-4.8 +Script=kwin_update_tabbox_qml_settings diff --git a/data/update_tabbox_qml_settings.cpp b/data/update_tabbox_qml_settings.cpp new file mode 100644 index 0000000000..618b36f1e9 --- /dev/null +++ b/data/update_tabbox_qml_settings.cpp @@ -0,0 +1,64 @@ +/******************************************************************** +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 boxswitch = config.group("Effect-BoxSwitch"); + const bool boxSwitchPrimary = boxswitch.readEntry("TabBox", true); + const bool boxSwitchAlternative = 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/effects/boxswitch/boxswitch.cpp b/effects/boxswitch/boxswitch.cpp index 4b6b41c37a..fac6b3f019 100644 --- a/effects/boxswitch/boxswitch.cpp +++ b/effects/boxswitch/boxswitch.cpp @@ -86,7 +86,7 @@ void BoxSwitchEffect::reconfigure(ReconfigureFlags) elevate_window = conf.readEntry("ElevateSelected", true); mAnimateSwitch = conf.readEntry("AnimateSwitch", false); - primaryTabBox = conf.readEntry("TabBox", true); + primaryTabBox = conf.readEntry("TabBox", false); secondaryTabBox = conf.readEntry("TabBoxAlternative", false); } diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index 3aa4ab08d3..9cc7935875 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -555,10 +555,6 @@ void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig) config.readEntry("ListMode", TabBoxConfig::defaultListMode()))); tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode( config.readEntry("SwitchingMode", TabBoxConfig::defaultSwitchingMode()))); - tabBoxConfig.setLayout(TabBoxConfig::LayoutMode( - config.readEntry("LayoutMode", TabBoxConfig::defaultLayoutMode()))); - tabBoxConfig.setSelectedItemViewPosition(TabBoxConfig::SelectedItemViewPosition( - config.readEntry("SelectedItem", TabBoxConfig::defaultSelectedItemViewPosition()))); tabBoxConfig.setShowOutline(config.readEntry("ShowOutline", TabBoxConfig::defaultShowOutline())); @@ -569,13 +565,7 @@ void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig) tabBoxConfig.setShowDesktop(config.readEntry("ShowDesktop", TabBoxConfig::defaultShowDesktop())); - tabBoxConfig.setMinWidth(config.readEntry("MinWidth", - TabBoxConfig::defaultMinWidth())); - tabBoxConfig.setMinHeight(config.readEntry("MinHeight", - TabBoxConfig::defaultMinHeight())); - tabBoxConfig.setLayoutName(config.readEntry("LayoutName", TabBoxConfig::defaultLayoutName())); - tabBoxConfig.setSelectedItemLayoutName(config.readEntry("SelectedLayoutName", TabBoxConfig::defaultSelectedItemLayoutName())); } /*! diff --git a/tabbox/tabboxconfig.h b/tabbox/tabboxconfig.h index 2b1517d259..c8e5617575 100644 --- a/tabbox/tabboxconfig.h +++ b/tabbox/tabboxconfig.h @@ -306,7 +306,7 @@ public: return 20; } static QString defaultLayoutName() { - return QString("Default"); + return QString("thumbnails"); } static QString defaultSelectedItemLayoutName() { return QString("Text");