-rw-r--r-- | library/datebookmonth.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/library/datebookmonth.h b/library/datebookmonth.h index 3c57c19..cb436a8 100644 --- a/library/datebookmonth.h +++ b/library/datebookmonth.h | |||
@@ -1,213 +1,228 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef DATEBOOKMONTH | 20 | #ifndef DATEBOOKMONTH |
21 | #define DATEBOOKMONTH | 21 | #define DATEBOOKMONTH |
22 | 22 | ||
23 | #include <qtopia/private/event.h> | 23 | #include <qtopia/private/event.h> |
24 | 24 | ||
25 | #include <qvbox.h> | 25 | #include <qvbox.h> |
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qvaluelist.h> | 28 | #include <qvaluelist.h> |
29 | #include <qtable.h> | 29 | #include <qtable.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qpopupmenu.h> | ||
31 | 32 | ||
32 | #include "calendar.h" | 33 | #include "calendar.h" |
33 | #include "timestring.h" | 34 | #include "timestring.h" |
34 | 35 | ||
35 | class QToolButton; | 36 | class QToolButton; |
36 | class QComboBox; | 37 | class QComboBox; |
37 | class QSpinBox; | 38 | class QSpinBox; |
38 | class Event; | 39 | class Event; |
39 | class DateBookDB; | 40 | class DateBookDB; |
40 | 41 | ||
41 | class DateBookMonthHeaderPrivate; | 42 | class DateBookMonthHeaderPrivate; |
42 | class DateBookMonthHeader : public QHBox | 43 | class DateBookMonthHeader : public QHBox |
43 | { | 44 | { |
44 | Q_OBJECT | 45 | Q_OBJECT |
45 | 46 | ||
46 | public: | 47 | public: |
47 | DateBookMonthHeader( QWidget *parent = 0, const char *name = 0 ); | 48 | DateBookMonthHeader( QWidget *parent = 0, const char *name = 0 ); |
48 | ~DateBookMonthHeader(); | 49 | ~DateBookMonthHeader(); |
49 | void setDate( int year, int month ); | 50 | void setDate( int year, int month ); |
50 | 51 | ||
51 | signals: | 52 | signals: |
52 | void dateChanged( int year, int month ); | 53 | void dateChanged( int year, int month ); |
53 | 54 | ||
54 | protected slots: | 55 | protected slots: |
55 | void keyPressEvent(QKeyEvent *e ) { | 56 | void keyPressEvent(QKeyEvent *e ) { |
56 | e->ignore(); | 57 | e->ignore(); |
57 | } | 58 | } |
58 | 59 | ||
59 | private slots: | 60 | private slots: |
60 | void updateDate(); | 61 | void updateDate(); |
61 | void firstMonth(); | 62 | void firstMonth(); |
62 | void lastMonth(); | 63 | void lastMonth(); |
63 | void monthBack(); | 64 | void monthBack(); |
64 | void monthForward(); | 65 | void monthForward(); |
65 | 66 | ||
66 | private: | 67 | private: |
67 | QToolButton *begin, *back, *next, *end; | 68 | QToolButton *begin, *back, *next, *end; |
68 | QComboBox *month; | 69 | QComboBox *month; |
69 | QSpinBox *year; | 70 | QSpinBox *year; |
70 | DateBookMonthHeaderPrivate *d; | 71 | DateBookMonthHeaderPrivate *d; |
71 | int focus; | 72 | int focus; |
72 | }; | 73 | }; |
73 | 74 | ||
74 | class DayItemMonthPrivate; | 75 | class DayItemMonthPrivate; |
75 | class DayItemMonth : public QTableItem | 76 | class DayItemMonth : public QTableItem |
76 | { | 77 | { |
77 | public: | 78 | public: |
78 | DayItemMonth( QTable *table, EditType et, const QString &t ); | 79 | DayItemMonth( QTable *table, EditType et, const QString &t ); |
79 | ~DayItemMonth(); | 80 | ~DayItemMonth(); |
80 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); | 81 | void paint( QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected ); |
81 | void setDay( int d ) { dy = d; } | 82 | void setDay( int d ) { dy = d; } |
82 | void setEvents( const QValueList<Event> &events ) { daysEvents = events; }; | 83 | void setEvents( const QValueList<Event> &events ) { daysEvents = events; }; |
83 | void setEvents( const QValueList<EffectiveEvent> &effEvents ); | 84 | void setEvents( const QValueList<EffectiveEvent> &effEvents ); |
84 | void clearEvents() { daysEvents.clear(); }; | 85 | void clearEvents() { daysEvents.clear(); }; |
85 | void clearEffEvents(); | 86 | void clearEffEvents(); |
86 | int day() const { return dy; } | 87 | int day() const { return dy; } |
87 | void setType( Calendar::Day::Type t ); | 88 | void setType( Calendar::Day::Type t ); |
88 | Calendar::Day::Type type() const { return typ; } | 89 | Calendar::Day::Type type() const { return typ; } |
89 | 90 | ||
90 | private: | 91 | private: |
91 | QBrush back; | 92 | QBrush back; |
92 | QColor forg; | 93 | QColor forg; |
93 | int dy; | 94 | int dy; |
94 | Calendar::Day::Type typ; | 95 | Calendar::Day::Type typ; |
95 | QValueList<Event> daysEvents; // not used anymore... | 96 | QValueList<Event> daysEvents; // not used anymore... |
96 | DayItemMonthPrivate *d; | 97 | DayItemMonthPrivate *d; |
97 | }; | 98 | }; |
98 | 99 | ||
99 | class DateBookMonthTablePrivate; | 100 | class DateBookMonthTablePrivate; |
100 | class DateBookMonthTable : public QTable | 101 | class DateBookMonthTable : public QTable |
101 | { | 102 | { |
102 | Q_OBJECT | 103 | Q_OBJECT |
103 | 104 | ||
104 | public: | 105 | public: |
105 | DateBookMonthTable( QWidget *parent = 0, const char *name = 0, | 106 | DateBookMonthTable( QWidget *parent = 0, const char *name = 0, |
106 | DateBookDB *newDb = 0 ); | 107 | DateBookDB *newDb = 0 ); |
107 | ~DateBookMonthTable(); | 108 | ~DateBookMonthTable(); |
108 | void setDate( int y, int m, int d ); | 109 | void setDate( int y, int m, int d ); |
109 | void redraw(); | 110 | void redraw(); |
110 | 111 | ||
111 | QSize minimumSizeHint() const { return sizeHint(); } | 112 | QSize minimumSizeHint() const { return sizeHint(); } |
112 | QSize minimumSize() const { return sizeHint(); } | 113 | QSize minimumSize() const { return sizeHint(); } |
113 | void getDate( int& y, int &m, int &d ) const {y=selYear;m=selMonth;d=selDay;} | 114 | void getDate( int& y, int &m, int &d ) const {y=selYear;m=selMonth;d=selDay;} |
114 | void setWeekStart( bool onMonday ); | 115 | void setWeekStart( bool onMonday ); |
115 | signals: | 116 | signals: |
116 | void dateClicked( int year, int month, int day ); | 117 | void dateClicked( int year, int month, int day ); |
117 | 118 | ||
118 | protected: | 119 | protected: |
119 | void viewportMouseReleaseEvent( QMouseEvent * ); | 120 | void viewportMouseReleaseEvent( QMouseEvent * ); |
120 | 121 | ||
121 | protected slots: | 122 | protected slots: |
122 | 123 | ||
123 | void keyPressEvent(QKeyEvent *e ) { | 124 | void keyPressEvent(QKeyEvent *e ) { |
124 | e->ignore(); | 125 | e->ignore(); |
125 | } | 126 | } |
126 | 127 | ||
127 | private slots: | 128 | private slots: |
128 | void dayClicked( int row, int col ); | 129 | void dayClicked( int row, int col ); |
129 | void dragDay( int row, int col ); | 130 | void dragDay( int row, int col ); |
130 | 131 | ||
131 | private: | 132 | private: |
132 | void setupTable(); | 133 | void setupTable(); |
133 | void setupLabels(); | 134 | void setupLabels(); |
134 | 135 | ||
135 | void findDay( int day, int &row, int &col ); | 136 | void findDay( int day, int &row, int &col ); |
136 | void getEvents(); | 137 | void getEvents(); |
137 | void changeDaySelection( int row, int col ); | 138 | void changeDaySelection( int row, int col ); |
138 | 139 | ||
139 | int year, month, day; | 140 | int year, month, day; |
140 | int selYear, selMonth, selDay; | 141 | int selYear, selMonth, selDay; |
141 | QValueList<Event> monthsEvents; // not used anymore... | 142 | QValueList<Event> monthsEvents; // not used anymore... |
142 | DateBookDB *db; | 143 | DateBookDB *db; |
143 | DateBookMonthTablePrivate *d; | 144 | DateBookMonthTablePrivate *d; |
144 | }; | 145 | }; |
145 | 146 | ||
146 | class DateBookMonthPrivate; | 147 | class DateBookMonthPrivate; |
147 | class DateBookMonth : public QVBox | 148 | class DateBookMonth : public QVBox |
148 | { | 149 | { |
149 | Q_OBJECT | 150 | Q_OBJECT |
150 | 151 | ||
151 | public: | 152 | public: |
152 | DateBookMonth( QWidget *parent = 0, const char *name = 0, bool ac = FALSE, | 153 | DateBookMonth( QWidget *parent = 0, const char *name = 0, bool ac = FALSE, |
153 | DateBookDB *data = 0 ); | 154 | DateBookDB *data = 0 ); |
154 | ~DateBookMonth(); | 155 | ~DateBookMonth(); |
155 | QDate selectedDate() const; | 156 | QDate selectedDate() const; |
156 | 157 | ||
157 | signals: | 158 | signals: |
158 | void dateClicked( int year, int month, int day ); | 159 | void dateClicked( int year, int month, int day ); |
159 | 160 | ||
160 | public slots: | 161 | public slots: |
161 | void setDate( int y, int m ); | 162 | void setDate( int y, int m ); |
162 | void setDate( int y, int m, int d ); | 163 | void setDate( int y, int m, int d ); |
163 | void setDate( QDate ); | 164 | void setDate( QDate ); |
164 | void redraw(); | 165 | void redraw(); |
165 | void slotWeekChange( bool ); | 166 | void slotWeekChange( bool ); |
166 | 167 | ||
167 | protected slots: | 168 | protected slots: |
168 | virtual void keyPressEvent(QKeyEvent *e); | 169 | virtual void keyPressEvent(QKeyEvent *e); |
169 | 170 | ||
170 | private slots: | 171 | private slots: |
171 | void forwardDateClicked( int y, int m, int d ) { emit dateClicked( y, m, d ); } | 172 | void forwardDateClicked( int y, int m, int d ) { emit dateClicked( y, m, d ); } |
172 | void finalDate(int, int, int); | 173 | void finalDate(int, int, int); |
173 | 174 | ||
174 | private: | 175 | private: |
175 | DateBookMonthHeader *header; | 176 | DateBookMonthHeader *header; |
176 | DateBookMonthTable *table; | 177 | DateBookMonthTable *table; |
177 | int year, month, day; | 178 | int year, month, day; |
178 | bool autoClose; | 179 | bool autoClose; |
179 | class DateBookMonthPrivate *d; | 180 | class DateBookMonthPrivate *d; |
180 | }; | 181 | }; |
181 | 182 | ||
182 | class DateButton : public QPushButton | 183 | class DateButton : public QPushButton |
183 | { | 184 | { |
184 | Q_OBJECT | 185 | Q_OBJECT |
185 | 186 | ||
186 | public: | 187 | public: |
187 | DateButton( bool longDate, QWidget *parent, const char * name = 0 ); | 188 | DateButton( bool longDate, QWidget *parent, const char * name = 0 ); |
188 | QDate date() const { return currDate; } | 189 | QDate date() const { return currDate; } |
189 | 190 | ||
190 | bool customWhatsThis() const; | 191 | bool customWhatsThis() const; |
191 | 192 | ||
192 | signals: | 193 | signals: |
193 | void dateSelected( int year, int month, int day ); | 194 | void dateSelected( int year, int month, int day ); |
194 | 195 | ||
195 | public slots: | 196 | public slots: |
196 | void setDate( int y, int m, int d ); | 197 | void setDate( int y, int m, int d ); |
197 | void setDate( QDate ); | 198 | void setDate( QDate ); |
198 | void setWeekStartsMonday( int ); | 199 | void setWeekStartsMonday( int ); |
199 | void setDateFormat( DateFormat ); | 200 | void setDateFormat( DateFormat ); |
200 | 201 | ||
201 | private slots: | 202 | private slots: |
202 | void pickDate(); | 203 | void pickDate(); |
203 | void gotHide(); | 204 | void gotHide(); |
204 | 205 | ||
205 | private: | 206 | private: |
206 | bool longFormat; | 207 | bool longFormat; |
207 | bool weekStartsMonday; | 208 | bool weekStartsMonday; |
208 | QDate currDate; | 209 | QDate currDate; |
209 | DateFormat df; | 210 | DateFormat df; |
210 | }; | 211 | }; |
211 | 212 | ||
213 | // this class is only here for Sharp ROM compatibility | ||
214 | // I have reverse engineered this class and it seems to | ||
215 | // work (only qtmail seems to use it) - sandman | ||
216 | // DO NOT USE IT IN NEW CODE !! | ||
217 | |||
218 | class DateBookMonthPopup : public QPopupMenu | ||
219 | { | ||
220 | Q_OBJECT | ||
221 | public: | ||
222 | DateBookMonthPopup ( QWidget *w ); | ||
223 | |||
224 | private: | ||
225 | DateBookMonth *m_dbm; | ||
226 | }; | ||
212 | 227 | ||
213 | #endif | 228 | #endif |