summaryrefslogtreecommitdiffstats
path: root/kgtk-wrapper
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-09 20:27:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-09 20:27:19 +0000
commitc6ca83d07d95e076b09bd802f66ba72d363b0235 (patch)
treef13000febb0c9c5a5da621b4bba53ba3eace022e /kgtk-wrapper
downloadkgtk-qt3-c6ca83d07d95e076b09bd802f66ba72d363b0235.tar.gz
kgtk-qt3-c6ca83d07d95e076b09bd802f66ba72d363b0235.zip
* Added kgtk-qt3
* Slight kpowersave message cleanup git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kgtk-qt3@1173604 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kgtk-wrapper')
-rwxr-xr-xkgtk-wrapper103
1 files changed, 103 insertions, 0 deletions
diff --git a/kgtk-wrapper b/kgtk-wrapper
new file mode 100755
index 0000000..a46c646
--- /dev/null
+++ b/kgtk-wrapper
@@ -0,0 +1,103 @@
+#!/bin/bash
+
+#
+# This script is part of the KGtk package.
+#
+# (C) Craig Drummond, 2007
+#
+# Craig.Drummond@lycos.co.uk
+#
+# --
+# Released under the GPL v2 or later
+# --
+#
+# This script attempts to determine which KGtk library (if any) should
+# be used when launching the app
+#
+
+if [ "`locale | grep 'LANG=' | grep -i 'utf-8' | wc -l`" = "0" ] ; then
+ export G_BROKEN_FILENAMES=1
+fi
+
+app=`basename $0`
+useApp=1
+
+if [ "$app" = "kgtk-wrapper" ] ; then
+ app=`basename $1`
+ useApp=0
+fi
+
+dir=$(cd "$(dirname "$0")"; pwd)
+if [ $useApp -eq 1 ] ; then
+ oldPath=$PATH
+ PATH=`echo $PATH | sed s:$dir::g | sed "s|::*|:|g"`
+fi
+
+realApp=`which $app`
+
+if [ -z $realApp ] ; then
+ realApp=`which ./$app`
+fi
+
+if [ $useApp -eq 1 ] ; then
+ PATH=$oldPath
+fi
+
+toolkit=`kreadconfig --file kgtkrc --group 'Apps' --key "$app"`
+
+if [ "$toolkit" = "" ] ; then
+ case $app in
+ eclipse | gimp | inkscape | firefox | kino | iceweasel | swiftfox | azureus | mozilla* )
+ toolkit="gtk2" ;;
+ scribus | scribus-ng | opera | designer-qt3 )
+ toolkit="qt3" ;;
+ designer-qt4 )
+ toolkit="qt4" ;;
+ abiword) # Non-working
+ toolkit="x" ;;
+ esac
+fi
+
+if [ "$toolkit" = "" ] && [ ! -z "$realApp" ] ; then
+ libs=`ldd $realApp 2>/dev/null`
+
+ if [ ! -z "$libs" ] ; then
+
+ if [ "0" != "`echo $libs | grep libgtk-x11-2 | wc -l`" ] ; then
+ toolkit="gtk2"
+ elif [ "0" != "`echo $libs | grep libqt-mt | wc -l`" ] ; then
+ toolkit="qt3"
+ elif [ "0" != "`echo $libs | grep libQtGui | wc -l`" ] ; then
+ toolkit="qt4"
+ fi
+
+ if [ "$toolkit" = "qt3" ] || [ "$toolkit" = "qt4" ] ; then
+ if [ "0" != "`echo $libs | grep libkio | wc -l`" ] ; then
+ toolkit=""
+ fi
+ fi
+
+ if [ -z "`which k$toolkit-wrapper`" ] ; then
+ toolkit=""
+ fi
+ fi
+fi
+
+if [ "$toolkit" = "x" ] ; then
+ toolkit=""
+fi
+
+if [ $useApp -eq 1 ] ; then
+ if [ "$toolkit" = "" ] ; then
+ $realApp "$@"
+ else
+ k$toolkit-wrapper $realApp "$@"
+ fi
+else
+ if [ "$toolkit" = "" ] ; then
+ "$@"
+ else
+ k$toolkit-wrapper "$@"
+ fi
+fi
+