summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJekyll Wu <adaptee@gmail.com>2012-03-18 18:32:16 (GMT)
committerJekyll Wu <adaptee@gmail.com>2012-03-18 18:34:01 (GMT)
commitf542899f13a7a7e9aab297a4e45877b862ceacba (patch)
tree1d39e4d14d4928a0f24959a526bbd7f608f5447c
parent33be288c037f1dad20fcbca9caa3b10087772c01 (diff)
Add kconf-update script for migrating exising tabbar and menubar settings
BUG:293231 FIXED-IN:4.9 REVIEW: 104253
-rw-r--r--data/CMakeLists.txt1
-rw-r--r--data/updaters/CMakeLists.txt2
-rwxr-xr-xdata/updaters/konsole-2.9.0-global-options.sh82
-rw-r--r--data/updaters/konsole.upd3
4 files changed, 88 insertions, 0 deletions
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 2b8dd95..9326ecf 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -2,4 +2,5 @@
add_subdirectory( color-schemes )
add_subdirectory( keyboard-layouts )
add_subdirectory( profiles )
+add_subdirectory( updaters )
diff --git a/data/updaters/CMakeLists.txt b/data/updaters/CMakeLists.txt
new file mode 100644
index 0000000..e145cb7
--- /dev/null
+++ b/data/updaters/CMakeLists.txt
@@ -0,0 +1,2 @@
+install(FILES konsole.upd DESTINATION ${DATA_INSTALL_DIR}/kconf_update)
+install(PROGRAMS konsole-2.9.0-global-options.sh DESTINATION ${DATA_INSTALL_DIR}/kconf_update)
diff --git a/data/updaters/konsole-2.9.0-global-options.sh b/data/updaters/konsole-2.9.0-global-options.sh
new file mode 100755
index 0000000..73cf261
--- /dev/null
+++ b/data/updaters/konsole-2.9.0-global-options.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+# Starting from konsole 2.9.0, menubar and tabbar setttings are global instead of per profile
+# This stupid script migrates those settings from default profile into konsolerc
+
+default_profile_name=`kreadconfig --file konsolerc --group 'Desktop Entry' --key DefaultProfile`
+
+# empty name implies that the user use is using the stock profile
+if test -z "$default_profile_name" ; then
+ exit 0
+fi
+
+default_profile_path=""
+
+OLD_IFS="$IFS"
+IFS=":"
+for path in `kde4-config --path data`; do
+ if test -f "$path/konsole/$default_profile_name"; then
+ default_profile_path="$path/konsole/$default_profile_name"
+ break
+ fi
+done
+IFS="$OLD_IFS"
+
+# empty path implies that the specified default profile does not exist
+if test -z "$default_profile_path" ; then
+ exit 0
+fi
+
+echo "[KonsoleWindow]"
+
+show_menu_bar=`kreadconfig --file "$default_profile_path" --group 'General' --key 'ShowMenuBar'`
+if test -n "$show_menu_bar"; then
+ echo "ShowMenuBarByDefault=$show_menu_bar"
+fi
+
+echo "[TabBar]"
+
+# The order of enum value has changed
+tab_bar_visibility=`kreadconfig --file "$default_profile_path" --group 'General' --key 'TabBarMode'`
+if test -n "$tab_bar_visibility"; then
+ new_value=""
+
+ if test "$tab_bar_visibility" = "0" ; then
+ new_value="2"
+ elif test "$tab_bar_visibility" = "1" ; then
+ new_value="1"
+ elif test "$tab_bar_visibility" = "2" ; then
+ new_value="0"
+ fi
+
+ if test -n "$new_value"; then
+ echo "TabBarVisibility=$new_value"
+ fi
+fi
+
+# The order of this enum value has changed
+tab_bar_position=`kreadconfig --file "$default_profile_path" --group 'General' --key 'TabBarPosition'`
+if test -n "$tab_bar_position"; then
+ new_value=""
+ if test "$tab_bar_position" = "0" ; then
+ new_value="1"
+ elif test "$tab_bar_position" = "1" ; then
+ new_value="0"
+ fi
+
+ if test -n "$new_value"; then
+ echo "TabBarPosition=$new_value"
+ fi
+fi
+
+
+show_quick_buttons=`kreadconfig --file "$default_profile_path" --group 'General' --key 'ShowNewAndCloseTabButtons'`
+if test -n "$show_quick_buttons"; then
+ echo "ShowQuickButtons=$show_quick_buttons"
+fi
+
+new_tab_behavior=`kreadconfig --file "$default_profile_path" --group 'General' --key 'NewTabBehavior'`
+if test -n "$new_tab_behavior"; then
+ echo "NewTabBehavior=$new_tab_behavior"
+fi
+
diff --git a/data/updaters/konsole.upd b/data/updaters/konsole.upd
new file mode 100644
index 0000000..8904dac
--- /dev/null
+++ b/data/updaters/konsole.upd
@@ -0,0 +1,3 @@
+Id=2.9.0-global-options
+File=konsolerc
+Script=konsole-2.9.0-global-options.sh