summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2003-06-27 08:41:10 +0000
committerVladimir Glazounov <vg@openoffice.org>2003-06-27 08:41:10 +0000
commit6b669458121fbbc704da131f25bf0dc8b78104e6 (patch)
tree80f0df55deb8c8f683decef4da01c40c8cefcaca /shell
parentb268c93dca046e2a1068bf9a15cf33f87265d3f1 (diff)
INTEGRATION: CWS mariner10 (1.1.76); FILE MERGED
2003/06/25 11:24:15 tra 1.1.76.1: #110368#reencode file urls to the current system encoding so that they are understandable for Mozilla and Co.
Diffstat (limited to 'shell')
-rwxr-xr-xshell/source/cmdmail/cmdmailmsg.cxx62
1 files changed, 60 insertions, 2 deletions
diff --git a/shell/source/cmdmail/cmdmailmsg.cxx b/shell/source/cmdmail/cmdmailmsg.cxx
index 83f11553c384..fd7bbbe18c39 100755
--- a/shell/source/cmdmail/cmdmailmsg.cxx
+++ b/shell/source/cmdmail/cmdmailmsg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cmdmailmsg.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: obr $ $Date: 2001-06-26 08:48:36 $
+ * last change: $Author: vg $ $Date: 2003-06-27 09:41:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,58 @@
#include "cmdmailmsg.hxx"
#endif
+//#############################################################
+// <HACK> #110368#
+// Mozilla and Co. expect file urls but not UTF8 encoded as we
+// do but in the current system encoding, so we have to recode
+// our file urls to this encoding
+#ifndef _RTL_URI_H_
+#include <rtl/uri.hxx>
+#endif
+
+#ifndef _OSL_THREAD_H_
+#include <osl/thread.h>
+#endif
+
+/* a slightly modified version of Pchar in rtl/source/uri.c */
+const sal_Bool uriCharClass[128] =
+{
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Pchar but without encoding slashes */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* !"#$%&'()*+,-./ */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, /* 0123456789:;<=>? */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* @ABCDEFGHIJKLMNO */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* PQRSTUVWXYZ[\]^_ */
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* `abcdefghijklmno */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 /* pqrstuvwxyz{|}~ */
+};
+
+//-------------------------------------
+rtl::OUString reencode_file_url(
+ const rtl::OUString& file_url,
+ rtl_TextEncoding from_textenc,
+ rtl_TextEncoding to_textenc)
+{
+ rtl::OUString tmp = rtl::Uri::decode(
+ file_url, rtl_UriDecodeWithCharset, from_textenc);
+
+ return rtl::Uri::encode(
+ tmp, uriCharClass, rtl_UriEncodeIgnoreEscapes, to_textenc);
+}
+
+//-------------------------------------
+void reencode_file_url_list(/*inout*/ com::sun::star::uno::Sequence<rtl::OUString>& file_url_list)
+{
+ sal_uInt32 nmax = file_url_list.getLength();
+ for (sal_uInt32 i = 0; i < nmax; i++)
+ file_url_list[i] = reencode_file_url(
+ file_url_list[i], RTL_TEXTENCODING_UTF8, osl_getThreadTextEncoding());
+}
+//
+// </HACK> #110368#
+//#############################################################
+
+
//------------------------------------------------------------------------
// namespace directives
//------------------------------------------------------------------------
@@ -205,6 +257,12 @@ void SAL_CALL CmdMailMsg::setAttachement( const Sequence< ::rtl::OUString >& aAt
{
MutexGuard aGuard( m_aMutex );
m_Attachments = aAttachment;
+
+ //#######################################
+ //#110368#
+ reencode_file_url_list(m_Attachments);
+ //#110368#
+ //#######################################
}
//------------------------------------------------