summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/datebookmonth.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/datebookmonth.h b/library/datebookmonth.h
index cb436a8..46b02c8 100644
--- a/library/datebookmonth.h
+++ b/library/datebookmonth.h
@@ -1,228 +1,230 @@
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#include <qpopupmenu.h>
32 32
33#include "calendar.h" 33#include "calendar.h"
34#include "timestring.h" 34#include "timestring.h"
35 35
36class QToolButton; 36class QToolButton;
37class QComboBox; 37class QComboBox;
38class QSpinBox; 38class QSpinBox;
39class Event; 39class Event;
40class DateBookDB; 40class DateBookDB;
41 41
42class DateBookMonthHeaderPrivate; 42class DateBookMonthHeaderPrivate;
43class DateBookMonthHeader : public QHBox 43class DateBookMonthHeader : public QHBox
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 46
47public: 47public:
48 DateBookMonthHeader( QWidget *parent = 0, const char *name = 0 ); 48 DateBookMonthHeader( QWidget *parent = 0, const char *name = 0 );
49 ~DateBookMonthHeader(); 49 ~DateBookMonthHeader();
50 void setDate( int year, int month ); 50 void setDate( int year, int month );
51 51
52signals: 52signals:
53 void dateChanged( int year, int month ); 53 void dateChanged( int year, int month );
54 54
55protected slots: 55protected slots:
56 void keyPressEvent(QKeyEvent *e ) { 56 void keyPressEvent(QKeyEvent *e ) {
57 e->ignore(); 57 e->ignore();
58 } 58 }
59 59
60private slots: 60private slots:
61 void updateDate(); 61 void updateDate();
62 void firstMonth(); 62 void firstMonth();
63 void lastMonth(); 63 void lastMonth();
64 void monthBack(); 64 void monthBack();
65 void monthForward(); 65 void monthForward();
66 66
67private: 67private:
68 QToolButton *begin, *back, *next, *end; 68 QToolButton *begin, *back, *next, *end;
69 QComboBox *month; 69 QComboBox *month;
70 QSpinBox *year; 70 QSpinBox *year;
71 DateBookMonthHeaderPrivate *d; 71 DateBookMonthHeaderPrivate *d;
72 int focus; 72 int focus;
73}; 73};
74 74
75class DayItemMonthPrivate; 75class DayItemMonthPrivate;
76class DayItemMonth : public QTableItem 76class DayItemMonth : public QTableItem
77{ 77{
78public: 78public:
79 DayItemMonth( QTable *table, EditType et, const QString &t ); 79 DayItemMonth( QTable *table, EditType et, const QString &t );
80 ~DayItemMonth(); 80 ~DayItemMonth();
81 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 );
82 void setDay( int d ) { dy = d; } 82 void setDay( int d ) { dy = d; }
83 void setEvents( const QValueList<Event> &events ) { daysEvents = events; }; 83 void setEvents( const QValueList<Event> &events ) { daysEvents = events; };
84 void setEvents( const QValueList<EffectiveEvent> &effEvents ); 84 void setEvents( const QValueList<EffectiveEvent> &effEvents );
85 void clearEvents() { daysEvents.clear(); }; 85 void clearEvents() { daysEvents.clear(); };
86 void clearEffEvents(); 86 void clearEffEvents();
87 int day() const { return dy; } 87 int day() const { return dy; }
88 void setType( Calendar::Day::Type t ); 88 void setType( Calendar::Day::Type t );
89 Calendar::Day::Type type() const { return typ; } 89 Calendar::Day::Type type() const { return typ; }
90 90
91private: 91private:
92 QBrush back; 92 QBrush back;
93 QColor forg; 93 QColor forg;
94 int dy; 94 int dy;
95 Calendar::Day::Type typ; 95 Calendar::Day::Type typ;
96 QValueList<Event> daysEvents; // not used anymore... 96 QValueList<Event> daysEvents; // not used anymore...
97 DayItemMonthPrivate *d; 97 DayItemMonthPrivate *d;
98}; 98};
99 99
100class DateBookMonthTablePrivate; 100class DateBookMonthTablePrivate;
101class DateBookMonthTable : public QTable 101class DateBookMonthTable : public QTable
102{ 102{
103 Q_OBJECT 103 Q_OBJECT
104 104
105public: 105public:
106 DateBookMonthTable( QWidget *parent = 0, const char *name = 0, 106 DateBookMonthTable( QWidget *parent = 0, const char *name = 0,
107 DateBookDB *newDb = 0 ); 107 DateBookDB *newDb = 0 );
108 ~DateBookMonthTable(); 108 ~DateBookMonthTable();
109 void setDate( int y, int m, int d ); 109 void setDate( int y, int m, int d );
110 void redraw(); 110 void redraw();
111 111
112 QSize minimumSizeHint() const { return sizeHint(); } 112 QSize minimumSizeHint() const { return sizeHint(); }
113 QSize minimumSize() const { return sizeHint(); } 113 QSize minimumSize() const { return sizeHint(); }
114 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;}
115 void setWeekStart( bool onMonday ); 115 void setWeekStart( bool onMonday );
116signals: 116signals:
117 void dateClicked( int year, int month, int day ); 117 void dateClicked( int year, int month, int day );
118 118
119protected: 119protected:
120 void viewportMouseReleaseEvent( QMouseEvent * ); 120 void viewportMouseReleaseEvent( QMouseEvent * );
121 121
122protected slots: 122protected slots:
123 123
124 void keyPressEvent(QKeyEvent *e ) { 124 void keyPressEvent(QKeyEvent *e ) {
125 e->ignore(); 125 e->ignore();
126 } 126 }
127 127
128private slots: 128private slots:
129 void dayClicked( int row, int col ); 129 void dayClicked( int row, int col );
130 void dragDay( int row, int col ); 130 void dragDay( int row, int col );
131 131
132private: 132private:
133 void setupTable(); 133 void setupTable();
134 void setupLabels(); 134 void setupLabels();
135 135
136 void findDay( int day, int &row, int &col ); 136 void findDay( int day, int &row, int &col );
137 void getEvents(); 137 void getEvents();
138 void changeDaySelection( int row, int col ); 138 void changeDaySelection( int row, int col );
139 139
140 int year, month, day; 140 int year, month, day;
141 int selYear, selMonth, selDay; 141 int selYear, selMonth, selDay;
142 QValueList<Event> monthsEvents; // not used anymore... 142 QValueList<Event> monthsEvents; // not used anymore...
143 DateBookDB *db; 143 DateBookDB *db;
144 DateBookMonthTablePrivate *d; 144 DateBookMonthTablePrivate *d;
145}; 145};
146 146
147class DateBookMonthPrivate; 147class DateBookMonthPrivate;
148class DateBookMonth : public QVBox 148class DateBookMonth : public QVBox
149{ 149{
150 Q_OBJECT 150 Q_OBJECT
151 151
152public: 152public:
153 /* ac = Auto Close */
153 DateBookMonth( QWidget *parent = 0, const char *name = 0, bool ac = FALSE, 154 DateBookMonth( QWidget *parent = 0, const char *name = 0, bool ac = FALSE,
154 DateBookDB *data = 0 ); 155 DateBookDB *data = 0 );
155 ~DateBookMonth(); 156 ~DateBookMonth();
156 QDate selectedDate() const; 157 QDate selectedDate() const;
157 158
158signals: 159signals:
160 /* ### FIXME add a signal with QDate -zecke */
159 void dateClicked( int year, int month, int day ); 161 void dateClicked( int year, int month, int day );
160 162
161public slots: 163public slots:
162 void setDate( int y, int m ); 164 void setDate( int y, int m );
163 void setDate( int y, int m, int d ); 165 void setDate( int y, int m, int d );
164 void setDate( QDate ); 166 void setDate( QDate );
165 void redraw(); 167 void redraw();
166 void slotWeekChange( bool ); 168 void slotWeekChange( bool );
167 169
168protected slots: 170protected slots:
169 virtual void keyPressEvent(QKeyEvent *e); 171 virtual void keyPressEvent(QKeyEvent *e);
170 172
171private slots: 173private slots:
172 void forwardDateClicked( int y, int m, int d ) { emit dateClicked( y, m, d ); } 174 void forwardDateClicked( int y, int m, int d ) { emit dateClicked( y, m, d ); }
173 void finalDate(int, int, int); 175 void finalDate(int, int, int);
174 176
175private: 177private:
176 DateBookMonthHeader *header; 178 DateBookMonthHeader *header;
177 DateBookMonthTable *table; 179 DateBookMonthTable *table;
178 int year, month, day; 180 int year, month, day;
179 bool autoClose; 181 bool autoClose;
180 class DateBookMonthPrivate *d; 182 class DateBookMonthPrivate *d;
181}; 183};
182 184
183class DateButton : public QPushButton 185class DateButton : public QPushButton
184{ 186{
185 Q_OBJECT 187 Q_OBJECT
186 188
187public: 189public:
188 DateButton( bool longDate, QWidget *parent, const char * name = 0 ); 190 DateButton( bool longDate, QWidget *parent, const char * name = 0 );
189 QDate date() const { return currDate; } 191 QDate date() const { return currDate; }
190 192
191 bool customWhatsThis() const; 193 bool customWhatsThis() const;
192 194
193signals: 195signals:
194 void dateSelected( int year, int month, int day ); 196 void dateSelected( int year, int month, int day );
195 197
196public slots: 198public slots:
197 void setDate( int y, int m, int d ); 199 void setDate( int y, int m, int d );
198 void setDate( QDate ); 200 void setDate( QDate );
199 void setWeekStartsMonday( int ); 201 void setWeekStartsMonday( int );
200 void setDateFormat( DateFormat ); 202 void setDateFormat( DateFormat );
201 203
202private slots: 204private slots:
203 void pickDate(); 205 void pickDate();
204 void gotHide(); 206 void gotHide();
205 207
206private: 208private:
207 bool longFormat; 209 bool longFormat;
208 bool weekStartsMonday; 210 bool weekStartsMonday;
209 QDate currDate; 211 QDate currDate;
210 DateFormat df; 212 DateFormat df;
211}; 213};
212 214
213// this class is only here for Sharp ROM compatibility 215// this class is only here for Sharp ROM compatibility
214// I have reverse engineered this class and it seems to 216// I have reverse engineered this class and it seems to
215// work (only qtmail seems to use it) - sandman 217// work (only qtmail seems to use it) - sandman
216// DO NOT USE IT IN NEW CODE !! 218// DO NOT USE IT IN NEW CODE !!
217 219
218class DateBookMonthPopup : public QPopupMenu 220class DateBookMonthPopup : public QPopupMenu
219{ 221{
220 Q_OBJECT 222 Q_OBJECT
221public: 223public:
222 DateBookMonthPopup ( QWidget *w ); 224 DateBookMonthPopup ( QWidget *w );
223 225
224private: 226private:
225 DateBookMonth *m_dbm; 227 DateBookMonth *m_dbm;
226}; 228};
227 229
228#endif 230#endif