svx/source/dialog/srchdlg.cxx | 4 ++++ vcl/qt5/QtTools.cxx | 3 +++ 2 files changed, 7 insertions(+)
New commits: commit 2eeb0b2b51066d1cb535d3fadee79dd91b01eeb4 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu May 29 00:09:43 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri May 30 07:45:11 2025 +0200 tdf#130857 svx: Keep current search term in find dialog In a WIP branch declaring support for using native Qt widgets for the "Tools" -> "Find and Replace" dialog, the scenario 1) open the dialog using "Tools" -> "Find and Replace" 2) enter "foo" in the "Find" combobox 3) press "Replace All" button 4) enter "bar" in the "Find combobox" 5) press "Replace All" button 6) repeat steps 2-5 a few times would sometimes result in the current search term ("foo" or "bar") getting replaced with the previous one after pressing the "Replace All" button. This is because SvxSearchDialog::Remember_Impl was removing the entry for the current search term from the combobox and then reinserting it at index 0. That would however not result in the "new" entry to automatically get selected for the Qt implementation in QtInstanceComboBox, while it seems to be the case for the GTK and VCL ones. Avoid the problem by skipping the removal and reinsertion if the current search term is already the first one among the combobox entries and in the vector of remembered search/replace terms. Change-Id: Ic1d002d414d5b75beb7a80e9ae7125e116a246f4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185987 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index d937e709c804..a4cb6da25c76 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -1598,6 +1598,10 @@ void SvxSearchDialog::Remember_Impl( const OUString &rStr, bool _bSearch ) // tdf#154818 - rearrange the search items const auto nPos = pListBox->find_text(rStr); + if (nPos == 0 && !pArr->empty() && pArr->at(0) == rStr) + // nothing to do, is already the first item + return; + if (nPos != -1) { pListBox->remove(nPos); commit 349c4c66ec36c53da162bb46438bdb9363f4d4ee Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed May 28 22:14:24 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri May 30 07:45:01 2025 +0200 tdf#130857 qt weld: Fix qtToVclStringWithAccelerator for empty string Return an empty string in qtToVclStringWithAccelerator when the input string is also an empty string. The previous logic resulted in "~" being returned because the initial index of 0 would never change. This resulted in the if(!m_xSearchComponent1PB->get_label().isEmpty() && bSearchComponent1 ) logic in SvxSearchDialog::Construct_Impl to return true and Buttons without text showing up in the Search and Replace dialog in a WIP branch adding support for that one for qt6 and SAL_VCL_QT_USE_WELDED_WIDGETS=1. Change-Id: Ie24c091676a36179471b8bd863d60838632de83b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185986 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtTools.cxx b/vcl/qt5/QtTools.cxx index fa264fe08d7c..18fb40191a13 100644 --- a/vcl/qt5/QtTools.cxx +++ b/vcl/qt5/QtTools.cxx @@ -357,6 +357,9 @@ QString vclToQtStringWithAccelerator(const OUString& rText) OUString qtToVclStringWithAccelerator(const QString& rText) { + if (rText.isEmpty()) + return OUString(); + // find and replace single "&" used for accelerator qsizetype nIndex = 0; while (nIndex < rText.size())