Author: damjan
Date: Wed Nov 25 18:49:36 2015
New Revision: 1716508

URL: http://svn.apache.org/viewvc?rev=1716508&view=rev
Log:
#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


Modified:
    openoffice/trunk/main/fpicker/source/office/OfficeFilePicker.cxx

Modified: openoffice/trunk/main/fpicker/source/office/OfficeFilePicker.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/fpicker/source/office/OfficeFilePicker.cxx?rev=1716508&r1=1716507&r2=1716508&view=diff
==============================================================================
--- openoffice/trunk/main/fpicker/source/office/OfficeFilePicker.cxx (original)
+++ openoffice/trunk/main/fpicker/source/office/OfficeFilePicker.cxx Wed Nov 25 
18:49:36 2015
@@ -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