-rw-r--r-- | korganizer/koagendaview.h | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 5e68146..3b871d9 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -1,299 +1,309 @@ | |||
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 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOAGENDAVIEW_H | 23 | #ifndef KOAGENDAVIEW_H |
24 | #define KOAGENDAVIEW_H | 24 | #define KOAGENDAVIEW_H |
25 | 25 | ||
26 | #include <qscrollview.h> | 26 | #include <q3scrollview.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <Q3BoxLayout> | ||
30 | #ifndef DESKTOP_VERSION | 31 | #ifndef DESKTOP_VERSION |
31 | #include <qksplitter.h> | 32 | #include <qksplitter.h> |
32 | #else | 33 | #else |
33 | #include <qsplitter.h> | 34 | #include <qsplitter.h> |
34 | #endif | 35 | #endif |
35 | #include <qmemarray.h> | 36 | #include <q3memarray.h> |
37 | //Added by qt3to4: | ||
38 | #include <QPaintEvent> | ||
39 | #include <QResizeEvent> | ||
40 | #include <Q3Frame> | ||
41 | #include <QPixmap> | ||
42 | #include <QLabel> | ||
43 | #include <QMouseEvent> | ||
44 | #include <Q3PtrList> | ||
45 | #include <QKeyEvent> | ||
36 | 46 | ||
37 | #include "koeventview.h" | 47 | #include "koeventview.h" |
38 | 48 | ||
39 | class QHBox; | 49 | class Q3HBox; |
40 | class QFrame; | 50 | class Q3Frame; |
41 | class QLabel; | 51 | class QLabel; |
42 | class QPushButton; | 52 | class QPushButton; |
43 | class CalendarView; | 53 | class CalendarView; |
44 | class KOAgenda; | 54 | class KOAgenda; |
45 | class KOAgendaItem; | 55 | class KOAgendaItem; |
46 | class KConfig; | 56 | class KConfig; |
47 | class KDGanttMinimizeSplitter; | 57 | class KDGanttMinimizeSplitter; |
48 | 58 | ||
49 | class KOAgendaButton : public QPushButton | 59 | class KOAgendaButton : public QPushButton |
50 | { | 60 | { |
51 | Q_OBJECT | 61 | Q_OBJECT |
52 | public: | 62 | public: |
53 | KOAgendaButton( QWidget *parent=0, const char *name=0 ) : | 63 | KOAgendaButton( QWidget *parent=0, const char *name=0 ) : |
54 | QPushButton( parent, name ) | 64 | QPushButton( parent, name ) |
55 | { | 65 | { |
56 | mNum = -3; | 66 | mNum = -3; |
57 | setFlat( true ); | 67 | setFlat( true ); |
58 | setFocusPolicy(NoFocus); | 68 | setFocusPolicy(Qt::NoFocus); |
59 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | 69 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); |
60 | connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); | 70 | connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); |
61 | }; | 71 | }; |
62 | 72 | ||
63 | QSize sizeHint () const { return QSize( 5,5) ;} | 73 | QSize sizeHint () const { return QSize( 5,5) ;} |
64 | void setNum( int n) { mNum = n; } | 74 | void setNum( int n) { mNum = n; } |
65 | private slots: | 75 | private slots: |
66 | void bClicked() {emit numClicked( mNum);} | 76 | void bClicked() {emit numClicked( mNum);} |
67 | signals: | 77 | signals: |
68 | void numClicked( int ); | 78 | void numClicked( int ); |
69 | private: | 79 | private: |
70 | int mNum; | 80 | int mNum; |
71 | }; | 81 | }; |
72 | 82 | ||
73 | class TimeLabels : public QScrollView { | 83 | class TimeLabels : public Q3ScrollView { |
74 | Q_OBJECT | 84 | Q_OBJECT |
75 | public: | 85 | public: |
76 | TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); | 86 | TimeLabels(int rows,QWidget *parent=0,const char *name=0,Qt::WFlags f=0); |
77 | 87 | ||
78 | void setCellHeight(int height); | 88 | void setCellHeight(int height); |
79 | 89 | ||
80 | /** Calculates the minimum width */ | 90 | /** Calculates the minimum width */ |
81 | virtual int minimumWidth() const; | 91 | virtual int minimumWidth() const; |
82 | 92 | ||
83 | /** updates widget's internal state */ | 93 | /** updates widget's internal state */ |
84 | void updateConfig(); | 94 | void updateConfig(); |
85 | 95 | ||
86 | /** */ | 96 | /** */ |
87 | void setAgenda(KOAgenda* agenda); | 97 | void setAgenda(KOAgenda* agenda); |
88 | 98 | ||
89 | /** */ | 99 | /** */ |
90 | virtual void paintEvent(QPaintEvent* e); | 100 | virtual void paintEvent(QPaintEvent* e); |
91 | void contentsMousePressEvent ( QMouseEvent * ) ; | 101 | void contentsMousePressEvent ( QMouseEvent * ) ; |
92 | void contentsMouseReleaseEvent ( QMouseEvent * ); | 102 | void contentsMouseReleaseEvent ( QMouseEvent * ); |
93 | void contentsMouseMoveEvent ( QMouseEvent * ); | 103 | void contentsMouseMoveEvent ( QMouseEvent * ); |
94 | 104 | ||
95 | public slots: | 105 | public slots: |
96 | /** update time label positions */ | 106 | /** update time label positions */ |
97 | void positionChanged(); | 107 | void positionChanged(); |
98 | signals: | 108 | signals: |
99 | void scaleChanged(); | 109 | void scaleChanged(); |
100 | protected: | 110 | protected: |
101 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 111 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
102 | 112 | ||
103 | private: | 113 | private: |
104 | QPixmap myPix; | 114 | QPixmap myPix; |
105 | bool mRedrawNeeded; | 115 | bool mRedrawNeeded; |
106 | int mMiniWidth; | 116 | int mMiniWidth; |
107 | int mMouseDownY; | 117 | int mMouseDownY; |
108 | QString mOrgCap; | 118 | QString mOrgCap; |
109 | int mRows; | 119 | int mRows; |
110 | int mCellHeight; | 120 | int mCellHeight; |
111 | 121 | ||
112 | /** */ | 122 | /** */ |
113 | KOAgenda* mAgenda; | 123 | KOAgenda* mAgenda; |
114 | }; | 124 | }; |
115 | 125 | ||
116 | class EventIndicator : public QFrame { | 126 | class EventIndicator : public Q3Frame { |
117 | Q_OBJECT | 127 | Q_OBJECT |
118 | public: | 128 | public: |
119 | enum Location { Top, Bottom }; | 129 | enum Location { Top, Bottom }; |
120 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); | 130 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); |
121 | virtual ~EventIndicator(); | 131 | virtual ~EventIndicator(); |
122 | 132 | ||
123 | void changeColumns(int columns); | 133 | void changeColumns(int columns); |
124 | void setPaintWidget( KDGanttMinimizeSplitter* ); | 134 | void setPaintWidget( KDGanttMinimizeSplitter* ); |
125 | void setXOffset( int ); | 135 | void setXOffset( int ); |
126 | void enableColumn(int column, bool enable); | 136 | void enableColumn(int column, bool enable); |
127 | 137 | ||
128 | protected: | 138 | protected: |
129 | void drawContents(QPainter *); | 139 | void drawContents(QPainter *); |
130 | 140 | ||
131 | private: | 141 | private: |
132 | int mXOffset; | 142 | int mXOffset; |
133 | KDGanttMinimizeSplitter* mPaintWidget; | 143 | KDGanttMinimizeSplitter* mPaintWidget; |
134 | int mColumns; | 144 | int mColumns; |
135 | QHBox *mTopBox; | 145 | Q3HBox *mTopBox; |
136 | QBoxLayout *mTopLayout; | 146 | Q3BoxLayout *mTopLayout; |
137 | Location mLocation; | 147 | Location mLocation; |
138 | QPixmap mPixmap; | 148 | QPixmap mPixmap; |
139 | QMemArray<bool> mEnabled; | 149 | Q3MemArray<bool> mEnabled; |
140 | }; | 150 | }; |
141 | 151 | ||
142 | /** | 152 | /** |
143 | KOAgendaView is the agenda-like view used to display events in an one or | 153 | KOAgendaView is the agenda-like view used to display events in an one or |
144 | multi-day view. | 154 | multi-day view. |
145 | */ | 155 | */ |
146 | class KOAgendaView : public KOEventView { | 156 | class KOAgendaView : public KOEventView { |
147 | Q_OBJECT | 157 | Q_OBJECT |
148 | public: | 158 | public: |
149 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); | 159 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); |
150 | virtual ~KOAgendaView(); | 160 | virtual ~KOAgendaView(); |
151 | void setStartHour( int ); | 161 | void setStartHour( int ); |
152 | void toggleAllDay(); | 162 | void toggleAllDay(); |
153 | 163 | ||
154 | 164 | ||
155 | /** Returns maximum number of days supported by the koagendaview */ | 165 | /** Returns maximum number of days supported by the koagendaview */ |
156 | virtual int maxDatesHint(); | 166 | virtual int maxDatesHint(); |
157 | 167 | ||
158 | /** Returns number of currently shown dates. */ | 168 | /** Returns number of currently shown dates. */ |
159 | virtual int currentDateCount(); | 169 | virtual int currentDateCount(); |
160 | 170 | ||
161 | /** returns the currently selected events */ | 171 | /** returns the currently selected events */ |
162 | virtual QPtrList<Incidence> selectedIncidences(); | 172 | virtual Q3PtrList<Incidence> selectedIncidences(); |
163 | 173 | ||
164 | /** returns the currently selected events */ | 174 | /** returns the currently selected events */ |
165 | virtual DateList selectedDates(); | 175 | virtual DateList selectedDates(); |
166 | 176 | ||
167 | /** Remove all events from view */ | 177 | /** Remove all events from view */ |
168 | void clearView(); | 178 | void clearView(); |
169 | void clearList(); | 179 | void clearList(); |
170 | KOAgenda *agenda() { return mAgenda;} | 180 | KOAgenda *agenda() { return mAgenda;} |
171 | virtual void printPreview(CalPrinter *calPrinter, | 181 | virtual void printPreview(CalPrinter *calPrinter, |
172 | const QDate &, const QDate &); | 182 | const QDate &, const QDate &); |
173 | 183 | ||
174 | /** start-datetime of selection */ | 184 | /** start-datetime of selection */ |
175 | QDateTime selectionStart() {return mTimeSpanBegin;} | 185 | QDateTime selectionStart() {return mTimeSpanBegin;} |
176 | /** end-datetime of selection */ | 186 | /** end-datetime of selection */ |
177 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 187 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
178 | /** returns true if selection is for whole day */ | 188 | /** returns true if selection is for whole day */ |
179 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 189 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
180 | /** make selected start/end invalid */ | 190 | /** make selected start/end invalid */ |
181 | void deleteSelectedDateTime(); | 191 | void deleteSelectedDateTime(); |
182 | void repaintAgenda(); | 192 | void repaintAgenda(); |
183 | public slots: | 193 | public slots: |
184 | void setInitStartHour(); | 194 | void setInitStartHour(); |
185 | virtual void updateView(); | 195 | virtual void updateView(); |
186 | virtual void updateConfig(); | 196 | virtual void updateConfig(); |
187 | virtual void showDates(const QDate &start, const QDate &end); | 197 | virtual void showDates(const QDate &start, const QDate &end); |
188 | virtual void showEvents(QPtrList<Event> eventList); | 198 | virtual void showEvents(Q3PtrList<Event> eventList); |
189 | 199 | ||
190 | void updateTodo( Todo *, int ); | 200 | void updateTodo( Todo *, int ); |
191 | void changeEventDisplay(Event *, int); | 201 | void changeEventDisplay(Event *, int); |
192 | 202 | ||
193 | void clearSelection(); | 203 | void clearSelection(); |
194 | 204 | ||
195 | void newTodo(int gx,int gy); | 205 | void newTodo(int gx,int gy); |
196 | void newEvent(int gx,int gy); | 206 | void newEvent(int gx,int gy); |
197 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 207 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
198 | void newEventAllDay(int gx, int gy); | 208 | void newEventAllDay(int gx, int gy); |
199 | void newTodoAllDay(int gx, int gy); | 209 | void newTodoAllDay(int gx, int gy); |
200 | 210 | ||
201 | void startDrag(Event *); | 211 | void startDrag(Event *); |
202 | 212 | ||
203 | void readSettings(); | 213 | void readSettings(); |
204 | void readSettings(KConfig *); | 214 | void readSettings(KConfig *); |
205 | void writeSettings(KConfig *); | 215 | void writeSettings(KConfig *); |
206 | 216 | ||
207 | void setContentsPos(int y); | 217 | void setContentsPos(int y); |
208 | 218 | ||
209 | void scrollOneHourUp(); | 219 | void scrollOneHourUp(); |
210 | void scrollOneHourDown(); | 220 | void scrollOneHourDown(); |
211 | void addToCalSlot(Incidence *, Incidence *); | 221 | void addToCalSlot(Incidence *, Incidence *); |
212 | void slotShowDateView( int, int ); | 222 | void slotShowDateView( int, int ); |
213 | void fillAgenda(); | 223 | void fillAgenda(); |
214 | void startIdleTimeout(); | 224 | void startIdleTimeout(); |
215 | 225 | ||
216 | signals: | 226 | signals: |
217 | void showDateView( int, QDate ); | 227 | void showDateView( int, QDate ); |
218 | void newTodoSignal( QDateTime ,bool ); | 228 | void newTodoSignal( QDateTime ,bool ); |
219 | void toggleExpand(); | 229 | void toggleExpand(); |
220 | void selectWeekNum( int ); | 230 | void selectWeekNum( int ); |
221 | void todoMoved( Todo *, int ); | 231 | void todoMoved( Todo *, int ); |
222 | void incidenceChanged(Incidence * , int ); | 232 | void incidenceChanged(Incidence * , int ); |
223 | // void cloneIncidenceSignal(Incidence *); | 233 | // void cloneIncidenceSignal(Incidence *); |
224 | 234 | ||
225 | protected: | 235 | protected: |
226 | KOAgendaButton* getNewDaylabel(); | 236 | KOAgendaButton* getNewDaylabel(); |
227 | bool mBlockUpdating; | 237 | bool mBlockUpdating; |
228 | int mUpcomingWidth; | 238 | int mUpcomingWidth; |
229 | /** Fill agenda beginning with date startDate */ | 239 | /** Fill agenda beginning with date startDate */ |
230 | void fillAgenda(const QDate &startDate); | 240 | void fillAgenda(const QDate &startDate); |
231 | void resizeEvent( QResizeEvent* e ); | 241 | void resizeEvent( QResizeEvent* e ); |
232 | /** Fill agenda using the current set value for the start date */ | 242 | /** Fill agenda using the current set value for the start date */ |
233 | 243 | ||
234 | /** Create labels for the selected dates. */ | 244 | /** Create labels for the selected dates. */ |
235 | void createDayLabels(); | 245 | void createDayLabels(); |
236 | 246 | ||
237 | /** | 247 | /** |
238 | Set the masks on the agenda widgets indicating, which days are holidays. | 248 | Set the masks on the agenda widgets indicating, which days are holidays. |
239 | */ | 249 | */ |
240 | void setHolidayMasks(); | 250 | void setHolidayMasks(); |
241 | 251 | ||
242 | protected slots: | 252 | protected slots: |
243 | void slotIdleTimeout(); | 253 | void slotIdleTimeout(); |
244 | void categoryChanged( Incidence * ); | 254 | void categoryChanged( Incidence * ); |
245 | void slotDaylabelClicked( int ); | 255 | void slotDaylabelClicked( int ); |
246 | /** Update event belonging to agenda item */ | 256 | /** Update event belonging to agenda item */ |
247 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 257 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
248 | //void updateMovedTodo(); | 258 | //void updateMovedTodo(); |
249 | 259 | ||
250 | void updateEventIndicatorTop(int newY); | 260 | void updateEventIndicatorTop(int newY); |
251 | void updateEventIndicatorBottom(int newY); | 261 | void updateEventIndicatorBottom(int newY); |
252 | 262 | ||
253 | /** Updates data for selected timespan */ | 263 | /** Updates data for selected timespan */ |
254 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 264 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
255 | /** Updates data for selected timespan for all day event*/ | 265 | /** Updates data for selected timespan for all day event*/ |
256 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 266 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
257 | 267 | ||
258 | private: | 268 | private: |
259 | bool flag_blockfillAgenda; | 269 | bool flag_blockfillAgenda; |
260 | QTimer* mIdleTimer; | 270 | QTimer* mIdleTimer; |
261 | QDateTime mIdleStart; | 271 | QDateTime mIdleStart; |
262 | // view widgets | 272 | // view widgets |
263 | QFrame *mDayLabels; | 273 | Q3Frame *mDayLabels; |
264 | QHBox *mDayLabelsFrame; | 274 | Q3HBox *mDayLabelsFrame; |
265 | QBoxLayout *mLayoutDayLabels; | 275 | Q3BoxLayout *mLayoutDayLabels; |
266 | QFrame *mAllDayFrame; | 276 | Q3Frame *mAllDayFrame; |
267 | KOAgenda *mAllDayAgenda; | 277 | KOAgenda *mAllDayAgenda; |
268 | KOAgenda *mAgenda; | 278 | KOAgenda *mAgenda; |
269 | TimeLabels *mTimeLabels; | 279 | TimeLabels *mTimeLabels; |
270 | QWidget *mDummyAllDayLeft; | 280 | QWidget *mDummyAllDayLeft; |
271 | 281 | ||
272 | KDGanttMinimizeSplitter* mSplitterAgenda; | 282 | KDGanttMinimizeSplitter* mSplitterAgenda; |
273 | QPushButton *mExpandButton; | 283 | QPushButton *mExpandButton; |
274 | 284 | ||
275 | DateList mSelectedDates; // List of dates to be displayed | 285 | DateList mSelectedDates; // List of dates to be displayed |
276 | int mViewType; | 286 | int mViewType; |
277 | 287 | ||
278 | bool mWeekStartsMonday; | 288 | bool mWeekStartsMonday; |
279 | int mStartHour; | 289 | int mStartHour; |
280 | 290 | ||
281 | KOEventPopupMenu *mAllAgendaPopup; | 291 | KOEventPopupMenu *mAllAgendaPopup; |
282 | //KOEventPopupMenu *mAllDayAgendaPopup; | 292 | //KOEventPopupMenu *mAllDayAgendaPopup; |
283 | 293 | ||
284 | EventIndicator *mEventIndicatorTop; | 294 | EventIndicator *mEventIndicatorTop; |
285 | EventIndicator *mEventIndicatorBottom; | 295 | EventIndicator *mEventIndicatorBottom; |
286 | 296 | ||
287 | QMemArray<int> mMinY; | 297 | Q3MemArray<int> mMinY; |
288 | QMemArray<int> mMaxY; | 298 | Q3MemArray<int> mMaxY; |
289 | 299 | ||
290 | QMemArray<bool> mHolidayMask; | 300 | Q3MemArray<bool> mHolidayMask; |
291 | 301 | ||
292 | QPtrList<KOAgendaButton> mDayLabelsList; | 302 | Q3PtrList<KOAgendaButton> mDayLabelsList; |
293 | QDateTime mTimeSpanBegin; | 303 | QDateTime mTimeSpanBegin; |
294 | QDateTime mTimeSpanEnd; | 304 | QDateTime mTimeSpanEnd; |
295 | bool mTimeSpanInAllDay; | 305 | bool mTimeSpanInAllDay; |
296 | void keyPressEvent ( QKeyEvent * e ); | 306 | void keyPressEvent ( QKeyEvent * e ); |
297 | }; | 307 | }; |
298 | 308 | ||
299 | #endif // KOAGENDAVIEW_H | 309 | #endif // KOAGENDAVIEW_H |