diff options
-rw-r--r-- | sfx2/source/dialog/mailmodel.cxx | 8 | ||||
-rw-r--r-- | shell/source/win32/simplemail/senddoc.cxx | 14 |
2 files changed, 21 insertions, 1 deletions
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 15f9eafebd8c..e1463d3c7395 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -845,7 +845,13 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css: Sequence< OUString > aAttachmentSeq(&(maAttachedDocuments[0]),maAttachedDocuments.size()); - xSimpleMailMessage->setSubject( maSubject ); + if ( xSimpleMailMessage->getSubject().getLength() == 0 ) { + OUString baseName( maAttachedDocuments[0].copy( maAttachedDocuments[0].lastIndexOf( '/' ) + 1 ) ); + OUString subject( baseName ); + if ( maAttachedDocuments.size() > 1 ) + subject += OUString::createFromAscii( ", ..." ); + xSimpleMailMessage->setSubject( subject ); + } xSimpleMailMessage->setAttachement( aAttachmentSeq ); sal_Bool bSend( sal_False ); diff --git a/shell/source/win32/simplemail/senddoc.cxx b/shell/source/win32/simplemail/senddoc.cxx index e1a08d84f694..28c378cb8a5f 100644 --- a/shell/source/win32/simplemail/senddoc.cxx +++ b/shell/source/win32/simplemail/senddoc.cxx @@ -30,6 +30,10 @@ #include "precompiled_shell.hxx" #include <osl/diagnose.h> #include <sal/macros.h> +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> +#include <rtl/uri.hxx> +#include <osl/thread.hxx> #include "simplemapi.hxx" @@ -166,7 +170,17 @@ void initMapiMessage( { ZeroMemory(pMapiMessage, sizeof(MapiMessage)); + try { + rtl_uString *subject = NULL; + rtl_uString_newFromAscii(&subject, const_cast<char*>(gSubject.c_str())); + rtl_uString *decoded_subject = NULL; + rtl_uriDecode(subject, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8, &decoded_subject); + rtl::OUString ou_subject(decoded_subject); + pMapiMessage->lpszSubject = strdup(OUStringToOString(ou_subject, osl_getThreadTextEncoding(), RTL_UNICODETOTEXT_FLAGS_UNDEFINED_QUESTIONMARK).getStr()); + } + catch (...) { pMapiMessage->lpszSubject = const_cast<char*>(gSubject.c_str()); + } pMapiMessage->lpszNoteText = (gBody.length() ? const_cast<char*>(gBody.c_str()) : NULL); pMapiMessage->lpOriginator = aMapiOriginator; pMapiMessage->lpRecips = &aMapiRecipientList[0]; |