fpicker/source/office/OfficeFilePicker.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 25aa9f30489801b2ed51395d7dad20ec0a2b0473
Author: Damjan Jovanovic <dam...@apache.org>
Date:   Wed Nov 25 18:49:36 2015 +0000

    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 <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/fpicker/source/office/OfficeFilePicker.cxx 
b/fpicker/source/office/OfficeFilePicker.cxx
index cdf83c2..269e666 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 );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to