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 /basctl/source/basicide/moduldl2.cxx | |
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 'basctl/source/basicide/moduldl2.cxx')
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 44796f0cdcef..17e937ee9513 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -549,6 +549,7 @@ void LibPage::InsertLib() Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); // file open dialog sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_pDialog->getDialog()); + aDlg.SetContext(sfx2::FileDialogHelper::BasicInsertLib); const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker(); xFP->setTitle(IDEResId(RID_STR_APPENDLIBS)); @@ -568,16 +569,6 @@ void LibPage::InsertLib() ";*.sti;*.otp" // presentation template ";*.sxm;*.odf" ); // formula - // set display directory and filter - OUString aPath(GetExtraData()->GetAddLibPath()); - if ( !aPath.isEmpty() ) - xFP->setDisplayDirectory( aPath ); - else - { - // macro path from configuration management - xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); - } - OUString aLastFilter(GetExtraData()->GetAddLibFilter()); if ( !aLastFilter.isEmpty() ) xFP->setCurrentFilter( aLastFilter ); @@ -1005,6 +996,7 @@ void LibPage::ExportAsPackage( const OUString& aLibName ) { // file open dialog sfx2::FileDialogHelper aDlg(ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, FileDialogFlags::NONE, m_pDialog->getDialog()); + aDlg.SetContext(sfx2::FileDialogHelper::BasicExportPackage); const Reference <XFilePicker3>& xFP = aDlg.GetFilePicker(); Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); @@ -1017,17 +1009,6 @@ void LibPage::ExportAsPackage( const OUString& aLibName ) OUString aTitle(IDEResId(RID_STR_PACKAGE_BUNDLE)); xFP->appendFilter( aTitle, "*.oxt" ); // library files - // set display directory and filter - OUString aPath = GetExtraData()->GetAddLibPath(); - if ( !aPath.isEmpty() ) - { - xFP->setDisplayDirectory( aPath ); - } - else - { - // macro path from configuration management - xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() ); - } xFP->setCurrentFilter( aTitle ); if ( xFP->execute() != RET_OK ) |