https://issues.apache.org/ooo/show_bug.cgi?id=123544
Bug ID: 123544
Issue Type: DEFECT
Summary: XFilePicker's setDisplayDirectory and setDefaultName
do not work in Windows
Product: App Dev
Version: 4.0.1
Hardware: PC
OS: Windows 7
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: api
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
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 in Windows 7;
in Ubuntu 12.10 (using OpenOffice 4) it works as expected.
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));
}
}
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.