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
icc-effect-5.14.5
Martin Gräßlin 2011-11-12 21:45:14 +01:00
parent a3e268e737
commit 219d0cc6a9
6 changed files with 77 additions and 13 deletions

View File

@ -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} )

View File

@ -0,0 +1,2 @@
Id=Kwin-4.8
Script=kwin_update_tabbox_qml_settings

View File

@ -0,0 +1,64 @@
/********************************************************************
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 boxswitch = config.group("Effect-BoxSwitch");
const bool boxSwitchPrimary = boxswitch.readEntry<bool>("TabBox", true);
const bool boxSwitchAlternative = 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);
}

View File

@ -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);
}

View File

@ -555,10 +555,6 @@ void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig)
config.readEntry<int>("ListMode", TabBoxConfig::defaultListMode())));
tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode(
config.readEntry<int>("SwitchingMode", TabBoxConfig::defaultSwitchingMode())));
tabBoxConfig.setLayout(TabBoxConfig::LayoutMode(
config.readEntry<int>("LayoutMode", TabBoxConfig::defaultLayoutMode())));
tabBoxConfig.setSelectedItemViewPosition(TabBoxConfig::SelectedItemViewPosition(
config.readEntry<int>("SelectedItem", TabBoxConfig::defaultSelectedItemViewPosition())));
tabBoxConfig.setShowOutline(config.readEntry<bool>("ShowOutline",
TabBoxConfig::defaultShowOutline()));
@ -569,13 +565,7 @@ void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig)
tabBoxConfig.setShowDesktop(config.readEntry<bool>("ShowDesktop",
TabBoxConfig::defaultShowDesktop()));
tabBoxConfig.setMinWidth(config.readEntry<int>("MinWidth",
TabBoxConfig::defaultMinWidth()));
tabBoxConfig.setMinHeight(config.readEntry<int>("MinHeight",
TabBoxConfig::defaultMinHeight()));
tabBoxConfig.setLayoutName(config.readEntry<QString>("LayoutName", TabBoxConfig::defaultLayoutName()));
tabBoxConfig.setSelectedItemLayoutName(config.readEntry<QString>("SelectedLayoutName", TabBoxConfig::defaultSelectedItemLayoutName()));
}
/*!

View File

@ -306,7 +306,7 @@ public:
return 20;
}
static QString defaultLayoutName() {
return QString("Default");
return QString("thumbnails");
}
static QString defaultSelectedItemLayoutName() {
return QString("Text");