From 67f047e2905ccf295f9f3e99b6f8f08c141641fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 16 Dec 2009 22:19:37 +0000 Subject: [PATCH] Kconf update for converting the old tabbox settings to the new one. Using C++ as the bash script didn't work. Nevertheless thanks to Jan Gerrit Marker for the half working script (would have worked if all entries were in the same config group). BUG: 211215 svn path=/trunk/KDE/kdebase/workspace/; revision=1063079 --- data/CMakeLists.txt | 11 +++++- data/kwin_update_tabbox_settings.upd | 2 ++ data/update_tabbox_settings.cpp | 54 ++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 data/kwin_update_tabbox_settings.upd create mode 100644 data/update_tabbox_settings.cpp diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index e4ebde6dce..10a5253cf2 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -24,10 +24,19 @@ target_link_libraries( kwin_update_default_rules ${KDE4_KDECORE_LIBS} ) install(TARGETS kwin_update_default_rules DESTINATION ${LIB_INSTALL_DIR}/kconf_update_bin/ ) +########### next target ############### +set( kwin_update_tabbox_settings_SRCS update_tabbox_settings.cpp ) + +kde4_add_executable( kwin_update_tabbox_settings ${kwin_update_tabbox_settings_SRCS} ) + +target_link_libraries( kwin_update_tabbox_settings ${KDE4_KDECORE_LIBS} ) + +install( TARGETS kwin_update_tabbox_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 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 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_settings.upd b/data/kwin_update_tabbox_settings.upd new file mode 100644 index 0000000000..95420a4d97 --- /dev/null +++ b/data/kwin_update_tabbox_settings.upd @@ -0,0 +1,2 @@ +Id=Kwin-Tabbox +Script=kwin_update_tabbox_settings diff --git a/data/update_tabbox_settings.cpp b/data/update_tabbox_settings.cpp new file mode 100644 index 0000000000..87a76a4c22 --- /dev/null +++ b/data/update_tabbox_settings.cpp @@ -0,0 +1,54 @@ +/******************************************************************** +KWin - the KDE window manager +This file is part of the KDE project. + +Copyright (C) 2005 Lubos Lunak +Copyright (C) 2009 Martin Gräßlin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ + +// read additional window rules and add them to kwinrulesrc + +#include +#include +#include +#include +#include +#include +#include + +int main( int argc, char* argv[] ) +{ + KAboutData about( "kwin_update_tabbox_settings", "kwin", KLocalizedString(), 0 ); + KCmdLineArgs::init( argc, argv, &about ); + KComponentData inst( &about ); + Q_UNUSED( KGlobal::locale() ); // jump-start locales to get to translated descriptions + KConfig config( "kwinrc" ); + KConfigGroup windows(&config, "Windows"); + KConfigGroup tabbox(&config, "TabBox"); + const bool traverse = tabbox.readEntry("TraverseAll", false); + const QString style = windows.readEntry("AltTabStyle", "KDE"); + if( !tabbox.hasKey("ListMode") ) + tabbox.writeEntry("ListMode", traverse?1:0); + if( !tabbox.hasKey("ShowTabBox") ) + tabbox.writeEntry("ShowTabBox", (style.compare("KDE", Qt::CaseInsensitive) == 0)?true:false); + tabbox.sync(); + config.sync(); + // Send signal to all kwin instances + QDBusMessage message = + QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); + QDBusConnection::sessionBus().send(message); + +}