diff options
5 files changed, 36 insertions, 3 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 533940d91f76..5ea0658bdbce 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -225,6 +225,13 @@ void RemoteFilesDialog::dispose() { m_pFileView->SetSelectHdl( Link<>() ); + std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_context ) ); + + Sequence< OUString > lastService( 1 ); + lastService[0] = m_sLastServiceUrl; + + officecfg::Office::Common::Misc::FilePickerLastService::set( lastService, batch ); + if( m_bIsUpdated ) { Sequence< OUString > placesUrlsList( m_aServices.size() ); @@ -238,12 +245,12 @@ void RemoteFilesDialog::dispose() ++i; } - std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_context ) ); officecfg::Office::Common::Misc::FilePickerPlacesUrls::set( placesUrlsList, batch ); officecfg::Office::Common::Misc::FilePickerPlacesNames::set( placesNamesList, batch ); - batch->commit(); } + batch->commit(); + m_pContainer.disposeAndClear(); // container must be first! m_pTreeView.disposeAndClear(); m_pFileView.disposeAndClear(); @@ -315,6 +322,13 @@ void RemoteFilesDialog::FillServicesListbox() Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get( m_context ) ); Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get( m_context ) ); + unsigned int nPos = 0; + unsigned int i = 0; + Sequence< OUString > lastService( officecfg::Office::Common::Misc::FilePickerLastService::get( m_context ) ); + + if( lastService.getLength() > 0 ) + m_sLastServiceUrl = lastService[0]; + for( sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace ) { ServicePtr pService( new Place( placesNamesList[nPlace], placesUrlsList[nPlace], true ) ); @@ -328,12 +342,19 @@ void RemoteFilesDialog::FillServicesListbox() if( !sPrefix.isEmpty() ) sPrefix += ": "; + if( placesUrlsList[nPlace] == m_sLastServiceUrl ) + nPos = i; + m_pServices_lb->InsertEntry( sPrefix + placesNamesList[nPlace] ); + + i++; } } if( m_pServices_lb->GetEntryCount() > 0 ) - m_pServices_lb->SelectEntryPos( 0 ); + { + m_pServices_lb->SelectEntryPos( nPos ); + } EnableControls(); } @@ -507,6 +528,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, SelectServiceHdl ) m_pTreeView->Expand( pRoot ); m_pName_ed->GrabFocus(); + + m_sLastServiceUrl = sURL; } } diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx index 34623056a8b0..05f9ca102f84 100644 --- a/fpicker/source/office/RemoteFilesDialog.hxx +++ b/fpicker/source/office/RemoteFilesDialog.hxx @@ -114,6 +114,7 @@ private: OUString m_sPath; OUString m_sStdDir; + OUString m_sLastServiceUrl; unsigned int m_nCurrentFilter; ::com::sun::star::uno::Sequence< OUString > m_aBlackList; diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 63947223306f..8940778d566e 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -568,6 +568,9 @@ <prop oor:name="FilePickerPlacesNames"> <value/> </prop> + <prop oor:name="FilePickerLastService"> + <value/> + </prop> <prop oor:name="CmisServersUrls"> <value> <it>https://www.googleapis.com/drive/v2</it> diff --git a/officecfg/registry/data/org/openoffice/Setup.xcu b/officecfg/registry/data/org/openoffice/Setup.xcu index 9b17125b66f1..2a77ab18b877 100644 --- a/officecfg/registry/data/org/openoffice/Setup.xcu +++ b/officecfg/registry/data/org/openoffice/Setup.xcu @@ -898,6 +898,7 @@ <it>/org.openoffice.Office.Common/Misc/UseSystemPrintDialog</it> <it>/org.openoffice.Office.Common/Misc/FilePickerPlacesNames</it> <it>/org.openoffice.Office.Common/Misc/FilePickerPlacesUrls</it> + <it>/org.openoffice.Office.Common/Misc/FilePickerLastService</it> <it>/org.openoffice.Office.Common/ODF</it> <it>/org.openoffice.Office.Common/Passwords</it> <it>/org.openoffice.Office.Common/Path</it> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 87aa3ed01285..5109e663590c 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5828,6 +5828,11 @@ <desc>List of names of the places the user bookmarked in the file picker dialog.</desc> </info> </prop> + <prop oor:name="FilePickerLastService" oor:type="oor:string-list" oor:nillable="false"> + <info> + <desc>URL of the last used service in the remote file picker.</desc> + </info> + </prop> <prop oor:name="CmisServersUrls" oor:type="oor:string-list" oor:nillable="false"> <info> <desc>List of sample URLs of the CMIS servers in the place edition dialog.</desc> |