-rw-r--r-- | korganizer/calprinter.h | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/korganizer/calprinter.h b/korganizer/calprinter.h new file mode 100644 index 0000000..7b58f4f --- a/dev/null +++ b/korganizer/calprinter.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | |||
4 | Copyright (c) 1998 Preston Brown | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | |||
20 | As a special exception, permission is given to link this program | ||
21 | with any edition of Qt, and distribute the resulting executable, | ||
22 | without including the source code for Qt in the source distribution. | ||
23 | */ | ||
24 | #ifndef _CALPRINTER_H | ||
25 | #define _CALPRINTER_H | ||
26 | |||
27 | // #define KORG_NOPRINTER | ||
28 | |||
29 | #ifndef KORG_NOPRINTER | ||
30 | |||
31 | #include <qptrlist.h> | ||
32 | |||
33 | #include <kdialogbase.h> | ||
34 | |||
35 | #include <korganizer/baseview.h> | ||
36 | |||
37 | #include "calprintbase.h" | ||
38 | |||
39 | using namespace KCal; | ||
40 | |||
41 | class QVButtonGroup; | ||
42 | class QWidgetStack; | ||
43 | class KPrinter; | ||
44 | class CalPrintDialog; | ||
45 | class KConfig; | ||
46 | class QComboBox; | ||
47 | class QLabel; | ||
48 | |||
49 | |||
50 | /** | ||
51 | CalPrinter is a class for printing Calendars. It can print in several | ||
52 | different formats (day, week, month). It also provides a way for setting | ||
53 | up the printer and remembering these preferences. | ||
54 | */ | ||
55 | class CalPrinter : public QObject, public KOrg::CalPrinterBase | ||
56 | { | ||
57 | Q_OBJECT | ||
58 | |||
59 | public: | ||
60 | enum ePrintOrientation { | ||
61 | eOrientPlugin=0, | ||
62 | eOrientPrinter, | ||
63 | eOrientPortrait, | ||
64 | eOrientLandscape | ||
65 | }; | ||
66 | public: | ||
67 | /** | ||
68 | \param par parent widget for dialogs | ||
69 | \param cal calendar to be printed | ||
70 | */ | ||
71 | CalPrinter( QWidget *par, Calendar *cal ); | ||
72 | virtual ~CalPrinter(); | ||
73 | |||
74 | void init( KPrinter *printer, Calendar *calendar ); | ||
75 | |||
76 | void setupPrinter(); | ||
77 | |||
78 | /** | ||
79 | Set date range to be printed. | ||
80 | |||
81 | \param start Start date | ||
82 | \param end End date | ||
83 | */ | ||
84 | void setDateRange( const QDate &start, const QDate &end ); | ||
85 | |||
86 | public slots: | ||
87 | void updateConfig(); | ||
88 | |||
89 | private slots: | ||
90 | void doPrint( CalPrintBase *selectedStyle, bool preview ); | ||
91 | |||
92 | public: | ||
93 | void preview( PrintType type, const QDate &fd, const QDate &td ); | ||
94 | void print( PrintType type, const QDate &fd, const QDate &td ); | ||
95 | |||
96 | protected: | ||
97 | QPtrList<CalPrintBase> mPrintPlugins; | ||
98 | |||
99 | private: | ||
100 | KPrinter *mPrinter; | ||
101 | Calendar *mCalendar; | ||
102 | QWidget *mParent; | ||
103 | KConfig *mConfig; | ||
104 | |||
105 | CalPrintDialog *mPrintDialog; | ||
106 | }; | ||
107 | |||
108 | class CalPrintDialog : public KDialogBase | ||
109 | { | ||
110 | Q_OBJECT | ||
111 | public: | ||
112 | CalPrintDialog( QPtrList<CalPrintBase> plugins, KPrinter *p, | ||
113 | QWidget *parent = 0, const char *name = 0 ); | ||
114 | virtual ~CalPrintDialog(); | ||
115 | CalPrintBase *selectedPlugin(); | ||
116 | CalPrinter::ePrintOrientation orientation() { return mOrientation; } | ||
117 | |||
118 | public slots: | ||
119 | void setPrintType( int ); | ||
120 | void setPreview( bool ); | ||
121 | |||
122 | protected slots: | ||
123 | void slotOk(); | ||
124 | void setupPrinter(); | ||
125 | void setPrinterLabel(); | ||
126 | signals: | ||
127 | void okClicked(); | ||
128 | private: | ||
129 | KPrinter *mPrinter; | ||
130 | QVButtonGroup *mTypeGroup; | ||
131 | QWidgetStack *mConfigArea; | ||
132 | QPtrList<CalPrintBase> mPrintPlugins; | ||
133 | QLabel *mPrinterLabel; | ||
134 | QString mPreviewText; | ||
135 | QComboBox *mOrientationSelection; | ||
136 | |||
137 | CalPrinter::ePrintOrientation mOrientation; | ||
138 | }; | ||
139 | |||
140 | #endif | ||
141 | |||
142 | #endif | ||