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

Szymon Kłos eszkadev at gmail.com
Tue Aug 18 01:45:00 PDT 2015


 fpicker/source/office/RemoteFilesDialog.cxx |   31 +++++++++++++++++++++++++---
 fpicker/source/office/RemoteFilesDialog.hxx |    3 +-
 fpicker/uiconfig/ui/remotefilesdialog.ui    |   17 +++++++++------
 include/svtools/fileview.hxx                |    3 +-
 svtools/source/contnr/fileview.cxx          |   11 +++------
 5 files changed, 46 insertions(+), 19 deletions(-)

New commits:
commit 910bdba989e09120faacafa050dfe187c68e4e2e
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Tue Aug 18 10:42:41 2015 +0200

    RemoteFilesDialog: file name autocompletion
    
    Change-Id: Iab051ccaf075cc91acce67e01863e8d7ecac820c

diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index 402cd75..e8d25c6 100644
--- a/fpicker/source/office/RemoteFilesDialog.cxx
+++ b/fpicker/source/office/RemoteFilesDialog.cxx
@@ -183,7 +183,6 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     get( m_pAddService_btn, "add_service_btn" );
     get( m_pServices_lb, "services_lb" );
     get( m_pFilter_lb, "filter_lb" );
-    get( m_pName_ed, "name_ed" );
     get( m_pNewFolder, "new_folder" );
 
     m_eMode = ( nBits & WB_SAVEAS ) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN;
@@ -194,6 +193,9 @@ RemoteFilesDialog::RemoteFilesDialog( vcl::Window* pParent, WinBits nBits )
     m_bServiceChanged = false;
     m_nCurrentFilter = LISTBOX_ENTRY_NOTFOUND;
 
+    m_pName_ed = VclPtr< AutocompleteEdit >::Create( get< vcl::Window >( "filename_container" ) );
+    m_pName_ed->Show();
+
     m_pFilter_lb->Enable( false );
     m_pName_ed->Enable( false );
 
@@ -1263,8 +1265,31 @@ void RemoteFilesDialog::UpdateControls( const OUString& rURL )
     m_pTreeView->SetSelectHdl( Link<>() );
 
     // read cached data for this url and fill the tree
-    const ::std::vector< std::pair< OUString, OUString > >& rFolders = m_pFileView->GetSubFolders();
-    m_pTreeView->FillTreeEntry( rURL, rFolders );
+    const ::std::vector< SvtContentEntry >& rFolders = m_pFileView->GetContent();
+    ::std::vector< std::pair< OUString, OUString > > aFolders;
+
+    m_pName_ed->ClearEntries();
+
+    for( ::std::vector< SvtContentEntry >::size_type i = 0; i < rFolders.size(); i++ )
+    {
+        int nTitleStart = rFolders[i].maURL.lastIndexOf( '/' );
+        if( nTitleStart != -1 )
+        {
+            OUString sTitle( INetURLObject::decode(
+                                rFolders[i].maURL.copy( nTitleStart + 1 ),
+                                INetURLObject::DECODE_WITH_CHARSET ) );
+
+            if( rFolders[i].mbIsFolder )
+            {
+                aFolders.push_back( std::pair< OUString, OUString > ( sTitle, rFolders[i].maURL ) );
+            }
+
+            // add entries to the autocompletion mechanism
+            m_pName_ed->AddEntry( sTitle );
+        }
+    }
+
+    m_pTreeView->FillTreeEntry( rURL, aFolders );
 
     m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) );
 
diff --git a/fpicker/source/office/RemoteFilesDialog.hxx b/fpicker/source/office/RemoteFilesDialog.hxx
index 4fe1188..bb0abaa 100644
--- a/fpicker/source/office/RemoteFilesDialog.hxx
+++ b/fpicker/source/office/RemoteFilesDialog.hxx
@@ -12,6 +12,7 @@
 
 #include <comphelper/docpasswordrequest.hxx>
 
+#include <svtools/autocmpledit.hxx>
 #include <svtools/foldertree.hxx>
 #include <svtools/place.hxx>
 #include <svtools/PlaceEditDialog.hxx>
@@ -156,7 +157,7 @@ private:
     VclPtr< SvtFileView > m_pFileView;
     VclPtr< FileViewContainer > m_pContainer;
     VclPtr< ListBox > m_pFilter_lb;
-    VclPtr< Edit > m_pName_ed;
+    VclPtr< AutocompleteEdit > m_pName_ed;
     PopupMenu* m_pAddMenu;
 
     ImageList m_aImages;
diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui
index e0699a5..7859348 100644
--- a/fpicker/uiconfig/ui/remotefilesdialog.ui
+++ b/fpicker/uiconfig/ui/remotefilesdialog.ui
@@ -234,26 +234,29 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEntry" id="name_ed">
+              <object class="GtkComboBox" id="filter_lb">
+                <property name="width_request">200</property>
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
+                <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
+                <property name="top_attach">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkComboBox" id="filter_lb">
-                <property name="width_request">200</property>
+              <object class="GtkBox" id="filename_container">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="hexpand">True</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
+                <property name="top_attach">1</property>
               </packing>
             </child>
           </object>
diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx
index cfcc42a..5789d2b 100644
--- a/include/svtools/fileview.hxx
+++ b/include/svtools/fileview.hxx
@@ -36,6 +36,7 @@ class ViewTabListBox_Impl;
 class SvtFileView_Impl;
 class SvTreeListEntry;
 class HeaderBar;
+struct SvtContentEntry;
 
 /// the result of an action in the FileView
 enum FileViewResult
@@ -173,7 +174,7 @@ public:
 
     void                    EndInplaceEditing( bool _bCancel );
 
-    ::std::vector< std::pair< OUString, OUString > > GetSubFolders();
+    ::std::vector< SvtContentEntry > GetContent();
 
 protected:
     virtual void            StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 0c2ac46f..5b72684 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1393,17 +1393,14 @@ OUString SvtFileView::GetConfigString() const
     return sRet;
 }
 
-::std::vector< std::pair< OUString, OUString > > SvtFileView::GetSubFolders()
+::std::vector< SvtContentEntry > SvtFileView::GetContent()
 {
-    ::std::vector< std::pair< OUString, OUString > > aContent;
+    ::std::vector< SvtContentEntry > aContent;
 
     for( ::std::vector< SortingData_Impl* >::size_type i = 0; i < mpImp->maContent.size(); i++ )
     {
-        if( mpImp->maContent[i]->mbIsFolder )
-        {
-            std::pair< OUString, OUString > aEntry( mpImp->maContent[i]->GetTitle(), mpImp->maContent[i]->maTargetURL );
-            aContent.push_back( aEntry );
-        }
+        SvtContentEntry aEntry( mpImp->maContent[i]->maTargetURL, mpImp->maContent[i]->mbIsFolder );
+        aContent.push_back( aEntry );
     }
 
     return aContent;


More information about the Libreoffice-commits mailing list