diff -u -r --new-file calendarsupport-20.08.3.orig/src/printing/calprintdefaultplugins.cpp calendarsupport-20.08.3/src/printing/calprintdefaultplugins.cpp --- calendarsupport-20.08.3.orig/src/printing/calprintdefaultplugins.cpp 2020-10-10 14:56:21.000000000 -0500 +++ calendarsupport-20.08.3/src/printing/calprintdefaultplugins.cpp 2020-11-21 13:57:32.443012469 -0600 @@ -1,28 +1,12 @@ /* - Copyright (c) 1998 Preston Brown - Copyright (C) 2003 Reinhold Kainhofer - Copyright (c) 2003 Cornelius Schumacher - Copyright (c) 2008 Ron Goodheart - Copyright (C) 2010-2020 Laurent Montel - Copyright (c) 2012-2013 Allen Winter - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - As a special exception, permission is given to link this program - with any edition of Qt, and distribute the resulting executable, - without including the source code for Qt in the source distribution. + SPDX-FileCopyrightText: 1998 Preston Brown + SPDX-FileCopyrightText: 2003 Reinhold Kainhofer + SPDX-FileCopyrightText: 2003 Cornelius Schumacher + SPDX-FileCopyrightText: 2008 Ron Goodheart + SPDX-FileCopyrightText: 2010-2020 Laurent Montel + SPDX-FileCopyrightText: 2012-2013 Allen Winter + + SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 */ #include "calprintdefaultplugins.h" @@ -40,7 +24,6 @@ #include #include -#include using namespace CalendarSupport; @@ -69,7 +52,7 @@ void CalPrintIncidence::readSettingsWidget() { - CalPrintIncidenceConfig *cfg + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { mUseColors = cfg->mColors->isChecked(); @@ -84,7 +67,7 @@ void CalPrintIncidence::setSettingsWidget() { - CalPrintIncidenceConfig *cfg + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { cfg->mColors->setChecked(mUseColors); @@ -205,7 +188,7 @@ bool visit(const KCalendarCore::FreeBusy::Ptr &fb) override { - Q_UNUSED(fb); + Q_UNUSED(fb) return true; } }; @@ -688,7 +671,7 @@ void CalPrintDay::readSettingsWidget() { - CalPrintDayConfig *cfg + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { mFromDate = cfg->mFromDate->date(); @@ -720,7 +703,7 @@ void CalPrintDay::setSettingsWidget() { - CalPrintDayConfig *cfg = dynamic_cast((QWidget *)mConfigWidget); + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { cfg->mFromDate->setDate(mFromDate); cfg->mToDate->setDate(mToDate); @@ -793,7 +776,7 @@ void CalPrintDay::setDateRange(const QDate &from, const QDate &to) { CalPrintPluginBase::setDateRange(from, to); - CalPrintDayConfig *cfg + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { cfg->mFromDate->setDate(from); @@ -821,7 +804,7 @@ QString line1 = local.toString(mFromDate, QLocale::ShortFormat); QString line2 = local.toString(mToDate, QLocale::ShortFormat); QString title; - if (orientation() == QPrinter::Landscape) { + if (orientation() == QPageLayout::Landscape) { title = i18nc("date from-to", "%1 - %2", line1, line2); } else { title = i18nc("date from-\nto", "%1 -\n%2", line1, line2); @@ -967,7 +950,7 @@ void CalPrintWeek::readSettingsWidget() { - CalPrintWeekConfig *cfg = dynamic_cast((QWidget *)mConfigWidget); + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { mFromDate = cfg->mFromDate->date(); mToDate = cfg->mToDate->date(); @@ -999,7 +982,7 @@ void CalPrintWeek::setSettingsWidget() { - CalPrintWeekConfig *cfg = dynamic_cast((QWidget *)mConfigWidget); + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { cfg->mFromDate->setDate(mFromDate); cfg->mToDate->setDate(mToDate); @@ -1066,21 +1049,21 @@ } } -QPrinter::Orientation CalPrintWeek::defaultOrientation() const +QPageLayout::Orientation CalPrintWeek::defaultOrientation() const { if (mWeekPrintType == Filofax) { - return QPrinter::Portrait; + return QPageLayout::Portrait; } else if (mWeekPrintType == SplitWeek) { - return QPrinter::Portrait; + return QPageLayout::Portrait; } else { - return QPrinter::Landscape; + return QPageLayout::Landscape; } } void CalPrintWeek::setDateRange(const QDate &from, const QDate &to) { CalPrintPluginBase::setDateRange(from, to); - CalPrintWeekConfig *cfg + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { cfg->mFromDate->setDate(from); @@ -1115,7 +1098,7 @@ do { line1 = local.toString(curWeek.addDays(-6), QLocale::ShortFormat); line2 = local.toString(curWeek, QLocale::ShortFormat); - if (orientation() == QPrinter::Landscape) { + if (orientation() == QPageLayout::Landscape) { title = i18nc("date from-to", "%1 - %2", line1, line2); } else { title = i18nc("date from-\nto", "%1 -\n%2", line1, line2); @@ -1142,7 +1125,7 @@ do { line1 = local.toString(curWeek.addDays(-6), QLocale::ShortFormat); line2 = local.toString(curWeek, QLocale::ShortFormat); - if (orientation() == QPrinter::Landscape) { + if (orientation() == QPageLayout::Landscape) { title = i18nc("date from - to (week number)", "%1 - %2 (Week %3)", line1, line2, curWeek.weekNumber()); } else { @@ -1228,7 +1211,7 @@ void CalPrintMonth::readSettingsWidget() { - CalPrintMonthConfig *cfg = dynamic_cast((QWidget *)mConfigWidget); + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { mFromDate = QDate(cfg->mFromYear->value(), cfg->mFromMonth->currentIndex() + 1, 1); @@ -1250,7 +1233,7 @@ void CalPrintMonth::setSettingsWidget() { - CalPrintMonthConfig *cfg = dynamic_cast((QWidget *)mConfigWidget); + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { setDateRange(mFromDate, mToDate); @@ -1306,7 +1289,7 @@ void CalPrintMonth::setDateRange(const QDate &from, const QDate &to) { CalPrintPluginBase::setDateRange(from, to); - CalPrintMonthConfig *cfg + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { cfg->mFromMonth->clear(); @@ -1389,7 +1372,7 @@ void CalPrintTodos::readSettingsWidget() { - CalPrintTodoConfig *cfg = dynamic_cast((QWidget *)mConfigWidget); + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { mPageTitle = cfg->mTitle->text(); @@ -1425,7 +1408,7 @@ void CalPrintTodos::setSettingsWidget() { - CalPrintTodoConfig *cfg + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { cfg->mTitle->setText(mPageTitle); diff -u -r --new-file calendarsupport-20.08.3.orig/src/printing/calprintdefaultplugins.h calendarsupport-20.08.3/src/printing/calprintdefaultplugins.h --- calendarsupport-20.08.3.orig/src/printing/calprintdefaultplugins.h 2020-10-10 14:56:21.000000000 -0500 +++ calendarsupport-20.08.3/src/printing/calprintdefaultplugins.h 2020-11-21 16:02:29.289180174 -0600 @@ -69,9 +69,9 @@ } QWidget *createConfigWidget(QWidget *) override; - Q_REQUIRED_RESULT QPrinter::Orientation defaultOrientation() const override + Q_REQUIRED_RESULT QPageLayout::Orientation defaultOrientation() const override { - return QPrinter::Portrait; + return QPageLayout::Portrait; } public: @@ -182,7 +182,7 @@ /** Returns the default orientation for the eWeekPrintType. */ - QPrinter::Orientation defaultOrientation() const override; + QPageLayout::Orientation defaultOrientation() const override; public: void print(QPainter &p, int width, int height) override; @@ -238,9 +238,9 @@ } QWidget *createConfigWidget(QWidget *) override; - QPrinter::Orientation defaultOrientation() const override + QPageLayout::Orientation defaultOrientation() const override { - return QPrinter::Landscape; + return QPageLayout::Landscape; } public: diff -u -r --new-file calendarsupport-20.08.3.orig/src/printing/calprinter.cpp calendarsupport-20.08.3/src/printing/calprinter.cpp --- calendarsupport-20.08.3.orig/src/printing/calprinter.cpp 2020-10-10 14:56:21.000000000 -0500 +++ calendarsupport-20.08.3/src/printing/calprinter.cpp 2020-11-21 16:02:29.290180174 -0600 @@ -39,7 +39,6 @@ #include #include #include -#include #include @@ -142,13 +141,13 @@ QPrinter printer; switch (dlgorientation) { case eOrientPlugin: - printer.setOrientation(selectedStyle->defaultOrientation()); + printer.setPageOrientation(selectedStyle->defaultOrientation()); break; case eOrientPortrait: - printer.setOrientation(QPrinter::Portrait); + printer.setPageOrientation(QPageLayout::Portrait); break; case eOrientLandscape: - printer.setOrientation(QPrinter::Landscape); + printer.setPageOrientation(QPageLayout::Landscape); break; case eOrientPrinter: break; @@ -182,7 +181,7 @@ setWindowTitle(i18nc("@title:window", "Print")); QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - QVBoxLayout *mainLayout = new QVBoxLayout(this); + auto *mainLayout = new QVBoxLayout(this); mOkButton = buttonBox->button(QDialogButtonBox::Ok); mOkButton->setDefault(true); mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return); @@ -190,12 +189,12 @@ connect(buttonBox, &QDialogButtonBox::rejected, this, &CalPrintDialog::reject); setModal(true); QWidget *page = new QWidget(this); - QVBoxLayout *pageVBoxLayout = new QVBoxLayout(page); + auto *pageVBoxLayout = new QVBoxLayout(page); pageVBoxLayout->setContentsMargins(0, 0, 0, 0); mainLayout->addWidget(page); mainLayout->addWidget(buttonBox); - QSplitter *splitter = new QSplitter(page); + auto *splitter = new QSplitter(page); pageVBoxLayout->addWidget(splitter); splitter->setOrientation(Qt::Horizontal); splitter->setChildrenCollapsible(false); @@ -204,7 +203,7 @@ mTypeGroup = new QButtonGroup(typeBox); QWidget *splitterRight = new QWidget(splitter); - QGridLayout *splitterRightLayout = new QGridLayout(splitterRight); + auto *splitterRightLayout = new QGridLayout(splitterRight); splitterRightLayout->setContentsMargins(0, 0, 0, 0); //splitterRightLayout->setMargin( marginHint() ); //splitterRightLayout->setSpacing( spacingHint() ); diff -u -r --new-file calendarsupport-20.08.3.orig/src/printing/calprintpluginbase.cpp calendarsupport-20.08.3/src/printing/calprintpluginbase.cpp --- calendarsupport-20.08.3.orig/src/printing/calprintpluginbase.cpp 2020-10-10 14:56:21.000000000 -0500 +++ calendarsupport-20.08.3/src/printing/calprintpluginbase.cpp 2020-11-21 16:02:29.290180174 -0600 @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -112,7 +111,7 @@ happens on the given day */ bool overlaps(CellItem *o) const override { - PrintCellItem *other = static_cast(o); + auto *other = static_cast(o); return !(other->start() >= end() || other->end() <= start()); } @@ -144,7 +143,7 @@ QWidget *CalPrintPluginBase::createConfigWidget(QWidget *w) { QFrame *wdg = new QFrame(w); - QVBoxLayout *layout = new QVBoxLayout(wdg); + auto *layout = new QVBoxLayout(wdg); QLabel *title = new QLabel(description(), wdg); QFont titleFont(title->font()); @@ -248,9 +247,9 @@ mPrintFooter = printFooter; } -QPrinter::Orientation CalPrintPluginBase::orientation() const +QPageLayout::Orientation CalPrintPluginBase::orientation() const { - return mPrinter ? mPrinter->orientation() : QPrinter::Portrait; + return mPrinter ? mPrinter->pageLayout().orientation() : QPageLayout::Portrait; } QColor CalPrintPluginBase::getTextColor(const QColor &c) const @@ -342,7 +341,7 @@ { if (mHeaderHeight >= 0) { return mHeaderHeight; - } else if (orientation() == QPrinter::Portrait) { + } else if (orientation() == QPageLayout::Portrait) { return PORTRAIT_HEADER_HEIGHT; } else { return LANDSCAPE_HEADER_HEIGHT; @@ -372,7 +371,7 @@ if (mFooterHeight >= 0) { return mFooterHeight; - } else if (orientation() == QPrinter::Portrait) { + } else if (orientation() == QPageLayout::Portrait) { return PORTRAIT_FOOTER_HEIGHT; } else { return LANDSCAPE_FOOTER_HEIGHT; @@ -961,7 +960,7 @@ QListIterator it2(cells); while (it2.hasNext()) { - PrintCellItem *placeItem = static_cast(it2.next()); + auto *placeItem = static_cast(it2.next()); drawAgendaItem(placeItem, p, startPrintDate, endPrintDate, minlen, box, includeDescription, excludeTime); } @@ -1673,7 +1672,7 @@ QFont oldfont(p.font()); p.setFont(QFont(QStringLiteral("sans-serif"), 7)); while (it1.hasNext()) { - PrintCellItem *placeItem = static_cast(it1.next()); + auto *placeItem = static_cast(it1.next()); int minsToStart = starttime.secsTo(placeItem->start()) / 60; int minsToEnd = starttime.secsTo(placeItem->end()) / 60; diff -u -r --new-file calendarsupport-20.08.3.orig/src/printing/calprintpluginbase.h calendarsupport-20.08.3/src/printing/calprintpluginbase.h --- calendarsupport-20.08.3.orig/src/printing/calprintpluginbase.h 2020-10-10 14:56:21.000000000 -0500 +++ calendarsupport-20.08.3/src/printing/calprintpluginbase.h 2020-11-21 16:02:29.290180174 -0600 @@ -123,7 +123,7 @@ */ static int weekdayColumn(int weekday); - QPrinter::Orientation orientation() const; + QPageLayout::Orientation orientation() const; /** Returns the height of the page header. If the height was explicitly set using setHeaderHeight, that value is returned, otherwise a diff -u -r --new-file calendarsupport-20.08.3.orig/src/printing/printplugin.h calendarsupport-20.08.3/src/printing/printplugin.h --- calendarsupport-20.08.3.orig/src/printing/printplugin.h 2020-10-10 14:56:21.000000000 -0500 +++ calendarsupport-20.08.3/src/printing/printplugin.h 2020-11-21 16:02:29.290180174 -0600 @@ -153,9 +153,9 @@ config settings), implement this function in your subclass and return the desired orientation. */ - virtual QPrinter::Orientation defaultOrientation() const + virtual QPageLayout::Orientation defaultOrientation() const { - return QPrinter::Portrait; + return QPageLayout::Portrait; } /** diff -u -r --new-file calendarsupport-20.08.3.orig/src/printing/yearprint.cpp calendarsupport-20.08.3/src/printing/yearprint.cpp --- calendarsupport-20.08.3.orig/src/printing/yearprint.cpp 2020-10-10 14:56:21.000000000 -0500 +++ calendarsupport-20.08.3/src/printing/yearprint.cpp 2020-11-21 13:57:32.444012470 -0600 @@ -1,23 +1,7 @@ /* - Copyright (C) 2004 Reinhold Kainhofer + SPDX-FileCopyrightText: 2004 Reinhold Kainhofer - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - As a special exception, permission is given to link this program - with any edition of Qt, and distribute the resulting executable, - without including the source code for Qt in the source distribution. + SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 */ #include "yearprint.h" @@ -38,7 +22,7 @@ void CalPrintYear::readSettingsWidget() { - CalPrintYearConfig *cfg = dynamic_cast((QWidget *)mConfigWidget); + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { mYear = cfg->mYear->value(); mPages = cfg->mPages->currentText().toInt(); @@ -49,7 +33,7 @@ void CalPrintYear::setSettingsWidget() { - CalPrintYearConfig *cfg + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { QDate start(mYear, 1, 1); @@ -98,15 +82,15 @@ } } -QPrinter::Orientation CalPrintYear::defaultOrientation() const +QPageLayout::Orientation CalPrintYear::defaultOrientation() const { - return (mPages == 1) ? QPrinter::Landscape : QPrinter::Portrait; + return (mPages == 1) ? QPageLayout::Landscape : QPageLayout::Portrait; } void CalPrintYear::setDateRange(const QDate &from, const QDate &to) { CalPrintPluginBase::setDateRange(from, to); - CalPrintYearConfig *cfg = dynamic_cast((QWidget *)mConfigWidget); + auto *cfg = dynamic_cast((QWidget *)mConfigWidget); if (cfg) { cfg->mYear->setValue(from.year()); } @@ -147,7 +131,7 @@ QString stdate = locale.toString(start, QLocale::ShortFormat); QString endate = locale.toString(end, QLocale::ShortFormat); QString title; - if (orientation() == QPrinter::Landscape) { + if (orientation() == QPageLayout::Landscape) { title = i18nc("date from - to", "%1 - %2", stdate, endate); } else { title = i18nc("date from -\nto", "%1 -\n%2", stdate, endate); diff -u -r --new-file calendarsupport-20.08.3.orig/src/printing/yearprint.h calendarsupport-20.08.3/src/printing/yearprint.h --- calendarsupport-20.08.3.orig/src/printing/yearprint.h 2020-10-10 14:56:21.000000000 -0500 +++ calendarsupport-20.08.3/src/printing/yearprint.h 2020-11-21 16:02:29.291180174 -0600 @@ -64,7 +64,7 @@ } QWidget *createConfigWidget(QWidget *) override; - Q_REQUIRED_RESULT QPrinter::Orientation defaultOrientation() const override; + Q_REQUIRED_RESULT QPageLayout::Orientation defaultOrientation() const override; public: void print(QPainter &p, int width, int height) override;