diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-04-07 13:24:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-04-07 16:54:45 +0200 |
commit | 9e786320a7d2609a9f997b32e31347f2eab0489e (patch) | |
tree | 5cce4899cb316735be546da843b29fb1fe6c6b33 /svtools | |
parent | 105a9390e02856887ff5cfb6dbf6fe008738ffe1 (diff) |
move using the vcl file dialog in headless mode to the point of creation
instead of setting and unsetting the config option at start and exit
because a document that crashes in headless mode leaves my config
in an unwanted built-in file dialog state.
Change-Id: Ib5fcc5994a08c78bffdf57cb5b252dc469167ba2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150126
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/uno/fpicker.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/svtools/source/uno/fpicker.cxx b/svtools/source/uno/fpicker.cxx index dbb69d601462..e02d8abebb80 100644 --- a/svtools/source/uno/fpicker.cxx +++ b/svtools/source/uno/fpicker.cxx @@ -48,6 +48,13 @@ static OUString FilePicker_getSystemPickerServiceName() #endif } +// Ensure that we use not the system file dialogs as headless mode relies on +// Application::EnableHeadlessMode() which only works for VCL dialogs +static bool UseSystemFileDialog() +{ + return !Application::IsHeadlessModeEnabled() && officecfg::Office::Common::Misc::UseSystemFileDialog::get(); +} + Reference< css::uno::XInterface > FilePicker_CreateInstance ( Reference< css::uno::XComponentContext > const & context) { @@ -57,7 +64,7 @@ Reference< css::uno::XInterface > FilePicker_CreateInstance ( return xResult; Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager()); - if (xFactory.is() && officecfg::Office::Common::Misc::UseSystemFileDialog::get()) + if (xFactory.is() && UseSystemFileDialog()) { xResult.set( Application::createFilePicker( context ) ); @@ -125,7 +132,7 @@ Reference< css::uno::XInterface > FolderPicker_CreateInstance ( return xResult; Reference< css::lang::XMultiComponentFactory > xFactory (context->getServiceManager()); - if (xFactory.is() && officecfg::Office::Common::Misc::UseSystemFileDialog::get()) + if (xFactory.is() && UseSystemFileDialog()) { xResult.set( Application::createFolderPicker( context ) ); if (!xResult.is()) |