Bug 70843 - Other: XFilePicker's setDisplayDirectory and setDefaultName do not work
Summary: Other: XFilePicker's setDisplayDirectory and setDefaultName do not work
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Extensions (show other bugs)
Version: Inherited From OOo
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-24 15:49 UTC by Ariel David Moya Sequeira
Modified: 2014-07-22 02:16 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Ariel David Moya Sequeira 2013-10-24 15:49:28 UTC
Problem description: 

When a file picker is created using the following code, the directory and filename are not set when the file picker is shown. This happens only in Windows; in Ubuntu 12.10 (using LibreOffice 3.6 from APT) it works as expected.

Steps to reproduce:
1. Create a new extension which shows a file picker using the code mentioned above.
2. Install the extension in LibreOffice in Windows.
2. Run LibreOffice in Windows.
3. Open an LibreOffice-compatible document.
4. Run the extension.

Current behavior:
The file picker doesn't start where the opened document is saved nor the filename of the document is set as default filename.

Expected behavior:
The default directory and filename of the file picker is the same as the opened document.
Operating System: Windows 7
Version: Inherited From OOo
Comment 1 Ariel David Moya Sequeira 2013-10-24 16:15:04 UTC
The code in Java is as follows. Here, "originalUrl" is the URL taken from the currently open document; "Environment" is just a helper class to retrieve some information about the opened document.

Object oFilePicker = component_factory.createInstanceWithContext("com.sun.star.ui.dialogs.FilePicker", Environment.getContext());
XFilePicker xFilePicker = (XFilePicker) UnoRuntime.queryInterface(XFilePicker.class, oFilePicker);

xFilePicker.setMultiSelectionMode(false);
if (originalUrl == null) {
	xFilePicker.setDisplayDirectory(Environment.getHomeDir());
	xFilePicker.setDefaultName("");
}
else {
	int idx = originalUrl.lastIndexOf('/');
	if (idx >= 0) {
		xFilePicker.setDisplayDirectory(originalUrl.substring(0, idx));
		xFilePicker.setDefaultName(originalUrl.substring(idx+1));
	}
}
Comment 2 Ariel David Moya Sequeira 2013-10-24 20:35:45 UTC
According to https://issues.apache.org/ooo/show_bug.cgi?id=123544, it's a problem with system dialogs. A solution can be found in the link provided above.
Comment 3 Owen Genat 2014-07-22 02:16:02 UTC
(In reply to comment #2)
> According to https://issues.apache.org/ooo/show_bug.cgi?id=123544, it's a
> problem with system dialogs. A solution can be found in the link provided
> above.

Comments in the AOO bug confirm this issue. Status set to NEW. There is also a possible solution posted:

https://issues.apache.org/ooo/show_bug.cgi?id=123544#c18

If this can be confirmed to work we may be able to RESOLVE this bug.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.