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 { eOrientPlugin = 0, eOrientPrinter, eOrientPortrait, eOrientLandscape };
30
31public:
32 /**
33 \param par parent widget for dialogs
34 \param cal calendar to be printed
35 \param uniqItem if true, indicates the calendar print dialog will only
36 provide the option to print an single incidence; else, all possible types
37 of print types will be shown
38 */
39 CalPrinter(QWidget *par, const KCalendarCore::Calendar::Ptr &calendar, bool uniqItem = false);
40
41 ~CalPrinter() override;
42
43 void init(const KCalendarCore::Calendar::Ptr &calendar);
44
45 /**
46 Set date range to be printed.
47
48 \param start Start date
49 \param end End date
50 */
51 void setDateRange(QDate start, QDate end);
52
53public Q_SLOTS:
54 void updateConfig();
55
56private Q_SLOTS:
57 void doPrint(CalendarSupport::PrintPlugin *selectedStyle, CalendarSupport::CalPrinter::ePrintOrientation dlgorientation, bool preview = false);
58
59public:
60 void print(int type, QDate fd, QDate td, const KCalendarCore::Incidence::List &selectedIncidences = KCalendarCore::Incidence::List(), bool preview = false);
61 KCalendarCore::Calendar::Ptr calendar() const;
62 KConfig *config() const;
63
64protected:
65 PrintPlugin::List mPrintPlugins;
66
67private:
69 QWidget *const mParent;
70 KConfig *const mConfig;
71 const bool mUniqItem;
72};
73
74class CalPrintDialog : public QDialog
75{
77public:
78 explicit CalPrintDialog(int initialPrintType, const PrintPlugin::List &plugins, QWidget *parent = nullptr, bool mUniqItem = false);
79
80 ~CalPrintDialog() override;
81
82 PrintPlugin *selectedPlugin();
83 void setOrientation(CalPrinter::ePrintOrientation orientation);
84 CalPrinter::ePrintOrientation orientation() const;
85
86public Q_SLOTS:
87 void setPrintType(QAbstractButton *button);
88 void setPreview(bool);
89
90private:
91 void slotOk();
92 void changePrintType(int id);
93 QButtonGroup *mTypeGroup = nullptr;
94 QStackedWidget *mConfigArea = nullptr;
95 QMap<int, PrintPlugin *> mPluginIDs;
96 QString mPreviewText;
97 QComboBox *mOrientationSelection = nullptr;
98 QPushButton *mOkButton = nullptr;
99 CalPrinter::ePrintOrientation mOrientation;
100};
101}
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:33
Q_SCRIPTABLE Q_NOREPLY void start()
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:32 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.