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