Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


senddoc.sh has separate cases for unknown mailer and for no mailer
configured. Both of these cases attempt to find a desktop "mailto"
handler, using different methods. This patch merges these two cases
and the strategies for finding the handler.

Note that there is ambiguity as to the proper mailto keyword for
attachments. I've used 'attachment', per direction in the referenced
xdg list email.

This builds on https://bugs.freedesktop.org/show_bug.cgi?id=32621



From 72e9d8b49f5896d3afc308236691a882fc87f44f Mon Sep 17 00:00:00 2001
From: David Steele <dsteele@gmail.com>
Date: Tue, 16 Oct 2012 19:11:37 -0400
Subject: [PATCH] Combine senddoc null and default cases for better mailer
 selection.

---
 shell/source/unix/misc/senddoc.sh |   60 +++++--------------------------------
 1 file changed, 8 insertions(+), 52 deletions(-)

diff --git a/shell/source/unix/misc/senddoc.sh
b/shell/source/unix/misc/senddoc.sh
index 5a755d7..0ff1594 100644
--- a/shell/source/unix/misc/senddoc.sh
+++ b/shell/source/unix/misc/senddoc.sh
@@ -369,62 +369,18 @@ case `basename "$MAILER" | sed 's/-.*$//'` in
         /usr/bin/open -a "${MAILER}" ${ATTACH}
         ;;

-    "")
-
-        # DESKTOP_LAUNCH, see
http://freedesktop.org/pipermail/xdg/2004-August/004489.html
-        if [ -n "$DESKTOP_LAUNCH" ]; then
-            while [ "$1" != "" ]; do
-                case $1 in
-                    --to)
-                        if [ "${TO}" != "" ]; then
-                            MAILTO="${MAILTO:-}${MAILTO:+&}to=$2"
-                        else
-                            TO="$2"
-                        fi
-                        shift
-                        ;;
-                    --cc)
-                        MAILTO="${MAILTO:-}${MAILTO:+&}cc="`echo "$2"
| ${URI_ENCODE}`
-                        shift
-                        ;;
-                    --bcc)
-                        MAILTO="${MAILTO:-}${MAILTO:+&}bcc="`echo
"$2" | ${URI_ENCODE}`
-                        shift
-                        ;;
-                    --subject)
-                        MAILTO="${MAILTO:-}${MAILTO:+&}subject="`echo
"$2" | ${URI_ENCODE}`
-                        shift
-                        ;;
-                    --body)
-                        MAILTO="${MAILTO:-}${MAILTO:+&}body="`echo
"$2" | ${URI_ENCODE}`
-                        shift
-                        ;;
-                    --attach)
-
MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "$2" | ${URI_ENCODE}`
-                        shift
-                        ;;
-                    *)
-                        ;;
-                esac
-                shift;
-            done
-
-            MAILTO="mailto:${TO}?${MAILTO}";
-            ${DESKTOP_LAUNCH} "${MAILTO}" &
-        else
-            echo "Could not determine a mail client to use."
-            exit 2
-        fi
-        ;;
-
     *)
-        # LO is configured to use something we do not recognize.
+
+        # LO is configured to use something we do not recognize, or
is not configured.
         # Try to be smart, and send the mail anyway, if we have the
         # possibility to do so.

-        if [ -n "$KDE_FULL_SESSION" -a -x /usr/bin/kde-open ] ; then
+        if [ -n "$DESKTOP_LAUNCH" ]; then
+            # http://lists.freedesktop.org/pipermail/xdg/2004-August/002873.html
+            MAILER=${DESKTOP_LAUNCH}
+        elif [ -n "$KDE_FULL_SESSION" -a -x /usr/bin/kde-open ] ; then
             MAILER=/usr/bin/kde-open
-        elif [ -x /usr/bin/gnome-open ] ; then
+        elif [ -n "$GNOME_DESKTOP_SESSION_ID" -a -x
/usr/bin/gnome-open ] ; then
             MAILER=/usr/bin/gnome-open
         elif [ -x /usr/bin/xdg-open ] ; then
             MAILER=/usr/bin/xdg-open
@@ -460,7 +416,7 @@ case `basename "$MAILER" | sed 's/-.*$//'` in
                     shift
                     ;;
                 --attach)
-                    MAILTO="${MAILTO:-}${MAILTO:+&}attach="`echo
"file://$2" | ${URI_ENCODE}`
+                    MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo
"file://$2" | ${URI_ENCODE}`
                     shift
                     ;;
                 *)
-- 
1.7.10.4

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.