[Libreoffice-commits] core.git: Branch 'feature/gsoc15-open-remote-files-dialog' - fpicker/source officecfg/registry

Szymon Kłos eszkadev at gmail.com
Tue Jul 14 04:13:25 PDT 2015


 fpicker/source/office/RemoteFilesDialog.cxx                |   29 +++++++++++--
 fpicker/source/office/RemoteFilesDialog.hxx                |    1 
 officecfg/registry/data/org/openoffice/Office/Common.xcu   |    3 +
 officecfg/registry/data/org/openoffice/Setup.xcu           |    1 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    5 ++
 5 files changed, 36 insertions(+), 3 deletions(-)

New commits:
commit d04b85c8f8e85bcb5c1fc05ba7e71713259b768f
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Tue Jul 14 13:10:53 2015 +0200

    RemoteFilesDialog: remember last used service
    
    Change-Id: I494b1d43d28d8e6c37ce9d391b37580be6a9be31

diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 533940d..5ea0658 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 3462305..05f9ca1 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 6394722..8940778 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 9b17125..2a77ab1 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 0bc0dc8..d3581d5 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5790,6 +5790,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>


More information about the Libreoffice-commits mailing list