#!/bin/sh

# Get some Configuration info on KDE

echo "[VersionInfo]"
#kdeconf() { kde3-config "$@" ;}   # KDE3
kdeconf() { kde4-config "$@" ;}   # KDE4

kdeconf --version

# http://techbase.kde.org/KDE_System_Administration/Environment_Variables
echo ""
echo "[Environment]"
while read var default; do
    printf "%24s = %s\n"  "${var}" "$(eval echo \${$var-${default}\(\*\)})"
done<<"EOF"
KDE_FULL_SESSION 
KDE_SESSION_UID 
KDE_SESSION_VERSION 
KDEWM                       kwin
KDE_DISPLAY 
KDE_MULTIHEAD 
KDEDIRS
KDEHOME                     ${HOME}/.kde
KDE_HOME_READONLY 
KDEROOTHOME                 ~root/.kde
KDESYCOCA
KDETMP                      /tmp
KDEVARTMP                   /var/tmp
KDE_LANG
KDE_UTF8_FILENAMES
KDE_NO_IPV6
KDE_USE_IDN                 at:ch:cn:de:dk:kr:jp:li:no:se:tw
KDE_IS_PRELINKED
KDE_MALLOC
KDE_NOUNLOAD
KDE_DOUNLOAD
KDE_DEBUG
KDE_DEBUG_NOPROCESSINFO
KDE_DEBUG_NOAREANAME
KDE_DEBUG_NOMETHODNAME
KDE_DEBUG_FILELINE
KDE_DEBUG_TIMESTAMP
KDE_COLOR_DEBUG
KDE_FORK_SLAVES
EOF
echo "(*) indicates variable unset and a default value substituted"

echo ""
echo "[Configuration]"
while read option; do
    printf "%18s = %s\n" "${option}" "$(kde4-config --${option})"
done<<"EOF"
prefix
exec-prefix
libsuffix
localprefix
qt-prefix
qt-binaries
qt-libraries
qt-plugins
EOF
#  --kde-version             Compiled in version string for KDE libraries
#  --locate filename         Find filename inside the resource type given to --path

echo ""
echo "[UserPaths]"
#KDE3#for upath in desktop trash autostart document; do
for upath in desktop autostart document; do
  printf "%18s = %s\n" "${upath}" "$(kdeconf --userpath ${upath})"
done

echo ""
echo "[Paths]"
while read ktype ksep kdescription; do
#  printf "PATH(${ktype}) [${kdescription}]\n  $(kdeconf --path ${ktype})\n"
  printf "%18s = %s [%s]\n" "${ktype}" "$(kdeconf --path ${ktype})" "$(kdeconf --install ${ktype})"
done <<EOF
$(kdeconf --types)
EOF
echo "values in []'s are application install paths"

exit 0
