diff options
author | Attila Szűcs <attila.szucs@collabora.com> | 2023-05-03 04:30:55 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2023-05-12 17:25:36 +0200 |
commit | 6be76f54a4e94b952975dfded25afff60257c6dd (patch) | |
tree | 0ce548afcf166c2eeb375a0df0c7bb98b1410b8a /vcl/jsdialog | |
parent | 59b0153d93d0cbc3dffd1e5d7df125c5f0360497 (diff) |
LOK: Navi-4 tree dblclick
Removed sendUpdate that was called 1/sec, so selection dont revert 1/sec.
Put sendUpdate into set_cursor(), that seems to be a better spot.
Fixed set_cursor usage in executor, that caused slection to not work
in dblclick at all.
Because set_cursor(int) use not absolute position, but relative to parent
And root was used as parent, so it picked SwContent from the 1. lvl,
but the 1. lvl items are not real items, just SwContentTypes ..
e.g.:Headings.. that cannot be activated.. so never happened anything.
Change-Id: Iea373af3a0832a4f97202122bd36022eddf26efe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151308
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151703
Tested-by: Jenkins
Diffstat (limited to 'vcl/jsdialog')
-rw-r--r-- | vcl/jsdialog/executor.cxx | 10 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 35 |
2 files changed, 41 insertions, 4 deletions
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx index 2784acf0cae8..af514bc70dde 100644 --- a/vcl/jsdialog/executor.cxx +++ b/vcl/jsdialog/executor.cxx @@ -441,7 +441,8 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator()); pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); pTreeView->select(*itEntry); - pTreeView->set_cursor(*itEntry); + pTreeView->set_cursor_without_notify(*itEntry); + pTreeView->grab_focus(); LOKTrigger::trigger_changed(*pTreeView); return true; } @@ -450,8 +451,11 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap sal_Int32 nRow = o3tl::toInt32(rData["data"]); pTreeView->unselect_all(); + std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator()); + pTreeView->get_iter_abs_pos(*itEntry, nRow); pTreeView->select(nRow); - pTreeView->set_cursor(nRow); + pTreeView->set_cursor_without_notify(*itEntry); + pTreeView->grab_focus(); LOKTrigger::trigger_changed(*pTreeView); LOKTrigger::trigger_row_activated(*pTreeView); return true; @@ -461,6 +465,8 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap sal_Int32 nAbsPos = o3tl::toInt32(rData["data"]); std::unique_ptr<weld::TreeIter> itEntry(pTreeView->make_iterator()); pTreeView->get_iter_abs_pos(*itEntry, nAbsPos); + pTreeView->set_cursor_without_notify(*itEntry); + pTreeView->grab_focus(); pTreeView->expand_row(*itEntry); return true; } diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index ed3a0893dbcb..a3c55e28ddfb 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -2016,16 +2016,47 @@ void JSTreeView::clear() sendUpdate(); } +void JSTreeView::set_cursor_without_notify(const weld::TreeIter& rIter) +{ + SalInstanceTreeView::set_cursor(rIter); +} + +void JSTreeView::set_cursor(const weld::TreeIter& rIter) +{ + SalInstanceTreeView::set_cursor(rIter); + sendUpdate(); +} + +void JSTreeView::set_cursor(int pos) +{ + SalInstanceTreeView::set_cursor(pos); + sendUpdate(); +} + void JSTreeView::expand_row(const weld::TreeIter& rIter) { + bool bNotify = false; + const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter); + if (!m_xTreeView->IsExpanded(rVclIter.iter)) + bNotify = true; + SalInstanceTreeView::expand_row(rIter); - sendUpdate(); + + if (bNotify) + sendUpdate(); } void JSTreeView::collapse_row(const weld::TreeIter& rIter) { + bool bNotify = false; + const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter); + if (m_xTreeView->IsExpanded(rVclIter.iter)) + bNotify = true; + SalInstanceTreeView::collapse_row(rIter); - sendUpdate(); + + if (bNotify) + sendUpdate(); } JSExpander::JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander, |