diff options
author | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-07-08 05:50:25 +0200 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-07-12 14:31:20 +0200 |
commit | d157c1bd70d630a58db33910d550bb8dee9fe62e (patch) | |
tree | 6a7d4a63cc524fcbbdcdfd8c4271fcbb7cd3c983 /cui | |
parent | c62bb20032cef7479e9293e84a8d57a2c74399d0 (diff) |
tdf#126665 Remember last used file picker directory
This introduces internal tracking of last used directories.
Each caller of the file picker can pass a "context". The selected
directory will then be saved & restored when opening the file picker
with the same context again.
After ffa636ba74b04b3258ec9a696bc4eac33581fa24 , the Windows file picker
no longer tracks the last used directory itself.
This is a replacement and an improvement at the same time, since there is not
one global last used directory, but one per context.
Change-Id: I10650cfb9359922690954fa65c89b4e47477e2c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118597
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/customize/acccfg.cxx | 1 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 1 | ||||
-rw-r--r-- | cui/source/dialogs/SignSignatureLineDialog.cxx | 1 | ||||
-rw-r--r-- | cui/source/dialogs/insdlg.cxx | 1 | ||||
-rw-r--r-- | cui/source/dialogs/screenshotannotationdlg.cxx | 1 | ||||
-rw-r--r-- | cui/source/options/optjava.cxx | 6 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 1 |
7 files changed, 9 insertions, 3 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 7a7965c903eb..d850da88f70b 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -1463,6 +1463,7 @@ void SfxAcceleratorConfigPage::StartFileDialog(StartFileDialogType nType, const m_pFileDlg->AddFilter(aFilterAllStr, FILEDIALOG_FILTER_ALL); m_pFileDlg->AddFilter(aFilterCfgStr, "*.cfg"); m_pFileDlg->SetCurrentFilter(aFilterCfgStr); + m_pFileDlg->SetContext(sfx2::FileDialogHelper::AcceleratorConfig); Link<sfx2::FileDialogHelper*, void> aDlgClosedLink = bSave ? LINK(this, SfxAcceleratorConfigPage, SaveHdl) diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 25f973016043..57f6a467bc43 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -2874,6 +2874,7 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, ImportHdl, weld::Button&, void) sfx2::FileDialogHelper aImportDialog( css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW, FileDialogFlags::Graphic | FileDialogFlags::MultiSelection, m_xDialog.get()); + aImportDialog.SetContext(sfx2::FileDialogHelper::IconImport); // disable the link checkbox in the dialog uno::Reference< css::ui::dialogs::XFilePickerControlAccess > diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx index 286f11501299..7af20b36445a 100644 --- a/cui/source/dialogs/SignSignatureLineDialog.cxx +++ b/cui/source/dialogs/SignSignatureLineDialog.cxx @@ -124,6 +124,7 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void) Reference<XComponentContext> xContext = comphelper::getProcessComponentContext(); sfx2::FileDialogHelper aHelper(TemplateDescription::FILEOPEN_PREVIEW, FileDialogFlags::NONE, m_xDialog.get()); + aHelper.SetContext(sfx2::FileDialogHelper::SignatureLine); Reference<XFilePicker3> xFilePicker = aHelper.GetFilePicker(); if (!xFilePicker->execute()) return; diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index 29c8d7cfb081..7e411d3c021d 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -85,6 +85,7 @@ IMPL_LINK_NOARG(SvInsertOleDlg, DoubleClickHdl, weld::TreeView&, bool) IMPL_LINK_NOARG(SvInsertOleDlg, BrowseHdl, weld::Button&, void) { sfx2::FileDialogHelper aHelper(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); + aHelper.SetContext(sfx2::FileDialogHelper::InsertOLE); const Reference< XFilePicker3 >& xFilePicker = aHelper.GetFilePicker(); // add filter diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx index 4f02452a8ad7..4a93d7b16aad 100644 --- a/cui/source/dialogs/screenshotannotationdlg.cxx +++ b/cui/source/dialogs/screenshotannotationdlg.cxx @@ -282,6 +282,7 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&, auto xFileDlg = std::make_unique<sfx2::FileDialogHelper>(ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, mpParentWindow); + xFileDlg->SetContext(sfx2::FileDialogHelper::ScreenshotAnnotation); const uno::Reference< ui::dialogs::XFilePicker3 > xFilePicker = xFileDlg->GetFilePicker(); diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx index a21c5b2b0bf8..85cd52921941 100644 --- a/cui/source/options/optjava.cxx +++ b/cui/source/options/optjava.cxx @@ -780,15 +780,15 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void) sfx2::FileDialogHelper aDlg(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get()); aDlg.SetTitle( CuiResId( RID_SVXSTR_ARCHIVE_TITLE ) ); aDlg.AddFilter( CuiResId( RID_SVXSTR_ARCHIVE_HEADLINE ), "*.jar;*.zip" ); + aDlg.SetContext(sfx2::FileDialogHelper::JavaClassPath); OUString sFolder; if (m_xPathList->count_selected_rows() > 0) { osl::FileBase::getFileURLFromSystemPath(m_xPathList->get_selected_text(), sFolder); // best effort } - if (sFolder.isEmpty()) - sFolder = SvtPathOptions().GetWorkPath(); - aDlg.SetDisplayDirectory( sFolder ); + if (!sFolder.isEmpty()) + aDlg.SetDisplayDirectory( sFolder ); if ( aDlg.Execute() == ERRCODE_NONE ) { OUString sURL = aDlg.GetPath(); diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 47542d147853..8db9b0e26f43 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -910,6 +910,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl, ValueSet*, void) IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, void) { sfx2::FileDialogHelper aFileDialog(0, FileDialogFlags::NONE, GetFrameWeld()); + aFileDialog.SetContext(sfx2::FileDialogHelper::BulletsAddImage); aFileDialog.SetTitle(CuiResId(RID_SVXSTR_ADD_IMAGE)); if ( aFileDialog.Execute() != ERRCODE_NONE ) return; |