sw/source/ui/dbui/mailmergehelper.cxx | 19 ++++++++----------- sw/source/ui/dbui/mmoutputpage.cxx | 25 ++++++++++++------------- sw/source/ui/envelp/mailmrge.cxx | 11 +++++------ sw/source/ui/inc/mailmergehelper.hxx | 3 ++- 4 files changed, 27 insertions(+), 31 deletions(-)
New commits: commit 1e3e64aae4014821e9cee4d4b856a5c29550d421 Author: Matteo Casalin <matteo.casa...@yahoo.com> Date: Tue Sep 24 12:45:50 2013 +0200 String to OUString Change-Id: I9e99c88be67a3cfa97b5d964075c77c3208136f6 Reviewed-on: https://gerrit.libreoffice.org/6031 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/dbui/mailmergehelper.cxx b/sw/source/ui/dbui/mailmergehelper.cxx index f6f9a89..7445bf9 100644 --- a/sw/source/ui/dbui/mailmergehelper.cxx +++ b/sw/source/ui/dbui/mailmergehelper.cxx @@ -51,23 +51,20 @@ using namespace ::com::sun::star::sdbcx; namespace SwMailMergeHelper { -String CallSaveAsDialog(String& rFilter) +OUString CallSaveAsDialog(OUString& rFilter) { - ErrCode nRet; - String sFactory(OUString::createFromAscii(SwDocShell::Factory().GetShortName())); ::sfx2::FileDialogHelper aDialog( ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, 0, - sFactory ); + OUString::createFromAscii(SwDocShell::Factory().GetShortName()) ); - String sRet; - nRet = aDialog.Execute(); - if(ERRCODE_NONE == nRet) + if (aDialog.Execute()!=ERRCODE_NONE) { - uno::Reference < ui::dialogs::XFilePicker > xFP = aDialog.GetFilePicker(); - sRet = xFP->getFiles().getConstArray()[0]; - rFilter = aDialog.GetRealFilter(); + return OUString(); } - return sRet; + + rFilter = aDialog.GetRealFilter(); + uno::Reference < ui::dialogs::XFilePicker > xFP = aDialog.GetFilePicker(); + return xFP->getFiles().getConstArray()[0]; } /* diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 668969f..da72f2d 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -600,14 +600,14 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) if(m_aSaveAsOneRB.IsChecked()) { - String sFilter; - String sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter); - if(!sPath.Len()) + OUString sFilter; + const OUString sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter); + if (sPath.isEmpty()) return 0; uno::Sequence< beans::PropertyValue > aValues(1); beans::PropertyValue* pValues = aValues.getArray(); pValues[0].Name = "FilterName"; - pValues[0].Value <<= OUString(sFilter); + pValues[0].Value <<= sFilter; uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); sal_uInt32 nErrorCode = ERRCODE_NONE; @@ -645,9 +645,9 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) if(nEnd > rConfigItem.GetMergedDocumentCount()) nEnd = rConfigItem.GetMergedDocumentCount(); } - String sFilter; - String sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter); - if(!sPath.Len()) + OUString sFilter; + OUString sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter); + if (sPath.isEmpty()) return 0; String sTargetTempURL = URIHelper::SmartRel2Abs( INetURLObject(), utl::TempFile::CreateTempName(), @@ -694,12 +694,11 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) { SwDocMergeInfo& rInfo = rConfigItem.GetDocumentMergeInfo(nDoc); INetURLObject aURL(sPath); - String sExtension = aURL.getExtension(); - if(!sExtension.Len()) + OUString sExtension = aURL.getExtension(); + if (sExtension.isEmpty()) { sExtension = comphelper::string::getToken(pSfxFlt->GetWildcard().getGlob(), 1, '.'); - sPath += '.'; - sPath += sExtension; + sPath += "." + sExtension; } String sStat(SW_RES(STR_STATSTR_LETTER)); sStat += ' '; @@ -729,7 +728,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) String sOutPath = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI); String sCounter = OUString('_'); sCounter += OUString::number(nDoc); - sOutPath.Insert(sCounter, sOutPath.Len() - sExtension.Len() - 1); + sOutPath.Insert(sCounter, sOutPath.Len() - sExtension.getLength() - 1); while(true) { @@ -739,7 +738,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) bool bFailed = false; try { - pValues[0].Value <<= OUString(sFilter); + pValues[0].Value <<= sFilter; uno::Reference< frame::XStorable > xTempStore( xTempDocShell->GetModel(), uno::UNO_QUERY); xTempStore->storeToURL( sOutPath, aValues ); } diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index fdac2f9..90a8742 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -669,14 +669,13 @@ bool SwMailMergeDlg::ExecQryShell() INetURLObject aAbs; if( pMedium ) aAbs = pMedium->GetURLObject(); - String sPath( + OUString sPath( URIHelper::SmartRel2Abs( aAbs, aPathED.GetText(), URIHelper::GetMaybeFileHdl())); pModOpt->SetMailingPath(sPath); - String sDelim = OUString(INET_PATH_TOKEN); - if (sPath.Len() >= sDelim.Len() && - sPath.Copy(sPath.Len()-sDelim.Len()).CompareTo(sDelim) != COMPARE_EQUAL) + const OUString sDelim = OUString(INET_PATH_TOKEN); + if (!sPath.endsWith(sDelim)) sPath += sDelim; pModOpt->SetIsNameFromColumn(aGenerateFromDataBaseCB.IsChecked()); @@ -693,9 +692,9 @@ bool SwMailMergeDlg::ExecQryShell() //#i97667# reset column name - otherwise it's remembered from the last run pMgr->SetEMailColumn(OUString()); //start save as dialog - String sFilter; + OUString sFilter; sPath = SwMailMergeHelper::CallSaveAsDialog(sFilter); - if(!sPath.Len()) + if (sPath.isEmpty()) return false; m_sSaveFilter = sFilter; } diff --git a/sw/source/ui/inc/mailmergehelper.hxx b/sw/source/ui/inc/mailmergehelper.hxx index 7c6bb04..eb33224 100644 --- a/sw/source/ui/inc/mailmergehelper.hxx +++ b/sw/source/ui/inc/mailmergehelper.hxx @@ -32,6 +32,7 @@ #include <cppuhelper/compbase1.hxx> #include <cppuhelper/compbase2.hxx> #include <vcl/scrbar.hxx> +#include "rtl/ustring.hxx" #include "swdllapi.h" class SwMailMergeConfigItem; @@ -43,7 +44,7 @@ namespace com { namespace sun { namespace star { namespace mail { namespace SwMailMergeHelper { - SW_DLLPUBLIC String CallSaveAsDialog(String& rFilter); + SW_DLLPUBLIC OUString CallSaveAsDialog(OUString& rFilter); SW_DLLPUBLIC bool CheckMailAddress( const OUString& rMailAddress ); SW_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::mail::XSmtpService > ConnectToSmtpServer( SwMailMergeConfigItem& rConfigItem,
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits