Issue 56809 - FolderPicker does not use default directory
Summary: FolderPicker does not use default directory
Status: CONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All Windows, all
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-27 19:05 UTC by andrew
Modified: 2013-02-24 21:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description andrew 2005-10-27 19:05:35 UTC
I duplicated this problem using Windows XP Professional, but I exepect the
problem on any windows computer.

When you use the FolderPicker service, the service that is used depends on your
settings. If your settings are set to use the system dialogs. Use:
Tools | Options |OpenOffice.org | Gernal | Use OpenOffice.org Dialogs
This option should NOT be checked to see the problem. Now, run the following macro:

Function ChooseADirectoryURL(Optional sInPath$) As String
  Dim oDialog As Object
  Dim oSFA As Object
  Dim s As String

  oDialog = CreateUnoService("com.sun.star.ui.dialogs.FolderPicker")
  'oDialog = CreateUnoService("com.sun.star.ui.dialogs.OfficeFolderPicker")
  oSFA = createUnoService("com.sun.star.ucb.SimpleFileAccess")
  
  If IsMissing(sInPath) Then
    Print "Using " & GetWorkDir()
    oDialog.setDisplayDirectory(GetWorkDir())
    'oDialog.setDisplayDirectory("file:///C:/Andy")
  ElseIf oSFA.Exists(sInPath) Then
    oDialog.setDisplayDirectory(sInPath)
  Else
    s = "Directory '" & sInPath & "' Does not exist"
    If MsgBox(s, 33, "Error") = 2 Then Exit Function
  End If
  Print "Set the value: " & oDialog.getDisplayDirectory()
  Inspect(oDialog)
  
  If oDialog.Execute() = 1 Then
    ChooseADirectoryURL() = oDialog.getDirectory()
  End If
End Function
Function GetWorkDir() As String
  Dim  oPathSettings
  oPathSettings = CreateUnoService("com.sun.star.util.PathSettings")
  GetWorkDir() = oPathSettings.Work
End Function

You do indeed set the default directory, but you do NOT use it. If, however, you
use the OfficeFolderPicker service directly (or if you are set to use this
service by default as already mentioned) then the default directory is set.
Comment 1 andrew 2005-10-27 19:12:54 UTC
As a followup, on my windows computer, the returned service is:
com.sun.star.ui.dialogs.Win32FolderPicker
Comment 2 stephan.wunderlich 2005-11-02 08:38:03 UTC
sw->tra: is this a limitation of the Win32FolderPicker ?
Comment 3 tino.rachui 2005-11-02 13:49:59 UTC
tra->hro: Would you have a look please.
Comment 4 kai.sommerfeld 2009-08-11 09:40:55 UTC
cd: Please take over.