1 /* 2 SPDX-FileCopyrightText: 2004 Reinhold Kainhofer <reinhold@kainhofer.com> 3 4 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 5 */ 6 7 #pragma once 8 9 #include "calendarsupport_export.h" 10 #include "calprintpluginbase.h" 11 #include "ui_calprintjournalconfig_base.h" 12 13 namespace CalendarSupport 14 { 15 class CalPrintJournal : public CalPrintPluginBase 16 { 17 public: CalPrintJournal()18 CalPrintJournal() 19 : CalPrintPluginBase() 20 { 21 } 22 ~CalPrintJournal()23 ~CalPrintJournal() override 24 { 25 } 26 groupName()27 Q_REQUIRED_RESULT QString groupName() const override 28 { 29 return QStringLiteral("Print journal"); 30 } 31 description()32 Q_REQUIRED_RESULT QString description() const override 33 { 34 return i18n("Print &journal"); 35 } 36 info()37 Q_REQUIRED_RESULT QString info() const override 38 { 39 return i18n("Prints all journals for a given date range"); 40 } 41 42 QWidget *createConfigWidget(QWidget *) override; sortID()43 Q_REQUIRED_RESULT int sortID() const override 44 { 45 return CalPrinterBase::Journallist; 46 } 47 enabled()48 Q_REQUIRED_RESULT bool enabled() const override 49 { 50 return true; 51 } 52 53 public: 54 void print(QPainter &p, int width, int height) override; 55 void readSettingsWidget() override; 56 void setSettingsWidget() override; 57 void doLoadConfig() override; 58 void doSaveConfig() override; 59 void setDateRange(const QDate &from, const QDate &to) override; 60 61 protected: 62 63 /** 64 Draws single journal item. 65 66 Obeys configuration options #mExcludeConfidential, #excludePrivate. 67 @param journal The item to be printed. 68 @param p QPainter of the printout 69 @param x x-coordinate of the upper left coordinate of the first item 70 @param y y-coordinate of the upper left coordinate of the first item 71 @param width width of the whole list 72 @param pageHeight Total height allowed for the list on a page. If an item 73 would be below that line, a new page is started. 74 */ 75 void drawJournal(const KCalendarCore::Journal::Ptr &journal, QPainter &p, int x, int &y, int width, int pageHeight); 76 bool mUseDateRange; 77 }; 78 79 class CalPrintJournalConfig : public QWidget, public Ui::CalPrintJournalConfig_Base 80 { 81 public: CalPrintJournalConfig(QWidget * parent)82 explicit CalPrintJournalConfig(QWidget *parent) 83 : QWidget(parent) 84 { 85 setupUi(this); 86 } 87 }; 88 } 89 90