rhbz#1773525 fix find&replace search save limit

f41
Caolán McNamara 5 years ago
parent 15ee3c2065
commit 11f6adddb4

@ -0,0 +1,49 @@
From d788f8d023bc323d6d392e9192af03fb37acc79d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 18 Nov 2019 12:42:41 +0000
Subject: [PATCH 1/2] rhbz#1773525 reducing the amount of saved search/replace
entries didn't work
Change-Id: I1512ef507130718859271079e603a95cf2105c58
---
svx/source/dialog/srchdlg.cxx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index 92fa6a1603ee..a2d2747e0221 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -149,7 +149,7 @@ struct SearchDlg_Impl
}
};
-static void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, weld::ComboBox& rCBox )
+static void ListToStrArr_Impl(sal_uInt16 nId, std::vector<OUString>& rStrLst, weld::ComboBox& rCBox, sal_uInt16 nRememberSize)
{
const SfxStringListItem* pSrchItem =
static_cast<const SfxStringListItem*>(SfxGetpApp()->GetItem( nId ));
@@ -158,6 +158,9 @@ static void ListToStrArr_Impl( sal_uInt16 nId, std::vector<OUString>& rStrLst, w
{
std::vector<OUString> aLst = pSrchItem->GetList();
+ if (aLst.size() > nRememberSize)
+ aLst.resize(nRememberSize);
+
for (const OUString & s : aLst)
{
rStrLst.push_back(s);
@@ -375,9 +378,9 @@ void SvxSearchDialog::Construct_Impl()
// Get stored search-strings from the application
ListToStrArr_Impl(SID_SEARCHDLG_SEARCHSTRINGS,
- aSearchStrings, *m_xSearchLB);
+ aSearchStrings, *m_xSearchLB, nRememberSize);
ListToStrArr_Impl(SID_SEARCHDLG_REPLACESTRINGS,
- aReplaceStrings, *m_xReplaceLB);
+ aReplaceStrings, *m_xReplaceLB, nRememberSize);
InitControls_Impl();
--
2.20.1

@ -0,0 +1,42 @@
From e60702efcc0e09dd386908c3c04e4d37a5b1d967 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 18 Nov 2019 13:44:46 +0000
Subject: [PATCH 2/2] rhbz#1773525 wrong elements removed from saved entries
when limit hit
Change-Id: Iaf8a012ffe927cbf38789e97b469d899e7cbf87b
---
svx/source/dialog/srchdlg.cxx | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index a2d2747e0221..85b5560b1558 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -1581,16 +1581,16 @@ void SvxSearchDialog::Remember_Impl( const OUString &rStr, bool _bSearch )
if (std::find(pArr->begin(), pArr->end(), rStr) != pArr->end())
return;
+ pArr->insert(pArr->begin(), rStr);
+ pListBox->insert_text(0, rStr);
+
// delete oldest entry at maximum occupancy (ListBox and Array)
- if(nRememberSize < pArr->size())
+ size_t nArrSize = pArr->size();
+ if (nArrSize > nRememberSize)
{
- pListBox->remove(static_cast<sal_uInt16>(nRememberSize - 1));
- (*pArr)[nRememberSize - 1] = rStr;
- pArr->erase(pArr->begin() + nRememberSize - 1);
+ pListBox->remove(nArrSize - 1);
+ pArr->erase(pArr->begin() + nArrSize - 1);
}
-
- pArr->insert(pArr->begin(), rStr);
- pListBox->insert_text(0, rStr);
}
void SvxSearchDialog::TemplatesChanged_Impl( SfxStyleSheetBasePool& rPool )
--
2.20.1

@ -54,7 +54,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice Name: libreoffice
Epoch: 1 Epoch: 1
Version: %{libo_version}.2 Version: %{libo_version}.2
Release: 2%{?libo_prerelease}%{?dist} Release: 3%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0 License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and MPLv2.0 and CC0
URL: http://www.libreoffice.org/ URL: http://www.libreoffice.org/
@ -245,6 +245,8 @@ Patch1: 0001-Resolves-rhbz-1432468-disable-opencl-by-default.patch
Patch2: 0001-Switch-mdds-to-1.5.0-and-liborcus-to-0.15.0.patch Patch2: 0001-Switch-mdds-to-1.5.0-and-liborcus-to-0.15.0.patch
Patch3: 0001-setting-has-default-true-on-an-element-in-a-GtkPopov.patch Patch3: 0001-setting-has-default-true-on-an-element-in-a-GtkPopov.patch
Patch4: 0001-Resolves-rhbz-1766990-starmath-might-not-be-availabl.patch Patch4: 0001-Resolves-rhbz-1766990-starmath-might-not-be-availabl.patch
Patch5: 0001-rhbz-1773525-reducing-the-amount-of-saved-search-rep.patch
Patch6: 0002-rhbz-1773525-wrong-elements-removed-from-saved-entri.patch
%if 0%{?rhel} %if 0%{?rhel}
# not upstreamed # not upstreamed
@ -2137,6 +2139,9 @@ done
%{_includedir}/LibreOfficeKit %{_includedir}/LibreOfficeKit
%changelog %changelog
* Mon Nov 18 2019 Caolán McNamara <caolanm@redhat.com> - 1:6.3.3.2-3
- rhbz#1773525 fix find&replace search save limit
* Sat Nov 02 2019 Pete Walter <pwalter@fedoraproject.org> - 1:6.3.3.2-2 * Sat Nov 02 2019 Pete Walter <pwalter@fedoraproject.org> - 1:6.3.3.2-2
- Rebuild for ICU 65 - Rebuild for ICU 65

Loading…
Cancel
Save