This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git


The following commit(s) were added to refs/heads/AOO41X by this push:
     new de4f303f92 #i96720# FilePicker: setDefaultName, setDefaultDirectory 
"broken"
de4f303f92 is described below

commit de4f303f92c636ab115e46e3d5e1477fba3d4960
Author: Damjan Jovanovic <dam...@apache.org>
AuthorDate: 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
    
    git-svn-id: https://svn.apache.org/repos/asf/openoffice/trunk@1716508 
13f79535-47bb-0310-9956-ffa450edef68
    (cherry picked from commit 1aa1f6e56713546a63af3b26af83aa1655ce348c)
---
 main/fpicker/source/office/OfficeFilePicker.cxx | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/main/fpicker/source/office/OfficeFilePicker.cxx 
b/main/fpicker/source/office/OfficeFilePicker.cxx
index 8aefcb7e24..d04bc08526 100644
--- a/main/fpicker/source/office/OfficeFilePicker.cxx
+++ b/main/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 );

Reply via email to