diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-01-25 17:48:15 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-03-24 22:40:50 +0100 |
commit | 2b11dee4847dc21a0ce54224815468307a5d0eb2 (patch) | |
tree | 472d08fad9de47e70fedb0703b88cdc66eea2189 /sw/source | |
parent | aeb01b75e56916bf36707ad703a16c90ad7f2419 (diff) |
MM: correctly handle directory in dialog
For convenience we present file URLs in the systems local file
notation. But the directory selection dialog expects an URL, so
we have to convert the local notation from the edit entry to a
file URL.
Change-Id: Idff6f7d4b135eef087c61560b0603b9a6669dbf7
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/ui/envelp/mailmrge.cxx | 34 | ||||
-rw-r--r-- | sw/source/uibase/inc/mailmrge.hxx | 1 |
2 files changed, 19 insertions, 16 deletions
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index 184053aac2d7..f1623bc091b2 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -491,24 +491,32 @@ bool SwMailMergeDlg::AskUserFilename() const return (m_pSaveSingleDocRB->IsChecked() || !m_pGenerateFromDataBaseCB->IsChecked()); } +OUString SwMailMergeDlg::GetURLfromPath() const +{ + SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); + INetURLObject aAbs; + if( pMedium ) + aAbs = pMedium->GetURLObject(); + if( INetProtocol::NotValid == aAbs.GetProtocol() ) + { + SvtPathOptions aPathOpt; + aAbs.SetURL( aPathOpt.GetWorkPath() ); + } + return URIHelper::SmartRel2Abs( + aAbs, m_pPathED->GetText(), URIHelper::GetMaybeFileHdl()); +} + bool SwMailMergeDlg::ExecQryShell() { if(pImpl->xSelSupp.is()) { - pImpl->xSelSupp->removeSelectionChangeListener( pImpl->xChgLstnr ); + pImpl->xSelSupp->removeSelectionChangeListener( pImpl->xChgLstnr ); } if (m_pPrinterRB->IsChecked()) nMergeType = DBMGR_MERGE_PRINTER; else { nMergeType = DBMGR_MERGE_FILE; - SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); - INetURLObject aAbs; - if( pMedium ) - aAbs = pMedium->GetURLObject(); - pModOpt->SetMailingPath( - URIHelper::SmartRel2Abs( - aAbs, m_pPathED->GetText(), URIHelper::GetMaybeFileHdl())); - + pModOpt->SetMailingPath( GetURLfromPath() ); pModOpt->SetIsNameFromColumn(m_pGenerateFromDataBaseCB->IsChecked()); if (!AskUserFilename()) { @@ -593,15 +601,9 @@ OUString SwMailMergeDlg::GetTargetURL() const IMPL_LINK_NOARG_TYPED(SwMailMergeDlg, InsertPathHdl, Button*, void) { - OUString sPath( m_pPathED->GetText() ); - if( sPath.isEmpty() ) { - SvtPathOptions aPathOpt; - sPath = aPathOpt.GetWorkPath(); - } - uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); uno::Reference < XFolderPicker2 > xFP = FolderPicker::create(xContext); - xFP->setDisplayDirectory(sPath); + xFP->setDisplayDirectory( GetURLfromPath() ); if( xFP->execute() == RET_OK ) { INetURLObject aURL(xFP->getDirectory()); if(aURL.GetProtocol() == INetProtocol::File) diff --git a/sw/source/uibase/inc/mailmrge.hxx b/sw/source/uibase/inc/mailmrge.hxx index cc30e6c787a5..59b8cc4a0392 100644 --- a/sw/source/uibase/inc/mailmrge.hxx +++ b/sw/source/uibase/inc/mailmrge.hxx @@ -115,6 +115,7 @@ class SwMailMergeDlg : public SvxStandardDialog virtual void Apply() override; bool ExecQryShell(); bool AskUserFilename() const; + OUString GetURLfromPath() const; public: SwMailMergeDlg(vcl::Window* pParent, SwWrtShell& rSh, |