| OLD | NEW | 
|    1 #!/bin/sh |    1 #!/bin/sh | 
|    2 #--------------------------------------------- |    2 #--------------------------------------------- | 
|    3 #   xdg-email |    3 #   xdg-email | 
|    4 # |    4 # | 
|    5 #   Utility script to open the users favorite email program, using the |    5 #   Utility script to open the users favorite email program, using the | 
|    6 #       RFC 2368 mailto: URI spec |    6 #       RFC 2368 mailto: URI spec | 
|    7 # |    7 # | 
|    8 #   Refer to the usage() function below for usage. |    8 #   Refer to the usage() function below for usage. | 
|    9 # |    9 # | 
|   10 #   Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> |   10 #   Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> | 
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  325             echo "Use 'man xdg-email' or 'xdg-email --manual' for additional inf
     o." |  325             echo "Use 'man xdg-email' or 'xdg-email --manual' for additional inf
     o." | 
|  326             exit_success |  326             exit_success | 
|  327             ;; |  327             ;; | 
|  328  |  328  | 
|  329             --manual) |  329             --manual) | 
|  330             manualpage |  330             manualpage | 
|  331             exit_success |  331             exit_success | 
|  332             ;; |  332             ;; | 
|  333  |  333  | 
|  334             --version) |  334             --version) | 
|  335             echo "xdg-email 1.0.2" |  335             echo "xdg-email 1.1.0 rc1" | 
|  336             exit_success |  336             exit_success | 
|  337             ;; |  337             ;; | 
|  338         esac |  338         esac | 
|  339     done |  339     done | 
|  340 } |  340 } | 
|  341  |  341  | 
|  342 check_common_commands "$@" |  342 check_common_commands "$@" | 
|  343  |  343  | 
|  344 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; |  344 [ -z "${XDG_UTILS_DEBUG_LEVEL}" ] && unset XDG_UTILS_DEBUG_LEVEL; | 
|  345 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then |  345 if [ ${XDG_UTILS_DEBUG_LEVEL-0} -lt 1 ]; then | 
|  346     # Be silent |  346     # Be silent | 
|  347     xdg_redirect_output=" > /dev/null 2> /dev/null" |  347     xdg_redirect_output=" > /dev/null 2> /dev/null" | 
|  348 else |  348 else | 
|  349     # All output to stderr |  349     # All output to stderr | 
|  350     xdg_redirect_output=" >&2" |  350     xdg_redirect_output=" >&2" | 
|  351 fi |  351 fi | 
|  352  |  352  | 
|  353 #-------------------------------------- |  353 #-------------------------------------- | 
|  354 # Checks for known desktop environments |  354 # Checks for known desktop environments | 
|  355 # set variable DE to the desktop environments name, lowercase |  355 # set variable DE to the desktop environments name, lowercase | 
|  356  |  356  | 
|  357 detectDE() |  357 detectDE() | 
|  358 { |  358 { | 
|  359     if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; |  359     if [ x"$KDE_FULL_SESSION" = x"true" ]; then DE=kde; | 
|  360     elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; |  360     elif [ x"$GNOME_DESKTOP_SESSION_ID" != x"" ]; then DE=gnome; | 
|  361     elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D
     Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul
     l 2>&1` ; then DE=gnome; |  361     elif `dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/D
     Bus org.freedesktop.DBus.GetNameOwner string:org.gnome.SessionManager > /dev/nul
     l 2>&1` ; then DE=gnome; | 
|  362     elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
     l 2>&1; then DE=xfce; |  362     elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/nul
     l 2>&1; then DE=xfce; | 
 |  363     elif [ x"$DESKTOP_SESSION" == x"LXDE" ]; then DE=lxde; | 
 |  364     else DE="" | 
|  363     fi |  365     fi | 
|  364 } |  366 } | 
|  365  |  367  | 
|  366 #---------------------------------------------------------------------------- |  368 #---------------------------------------------------------------------------- | 
|  367 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 |  369 # kfmclient exec/openURL can give bogus exit value in KDE <= 3.5.4 | 
|  368 # It also always returns 1 in KDE 3.4 and earlier |  370 # It also always returns 1 in KDE 3.4 and earlier | 
|  369 # Simply return 0 in such case |  371 # Simply return 0 in such case | 
|  370  |  372  | 
|  371 kfmclient_fix_exit_code() |  373 kfmclient_fix_exit_code() | 
|  372 { |  374 { | 
|  373     version=`kde${KDE_SESSION_VERSION}-config --version 2>/dev/null | grep KDE` |  375     [ x"$KDE_SESSION_VERSION" = x"4" ] && return 0; | 
|  374     major=`echo $version | sed 's/KDE: \([0-9]\).*/\1/'` |  376     version=`LC_ALL=C.UTF-8 kde-config --version 2>/dev/null | grep '^KDE'` | 
|  375     minor=`echo $version | sed 's/KDE: [0-9]*\.\([0-9]\).*/\1/'` |  377     major=`echo $version | sed 's/KDE.*: \([0-9]\).*/\1/'` | 
|  376     release=`echo $version | sed 's/KDE: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` |  378     minor=`echo $version | sed 's/KDE.*: [0-9]*\.\([0-9]\).*/\1/'` | 
 |  379     release=`echo $version | sed 's/KDE.*: [0-9]*\.[0-9]*\.\([0-9]\).*/\1/'` | 
|  377     test "$major" -gt 3 && return $1 |  380     test "$major" -gt 3 && return $1 | 
|  378     test "$minor" -gt 5 && return $1 |  381     test "$minor" -gt 5 && return $1 | 
|  379     test "$release" -gt 4 && return $1 |  382     test "$release" -gt 4 && return $1 | 
|  380     return 0 |  383     return 0 | 
|  381 } |  384 } | 
|  382  |  385  | 
|  383 run_thunderbird() |  386 run_thunderbird() | 
|  384 { |  387 { | 
|  385     local THUNDERBIRD MAILTO NEWMAILTO TO CC BCC SUBJECT BODY ATTACH |  388     local THUNDERBIRD MAILTO NEWMAILTO TO CC BCC SUBJECT BODY ATTACH | 
|  386     THUNDERBIRD="$1" |  389     THUNDERBIRD="$1" | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  427     "$THUNDERBIRD" -compose "$NEWMAILTO" |  430     "$THUNDERBIRD" -compose "$NEWMAILTO" | 
|  428     if [ $? -eq 0 ]; then |  431     if [ $? -eq 0 ]; then | 
|  429         exit_success |  432         exit_success | 
|  430     else |  433     else | 
|  431         exit_failure_operation_failed |  434         exit_failure_operation_failed | 
|  432     fi |  435     fi | 
|  433 } |  436 } | 
|  434  |  437  | 
|  435 open_kde() |  438 open_kde() | 
|  436 { |  439 { | 
|  437     local client |  440     local client kde_email_profile_name | 
|  438     client=`kreadconfig --file emaildefaults --group PROFILE_Default --key Email
     Client | cut -d ' ' -f 1` |  441     kde_email_profile_name=`kreadconfig --file emaildefaults --group Defaults --
     key Profile` | 
 |  442     client=`kreadconfig --file emaildefaults --group PROFILE_"$kde_email_profile
     _name" --key EmailClient | cut -d ' ' -f 1` | 
|  439     echo $client | grep thunderbird > /dev/null 2>&1 |  443     echo $client | grep thunderbird > /dev/null 2>&1 | 
|  440     if [ $? -eq 0 ] ; then |  444     if [ $? -eq 0 ] ; then | 
|  441         run_thunderbird "$client" "$1" |  445         run_thunderbird "$client" "$1" | 
|  442     fi |  446     fi | 
|  443  |  447  | 
|  444     if [ -f /etc/SuSE-release ] ; then |  448     if [ -f /etc/SuSE-release ] ; then | 
|  445         # Workaround for SUSE 10.0 |  449         # Workaround for SUSE 10.0 | 
|  446         [ -z "$client" ] && client="kmail" |  450         [ -z "$client" ] && client="kmail" | 
|  447         if ! which "$client" > /dev/null 2> /dev/null; then |  451         if ! which "$client" > /dev/null 2> /dev/null; then | 
|  448             DEBUG 3 "KDE has $client configured as email client which isn't inst
     alled" |  452             DEBUG 3 "KDE has $client configured as email client which isn't inst
     alled" | 
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  706     ;; |  710     ;; | 
|  707  |  711  | 
|  708     gnome) |  712     gnome) | 
|  709     open_gnome "${mailto}" |  713     open_gnome "${mailto}" | 
|  710     ;; |  714     ;; | 
|  711  |  715  | 
|  712     xfce) |  716     xfce) | 
|  713     open_xfce "${mailto}" |  717     open_xfce "${mailto}" | 
|  714     ;; |  718     ;; | 
|  715  |  719  | 
|  716     generic) |  720     generic|lxde) | 
|  717     open_generic "${mailto}" |  721     open_generic "${mailto}" | 
|  718     ;; |  722     ;; | 
|  719  |  723  | 
|  720     *) |  724     *) | 
|  721     exit_failure_operation_impossible "no method available for opening '${mailto
     }'" |  725     exit_failure_operation_impossible "no method available for opening '${mailto
     }'" | 
|  722     ;; |  726     ;; | 
|  723 esac |  727 esac | 
| OLD | NEW |