summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorDamjan Jovanovic <damjan@apache.org>2015-11-25 18:49:36 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-08-27 18:26:31 +0000
commit25aa9f30489801b2ed51395d7dad20ec0a2b0473 (patch)
tree20e54da5a471149e21523d6677e869ad975321c5 /fpicker
parentb3533883fd0397dbe9110145d62ef35944b64f69 (diff)
Resolves: #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 (cherry picked from commit 42d181e761c9903bfe5dd71334cadacebd1d0dc8) Change-Id: I3f99937b667d7fe5198f6445ccd4d0e22d48c7c7 Reviewed-on: https://gerrit.libreoffice.org/28426 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/OfficeFilePicker.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index cdf83c2cdc1a..269e666453b1 100644
--- a/fpicker/source/office/OfficeFilePicker.cxx
+++ b/fpicker/source/office/OfficeFilePicker.cxx
@@ -140,18 +140,28 @@ void SvtFilePicker::prepareExecute()
// --**-- doesn't match the spec yet
if ( !m_aDisplayDirectory.isEmpty() || !m_aDefaultName.isEmpty() )
{
+ bool isFileSet = false;
if ( !m_aDisplayDirectory.isEmpty() )
{
- 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.isEmpty() )
{
aPath.insertName( m_aDefaultName );
getDialog()->SetHasFilename( true );
}
getDialog()->SetPath( aPath.GetMainURL( INetURLObject::NO_DECODE ) );
+ isFileSet = true;
}
- else if ( !m_aDefaultName.isEmpty() )
+ if ( !isFileSet && !m_aDefaultName.isEmpty() )
{
getDialog()->SetPath( m_aDefaultName );
getDialog()->SetHasFilename( true );