summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2015-06-24 13:13:02 +0200
committerSzymon Kłos <eszkadev@gmail.com>2015-07-16 09:53:04 +0200
commite901bff773a12ceace2f64b6e1aff227eb181b35 (patch)
tree1517e0bf598eeed9affd2baccff64b01ea343f4c /svtools
parentbd81a6309cf15bbc4ed18c1feeefe35617a8762b (diff)
RemoteFilesDialog: SvTreeListBox shows the current path
Change-Id: Ib8873fe7f97dd1b46752fc2dee433be72621a93e
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/dialogs/RemoteFilesDialog.cxx108
1 files changed, 72 insertions, 36 deletions
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 8bba8fe87b24..0d4541baeb7a 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -198,7 +198,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
m_pTreeView->SetDefaultExpandedEntryBmp(m_aFolderImage);
m_pTreeView->SetSelectHdl( LINK( this, RemoteFilesDialog, TreeSelectHdl ) );
- m_pTreeView->SetExpandedHdl( LINK( this, RemoteFilesDialog, TreeExpandHdl ) );
+ m_pTreeView->SetExpandingHdl( LINK( this, RemoteFilesDialog, TreeExpandHdl ) );
sal_Int32 nPosX = m_pTreeView->GetSizePixel().Width();
m_pSplitter->SetPosPixel(Point(nPosX, 0));
@@ -403,6 +403,7 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
if( eResult == eSuccess )
{
m_pPath->SetURL( sURL );
+ setTreePath( sURL );
m_pFilter_lb->Enable( true );
m_pName_ed->Enable( true );
m_pContainer->Enable( true );
@@ -414,58 +415,93 @@ FileViewResult RemoteFilesDialog::OpenURL( OUString sURL )
void RemoteFilesDialog::fillTreeEntry( SvTreeListEntry* pParent )
{
- if( pParent && m_pTreeView->IsExpanded( pParent ) )
+ if( pParent && !m_pTreeView->IsExpanded( pParent ) )
{
- // remove childs
+ // fill only empty entries - containing only dummy entry
+ if( m_pTreeView->GetChildCount( pParent ) == 1 && pParent->GetUserData() )
+ {
+ ::std::vector< SortingData_Impl* > aContent;
- SvTreeList* pModel = m_pTreeView->GetModel();
+ FileViewContentEnumerator* pContentEnumerator = new FileViewContentEnumerator(
+ m_xEnv, aContent, m_aMutex, NULL );
- if( pModel->HasChildren( pParent ) )
- {
- SvTreeListEntries& rEntries = pModel->GetChildList( pParent );
- rEntries.clear();
- }
+ OUString* pURL = static_cast< OUString* >( pParent->GetUserData() );
+
+ if( pURL )
+ {
+ FolderDescriptor aFolder( *pURL );
+ Sequence< OUString > aBlackList;
- // fill with new ones
+ EnumerationResult eResult =
+ pContentEnumerator->enumerateFolderContentSync( aFolder, aBlackList );
+
+ if ( SUCCESS == eResult )
+ {
+ unsigned int nChilds = 0;
+
+ for( unsigned int i = 0; i < aContent.size(); i++ )
+ {
+ if( aContent[i]->mbIsFolder )
+ {
+ SvTreeListEntry* pEntry = m_pTreeView->InsertEntry( aContent[i]->GetTitle(), pParent, true );
- ::std::vector< SortingData_Impl* > aContent;
+ OUString* sData = new OUString( aContent[i]->maTargetURL );
+ pEntry->SetUserData( static_cast< void* >( sData ) );
- FileViewContentEnumerator* pContentEnumerator = new FileViewContentEnumerator(
- m_xEnv, aContent, m_aMutex, NULL );
+ nChilds++;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+void RemoteFilesDialog::setTreePath( OUString sUrl )
+{
+ INetURLObject aURL( sUrl );
+ aURL.setFinalSlash();
- OUString* pURL = static_cast< OUString* >( pParent->GetUserData() );
+ OUString sPath = aURL.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
- if( pURL )
+ SvTreeListEntry* pEntry = m_pTreeView->First();
+ bool end = false;
+
+ while( pEntry && !end )
+ {
+ if( pEntry->GetUserData() )
{
- FolderDescriptor aFolder( *pURL );
- Sequence< OUString > aBlackList;
+ OUString sNodeUrl = *static_cast< OUString* >( pEntry->GetUserData() );
- EnumerationResult eResult =
- pContentEnumerator->enumerateFolderContentSync( aFolder, aBlackList );
+ INetURLObject aUrlObj( sNodeUrl );
+ aUrlObj.setFinalSlash();
- if ( SUCCESS == eResult )
- {
- unsigned int nChilds = 0;
+ sNodeUrl = aUrlObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET );
- for( unsigned int i = 0; i < aContent.size(); i++ )
- {
- if( aContent[i]->mbIsFolder )
- {
- SvTreeListEntry* pEntry = m_pTreeView->InsertEntry( aContent[i]->GetTitle(), pParent, true );
+ if( sPath == sNodeUrl)
+ {
+ m_pTreeView->Select( pEntry );
- OUString* sData = new OUString( aContent[i]->maTargetURL );
- pEntry->SetUserData( static_cast< void* >( sData ) );
+ if( !m_pTreeView->IsExpanded( pEntry ) )
+ m_pTreeView->Expand( pEntry );
- nChilds++;
- }
- }
+ end = true;
+ }
+ else if( sPath.startsWith( sNodeUrl ) )
+ {
+ if( !m_pTreeView->IsExpanded( pEntry ) )
+ m_pTreeView->Expand( pEntry );
- if( nChilds == 0 )
- {
- m_pTreeView->Collapse( pParent );
- }
+ pEntry = m_pTreeView->FirstChild( pEntry );
+ pEntry = m_pTreeView->NextSibling( pEntry );
+ }
+ else
+ {
+ pEntry = m_pTreeView->NextSibling( pEntry );
}
}
+ else
+ break;
}
}