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

Szymon Kłos eszkadev at gmail.com
Wed Jun 24 04:14:45 PDT 2015


 include/svtools/RemoteFilesDialog.hxx        |    1 
 svtools/source/control/breadcrumb.cxx        |    2 
 svtools/source/dialogs/RemoteFilesDialog.cxx |  108 ++++++++++++++++++---------
 3 files changed, 74 insertions(+), 37 deletions(-)

New commits:
commit db5669304c26b7d4d90ac001b35ee34c94c4d859
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Wed Jun 24 13:13:02 2015 +0200

    RemoteFilesDialog: SvTreeListBox shows the current path
    
    Change-Id: Ib8873fe7f97dd1b46752fc2dee433be72621a93e

diff --git a/include/svtools/RemoteFilesDialog.hxx b/include/svtools/RemoteFilesDialog.hxx
index c6bf8d8..c437e1e 100644
--- a/include/svtools/RemoteFilesDialog.hxx
+++ b/include/svtools/RemoteFilesDialog.hxx
@@ -114,6 +114,7 @@ private:
     FileViewResult OpenURL( OUString sURL );
 
     void fillTreeEntry( SvTreeListEntry* pParent );
+    void setTreePath( OUString sPath );
 
     DECL_LINK ( AddServiceHdl, void * );
     DECL_LINK ( SelectServiceHdl, void * );
diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 8bba8fe..0d4541b 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;
     }
 }
 
commit d85b370bcbcee982cdff4b41d46a7850a20eb196
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Tue Jun 23 17:08:16 2015 +0200

    Breadcrumb: accessibility, TABSTOP
    
    Change-Id: I97c4ba80697ff57fbbf6f41cdc9204703aaf86e5

diff --git a/svtools/source/control/breadcrumb.cxx b/svtools/source/control/breadcrumb.cxx
index 735756a..8b43fa1 100644
--- a/svtools/source/control/breadcrumb.cxx
+++ b/svtools/source/control/breadcrumb.cxx
@@ -182,7 +182,7 @@ void Breadcrumb::SetMode( SvtBreadcrumbMode eMode )
 
 void Breadcrumb::appendField()
 {
-    m_aLinks.push_back( VclPtr< FixedHyperlink >::Create( this ) );
+    m_aLinks.push_back( VclPtr< FixedHyperlink >::Create( this, WB_TABSTOP ) );
     m_aLinks[m_aLinks.size() - 1]->Hide();
     m_aLinks[m_aLinks.size() - 1]->SetClickHdl( LINK( this, Breadcrumb, ClickLinkHdl ) );
 


More information about the Libreoffice-commits mailing list