[Libreoffice-commits] core.git: Branch 'aoo/trunk' - fpicker/source
Damjan Jovanovic
damjan at apache.org
Wed Nov 25 12:08:16 PST 2015
fpicker/source/office/OfficeFilePicker.cxx | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
New commits:
commit 42d181e761c9903bfe5dd71334cadacebd1d0dc8
Author: Damjan Jovanovic <damjan at apache.org>
Date: Wed Nov 25 18:49:36 2015 +0000
#i96720# FilePicker: setDefaultName, setDefaultDirectory "broken"
Display the proposed filename even when the URL
specified for the file picker directory is invalid.
As the Win32 file picker sadly allows both paths and URLs
for directories, users try paths on other more
restrictive platforms, and since the file picker there
shows neither the directory nor the file, they wrongly
conclude both are broken.
Patch by: me
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index 79af62b..b25cd58 100644
--- a/fpicker/source/office/OfficeFilePicker.cxx
+++ b/fpicker/source/office/OfficeFilePicker.cxx
@@ -171,19 +171,29 @@ void SvtFilePicker::prepareExecute()
// --**-- doesn't match the spec yet
if ( m_aDisplayDirectory.getLength() > 0 || m_aDefaultName.getLength() > 0 )
{
+ sal_Bool isFileSet = sal_False;
if ( m_aDisplayDirectory.getLength() > 0 )
{
- INetURLObject aPath( m_aDisplayDirectory );
+ INetURLObject aPath;
+ INetURLObject givenPath( m_aDisplayDirectory );
+ if (!givenPath.HasError())
+ aPath = givenPath;
+ else
+ {
+ INetURLObject aStdDirObj( SvtPathOptions().GetWorkPath() );
+ aPath = aStdDirObj;
+ }
if ( m_aDefaultName.getLength() > 0 )
{
aPath.insertName( m_aDefaultName );
getDialog()->SetHasFilename( true );
}
String sPath = aPath.GetMainURL( INetURLObject::NO_DECODE );
- getDialog()->SetPath( aPath.GetMainURL( INetURLObject::NO_DECODE ) );
+ getDialog()->SetPath( sPath );
+ isFileSet = sal_True;
}
- else if ( m_aDefaultName.getLength() > 0 )
+ if ( !isFileSet && m_aDefaultName.getLength() > 0 )
{
getDialog()->SetPath( m_aDefaultName );
getDialog()->SetHasFilename( true );
More information about the Libreoffice-commits
mailing list