keep m_nCursorIndex updated with the most recent used entry

so right clicking on the tree keeps current entry selected on re-focus
in

Change-Id: I25ecb11b8fefbff6464e02936b2a669c34c42b8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100852
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2020-08-17 09:59:29 +01:00
parent e1aea22f3f
commit 15e75a08a2

View File

@@ -75,10 +75,10 @@ void OTasksWindow::updateHelpText()
IMPL_LINK(OTasksWindow, onSelected, weld::TreeView&, rTreeView, bool)
{
int nCurEntry = rTreeView.get_cursor_index();
assert(nCurEntry != -1 && "OTasksWindow::onSelected: invalid entry!");
m_nCursorIndex = rTreeView.get_cursor_index();
assert(m_nCursorIndex != -1 && "OTasksWindow::onSelected: invalid entry!");
URL aCommand;
aCommand.Complete = reinterpret_cast<TaskEntry*>(rTreeView.get_id(nCurEntry).toUInt64())->sUNOCommand;
aCommand.Complete = reinterpret_cast<TaskEntry*>(rTreeView.get_id(m_nCursorIndex).toUInt64())->sUNOCommand;
getDetailView()->getBorderWin().getView()->getAppController().executeChecked( aCommand, Sequence< PropertyValue >() );
return true;
@@ -105,6 +105,7 @@ IMPL_LINK_NOARG(OTasksWindow, FocusOutHdl, weld::Widget&, void)
IMPL_LINK_NOARG(OTasksWindow, OnEntrySelectHdl, weld::TreeView&, void)
{
m_nCursorIndex = m_xTreeView->get_cursor_index();
updateHelpText();
}