Skip to content

Commit aec5e1c

Browse files
committed
jsdialog: be sure we found entry for context menu in treeview
Fix regression from commit 0d18454 jsdialog: reduce unwanted containers after that patch we didn't get the entry because coordinates of the entry based on abs pos in the tree were negative Signed-off-by: Szymon Kłos <[email protected]> Change-Id: I6a9e2c7acb7f02231caaeac1a861321a3a235fb8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178962 Reviewed-by: Pranam Lashkari <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181526 Tested-by: Jenkins
1 parent 044c9a4 commit aec5e1c

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

sfx2/uiconfig/ui/templatepanel.ui

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
<property name="hexpand">True</property>
3030
<property name="vexpand">True</property>
3131
<property name="orientation">vertical</property>
32+
<property name="border-width">6</property>
33+
<property name="spacing">3</property>
3234
<child>
3335
<object class="GtkBox">
3436
<property name="visible">True</property>

vcl/jsdialog/executor.cxx

+4-1
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,10 @@ bool ExecuteAction(const OUString& nWindowId, const OUString& rWidget, StringMap
587587
pTreeView->scroll_to_row(*itEntry);
588588

589589
tools::Rectangle aRect = pTreeView->get_row_area(*itEntry);
590-
CommandEvent aCommand(aRect.Center(), CommandEventId::ContextMenu);
590+
Point aPoint = aRect.Center();
591+
assert(aPoint.getX() >= 0 && aPoint.getY() >= 0);
592+
593+
CommandEvent aCommand(aPoint, CommandEventId::ContextMenu);
591594

592595
LOKTrigger::trigger_popup_menu(*pTreeView, aCommand);
593596
}

vcl/jsdialog/jsdialogbuilder.cxx

+2
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,8 @@ OUString JSMenu::popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rR
19891989
std::unique_ptr<weld::TreeIter> itEntry(pTree->make_iterator());
19901990
if (pTree->get_dest_row_at_pos(rRect.Center(), itEntry.get(), false, false))
19911991
sCancelId = pTree->get_text(*itEntry);
1992+
else
1993+
SAL_WARN("vcl", "No entry detected in JSMenu::popup_at_rect");
19921994
}
19931995

19941996
m_pSender->sendMenu(m_pPopupMenu, pParent ? pParent->get_buildable_name() : "", sCancelId);

0 commit comments

Comments
 (0)