summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-08-18 10:42:41 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-08-29 12:33:09 +0200
commit495285ee3a00d6c14e3d5a8df2e5715fb7edb233 (patch)
tree71519e8c206240ac84a0013bc7e3325456706914 /fpicker
parent5f2f8343927a447b5005ba7f49fb84603b92ea6c (diff)
RemoteFilesDialog: file name autocompletion
Change-Id: Iab051ccaf075cc91acce67e01863e8d7ecac820c
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/RemoteFilesDialog.cxx31
-rw-r--r--fpicker/source/office/RemoteFilesDialog.hxx3
-rw-r--r--fpicker/uiconfig/ui/remotefilesdialog.ui17
3 files changed, 40 insertions, 11 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx
index e87f6cb1b0d1..ab6159ae010b 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 );
@@ -1252,8 +1254,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 4fef385593cd..ad1323c2fea2 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 e0699a5b96a8..78593484273b 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>