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

Szymon Kłos eszkadev at gmail.com
Wed Jun 10 04:11:22 PDT 2015


 svtools/source/dialogs/RemoteFilesDialog.cxx |   54 +++++++++++++++------------
 1 file changed, 30 insertions(+), 24 deletions(-)

New commits:
commit 10f0fdab6b72eb4919b1888703dc5b7b151f8461
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Wed Jun 10 13:09:57 2015 +0200

    sorting the folder tree view content
    
    Change-Id: I1bfd107b1549cd40864ae5c5bd6c08797f67a845

diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index ca5db95..6aad7ea 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -258,7 +258,7 @@ RemoteFilesDialog::RemoteFilesDialog(vcl::Window* pParent, WinBits nBits)
     m_pSplitter->SetSplitHdl( LINK( this, RemoteFilesDialog, SplitHdl ) );
     m_pSplitter->Show();
 
-    m_pTreeView = VclPtr<SvTreeListBox>::Create( m_pContainer, WB_BORDER );
+    m_pTreeView = VclPtr<SvTreeListBox>::Create( m_pContainer, WB_BORDER | WB_SORT );
     Size aSize(100, 200);
     m_pTreeView->set_height_request(aSize.Height());
     m_pTreeView->set_width_request(aSize.Width());
commit 811a0b97af052c6e06c857d7c9d06090389dcf68
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Wed Jun 10 13:04:43 2015 +0200

    removed unnecessary 'if'
    
    Change-Id: I0efe7e59a4402e856c645fbfb55c3c7696c7656e

diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 8206f25..ca5db95 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -448,15 +448,12 @@ void RemoteFilesDialog::fillTreeEntry( SvTreeListEntry* pParent )
     {
         // remove childs
 
-        if ( pParent )
-        {
-            SvTreeList* pModel = m_pTreeView->GetModel();
+        SvTreeList* pModel = m_pTreeView->GetModel();
 
-            if( pModel->HasChildren( pParent ) )
-            {
-                SvTreeListEntries& rEntries = pModel->GetChildList( pParent );
-                rEntries.clear();
-            }
+        if( pModel->HasChildren( pParent ) )
+        {
+            SvTreeListEntries& rEntries = pModel->GetChildList( pParent );
+            rEntries.clear();
         }
 
         // fill with new ones
commit edff7c0fb88da271917779437a4a279e4eafbf14
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Wed Jun 10 12:37:16 2015 +0200

    breadcrumb: hide final separator, current dir should be inactive
    
    Change-Id: If7889b0b95af1d34aa4298cf8ffab0b9164309d2

diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 5764c42..8206f25 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -138,6 +138,7 @@ class Breadcrumb : public VclHBox
 
         m_aLinks[0]->SetText( m_sRootName );
         m_aLinks[0]->Show();
+        m_aLinks[0]->Enable( true );
         m_aLinks[0]->SetURL( INetURLObject::GetScheme( aURL.GetProtocol() )
                                 + aURL.GetHost() );
         m_aSeparators[0]->Show();
@@ -155,10 +156,15 @@ class Breadcrumb : public VclHBox
                                 + aURL.GetHost()
                                 + OUString( sPath.getStr(), nEnd ) );
             m_aLinks[i]->Show();
+            m_aLinks[i]->Enable( true );
             m_aSeparators[i]->Show();
 
             nPos = nEnd;
         }
+
+        m_aLinks[i - 1]->Enable( false );
+        m_aSeparators[i - 1]->Hide();
+
         for( ; i < m_aLinks.size(); i++ )
         {
             m_aLinks[i]->Hide();
commit 5a102714e82a17f7c691c3cea67b4390ecbf2421
Author: Szymon Kłos <eszkadev at gmail.com>
Date:   Wed Jun 10 12:25:18 2015 +0200

    dynamically created labels in the breadcrumb
    
    Change-Id: Icef0cf686f49a2ba38c39664943f77d20120e44a

diff --git a/svtools/source/dialogs/RemoteFilesDialog.cxx b/svtools/source/dialogs/RemoteFilesDialog.cxx
index 20eca9a..5764c42 100644
--- a/svtools/source/dialogs/RemoteFilesDialog.cxx
+++ b/svtools/source/dialogs/RemoteFilesDialog.cxx
@@ -78,8 +78,6 @@ class FileViewContainer : public vcl::Window
 class Breadcrumb : public VclHBox
 {
     private:
-    const unsigned int m_cCount = 4; // how many labels we have - temporary
-
     std::vector< VclPtr< FixedHyperlink > > m_aLinks;
     std::vector< VclPtr< FixedText > > m_aSeparators;
 
@@ -94,16 +92,7 @@ class Breadcrumb : public VclHBox
     Breadcrumb( vcl::Window* pParent ) : VclHBox( pParent )
     {
         set_spacing( 6 );
-
-        for(unsigned int i = 0; i < m_cCount; i++)
-        {
-            m_aLinks.push_back( VclPtr< FixedHyperlink >::Create( this ) );
-            m_aLinks[i]->Hide();
-            m_aLinks[i]->SetClickHdl( LINK( this, Breadcrumb, ClickLinkHdl ) );
-            m_aSeparators.push_back( VclPtr< FixedText >::Create( this ) );
-            m_aSeparators[i]->SetText( ">" );
-            m_aSeparators[i]->Hide();
-        }
+        appendField(); // root
     }
 
     ~Breadcrumb()
@@ -113,7 +102,7 @@ class Breadcrumb : public VclHBox
 
     void dispose()
     {
-        for(unsigned int i = 0; i < m_cCount; i++)
+        for( unsigned int i = 0; i < m_aLinks.size(); i++ )
         {
             m_aSeparators[i].disposeAndClear();
             m_aLinks[i].disposeAndClear();
@@ -153,8 +142,11 @@ class Breadcrumb : public VclHBox
                                 + aURL.GetHost() );
         m_aSeparators[0]->Show();
 
-        for(i = 1; i < m_cCount && i < nSegments + 1; i++)
+        for( i = 1; i < nSegments + 1; i++ )
         {
+            if( i >= m_aLinks.size() )
+                appendField();
+
             unsigned int nEnd = sPath.indexOf( '/', nPos + 1 );
             OUString sLabel = OUString( sPath.getStr() + nPos + 1, nEnd - nPos - 1 );
 
@@ -167,12 +159,23 @@ class Breadcrumb : public VclHBox
 
             nPos = nEnd;
         }
-        for(; i < m_cCount; i++)
+        for( ; i < m_aLinks.size(); i++ )
         {
             m_aLinks[i]->Hide();
             m_aSeparators[i]->Hide();
         }
     }
+
+    private:
+    void appendField()
+    {
+        m_aLinks.push_back( VclPtr< FixedHyperlink >::Create( this ) );
+        m_aLinks[m_aLinks.size() - 1]->Hide();
+        m_aLinks[m_aLinks.size() - 1]->SetClickHdl( LINK( this, Breadcrumb, ClickLinkHdl ) );
+        m_aSeparators.push_back( VclPtr< FixedText >::Create( this ) );
+        m_aSeparators[m_aLinks.size() - 1]->SetText( ">" );
+        m_aSeparators[m_aLinks.size() - 1]->Hide();
+    }
 };
 
 IMPL_LINK ( Breadcrumb, ClickLinkHdl, FixedHyperlink*, pLink )


More information about the Libreoffice-commits mailing list