[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 28 14:26:30 UTC 2020
sw/source/uibase/inc/navipi.hxx | 1 +
sw/source/uibase/utlui/navipi.cxx | 21 ++++++++++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
New commits:
commit 021019e0310363daed12d4a006e1785e3184c33e
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jul 28 12:33:15 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jul 28 16:25:47 2020 +0200
tdf#134959 move focus on activate, but leave focus on value-changed
if the user presses enter to activate the Entry try to go to the page, and on
success we move focus to the document.
if the SpinButton changed value a Timer was launched, when it times-out, move
to the desired page, but leave focus where it currently is, i.e. typically
remaining in the spinbutton, or whatever other widget the user moved to in the
meantime
This replaces always grabbing focus to the document on a page-change and
re-grabbing focus back to the spinbutton.
Change-Id: I597597aedb1753aee755671a2a55779ca6196c09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99595
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx
index 14e066c73380..fee94525d577 100644
--- a/sw/source/uibase/inc/navipi.hxx
+++ b/sw/source/uibase/inc/navipi.hxx
@@ -107,6 +107,7 @@ class SwNavigationPI : public PanelLayout
DECL_LINK( GlobalMenuSelectHdl, const OString&, void );
DECL_LINK( ChangePageHdl, Timer*, void );
DECL_LINK( PageEditModifyHdl, weld::SpinButton&, void );
+ DECL_LINK( EditActionHdl, weld::Entry&, bool );
bool EditAction();
void UsePage();
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 0e3af56e48ec..577aba8fc645 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -412,13 +412,7 @@ bool SwNavigationPI::EditAction()
SwWrtShell &rSh = m_pCreateView->GetWrtShell();
sal_uInt16 nNewPage = m_xEdit->get_value();
- sal_uInt16 nPhyPage, nVirPage;
- rSh.GetPageNum(nPhyPage, nVirPage);
- if (nPhyPage == nNewPage)
- return false;
-
rSh.GotoPage(nNewPage, true);
- m_pCreateView->GetEditWin().GrabFocus();
m_pCreateView->GetViewFrame()->GetBindings().Invalidate(FN_STAT_PAGE);
return true;
@@ -554,6 +548,7 @@ SwNavigationPI::SwNavigationPI(vcl::Window* pParent,
// Insert the numeric field in the toolbox.
m_xEdit->set_accessible_name(m_xEdit->get_tooltip_text());
m_xEdit->set_width_chars(3);
+ m_xEdit->connect_activate(LINK(this, SwNavigationPI, EditActionHdl));
m_xEdit->connect_value_changed(LINK(this, SwNavigationPI, PageEditModifyHdl));
m_xEdit->set_help_id("modules/swriter/ui/navigatorpanel/numericfield");
@@ -1054,8 +1049,20 @@ IMPL_LINK_NOARG(SwNavigationPI, ChangePageHdl, Timer *, void)
{
if (IsDisposed())
return;
+ // tdf#134959 if the SpinButton changed value this Timer was launched, now
+ // change to the desired page, but we leave focus where it currently is,
+ // i.e. typically remaining in the spinbutton, or whatever other widget the
+ // user moved to in the meantime
+ EditAction();
+}
+
+IMPL_LINK_NOARG(SwNavigationPI, EditActionHdl, weld::Entry&, bool)
+{
+ // tdf#134959 if the user presses enter to activate the Entry
+ // go to the page, and on success we move focus to the document
if (EditAction())
- m_xEdit->grab_focus();
+ m_pCreateView->GetEditWin().GrabFocus();
+ return true;
}
IMPL_LINK_NOARG(SwNavigationPI, PageEditModifyHdl, weld::SpinButton&, void)
More information about the Libreoffice-commits
mailing list