← Back to team overview

desktop-packages team mailing list archive

[Bug 1466085] Re: open file dialog returns unusable network path

 

The macro by itself is not problematic if used in local files.
You can use any macro for selecting-opening a file with CreateUnoService("com.sun.star.ui.dialogs.FilePicker")

opening an odb and getting the name using in a macro:
oDBDoc = ThisComponent.Parent
sDocURL = oDBDoc.getURL()

returns something like:
/run/user/1000/gvfs/smb-share:server=myservername,share=XXX/YYY/ZZZ)

but using in a macro the file dialog and selecting the same .odb:
selectedfile = file_dialog.Files(0)

returns something like
smb://myservername/myservershare/thenameofthefileinURLnotation)

which is a totally different "path to file" (the one contains a URI but
the other not).

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to libreoffice in Ubuntu.
https://bugs.launchpad.net/bugs/1466085

Title:
  open file dialog returns unusable network path

Status in libreoffice package in Ubuntu:
  Incomplete

Bug description:
  using a macro to open an open file dialog and trying to catch the filename and path I get an unusable path.
  I open the file dialog in the directory where the odb file is (a network place)  using:
  	oDBDoc = ThisComponent.Parent
  	oDBDoc = ThisComponent.Parent
  	If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
  		GlobalScope.BasicLibraries.LoadLibrary("Tools")
  	End If
  	If (oDBDoc.hasLocation()) Then
  		sDocURL = oDBDoc.getURL()
  		uDocPath = DirectoryNameoutofPath(sDocURL, "/")
  		sDocPath = ConvertFromUrl(uDocPath)
  		MsgBox sDocPath
  	Else
  		MsgBox "No running component! Exiting!"
  	End if

  msgbox shows:
  /run/user/1000/gvfs/smb-share:server=fserver,share=XXX/YYY/ZZZ

     	file_dialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
     	ucb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
  	AddFiltersToDialog(FilterNames(), file_dialog)
  	'init_path = ConvertToUrl("/usr")
      If ucb.Exists(init_path) Then
        	file_dialog.SetDisplayDirectory(uDocPath)
      End If
  	open_status = file_dialog.Execute()
  	If open_status = 1 Then
  		selectedfile = file_dialog.Files(0)
  	End If
  	file_dialog.Dispose()

  After selecting in that directory any file the returned name is

  smb://myservername/myservershare/thenameofthefileinURLnotation

  ConvertFromUrl returns the exact same filename (with smb and in URL
  notation).

  
  1
  lsb_release -rd
  Description:	Ubuntu 14.04.2 LTS
  Release:	14.04

  2
  apt-cache policy libreoffice
  libreoffice:
    Εγκατεστημένα: 1:4.2.8-0ubuntu2
    Υποψήφιο:      1:4.2.8-0ubuntu2
    Πίνακας Έκδοσης:
   *** 1:4.2.8-0ubuntu2 0
          500 http://gr.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
          500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
          100 /var/lib/dpkg/status
       1:4.2.3~rc3-0ubuntu2 0
          500 http://gr.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1466085/+subscriptions


References