From d157c1bd70d630a58db33910d550bb8dee9fe62e Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Thu, 8 Jul 2021 05:50:25 +0200 Subject: 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 Reviewed-by: Samuel Mehrbrodt --- sw/source/uibase/app/docsh2.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sw/source/uibase/app/docsh2.cxx') diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 30b31f90cdc7..4fa73d0349d7 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -546,7 +546,6 @@ void SwDocShell::Execute(SfxRequest& rReq) if ( aFileName.isEmpty() ) { - SvtPathOptions aPathOpt; SfxNewFileDialog aNewFileDlg(GetView()->GetFrameWeld(), SfxNewFileDialogMode::LoadTemplate); aNewFileDlg.SetTemplateFlags(nFlags); @@ -555,10 +554,9 @@ void SwDocShell::Execute(SfxRequest& rReq) { FileDialogHelper aDlgHelper(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetView()->GetFrameWeld()); + aDlgHelper.SetContext(FileDialogHelper::WriterLoadTemplate); uno::Reference < XFilePicker3 > xFP = aDlgHelper.GetFilePicker(); - xFP->setDisplayDirectory( aPathOpt.GetWorkPath() ); - SfxObjectFactory &rFact = GetFactory(); SfxFilterMatcher aMatcher( rFact.GetFactoryName() ); SfxFilterMatcherIter aIter( aMatcher ); @@ -671,6 +669,7 @@ void SwDocShell::Execute(SfxRequest& rReq) FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE, GetView()->GetFrameWeld()); + aDlgHelper.SetContext(FileDialogHelper::WriterSaveHTML); aDlgHelper.AddFilter( pHtmlFlt->GetFilterName(), pHtmlFlt->GetDefaultExtension() ); aDlgHelper.SetCurrentFilter( pHtmlFlt->GetFilterName() ); if( ERRCODE_NONE != aDlgHelper.Execute()) @@ -926,6 +925,7 @@ void SwDocShell::Execute(SfxRequest& rReq) FileDialogHelper aDlgHelper(TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, FileDialogFlags::NONE, GetView()->GetFrameWeld()); + aDlgHelper.SetContext(FileDialogHelper::WriterNewHTMLGlobalDoc); const sal_Int16 nControlIds[] = { CommonFilePickerElementIds::PUSHBUTTON_OK, -- cgit