Commit 2215dc30 authored by Glen Ditchfield's avatar Glen Ditchfield 🐛
Browse files

Fix line breaks and duplication in printed headers

parent 204d42fa
Pipeline #68337 passed with stage
in 5 minutes and 36 seconds
......@@ -786,10 +786,10 @@ void CalPrintDay::print(QPainter &p, int width, int height)
QString line1 = local.toString(mFromDate, QLocale::ShortFormat);
QString line2 = local.toString(mToDate, QLocale::ShortFormat);
QString title;
if (orientation() == QPageLayout::Landscape) {
title = i18nc("date from-to", "%1 - %2", line1, line2);
if (mFromDate == mToDate) {
title = line1;
} else {
title = i18nc("date from-\nto", "%1 -\n%2", line1, line2);
title = i18nc("date from-to", "%1\u2013%2", line1, line2);
}
drawHeader(p, title, mFromDate, QDate(), headerBox);
if (mDayPrintType == Filofax) {
......@@ -1039,11 +1039,7 @@ void CalPrintWeek::print(QPainter &p, int width, int height)
do {
line1 = local.toString(curWeek.addDays(-6), QLocale::ShortFormat);
line2 = local.toString(curWeek, QLocale::ShortFormat);
if (orientation() == QPageLayout::Landscape) {
title = i18nc("date from-to", "%1 - %2", line1, line2);
} else {
title = i18nc("date from-\nto", "%1 -\n%2", line1, line2);
}
title = i18nc("date from-to", "%1\u2013%2", line1, line2);
drawHeader(p, title, curWeek.addDays(-6), QDate(), headerBox);
drawWeek(p, curWeek, mStartTime, mEndTime, weekBox, mSingleLineLimit, mShowNoteLines,
......@@ -1066,9 +1062,9 @@ void CalPrintWeek::print(QPainter &p, int width, int height)
line1 = local.toString(curWeek.addDays(-6), QLocale::ShortFormat);
line2 = local.toString(curWeek, QLocale::ShortFormat);
if (orientation() == QPageLayout::Landscape) {
title = i18nc("date from - to (week number)", "%1 - %2 (Week %3)", line1, line2, curWeek.weekNumber());
title = i18nc("date from - to (week number)", "%1\u2013%2 (Week %3)", line1, line2, curWeek.weekNumber());
} else {
title = i18nc("date from -\nto (week number)", "%1 -\n%2 (Week %3)", line1, line2, curWeek.weekNumber());
title = i18nc("date from - to\\n(week number)", "%1\u2013%2\n(Week %3)", line1, line2, curWeek.weekNumber());
}
drawHeader(p, title, curWeek, QDate(), headerBox);
......
......@@ -2233,13 +2233,13 @@ void CalPrintPluginBase::drawSplitHeaderRight(QPainter &p, QDate fd, QDate td, Q
QLocale locale;
if (fd.month() == td.month()) {
title = i18nc("Date range: Month dayStart - dayEnd",
"%1 %2 - %3",
"%1 %2\u2013%3",
locale.monthName(fd.month(), QLocale::LongFormat),
locale.toString(fd, QStringLiteral("dd")),
locale.toString(td, QStringLiteral("dd")));
} else {
title = i18nc("Date range: monthStart dayStart - monthEnd dayEnd",
"%1 %2 - %3 %4",
"%1 %2\u2013%3 %4",
locale.monthName(fd.month(), QLocale::LongFormat),
locale.toString(fd, QStringLiteral("dd")),
locale.monthName(td.month(), QLocale::LongFormat),
......
......@@ -139,12 +139,7 @@ void CalPrintYear::print(QPainter &p, int width, int height)
end = end.addDays(-1);
QString stdate = locale.toString(start, QLocale::ShortFormat);
QString endate = locale.toString(end, QLocale::ShortFormat);
QString title;
if (orientation() == QPageLayout::Landscape) {
title = i18nc("date from - to", "%1 - %2", stdate, endate);
} else {
title = i18nc("date from -\nto", "%1 -\n%2", stdate, endate);
}
QString title =i18nc("date from-to", "%1\u2013%2", stdate, endate);
drawHeader(p, title, start.addMonths(-1), start.addMonths(monthsPerPage), headerBox);
QRect monthesBox(headerBox);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment