[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - vcl/source
Juergen Funk (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 16 09:35:11 UTC 2020
vcl/source/window/printdlg.cxx | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
New commits:
commit edc33e9d0f05f3717a5f450c60d5f538fdb89c6e
Author: Juergen Funk <juergen.funk_ml at cib.de>
AuthorDate: Fri Sep 4 10:53:44 2020 +0200
Commit: Juergen Funk <juergen.funk_ml at cib.de>
CommitDate: Wed Sep 16 11:34:35 2020 +0200
tdf#127932 fix wrong page number in print progress
- in ctor, reset start pages to non-inflated value after size
calculation
- update label, _then_ progress in setProgress()
trac#33592
Change-Id: I66576e339de814922512b68167e6c0a9b1025378
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102031
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
(cherry picked from commit 63bf8f042abe3c0f6989f6763d13f5389182b816)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102281
Tested-by: Jenkins
(cherry picked from commit 72c1c84e14ffc8127f24930066220e7c7b28a970)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102832
Tested-by: Juergen Funk <juergen.funk_ml at cib.de>
Reviewed-by: Juergen Funk <juergen.funk_ml at cib.de>
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index b59bfc17dfe3..c4cf4977b41a 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1972,6 +1972,15 @@ void PrintDialog::previewBackward()
mpPageEdit->Down();
}
+
+static OUString getNewLabel(const OUString& aLabel, int i_nCurr, int i_nMax)
+{
+ OUString aNewText( aLabel.replaceFirst( "%p", OUString::number( i_nCurr ) ) );
+ aNewText = aNewText.replaceFirst( "%n", OUString::number( i_nMax ) );
+
+ return aNewText;
+}
+
// PrintProgressDialog
PrintProgressDialog::PrintProgressDialog(vcl::Window* i_pParent, int i_nMax)
@@ -1991,9 +2000,7 @@ PrintProgressDialog::PrintProgressDialog(vcl::Window* i_pParent, int i_nMax)
//just multiply largest value by 10 and take the width of that string as
//the max size we will want
- OUString aNewText( searchAndReplace( maStr, "%p", 2, OUString::number( mnMax * 10 ) ) );
- aNewText = searchAndReplace( aNewText, "%n", 2, OUString::number( mnMax * 10 ) );
- mpText->SetText( aNewText );
+ mpText->SetText( getNewLabel(maStr, mnMax * 10, mnMax * 10) );
mpText->set_width_request(mpText->get_preferred_size().Width());
//Pick a useful max width
@@ -2001,6 +2008,7 @@ PrintProgressDialog::PrintProgressDialog(vcl::Window* i_pParent, int i_nMax)
mpButton->SetClickHdl( LINK( this, PrintProgressDialog, ClickHdl ) );
+ mpText->SetText( getNewLabel(maStr, mnMax, mnMax) );
}
PrintProgressDialog::~PrintProgressDialog()
@@ -2029,11 +2037,9 @@ void PrintProgressDialog::setProgress( int i_nCurrent )
if( mnMax < 1 )
mnMax = 1;
- mpProgress->SetValue(mnCur*100/mnMax);
+ mpText->SetText( getNewLabel(maStr, mnCur, mnMax) );
- OUString aNewText( searchAndReplace( maStr, "%p", 2, OUString::number( mnCur ) ) );
- aNewText = searchAndReplace( aNewText, "%n", 2, OUString::number( mnMax ) );
- mpText->SetText( aNewText );
+ mpProgress->SetValue(mnCur*100/mnMax);
}
void PrintProgressDialog::tick()
More information about the Libreoffice-commits
mailing list