Diffstat (limited to 'core/pim/datebook/datebookday.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/datebook/datebookday.h | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index c8cb26b..3e44364 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h | |||
@@ -31,70 +31,70 @@ | |||
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | 32 | ||
33 | class DateBookDayHeader; | 33 | class DateBookDayHeader; |
34 | class DateBookDB; | 34 | class DateBookDB; |
35 | class DatebookdayAllday; | 35 | class DatebookdayAllday; |
36 | class QDateTime; | 36 | class QDateTime; |
37 | class QMouseEvent; | 37 | class QMouseEvent; |
38 | class QPaintEvent; | 38 | class QPaintEvent; |
39 | class QResizeEvent; | 39 | class QResizeEvent; |
40 | 40 | ||
41 | class DateBookDayViewQuickLineEdit : public QLineEdit | 41 | class DateBookDayViewQuickLineEdit : public QLineEdit |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name=0); | 45 | DateBookDayViewQuickLineEdit(const QDateTime &start, const QDateTime &end,QWidget * parent, const char *name=0); |
46 | protected: | 46 | protected: |
47 | Event quickEvent; | 47 | Event quickEvent; |
48 | int active; | 48 | int active; |
49 | void focusOutEvent( QFocusEvent *e ); | 49 | void focusOutEvent( QFocusEvent *e ); |
50 | protected slots: | 50 | protected slots: |
51 | void slotReturnPressed(void); | 51 | void slotReturnPressed(void); |
52 | void finallyCallClose(); | 52 | void finallyCallClose(); |
53 | signals: | 53 | signals: |
54 | void insertEvent(const Event &e); | 54 | void insertEvent(const Event &e); |
55 | }; | 55 | }; |
56 | 56 | ||
57 | 57 | ||
58 | class DateBookDayView : public QTable | 58 | class DateBookDayView : public QTable |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | public: | 61 | public: |
62 | DateBookDayView( bool hourClock, QWidget *parent, const char *name ); | 62 | DateBookDayView( bool hourClock, QWidget *parent, const char *name ); |
63 | bool whichClock() const; | 63 | bool whichClock() const; |
64 | 64 | ||
65 | void setRowStyle( int style ); | 65 | void setRowStyle( int style ); |
66 | 66 | ||
67 | public slots: | 67 | public slots: |
68 | void moveUp(); | 68 | void moveUp(); |
69 | void moveDown(); | 69 | void moveDown(); |
70 | void slotDateChanged( int year, int month, int day ); | 70 | void slotDateChanged( int year, int month, int day ); |
71 | 71 | ||
72 | signals: | 72 | signals: |
73 | void sigColWidthChanged(); | 73 | void sigColWidthChanged(); |
74 | void sigCapturedKey( const QString &txt ); | 74 | void sigCapturedKey( const QString &txt ); |
75 | protected slots: | 75 | protected slots: |
76 | void slotChangeClock( bool ); | 76 | void slotChangeClock( bool ); |
77 | protected: | 77 | protected: |
78 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); | 78 | virtual void paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected ); |
79 | virtual void paintFocus( QPainter *p, const QRect &cr ); | 79 | virtual void paintFocus( QPainter *p, const QRect &cr ); |
80 | 80 | ||
81 | virtual void resizeEvent( QResizeEvent *e ); | 81 | virtual void resizeEvent( QResizeEvent *e ); |
82 | void keyPressEvent( QKeyEvent *e ); | 82 | void keyPressEvent( QKeyEvent *e ); |
83 | void contentsMouseReleaseEvent( QMouseEvent *e ); | 83 | void contentsMouseReleaseEvent( QMouseEvent *e ); |
84 | void initHeader(); | 84 | void initHeader(); |
85 | private: | 85 | private: |
86 | bool ampm; | 86 | bool ampm; |
87 | QDate currDate; | 87 | QDate currDate; |
88 | DateBookDayViewQuickLineEdit *quickLineEdit; | 88 | DateBookDayViewQuickLineEdit *quickLineEdit; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | class DateBookDay; | 91 | class DateBookDay; |
92 | class DateBookDayWidget : public QWidget | 92 | class DateBookDayWidget : public QWidget |
93 | { | 93 | { |
94 | Q_OBJECT | 94 | Q_OBJECT |
95 | 95 | ||
96 | public: | 96 | public: |
97 | DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ); | 97 | DateBookDayWidget( const EffectiveEvent &e, DateBookDay *db ); |
98 | ~DateBookDayWidget(); | 98 | ~DateBookDayWidget(); |
99 | 99 | ||
100 | const QRect &geometry() { return geom; } | 100 | const QRect &geometry() { return geom; } |
@@ -148,67 +148,68 @@ signals: | |||
148 | protected: | 148 | protected: |
149 | void paintEvent( QPaintEvent *e ); | 149 | void paintEvent( QPaintEvent *e ); |
150 | 150 | ||
151 | private: | 151 | private: |
152 | QRect geom; | 152 | QRect geom; |
153 | QTime time; | 153 | QTime time; |
154 | DateBookDay *dateBook; | 154 | DateBookDay *dateBook; |
155 | }; | 155 | }; |
156 | 156 | ||
157 | //reimplemented the compareItems function so that it sorts DayWidgets by geometry heights | 157 | //reimplemented the compareItems function so that it sorts DayWidgets by geometry heights |
158 | class WidgetListClass : public QList<DateBookDayWidget> | 158 | class WidgetListClass : public QList<DateBookDayWidget> |
159 | { | 159 | { |
160 | private: | 160 | private: |
161 | 161 | ||
162 | int compareItems( QCollection::Item s1, QCollection::Item s2 ) | 162 | int compareItems( QCollection::Item s1, QCollection::Item s2 ) |
163 | { | 163 | { |
164 | //hmm, don't punish me for that ;) | 164 | //hmm, don't punish me for that ;) |
165 | if (reinterpret_cast<DateBookDayWidget*>(s1)->geometry().height() > reinterpret_cast<DateBookDayWidget*>(s2)->geometry().height()) | 165 | if (reinterpret_cast<DateBookDayWidget*>(s1)->geometry().height() > reinterpret_cast<DateBookDayWidget*>(s2)->geometry().height()) |
166 | { | 166 | { |
167 | return -1; | 167 | return -1; |
168 | } else | 168 | } else |
169 | { | 169 | { |
170 | return 1; | 170 | return 1; |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | }; | 175 | }; |
176 | 176 | ||
177 | class DateBookDay : public QVBox | 177 | class DateBookDay : public QVBox |
178 | { | 178 | { |
179 | Q_OBJECT | 179 | Q_OBJECT |
180 | 180 | ||
181 | friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB | 181 | friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB |
182 | public: | 182 | public: |
183 | DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, | 183 | DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb,DateBookHoliday*newHdb, |
184 | QWidget *parent, const char *name ); | 184 | QWidget *parent, const char *name ); |
185 | void selectedDates( QDateTime &start, QDateTime &end ); | 185 | void selectedDates( QDateTime &start, QDateTime &end ); |
186 | |||
186 | QDate date() const; | 187 | QDate date() const; |
187 | DateBookDayView *dayView() const { return view; } | 188 | DateBookDayView *dayView() const { return view; } |
188 | void setStartViewTime( int startHere ); | 189 | void setStartViewTime( int startHere ); |
189 | int startViewTime() const; | 190 | int startViewTime() const; |
190 | void setSelectedWidget( DateBookDayWidget * ); | 191 | void setSelectedWidget( DateBookDayWidget * ); |
191 | DateBookDayWidget * getSelectedWidget( void ); | 192 | DateBookDayWidget * getSelectedWidget( void ); |
192 | void setJumpToCurTime( bool bJump ); | 193 | void setJumpToCurTime( bool bJump ); |
193 | void setRowStyle( int style ); | 194 | void setRowStyle( int style ); |
194 | static QDate findRealStart( int uid, const QDate& isIncluded, | 195 | static QDate findRealStart( int uid, const QDate& isIncluded, |
195 | DateBookDB* ); | 196 | DateBookDB* ); |
196 | 197 | ||
197 | public slots: | 198 | public slots: |
198 | void setDate( int y, int m, int d ); | 199 | void setDate( int y, int m, int d ); |
199 | void setDate( QDate ); | 200 | void setDate( QDate ); |
200 | void redraw(); | 201 | void redraw(); |
201 | void slotWeekChanged( bool bStartOnMonday ); | 202 | void slotWeekChanged( bool bStartOnMonday ); |
202 | void updateView();//updates TimeMarker and DayWidget-colors | 203 | void updateView(); //updates TimeMarker and DayWidget-colors |
203 | 204 | ||
204 | signals: | 205 | signals: |
205 | void removeEvent( const Event& ); | 206 | void removeEvent( const Event& ); |
206 | void editEvent( const Event& ); | 207 | void editEvent( const Event& ); |
207 | void duplicateEvent( const Event& ); | 208 | void duplicateEvent( const Event& ); |
208 | void beamEvent( const Event& ); | 209 | void beamEvent( const Event& ); |
209 | void newEvent(); | 210 | void newEvent(); |
210 | void sigNewEvent( const QString & ); | 211 | void sigNewEvent( const QString & ); |
211 | 212 | ||
212 | protected slots: | 213 | protected slots: |
213 | void keyPressEvent(QKeyEvent *); | 214 | void keyPressEvent(QKeyEvent *); |
214 | 215 | ||
@@ -216,21 +217,22 @@ private slots: | |||
216 | void dateChanged( int y, int m, int d ); | 217 | void dateChanged( int y, int m, int d ); |
217 | void slotColWidthChanged() { relayoutPage(); }; | 218 | void slotColWidthChanged() { relayoutPage(); }; |
218 | 219 | ||
219 | private: | 220 | private: |
220 | void getEvents(); | 221 | void getEvents(); |
221 | void relayoutPage( bool fromResize = false ); | 222 | void relayoutPage( bool fromResize = false ); |
222 | DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); | 223 | DateBookDayWidget *intersects( const DateBookDayWidget *item, const QRect &geom ); |
223 | QDate currDate; | 224 | QDate currDate; |
224 | DateBookDayView *view; | 225 | DateBookDayView *view; |
225 | DateBookDayHeader *header; | 226 | DateBookDayHeader *header; |
226 | DatebookdayAllday *m_allDays; | 227 | DatebookdayAllday *m_allDays; |
227 | DateBookDB *db; | 228 | DateBookDB *db; |
228 | WidgetListClass widgetList;//reimplemented QList for sorting widgets by height | 229 | WidgetListClass widgetList; //reimplemented QList for sorting widgets by height |
229 | int startTime; | 230 | int startTime; |
230 | bool jumpToCurTime;//should we jump to current time in dayview? | 231 | bool jumpToCurTime; //should we jump to current time in dayview? |
231 | int rowStyle; | 232 | int rowStyle; |
232 | DateBookDayWidget *selectedWidget; //actual selected widget (obviously) | 233 | DateBookDayWidget *selectedWidget; //actual selected widget (obviously) |
233 | DateBookDayTimeMarker *timeMarker;//marker for current time | 234 | DateBookDayTimeMarker *timeMarker; //marker for current time |
235 | DateBookHoliday*_holiday_db; | ||
234 | }; | 236 | }; |
235 | 237 | ||
236 | #endif | 238 | #endif |