-rw-r--r-- | core/pim/datebook/datebook.cpp | 5 | ||||
-rw-r--r-- | core/pim/datebook/datebook.h | 4 | ||||
-rw-r--r-- | core/pim/datebook/datebook.pro | 2 | ||||
-rw-r--r-- | core/pim/datebook/modules/monthview/odatebookmonth.cpp | 392 | ||||
-rw-r--r-- | core/pim/datebook/modules/monthview/odatebookmonth.h | 132 |
5 files changed, 531 insertions, 4 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 0579279..cc7bf4b 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -29,2 +29,3 @@ | |||
29 | #include "modules/weeklst/datebookweeklst.h" | 29 | #include "modules/weeklst/datebookweeklst.h" |
30 | #include "modules/monthview/odatebookmonth.h" | ||
30 | #include "dateentryimpl.h" | 31 | #include "dateentryimpl.h" |
@@ -37,3 +38,3 @@ | |||
37 | 38 | ||
38 | #include <qpe/datebookmonth.h> | 39 | //#include <qpe/datebookmonth.h> |
39 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
@@ -591,3 +592,3 @@ void DateBook::initMonth() | |||
591 | if ( !monthView ) { | 592 | if ( !monthView ) { |
592 | monthView = new DateBookMonth( views, "month view", FALSE, db ); | 593 | monthView = new ODateBookMonth( views, "month view", FALSE, db ); |
593 | views->addWidget( monthView, MONTH ); | 594 | views->addWidget( monthView, MONTH ); |
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h index fb8b083..05ab781 100644 --- a/core/pim/datebook/datebook.h +++ b/core/pim/datebook/datebook.h | |||
@@ -33,3 +33,3 @@ class DateBookWeek; | |||
33 | class DateBookWeekLst; | 33 | class DateBookWeekLst; |
34 | class DateBookMonth; | 34 | class ODateBookMonth; |
35 | class Event; | 35 | class Event; |
@@ -110,3 +110,3 @@ private: | |||
110 | DateBookWeek *weekView; | 110 | DateBookWeek *weekView; |
111 | DateBookMonth *monthView; | 111 | ODateBookMonth *monthView; |
112 | DateBookWeekLst *weekLstView; | 112 | DateBookWeekLst *weekLstView; |
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index 26f4d8d..7813673 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro | |||
@@ -13,2 +13,3 @@ HEADERS = datebookday.h \ | |||
13 | modules/weeklst/datebookweeklstdblview.h \ | 13 | modules/weeklst/datebookweeklstdblview.h \ |
14 | modules/monthview/odatebookmonth.h \ | ||
14 | datebookweekheaderimpl.h \ | 15 | datebookweekheaderimpl.h \ |
@@ -33,2 +34,3 @@ SOURCES = main.cpp \ | |||
33 | modules/weeklst/datebookweeklstdblview.cpp \ | 34 | modules/weeklst/datebookweeklstdblview.cpp \ |
35 | modules/monthview/odatebookmonth.cpp \ | ||
34 | datebookweekheaderimpl.cpp \ | 36 | datebookweekheaderimpl.cpp \ |
diff --git a/core/pim/datebook/modules/monthview/odatebookmonth.cpp b/core/pim/datebook/modules/monthview/odatebookmonth.cpp new file mode 100644 index 0000000..5e2f1bb --- a/dev/null +++ b/core/pim/datebook/modules/monthview/odatebookmonth.cpp | |||
@@ -0,0 +1,392 @@ | |||
1 | /* this is a straight copy of datemonthview. We can not make child of | ||
2 | * it 'cause the origin view isn't virtual in any form. | ||
3 | */ | ||
4 | /********************************************************************** | ||
5 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
6 | ** | ||
7 | ** This file is part of the Qtopia Environment. | ||
8 | ** | ||
9 | ** This file may be distributed and/or modified under the terms of the | ||
10 | ** GNU General Public License version 2 as published by the Free Software | ||
11 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
12 | ** packaging of this file. | ||
13 | ** | ||
14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
16 | ** | ||
17 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
18 | ** | ||
19 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
20 | ** not clear to you. | ||
21 | ** | ||
22 | **********************************************************************/ | ||
23 | #include "odatebookmonth.h" | ||
24 | #include "datebooktypes.h" | ||
25 | |||
26 | #include <qpe/config.h> | ||
27 | #include <qpe/datebookmonth.h> | ||
28 | |||
29 | #include <qpe/resource.h> | ||
30 | #include <qpe/qpeapplication.h> | ||
31 | |||
32 | #include <qtoolbutton.h> | ||
33 | #include <qspinbox.h> | ||
34 | #include <qcombobox.h> | ||
35 | #include <qvaluestack.h> | ||
36 | #include <qwhatsthis.h> | ||
37 | |||
38 | |||
39 | //--------------------------------------------------------------------------- | ||
40 | |||
41 | class ODateBookMonthTablePrivate | ||
42 | { | ||
43 | public: | ||
44 | ODateBookMonthTablePrivate() {}; | ||
45 | ~ODateBookMonthTablePrivate() { mMonthEvents.clear(); }; | ||
46 | |||
47 | QValueList<EffectiveEvent> mMonthEvents; | ||
48 | bool onMonday; | ||
49 | }; | ||
50 | |||
51 | ODateBookMonthTable::ODateBookMonthTable( QWidget *parent, const char *name, | ||
52 | DateBookDBHoliday *newDb ) | ||
53 | : QTable( 6, 7, parent, name ), | ||
54 | db( newDb ) | ||
55 | { | ||
56 | d = new ODateBookMonthTablePrivate(); | ||
57 | selYear = -1; | ||
58 | selMonth = -1; | ||
59 | selDay = -1; | ||
60 | |||
61 | /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */ | ||
62 | year = -1; | ||
63 | month = -1; | ||
64 | day = -1; | ||
65 | |||
66 | Config cfg( "qpe" ); | ||
67 | cfg.setGroup( "Time" ); | ||
68 | d->onMonday = cfg.readBoolEntry( "MONDAY" ); | ||
69 | |||
70 | horizontalHeader()->setResizeEnabled( FALSE ); | ||
71 | // we have to do this here... or suffer the consequences later... | ||
72 | for ( int i = 0; i < 7; i++ ){ | ||
73 | horizontalHeader()->resizeSection( i, 30 ); | ||
74 | setColumnStretchable( i, TRUE ); | ||
75 | } | ||
76 | setupLabels(); | ||
77 | |||
78 | verticalHeader()->hide(); | ||
79 | setLeftMargin( 0 ); | ||
80 | for ( int i = 0; i < 6; ++i ) | ||
81 | setRowStretchable( i, TRUE ); | ||
82 | |||
83 | setSelectionMode( NoSelection ); | ||
84 | |||
85 | connect( this, SIGNAL( clicked(int,int,int,const QPoint&) ), | ||
86 | this, SLOT( dayClicked(int,int) ) ); | ||
87 | connect( this, SIGNAL( currentChanged(int,int) ), | ||
88 | this, SLOT( dragDay(int,int) ) ); | ||
89 | setVScrollBarMode( AlwaysOff ); | ||
90 | setHScrollBarMode( AlwaysOff ); | ||
91 | } | ||
92 | |||
93 | ODateBookMonthTable::~ODateBookMonthTable() | ||
94 | { | ||
95 | monthsEvents.clear(); | ||
96 | delete d; | ||
97 | } | ||
98 | |||
99 | void ODateBookMonthTable::setDate(int y, int m, int d) | ||
100 | { | ||
101 | if (month == m && year == y) { | ||
102 | if ( selYear == -1 ) | ||
103 | year = selYear; | ||
104 | if ( selMonth == -1 ) | ||
105 | month = selMonth; | ||
106 | int r1, c1, r2, c2; | ||
107 | findDay(selDay, r1, c1); | ||
108 | selDay = day = d; | ||
109 | findDay(selDay, r2, c2); | ||
110 | setCurrentCell( r2, c2 ); | ||
111 | //updateCell(r1,c1); | ||
112 | //updateCell(r2,c2); | ||
113 | } else { | ||
114 | selYear = year = y; | ||
115 | selMonth = month = m; | ||
116 | selDay = day = d; | ||
117 | setupTable(); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | void ODateBookMonthTable::redraw() | ||
122 | { | ||
123 | setupLabels(); | ||
124 | setupTable(); | ||
125 | } | ||
126 | |||
127 | void ODateBookMonthTable::setWeekStart( bool onMonday ) | ||
128 | { | ||
129 | d->onMonday = onMonday; | ||
130 | setupLabels(); | ||
131 | setupTable(); | ||
132 | } | ||
133 | |||
134 | void ODateBookMonthTable::setupTable() | ||
135 | { | ||
136 | QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday ); | ||
137 | QValueList<Calendar::Day>::Iterator it = days.begin(); | ||
138 | int row = 0, col = 0; | ||
139 | int crow = 0; | ||
140 | int ccol = 0; | ||
141 | for ( ; it != days.end(); ++it ) { | ||
142 | DayItemMonth *i = (DayItemMonth *)item( row, col ); | ||
143 | if ( !i ) { | ||
144 | i = new DayItemMonth( this, QTableItem::Never, "" ); | ||
145 | setItem( row, col, i ); | ||
146 | } | ||
147 | Calendar::Day calDay = *it; | ||
148 | i->clearEffEvents(); | ||
149 | i->setDay( calDay.date ); | ||
150 | i->setType( calDay.type ); | ||
151 | if ( i->day() == day && calDay.type == Calendar::Day::ThisMonth ) { | ||
152 | crow = row; | ||
153 | ccol = col; | ||
154 | } | ||
155 | |||
156 | updateCell( row, col ); | ||
157 | |||
158 | if ( col == 6 ) { | ||
159 | ++row; | ||
160 | col = 0; | ||
161 | } else { | ||
162 | ++col; | ||
163 | } | ||
164 | } | ||
165 | setCurrentCell( crow, ccol ); | ||
166 | getEvents(); | ||
167 | } | ||
168 | |||
169 | void ODateBookMonthTable::findDay( int day, int &row, int &col ) | ||
170 | { | ||
171 | QDate dtBegin( year, month, 1 ); | ||
172 | int skips = dtBegin.dayOfWeek(); | ||
173 | int effective_day = day + skips - 1; // row/columns begin at 0 | ||
174 | // make an extra adjustment if we start on Mondays. | ||
175 | if ( d->onMonday ) | ||
176 | effective_day--; | ||
177 | row = effective_day / 7; | ||
178 | col = effective_day % 7; | ||
179 | } | ||
180 | |||
181 | void ODateBookMonthTable::dayClicked( int row, int col ) | ||
182 | { | ||
183 | changeDaySelection( row, col ); | ||
184 | emit dateClicked( selYear, selMonth, selDay ); | ||
185 | } | ||
186 | |||
187 | void ODateBookMonthTable::dragDay( int row, int col ) | ||
188 | { | ||
189 | changeDaySelection( row, col ); | ||
190 | } | ||
191 | |||
192 | void ODateBookMonthTable::changeDaySelection( int row, int col ) | ||
193 | { | ||
194 | DayItemMonth *i = (DayItemMonth*)item( row, col ); | ||
195 | if ( !i ) | ||
196 | return; | ||
197 | switch ( i->type() ) { | ||
198 | case Calendar::Day::ThisMonth: | ||
199 | selMonth = month; | ||
200 | break; | ||
201 | case Calendar::Day::PrevMonth: | ||
202 | selMonth = month-1; | ||
203 | break; | ||
204 | default: | ||
205 | selMonth = month+1; | ||
206 | } | ||
207 | |||
208 | selYear = year; | ||
209 | if ( selMonth <= 0 ) { | ||
210 | selMonth = 12; | ||
211 | selYear--; | ||
212 | } else if ( selMonth > 12 ) { | ||
213 | selMonth = 1; | ||
214 | selYear++; | ||
215 | } | ||
216 | selDay = i->day(); | ||
217 | } | ||
218 | |||
219 | |||
220 | void ODateBookMonthTable::viewportMouseReleaseEvent( QMouseEvent * ) | ||
221 | { | ||
222 | dayClicked( currentRow(), currentColumn() ); | ||
223 | } | ||
224 | |||
225 | void ODateBookMonthTable::getEvents() | ||
226 | { | ||
227 | if ( !db ) | ||
228 | return; | ||
229 | |||
230 | QDate dtStart( year, month, 1 ); | ||
231 | d->mMonthEvents = db->getEffectiveEvents( dtStart, | ||
232 | QDate( year, month, | ||
233 | dtStart.daysInMonth() ) ); | ||
234 | QValueListIterator<EffectiveEvent> it = d->mMonthEvents.begin(); | ||
235 | // now that the events are sorted, basically go through the list, make | ||
236 | // a small list for every day and set it for each item... | ||
237 | // clear all the items... | ||
238 | while ( it != d->mMonthEvents.end() ) { | ||
239 | QValueList<EffectiveEvent> dayEvent; | ||
240 | EffectiveEvent e = *it; | ||
241 | ++it; | ||
242 | dayEvent.append( e ); | ||
243 | while ( it != d->mMonthEvents.end() | ||
244 | && e.date() == (*it).date() ) { | ||
245 | dayEvent.append( *it ); | ||
246 | ++it; | ||
247 | } | ||
248 | int row, col; | ||
249 | findDay( e.date().day(), row, col ); | ||
250 | DayItemMonth* w = static_cast<DayItemMonth*>( item( row, col ) ); | ||
251 | w->setEvents( dayEvent ); | ||
252 | updateCell( row, col ); | ||
253 | dayEvent.clear(); | ||
254 | } | ||
255 | } | ||
256 | |||
257 | |||
258 | void ODateBookMonthTable::setupLabels() | ||
259 | { | ||
260 | for ( int i = 0; i < 7; ++i ) { | ||
261 | // horizontalHeader()->resizeSection( i, 30 ); | ||
262 | // setColumnStretchable( i, TRUE ); | ||
263 | if ( d->onMonday ) | ||
264 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( i + 1 ) ); | ||
265 | else { | ||
266 | if ( i == 0 ) | ||
267 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( 7 ) ); | ||
268 | else | ||
269 | horizontalHeader()->setLabel( i, Calendar::nameOfDay( i ) ); | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | |||
274 | |||
275 | //--------------------------------------------------------------------------- | ||
276 | |||
277 | ODateBookMonth::ODateBookMonth( QWidget *parent, const char *name, bool ac, | ||
278 | DateBookDBHoliday *data ) | ||
279 | : QVBox( parent, name ), | ||
280 | autoClose( ac ) | ||
281 | { | ||
282 | setFocusPolicy(StrongFocus); | ||
283 | year = QDate::currentDate().year(); | ||
284 | month = QDate::currentDate().month(); | ||
285 | day = QDate::currentDate().day(); | ||
286 | header = new DateBookMonthHeader( this, "DateBookMonthHeader" ); | ||
287 | table = new ODateBookMonthTable( this, "DateBookMonthTable", data ); | ||
288 | header->setDate( year, month ); | ||
289 | table->setDate( year, month, QDate::currentDate().day() ); | ||
290 | header->setFocusPolicy(NoFocus); | ||
291 | table->setFocusPolicy(NoFocus); | ||
292 | connect( header, SIGNAL( dateChanged(int,int) ), | ||
293 | this, SLOT( setDate(int,int) ) ); | ||
294 | connect( table, SIGNAL( dateClicked(int,int,int) ), | ||
295 | this, SLOT( finalDate(int,int,int) ) ); | ||
296 | connect( qApp, SIGNAL(weekChanged(bool)), this, | ||
297 | SLOT(slotWeekChange(bool)) ); | ||
298 | table->setFocus(); | ||
299 | } | ||
300 | |||
301 | ODateBookMonth::~ODateBookMonth() | ||
302 | { | ||
303 | |||
304 | } | ||
305 | |||
306 | void ODateBookMonth::setDate( int y, int m ) | ||
307 | { | ||
308 | /* only change the date if this is a different date, | ||
309 | * other wise we may mistakenly overide the day */ | ||
310 | if ( (y != year) || (m != month) ) { | ||
311 | year = y; | ||
312 | month = m; | ||
313 | QDate nd( y, m, 1 ); | ||
314 | if ( nd.daysInMonth() < day ) | ||
315 | day = nd.daysInMonth(); | ||
316 | table->setDate( year, month, day ); | ||
317 | } | ||
318 | } | ||
319 | |||
320 | void ODateBookMonth::setDate( int y, int m, int d ) | ||
321 | { | ||
322 | header->setDate( y, m); | ||
323 | table->setDate( y, m, d); | ||
324 | year = y; | ||
325 | month = m; | ||
326 | day = d; | ||
327 | } | ||
328 | |||
329 | /* called when we wish to close or pass back the date */ | ||
330 | void ODateBookMonth::finalDate(int y, int m, int d) | ||
331 | { | ||
332 | setDate( y, m, d ); | ||
333 | |||
334 | emit dateClicked(y, m, d); | ||
335 | // emit dateClicked(QDate(y, m, d).toString()); | ||
336 | |||
337 | if ( autoClose && parentWidget() ) | ||
338 | parentWidget()->close(); | ||
339 | } | ||
340 | |||
341 | void ODateBookMonth::setDate( QDate d) | ||
342 | { | ||
343 | setDate(d.year(), d.month(), d.day()); | ||
344 | } | ||
345 | |||
346 | void ODateBookMonth::redraw() | ||
347 | { | ||
348 | table->setDate( year, month, day ); | ||
349 | table->redraw(); | ||
350 | } | ||
351 | |||
352 | QDate ODateBookMonth::selectedDate() const | ||
353 | { | ||
354 | if ( !table ) | ||
355 | return QDate::currentDate(); | ||
356 | int y, m, d; | ||
357 | table->getDate( y, m, d ); | ||
358 | return QDate( y, m, d ); | ||
359 | } | ||
360 | |||
361 | void ODateBookMonth::slotWeekChange( bool startOnMonday ) | ||
362 | { | ||
363 | table->setWeekStart( startOnMonday ); | ||
364 | } | ||
365 | |||
366 | void ODateBookMonth::keyPressEvent( QKeyEvent *e ) | ||
367 | { | ||
368 | switch(e->key()) { | ||
369 | case Key_Up: | ||
370 | setDate(QDate(year, month, day).addDays(-7)); | ||
371 | break; | ||
372 | case Key_Down: | ||
373 | setDate(QDate(year, month, day).addDays(7)); | ||
374 | break; | ||
375 | case Key_Left: | ||
376 | setDate(QDate(year, month, day).addDays(-1)); | ||
377 | break; | ||
378 | case Key_Right: | ||
379 | setDate(QDate(year, month, day).addDays(1)); | ||
380 | break; | ||
381 | case Key_Space: | ||
382 | qWarning("space"); | ||
383 | emit dateClicked(year, month, day); | ||
384 | if ( autoClose && parentWidget() ) | ||
385 | parentWidget()->close(); | ||
386 | break; | ||
387 | default: | ||
388 | qWarning("ignore"); | ||
389 | e->ignore(); | ||
390 | break; | ||
391 | } | ||
392 | } | ||
diff --git a/core/pim/datebook/modules/monthview/odatebookmonth.h b/core/pim/datebook/modules/monthview/odatebookmonth.h new file mode 100644 index 0000000..e967abe --- a/dev/null +++ b/core/pim/datebook/modules/monthview/odatebookmonth.h | |||
@@ -0,0 +1,132 @@ | |||
1 | /* this is a straight copy of datemonthview. We can not make child of | ||
2 | * it 'cause the origin view isn't virtual in any form. | ||
3 | */ | ||
4 | /********************************************************************** | ||
5 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
6 | ** | ||
7 | ** This file is part of the Qtopia Environment. | ||
8 | ** | ||
9 | ** This file may be distributed and/or modified under the terms of the | ||
10 | ** GNU General Public License version 2 as published by the Free Software | ||
11 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
12 | ** packaging of this file. | ||
13 | ** | ||
14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
16 | ** | ||
17 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
18 | ** | ||
19 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
20 | ** not clear to you. | ||
21 | ** | ||
22 | **********************************************************************/ | ||
23 | #ifndef ODATEBOOKMONTH | ||
24 | #define ODATEBOOKMONTH | ||
25 | |||
26 | #include <qtopia/private/event.h> | ||
27 | #include <qpe/datebookmonth.h> | ||
28 | |||
29 | #include <qvbox.h> | ||
30 | #include <qhbox.h> | ||
31 | #include <qdatetime.h> | ||
32 | #include <qvaluelist.h> | ||
33 | #include <qtable.h> | ||
34 | #include <qpushbutton.h> | ||
35 | #include <qpopupmenu.h> | ||
36 | |||
37 | #include <qpe/calendar.h> | ||
38 | #include <qpe/timestring.h> | ||
39 | |||
40 | class QToolButton; | ||
41 | class QComboBox; | ||
42 | class QSpinBox; | ||
43 | class Event; | ||
44 | class DateBookDB; | ||
45 | class DateBookDBHoliday; | ||
46 | |||
47 | class ODateBookMonthTablePrivate; | ||
48 | class ODateBookMonthTable : public QTable | ||
49 | { | ||
50 | Q_OBJECT | ||
51 | |||
52 | public: | ||
53 | ODateBookMonthTable( QWidget *parent = 0, const char *name = 0, | ||
54 | DateBookDBHoliday *newDb = 0 ); | ||
55 | virtual ~ODateBookMonthTable(); | ||
56 | void setDate( int y, int m, int d ); | ||
57 | void redraw(); | ||
58 | |||
59 | QSize minimumSizeHint() const { return sizeHint(); } | ||
60 | QSize minimumSize() const { return sizeHint(); } | ||
61 | void getDate( int& y, int &m, int &d ) const {y=selYear;m=selMonth;d=selDay;} | ||
62 | void setWeekStart( bool onMonday ); | ||
63 | signals: | ||
64 | void dateClicked( int year, int month, int day ); | ||
65 | |||
66 | protected: | ||
67 | virtual void viewportMouseReleaseEvent( QMouseEvent * ); | ||
68 | |||
69 | protected slots: | ||
70 | |||
71 | virtual void keyPressEvent(QKeyEvent *e ) { | ||
72 | e->ignore(); | ||
73 | } | ||
74 | |||
75 | private slots: | ||
76 | void dayClicked( int row, int col ); | ||
77 | void dragDay( int row, int col ); | ||
78 | |||
79 | private: | ||
80 | void setupTable(); | ||
81 | void setupLabels(); | ||
82 | |||
83 | void findDay( int day, int &row, int &col ); | ||
84 | void getEvents(); | ||
85 | void changeDaySelection( int row, int col ); | ||
86 | |||
87 | int year, month, day; | ||
88 | int selYear, selMonth, selDay; | ||
89 | QValueList<Event> monthsEvents; // not used anymore... | ||
90 | DateBookDBHoliday *db; | ||
91 | ODateBookMonthTablePrivate *d; | ||
92 | }; | ||
93 | |||
94 | class ODateBookMonthPrivate; | ||
95 | class ODateBookMonth : public QVBox | ||
96 | { | ||
97 | Q_OBJECT | ||
98 | |||
99 | public: | ||
100 | /* ac = Auto Close */ | ||
101 | ODateBookMonth( QWidget *parent = 0, const char *name = 0, bool ac = FALSE, | ||
102 | DateBookDBHoliday *data = 0 ); | ||
103 | virtual ~ODateBookMonth(); | ||
104 | QDate selectedDate() const; | ||
105 | |||
106 | signals: | ||
107 | /* ### FIXME add a signal with QDate -zecke */ | ||
108 | void dateClicked( int year, int month, int day ); | ||
109 | |||
110 | public slots: | ||
111 | void setDate( int y, int m ); | ||
112 | void setDate( int y, int m, int d ); | ||
113 | void setDate( QDate ); | ||
114 | void redraw(); | ||
115 | void slotWeekChange( bool ); | ||
116 | |||
117 | protected slots: | ||
118 | virtual void keyPressEvent(QKeyEvent *e); | ||
119 | |||
120 | private slots: | ||
121 | void forwardDateClicked( int y, int m, int d ) { emit dateClicked( y, m, d ); } | ||
122 | void finalDate(int, int, int); | ||
123 | |||
124 | private: | ||
125 | DateBookMonthHeader *header; | ||
126 | ODateBookMonthTable *table; | ||
127 | int year, month, day; | ||
128 | bool autoClose; | ||
129 | class ODateBookMonthPrivate *d; | ||
130 | }; | ||
131 | |||
132 | #endif | ||