-rw-r--r-- | korganizer/komonthview.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index a29a1a8..bf861ef 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,295 +1,297 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qintdict.h> | 30 | #include <qintdict.h> |
31 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
32 | #include <qvaluelist.h> | 32 | #include <qvaluelist.h> |
33 | #include <qptrvector.h> | 33 | #include <qptrvector.h> |
34 | 34 | ||
35 | #include <libkcal/calendar.h> | 35 | #include <libkcal/calendar.h> |
36 | #include <libkcal/event.h> | 36 | #include <libkcal/event.h> |
37 | 37 | ||
38 | #include "koeventview.h" | 38 | #include "koeventview.h" |
39 | #include "navigatorbar.h" | ||
39 | 40 | ||
40 | #ifdef DESKTOP_VERSION | 41 | #ifdef DESKTOP_VERSION |
41 | class QToolTipGroup; | 42 | class QToolTipGroup; |
42 | #endif | 43 | #endif |
43 | 44 | ||
44 | class KNOWhatsThis; | 45 | class KNOWhatsThis; |
45 | class KOWeekButton : public QPushButton | 46 | class KOWeekButton : public QPushButton |
46 | { | 47 | { |
47 | Q_OBJECT | 48 | Q_OBJECT |
48 | public: | 49 | public: |
49 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 50 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
50 | QPushButton( parent, name) | 51 | QPushButton( parent, name) |
51 | { | 52 | { |
52 | connect( this, SIGNAL( clicked() ), | 53 | connect( this, SIGNAL( clicked() ), |
53 | SLOT( bottonClicked() )); | 54 | SLOT( bottonClicked() )); |
54 | mNumber = -1; | 55 | mNumber = -1; |
55 | } | 56 | } |
56 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 57 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
57 | int getWeekNum() { return mNumber;} | 58 | int getWeekNum() { return mNumber;} |
58 | signals: | 59 | signals: |
59 | void selectWeekNum ( int ); | 60 | void selectWeekNum ( int ); |
60 | private: | 61 | private: |
61 | int mNumber; | 62 | int mNumber; |
62 | private slots : | 63 | private slots : |
63 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 64 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
64 | }; | 65 | }; |
65 | 66 | ||
66 | class KNoScrollListBox: public QListBox | 67 | class KNoScrollListBox: public QListBox |
67 | { | 68 | { |
68 | Q_OBJECT | 69 | Q_OBJECT |
69 | public: | 70 | public: |
70 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 71 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
71 | ~KNoScrollListBox(); | 72 | ~KNoScrollListBox(); |
72 | QString getWhatsThisText(QPoint p) ; | 73 | QString getWhatsThisText(QPoint p) ; |
73 | 74 | ||
74 | signals: | 75 | signals: |
75 | void shiftDown(); | 76 | void shiftDown(); |
76 | void shiftUp(); | 77 | void shiftUp(); |
77 | void rightClick(); | 78 | void rightClick(); |
78 | 79 | ||
79 | protected slots: | 80 | protected slots: |
80 | void oneDown(); | 81 | void oneDown(); |
81 | void keyPressEvent(QKeyEvent *); | 82 | void keyPressEvent(QKeyEvent *); |
82 | void keyReleaseEvent(QKeyEvent *); | 83 | void keyReleaseEvent(QKeyEvent *); |
83 | void mousePressEvent(QMouseEvent *); | 84 | void mousePressEvent(QMouseEvent *); |
84 | 85 | ||
85 | private: | 86 | private: |
86 | KNOWhatsThis * mWT; | 87 | KNOWhatsThis * mWT; |
87 | }; | 88 | }; |
88 | 89 | ||
89 | 90 | ||
90 | class MonthViewItem: public QListBoxItem | 91 | class MonthViewItem: public QListBoxItem |
91 | { | 92 | { |
92 | public: | 93 | public: |
93 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 94 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
94 | 95 | ||
95 | void setRecur(bool on) { mRecur = on; } | 96 | void setRecur(bool on) { mRecur = on; } |
96 | void setAlarm(bool on) { mAlarm = on; } | 97 | void setAlarm(bool on) { mAlarm = on; } |
97 | void setReply(bool on) { mReply = on; } | 98 | void setReply(bool on) { mReply = on; } |
98 | void setMoreInfo(bool on) { mInfo = on; } | 99 | void setMoreInfo(bool on) { mInfo = on; } |
99 | 100 | ||
100 | 101 | ||
101 | void setPalette(const QPalette &p) { mPalette = p; } | 102 | void setPalette(const QPalette &p) { mPalette = p; } |
102 | QPalette palette() const { return mPalette; } | 103 | QPalette palette() const { return mPalette; } |
103 | 104 | ||
104 | Incidence *incidence() const { return mIncidence; } | 105 | Incidence *incidence() const { return mIncidence; } |
105 | QDate incidenceDate() { return mDate; } | 106 | QDate incidenceDate() { return mDate; } |
106 | 107 | ||
107 | protected: | 108 | protected: |
108 | virtual void paint(QPainter *); | 109 | virtual void paint(QPainter *); |
109 | virtual int height(const QListBox *) const; | 110 | virtual int height(const QListBox *) const; |
110 | virtual int width(const QListBox *) const; | 111 | virtual int width(const QListBox *) const; |
111 | 112 | ||
112 | private: | 113 | private: |
113 | bool mRecur; | 114 | bool mRecur; |
114 | bool mAlarm; | 115 | bool mAlarm; |
115 | bool mReply; | 116 | bool mReply; |
116 | bool mInfo; | 117 | bool mInfo; |
117 | 118 | ||
118 | QPalette mPalette; | 119 | QPalette mPalette; |
119 | QDate mDate; | 120 | QDate mDate; |
120 | 121 | ||
121 | Incidence *mIncidence; | 122 | Incidence *mIncidence; |
122 | }; | 123 | }; |
123 | 124 | ||
124 | 125 | ||
125 | class KOMonthView; | 126 | class KOMonthView; |
126 | 127 | ||
127 | class MonthViewCell : public QWidget | 128 | class MonthViewCell : public QWidget |
128 | { | 129 | { |
129 | Q_OBJECT | 130 | Q_OBJECT |
130 | public: | 131 | public: |
131 | MonthViewCell(KOMonthView *,QWidget* ); | 132 | MonthViewCell(KOMonthView *,QWidget* ); |
132 | 133 | ||
133 | void setDate( const QDate & ); | 134 | void setDate( const QDate & ); |
134 | QDate date() const; | 135 | QDate date() const; |
135 | 136 | ||
136 | void setPrimary( bool ); | 137 | void setPrimary( bool ); |
137 | bool isPrimary() const; | 138 | bool isPrimary() const; |
138 | 139 | ||
139 | void setHoliday( bool ); | 140 | void setHoliday( bool ); |
140 | void setHoliday( const QString & ); | 141 | void setHoliday( const QString & ); |
141 | 142 | ||
142 | void updateCell(); | 143 | void updateCell(); |
143 | void startUpdateCell(); | 144 | void startUpdateCell(); |
144 | void finishUpdateCell(); | 145 | void finishUpdateCell(); |
145 | void insertEvent(Event *); | 146 | void insertEvent(Event *); |
146 | void insertTodo(Todo *); | 147 | void insertTodo(Todo *); |
147 | 148 | ||
148 | void updateConfig( bool bigFont = false ); | 149 | void updateConfig( bool bigFont = false ); |
149 | 150 | ||
150 | void enableScrollBars( bool ); | 151 | void enableScrollBars( bool ); |
151 | 152 | ||
152 | Incidence *selectedIncidence(); | 153 | Incidence *selectedIncidence(); |
153 | QDate selectedIncidenceDate(); | 154 | QDate selectedIncidenceDate(); |
154 | 155 | ||
155 | void deselect(); | 156 | void deselect(); |
156 | void select(); | 157 | void select(); |
157 | 158 | ||
158 | #ifdef DESKTOP_VERSION | 159 | #ifdef DESKTOP_VERSION |
159 | static QToolTipGroup *toolTipGroup(); | 160 | static QToolTipGroup *toolTipGroup(); |
160 | #endif | 161 | #endif |
161 | signals: | 162 | signals: |
162 | void defaultAction( Incidence * ); | 163 | void defaultAction( Incidence * ); |
163 | void newEventSignal( QDateTime ); | 164 | void newEventSignal( QDateTime ); |
164 | void showDaySignal( QDate ); | 165 | void showDaySignal( QDate ); |
165 | 166 | ||
166 | protected: | 167 | protected: |
167 | QString mToolTip; | 168 | QString mToolTip; |
168 | void resizeEvent( QResizeEvent * ); | 169 | void resizeEvent( QResizeEvent * ); |
169 | 170 | ||
170 | protected slots: | 171 | protected slots: |
171 | void defaultAction( QListBoxItem * ); | 172 | void defaultAction( QListBoxItem * ); |
172 | void contextMenu( QListBoxItem * ); | 173 | void contextMenu( QListBoxItem * ); |
173 | void selection( QListBoxItem * ); | 174 | void selection( QListBoxItem * ); |
174 | void cellClicked( QListBoxItem * ); | 175 | void cellClicked( QListBoxItem * ); |
175 | void newEvent(); | 176 | void newEvent(); |
176 | void showDay(); | 177 | void showDay(); |
177 | 178 | ||
178 | private: | 179 | private: |
179 | KOMonthView *mMonthView; | 180 | KOMonthView *mMonthView; |
180 | 181 | ||
181 | QDate mDate; | 182 | QDate mDate; |
182 | bool mPrimary; | 183 | bool mPrimary; |
183 | bool mHoliday; | 184 | bool mHoliday; |
184 | QString mHolidayString; | 185 | QString mHolidayString; |
185 | 186 | ||
186 | //QLabel *mLabel; | 187 | //QLabel *mLabel; |
187 | QPushButton *mLabel; | 188 | QPushButton *mLabel; |
188 | QListBox *mItemList; | 189 | QListBox *mItemList; |
189 | #ifdef DESKTOP_VERSION | 190 | #ifdef DESKTOP_VERSION |
190 | static QToolTipGroup *mToolTipGroup; | 191 | static QToolTipGroup *mToolTipGroup; |
191 | #endif | 192 | #endif |
192 | QSize mLabelSize; | 193 | QSize mLabelSize; |
193 | QSize mLabelBigSize; | 194 | QSize mLabelBigSize; |
194 | QPalette mHolidayPalette; | 195 | QPalette mHolidayPalette; |
195 | QPalette mStandardPalette; | 196 | QPalette mStandardPalette; |
196 | QPalette mPrimaryPalette; | 197 | QPalette mPrimaryPalette; |
197 | QPalette mNonPrimaryPalette; | 198 | QPalette mNonPrimaryPalette; |
198 | void setMyPalette(); | 199 | void setMyPalette(); |
199 | QPalette getPalette (); | 200 | QPalette getPalette (); |
200 | void keyPressEvent ( QKeyEvent * ) ; | 201 | void keyPressEvent ( QKeyEvent * ) ; |
201 | 202 | ||
202 | }; | 203 | }; |
203 | 204 | ||
204 | 205 | ||
205 | class KOMonthView: public KOEventView | 206 | class KOMonthView: public KOEventView |
206 | { | 207 | { |
207 | Q_OBJECT | 208 | Q_OBJECT |
208 | public: | 209 | public: |
209 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 210 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
210 | ~KOMonthView(); | 211 | ~KOMonthView(); |
211 | 212 | ||
212 | /** Returns maximum number of days supported by the komonthview */ | 213 | /** Returns maximum number of days supported by the komonthview */ |
213 | virtual int maxDatesHint(); | 214 | virtual int maxDatesHint(); |
214 | 215 | ||
215 | /** Returns number of currently shown dates. */ | 216 | /** Returns number of currently shown dates. */ |
216 | virtual int currentDateCount(); | 217 | virtual int currentDateCount(); |
217 | 218 | ||
218 | /** returns the currently selected events */ | 219 | /** returns the currently selected events */ |
219 | virtual QPtrList<Incidence> selectedIncidences(); | 220 | virtual QPtrList<Incidence> selectedIncidences(); |
220 | 221 | ||
221 | /** returns dates of the currently selected events */ | 222 | /** returns dates of the currently selected events */ |
222 | virtual DateList selectedDates(); | 223 | virtual DateList selectedDates(); |
223 | 224 | ||
224 | virtual void printPreview(CalPrinter *calPrinter, | 225 | virtual void printPreview(CalPrinter *calPrinter, |
225 | const QDate &, const QDate &); | 226 | const QDate &, const QDate &); |
226 | bool isMonthView() { return true; } | 227 | bool isMonthView() { return true; } |
227 | bool isUpdatePossible() { return updatePossible; } | 228 | bool isUpdatePossible() { return updatePossible; } |
228 | 229 | ||
229 | MonthViewCell * selectedCell(); | 230 | MonthViewCell * selectedCell(); |
230 | bool skipResize; | 231 | bool skipResize; |
232 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | ||
231 | public slots: | 233 | public slots: |
232 | virtual void updateView(); | 234 | virtual void updateView(); |
233 | virtual void updateConfig(); | 235 | virtual void updateConfig(); |
234 | virtual void showDates(const QDate &start, const QDate &end); | 236 | virtual void showDates(const QDate &start, const QDate &end); |
235 | virtual void showEvents(QPtrList<Event> eventList); | 237 | virtual void showEvents(QPtrList<Event> eventList); |
236 | 238 | ||
237 | void changeEventDisplay(Event *, int); | 239 | void changeEventDisplay(Event *, int); |
238 | 240 | ||
239 | void clearSelection(); | 241 | void clearSelection(); |
240 | 242 | ||
241 | void showContextMenu( Incidence * ); | 243 | void showContextMenu( Incidence * ); |
242 | 244 | ||
243 | void setSelectedCell( MonthViewCell * ); | 245 | void setSelectedCell( MonthViewCell * ); |
244 | 246 | ||
245 | protected slots: | 247 | protected slots: |
246 | void selectInternalWeekNum ( int ); | 248 | void selectInternalWeekNum ( int ); |
247 | void switchView(); | 249 | void switchView(); |
248 | void processSelectionChange(); | 250 | void processSelectionChange(); |
249 | signals: | 251 | signals: |
250 | void nextMonth(); | 252 | void nextMonth(); |
251 | void prevMonth(); | 253 | void prevMonth(); |
252 | void showNavigator( bool ); | ||
253 | void selectWeekNum ( int ); | 254 | void selectWeekNum ( int ); |
254 | void showDaySignal( QDate ); | 255 | void showDaySignal( QDate ); |
255 | protected: | 256 | protected: |
256 | void resizeEvent(QResizeEvent *); | 257 | void resizeEvent(QResizeEvent *); |
257 | void viewChanged(); | 258 | void viewChanged(); |
258 | void updateDayLabels(); | 259 | void updateDayLabels(); |
259 | 260 | ||
260 | private: | 261 | private: |
262 | NavigatorBar* mNavigatorBar; | ||
261 | int currentWeek(); | 263 | int currentWeek(); |
262 | bool clPending; | 264 | bool clPending; |
263 | QWidgetStack * mWidStack; | 265 | QWidgetStack * mWidStack; |
264 | QWidget* mMonthView; | 266 | QWidget* mMonthView; |
265 | QWidget* mWeekView; | 267 | QWidget* mWeekView; |
266 | bool mShowWeekView; | 268 | bool mShowWeekView; |
267 | bool updatePossible; | 269 | bool updatePossible; |
268 | int mDaysPerWeek; | 270 | int mDaysPerWeek; |
269 | int mNumWeeks; | 271 | int mNumWeeks; |
270 | int mNumCells; | 272 | int mNumCells; |
271 | bool mWeekStartsMonday; | 273 | bool mWeekStartsMonday; |
272 | bool mShowSatSunComp; | 274 | bool mShowSatSunComp; |
273 | void computeLayout(); | 275 | void computeLayout(); |
274 | void computeLayoutWeek(); | 276 | void computeLayoutWeek(); |
275 | 277 | ||
276 | QPtrVector<MonthViewCell> mCells; | 278 | QPtrVector<MonthViewCell> mCells; |
277 | QPtrVector<QLabel> mDayLabels; | 279 | QPtrVector<QLabel> mDayLabels; |
278 | QPtrVector<KOWeekButton> mWeekLabels; | 280 | QPtrVector<KOWeekButton> mWeekLabels; |
279 | QPtrVector<MonthViewCell> mCellsW; | 281 | QPtrVector<MonthViewCell> mCellsW; |
280 | QPtrVector<QLabel> mDayLabelsW; | 282 | QPtrVector<QLabel> mDayLabelsW; |
281 | QPtrVector<KOWeekButton> mWeekLabelsW; | 283 | QPtrVector<KOWeekButton> mWeekLabelsW; |
282 | 284 | ||
283 | bool mShortDayLabels; | 285 | bool mShortDayLabels; |
284 | int mWidthLongDayLabel; | 286 | int mWidthLongDayLabel; |
285 | 287 | ||
286 | QDate mStartDate; | 288 | QDate mStartDate; |
287 | 289 | ||
288 | MonthViewCell *mSelectedCell; | 290 | MonthViewCell *mSelectedCell; |
289 | 291 | ||
290 | KOEventPopupMenu *mContextMenu; | 292 | KOEventPopupMenu *mContextMenu; |
291 | void keyPressEvent ( QKeyEvent * ) ; | 293 | void keyPressEvent ( QKeyEvent * ) ; |
292 | 294 | ||
293 | }; | 295 | }; |
294 | 296 | ||
295 | #endif | 297 | #endif |