CalendarSupport

calprinter.h
1/*
2 SPDX-FileCopyrightText: 1998 Preston Brown <pbrown@kde.org>
3 SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
4
5 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
6*/
7#pragma once
8
9#include "calendarsupport_export.h"
10#include "printplugin.h"
11
12#include <QComboBox>
13#include <QDialog>
14#include <QPushButton>
15class QButtonGroup;
16class QStackedWidget;
17
18namespace CalendarSupport
19{
20/**
21 CalPrinter is a class for printing Calendars. It can print in several
22 different formats (day, week, month). It also provides a way for setting
23 up the printer and remembering these preferences.
24*/
25class CALENDARSUPPORT_EXPORT CalPrinter : public QObject, public CalPrinterBase
26{
27 Q_OBJECT
28public:
29 enum ePrintOrientation {
30 eOrientPlugin = 0,
31 eOrientPrinter,
32 eOrientPortrait,
33 eOrientLandscape
34 };
35
36public:
37 /**
38 \param par parent widget for dialogs
39 \param cal calendar to be printed
40 \param uniqItem if true, indicates the calendar print dialog will only
41 provide the option to print an single incidence; else, all possible types
42 of print types will be shown
43 */
44 CalPrinter(QWidget *par, const KCalendarCore::Calendar::Ptr &calendar, bool uniqItem = false);
45
46 ~CalPrinter() override;
47
48 void init(const KCalendarCore::Calendar::Ptr &calendar);
49
50 /**
51 Set date range to be printed.
52
53 \param start Start date
54 \param end End date
55 */
56 void setDateRange(QDate start, QDate end);
57
58public Q_SLOTS:
59 void updateConfig();
60
61private Q_SLOTS:
62 void doPrint(CalendarSupport::PrintPlugin *selectedStyle, CalendarSupport::CalPrinter::ePrintOrientation dlgorientation, bool preview = false);
63
64public:
65 void print(int type, QDate fd, QDate td, const KCalendarCore::Incidence::List &selectedIncidences = KCalendarCore::Incidence::List(), bool preview = false);
66 KCalendarCore::Calendar::Ptr calendar() const;
67 KConfig *config() const;
68
69protected:
70 PrintPlugin::List mPrintPlugins;
71
72private:
74 QWidget *const mParent;
75 KConfig *const mConfig;
76 const bool mUniqItem;
77};
78
79class CalPrintDialog : public QDialog
80{
82public:
83 explicit CalPrintDialog(int initialPrintType, const PrintPlugin::List &plugins, QWidget *parent = nullptr, bool mUniqItem = false);
84
85 ~CalPrintDialog() override;
86
87 PrintPlugin *selectedPlugin();
88 void setOrientation(CalPrinter::ePrintOrientation orientation);
89 CalPrinter::ePrintOrientation orientation() const;
90
91public Q_SLOTS:
92 void setPrintType(QAbstractButton *button);
93 void setPreview(bool);
94
95private:
96 void slotOk();
97 void changePrintType(int id);
98 QButtonGroup *mTypeGroup = nullptr;
99 QStackedWidget *mConfigArea = nullptr;
100 QMap<int, PrintPlugin *> mPluginIDs;
101 QString mPreviewText;
102 QComboBox *mOrientationSelection = nullptr;
103 QPushButton *mOkButton = nullptr;
104 CalPrinter::ePrintOrientation mOrientation;
105};
106}
Base class of Calendar printer class.
Definition printplugin.h:23
CalPrinter is a class for printing Calendars.
Definition calprinter.h:26
Base class for Calendar printing classes.
Definition printplugin.h:43
Q_SCRIPTABLE Q_NOREPLY void start()
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:28 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.