[Libreoffice-commits] core.git: dbaccess/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 21 08:09:09 UTC 2021
dbaccess/source/ui/browser/dsEntriesNoExp.cxx | 56 +-------------------------
1 file changed, 3 insertions(+), 53 deletions(-)
New commits:
commit 2a357832b9eedea161f593c1b3bf8dd973949c95
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Sep 20 11:54:48 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Sep 21 10:08:36 2021 +0200
Resolves: tdf#136442 don't query siblings and parent to determine type
because this is used during sorting of the tree elements so its position
isn't necessarily meaningful during the sort. DBTreeListUserData is
supposed to exist for elements not staged for removal and that already
has the type as a member
Change-Id: Ie1004dbcdca2fae8711941d98a084103a0b15815
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122354
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index 0db9f29f5236..debc3fa51a67 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -55,59 +55,9 @@ OUString SbaTableQueryBrowser::GetEntryText(const weld::TreeIter& rEntry) const
SbaTableQueryBrowser::EntryType SbaTableQueryBrowser::getEntryType(const weld::TreeIter& rEntry) const
{
- std::unique_ptr<weld::TreeIter> xRootEntry = m_pTreeView->GetRootLevelParent(&rEntry);
- weld::TreeView& rTreeView = m_pTreeView->GetWidget();
-
- if (rTreeView.iter_compare(*xRootEntry, rEntry) == 0)
- return etDatasource;
-
- std::unique_ptr<weld::TreeIter> xEntryParent(rTreeView.make_iterator(&rEntry));
- if (!rTreeView.iter_parent(*xEntryParent))
- xEntryParent.reset();
-
- std::unique_ptr<weld::TreeIter> xTables;
- std::unique_ptr<weld::TreeIter> xQueries;
-
- std::unique_ptr<weld::TreeIter> xContainer = rTreeView.make_iterator(xRootEntry.get());
- if (rTreeView.iter_children(*xContainer))
- {
- // 1st child is queries
- xQueries = rTreeView.make_iterator(xContainer.get());
-
- if (rTreeView.iter_next_sibling(*xContainer))
- {
- // 2nd child is tables
- xTables = rTreeView.make_iterator(xContainer.get());
- }
- }
-
- if (xTables && rTreeView.iter_compare(*xTables, rEntry) == 0)
- return etTableContainer;
-
- if (xQueries && rTreeView.iter_compare(*xQueries, rEntry) == 0)
- return etQueryContainer;
-
- if (xTables && xEntryParent && rTreeView.iter_compare(*xTables, *xEntryParent) == 0)
- return etTableOrView;
-
- if (xQueries && xEntryParent)
- {
- if (rTreeView.iter_compare(*xQueries, *xEntryParent) == 0)
- {
- DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rEntry).toUInt64());
- if (pEntryData)
- return pEntryData->eType;
- return etQuery;
- }
-
- while (rTreeView.iter_compare(*xEntryParent, *xQueries) != 0)
- {
- if (!rTreeView.iter_parent(*xEntryParent))
- return etUnknown;
- }
- }
-
- return etQueryContainer;
+ const weld::TreeView& rTreeView = m_pTreeView->GetWidget();
+ DBTreeListUserData* pEntryData = reinterpret_cast<DBTreeListUserData*>(rTreeView.get_id(rEntry).toUInt64());
+ return pEntryData ? pEntryData->eType : etUnknown;
}
void SbaTableQueryBrowser::select(const weld::TreeIter* pEntry, bool bSelect)
More information about the Libreoffice-commits
mailing list