[Libreoffice-commits] core.git: cui/source

Mihály Palenik palenik.mihaly at gmail.com
Tue Jul 7 02:40:56 PDT 2015


 cui/source/options/optaboutconfig.cxx |   35 ++++++++++++++++++++++++++--------
 cui/source/options/optaboutconfig.hxx |    1 
 2 files changed, 28 insertions(+), 8 deletions(-)

New commits:
commit ac34ba072756efd92febdb1a9d59b4d789424a25
Author: Mihály Palenik <palenik.mihaly at gmail.com>
Date:   Tue Jun 30 23:13:53 2015 +0200

    Use expanding handler in Expert Configuration dialog
    
    Expert Configuration dialog use expanding handler instead of double click
    handler when expanding tree node.
    
    Change-Id: Ia35c289db46796ca61ef8898e669af6c5a0bd24d
    Reviewed-on: https://gerrit.libreoffice.org/16674
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 02acd70..204f1e6 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -153,6 +153,7 @@ CuiAboutConfigTabPage::CuiAboutConfigTabPage( vcl::Window* pParent/*, const SfxI
     m_pEditBtn->SetClickHdl( LINK( this, CuiAboutConfigTabPage, StandardHdl_Impl ) );
     m_pResetBtn->SetClickHdl( LINK( this, CuiAboutConfigTabPage, ResetBtnHdl_Impl ) );
     m_pPrefBox->SetDoubleClickHdl( LINK(this, CuiAboutConfigTabPage, StandardHdl_Impl) );
+    m_pPrefBox->SetExpandingHdl( LINK(this, CuiAboutConfigTabPage, ExpandingHdl_Impl) );
     m_pSearchBtn->SetClickHdl( LINK(this, CuiAboutConfigTabPage, SearchHdl_Impl) );
 
     m_pPrefBox->InsertHeaderEntry(get<FixedText>("preference")->GetText());
@@ -279,6 +280,7 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
             pEntry->AddItem( new SvLBoxString( pEntry, 0, ""));
 
             pEntry->SetUserData( new UserData(xNextNameAccess) );
+            pEntry->EnableChildrenOnDemand();
             m_pPrefBox->Insert( pEntry, pParentEntry );
         }
         else
@@ -547,16 +549,12 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, ResetBtnHdl_Impl )
 
 IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
 {
-    SvTreeListEntry* pEntry = m_pPrefBox->FirstSelected();
+    SvTreeListEntry* pEntry = m_pPrefBox->GetHdlEntry();
+    if(pEntry == nullptr)
+        return 0;
 
     UserData *pUserData = static_cast<UserData*>(pEntry->GetUserData());
-    if(!pUserData->bIsPropertyPath)
-    {
-        //if selection is not node
-        if(!pEntry->HasChildren())
-            FillItems( pUserData->aXNameAccess, pEntry );
-    }
-    else
+    if(pUserData->bIsPropertyPath)
     {
         //if selection is a node
         OUString sPropertyName = SvTabListBox::GetEntryText( pEntry, 1 );
@@ -814,4 +812,25 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, SearchHdl_Impl)
     return 0;
 }
 
+IMPL_LINK_NOARG( CuiAboutConfigTabPage, ExpandingHdl_Impl )
+{
+    SvTreeListEntry* pEntry = m_pPrefBox->GetHdlEntry();
+
+    if(pEntry != nullptr && pEntry->HasChildrenOnDemand())
+    {
+        pEntry->EnableChildrenOnDemand(false);
+        SvTreeListEntry *pFirstChild = m_pPrefBox->FirstChild(pEntry);
+        if(pFirstChild)
+            m_pPrefBox->RemoveEntry(pFirstChild);
+
+        if(pEntry->GetUserData() != nullptr)
+        {
+            UserData *pUserData = static_cast<UserData*>(pEntry->GetUserData());
+            FillItems( pUserData->aXNameAccess, pEntry );
+        }
+    }
+
+    return true;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optaboutconfig.hxx b/cui/source/options/optaboutconfig.hxx
index 48f97e3..e085f5a 100644
--- a/cui/source/options/optaboutconfig.hxx
+++ b/cui/source/options/optaboutconfig.hxx
@@ -62,6 +62,7 @@ private:
     DECL_LINK( StandardHdl_Impl, void * );
     DECL_LINK( ResetBtnHdl_Impl, void * );
     DECL_LINK( SearchHdl_Impl, void* );
+    DECL_LINK( ExpandingHdl_Impl, void* );
 
 public:
    explicit CuiAboutConfigTabPage(vcl::Window* pParent);


More information about the Libreoffice-commits mailing list