summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-03-23 11:25:10 +0000
committerXisco Fauli <xiscofauli@libreoffice.org>2023-04-07 18:43:25 +0200
commitcf48e0236e0f1f5d2479573d73ec0f5325164406 (patch)
treec7a6110d77be7a3bd8243b02c7b1c475c7ba4aab
parentRelated: tdf#153628 too many "Activate" calls with gtk (diff)
downloadcore-cf48e0236e0f1f5d2479573d73ec0f5325164406.tar.gz
core-cf48e0236e0f1f5d2479573d73ec0f5325164406.zip
tdf#154322 select the first entry of the current page by default
rather than default to nothing selected, if we switch pages and then back to page 1 this will be selected anyway, so start off that way Change-Id: Ia684a5e44b12c984df3920f18b34c99693a2702c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149428 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--svx/source/form/datanavi.cxx13
-rw-r--r--svx/source/inc/datanavi.hxx1
2 files changed, 14 insertions, 0 deletions
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 5d3242e84683..635e55cdf2ab 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -189,6 +189,15 @@ namespace svxform
m_xItemList->clear();
}
+ void XFormsPage::SelectFirstEntry()
+ {
+ if (m_xItemList->get_iter_first(*m_xScratchIter))
+ {
+ m_xItemList->select(*m_xScratchIter);
+ ItemSelectHdl(*m_xItemList);
+ }
+ }
+
XFormsPage::XFormsPage(weld::Container* pPage, DataNavigatorWindow* _pNaviWin, DataGroupType _eGroup)
: BuilderPage(pPage, nullptr, "svx/ui/xformspage.ui", "XFormsPage")
, m_pParent(pPage)
@@ -1316,6 +1325,10 @@ namespace svxform
// load xforms models of the current document
LoadModels();
+
+ // tdf#154322 select the first entry of the current page by default
+ if (XFormsPage* pPage = GetPage(sPageId))
+ pPage->SelectFirstEntry();
}
DataNavigatorWindow::~DataNavigatorWindow()
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index b165b9a94531..fe26bd27b407 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -237,6 +237,7 @@ namespace svxform
bool DoMenuAction(std::string_view rMenuID);
void EnableMenuItems();
+ void SelectFirstEntry();
const OUString& GetInstanceName() const { return m_sInstanceName; }
const OUString& GetInstanceURL() const { return m_sInstanceURL; }