summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2021-02-15 19:43:17 -0400
committerJan Holesovsky <kendy@collabora.com>2021-02-23 15:21:52 +0100
commit99937777801d0fc9574d03c40369de166f601d9c (patch)
treead81d833fe8043b39a840dc548dbeb56f23dd5cb
parent97a9e3d99e0fea7a27d5f06d2d92e6c3c2549ca2 (diff)
lok: fix treeview action "select"
Unfortunately the Macros dialog has a treeview control that fill on demand and the position is absolute and it has a side effect to deselect the item since the relative entry position is nullptr. Change-Id: Ie442f6d634437a293cde65da0764d3f433a70155 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110963 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
-rw-r--r--vcl/jsdialog/executor.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 4c40109a5057..bca3d0a98ea7 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -242,11 +242,14 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
{
OString nRowString
= OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
- int nRow = std::atoi(nRowString.getStr());
-
pTreeView->unselect(pTreeView->get_selected_index());
- pTreeView->select(nRow);
- pTreeView->set_cursor(nRow);
+
+ int nAbsPos = std::atoi(nRowString.getStr());
+
+ std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator());
+ pTreeView->get_iter_abs_pos(*itEntry, nAbsPos);
+ pTreeView->select(*itEntry);
+ pTreeView->set_cursor(*itEntry);
LOKTrigger::trigger_changed(*pTreeView);
return true;
}