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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 14 12:58:57 UTC 2021


 sw/source/uibase/dbui/dbtree.cxx |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 351edb44eb0548f7e56464de42c1758a1f5e4ab4
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Mar 14 14:33:34 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Mar 14 13:58:18 2021 +0100

    tdf#141012: do not try to expand the node if RequestingChildrenHdl failed
    
    Just select the database node itself, so that it's still obvious which
    database is associated with this document.
    
    After selecting this node when initializing the tab, another call to
    SwDBTreeList::Select will be made, so make sure to handle empty table and
    column names.
    
    Change-Id: Ie1d1bd445e18d5900910c780a24102b4dde5c787
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112467
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index 9d1aa0f73436..23fdfcd68dda 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -332,14 +332,25 @@ void SwDBTreeList::Select(std::u16string_view rDBName, std::u16string_view rTabl
     {
         if (rDBName == m_xTreeView->get_text(*xParent))
         {
+            if (rTableName.empty() && rColumnName.empty())
+            {
+                // Just select the database node, do not expand
+                m_xTreeView->scroll_to_row(*xParent);
+                m_xTreeView->select(*xParent);
+                return;
+            }
             if (!m_xTreeView->iter_has_child(*xParent))
             {
                 RequestingChildrenHdl(*xParent);
-                m_xTreeView->expand_row(*xParent);
+                // If successful, it will be expanded in a call to scroll_to_row for its children
             }
             std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(xParent.get()));
             if (!m_xTreeView->iter_children(*xChild))
+            {
+                m_xTreeView->scroll_to_row(*xParent);
+                m_xTreeView->select(*xParent);
                 continue;
+            }
             do
             {
                 if (rTableName == m_xTreeView->get_text(*xChild))


More information about the Libreoffice-commits mailing list