-rw-r--r-- | korganizer/koagenda.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index 111242f..12943d7 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h | |||
@@ -33,254 +33,258 @@ | |||
33 | #include "koagendaitem.h" | 33 | #include "koagendaitem.h" |
34 | 34 | ||
35 | class QPopupMenu; | 35 | class QPopupMenu; |
36 | class QTime; | 36 | class QTime; |
37 | class KConfig; | 37 | class KConfig; |
38 | class QFrame; | 38 | class QFrame; |
39 | class KOAgenda; | 39 | class KOAgenda; |
40 | class KCal::Event; | 40 | class KCal::Event; |
41 | class KCal::Todo; | 41 | class KCal::Todo; |
42 | 42 | ||
43 | using namespace KCal; | 43 | using namespace KCal; |
44 | 44 | ||
45 | class MarcusBains : public QFrame { | 45 | class MarcusBains : public QFrame { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | MarcusBains(KOAgenda *agenda=0,const char *name=0); | 48 | MarcusBains(KOAgenda *agenda=0,const char *name=0); |
49 | virtual ~MarcusBains(); | 49 | virtual ~MarcusBains(); |
50 | 50 | ||
51 | public slots: | 51 | public slots: |
52 | void updateLocation(bool recalculate=false); | 52 | void updateLocation(bool recalculate=false); |
53 | void updateLoc(); | 53 | void updateLoc(); |
54 | 54 | ||
55 | private: | 55 | private: |
56 | int todayColumn(); | 56 | int todayColumn(); |
57 | QTimer *minutes; | 57 | QTimer *minutes; |
58 | QLabel *mTimeBox; | 58 | QLabel *mTimeBox; |
59 | KOAgenda *agenda; | 59 | KOAgenda *agenda; |
60 | QTime oldTime; | 60 | QTime oldTime; |
61 | int oldToday; | 61 | int oldToday; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | 64 | ||
65 | class KOAgenda : public QScrollView | 65 | class KOAgenda : public QScrollView |
66 | { | 66 | { |
67 | Q_OBJECT | 67 | Q_OBJECT |
68 | public: | 68 | public: |
69 | enum MouseActionType { NOP, MOVE, SELECT, | 69 | enum MouseActionType { NOP, MOVE, SELECT, |
70 | RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; | 70 | RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; |
71 | 71 | ||
72 | KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, | 72 | KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, |
73 | const char * name=0, WFlags f=0 ); | 73 | const char * name=0, WFlags f=0 ); |
74 | KOAgenda ( int columns, QWidget * parent=0, | 74 | KOAgenda ( int columns, QWidget * parent=0, |
75 | const char * name=0, WFlags f=0 ); | 75 | const char * name=0, WFlags f=0 ); |
76 | virtual ~KOAgenda(); | 76 | virtual ~KOAgenda(); |
77 | 77 | ||
78 | Incidence *selectedIncidence() const; | 78 | Incidence *selectedIncidence() const; |
79 | QDate selectedIncidenceDate() const; | 79 | QDate selectedIncidenceDate() const; |
80 | 80 | ||
81 | virtual bool eventFilter ( QObject *, QEvent * ); | 81 | virtual bool eventFilter ( QObject *, QEvent * ); |
82 | 82 | ||
83 | void contentsToGrid (int x, int y, int& gx, int& gy); | 83 | void contentsToGrid (int x, int y, int& gx, int& gy); |
84 | void gridToContents (int gx, int gy, int& x, int& y); | 84 | void gridToContents (int gx, int gy, int& x, int& y); |
85 | 85 | ||
86 | int timeToY (const QTime &time); | 86 | int timeToY (const QTime &time); |
87 | QTime gyToTime (int y); | 87 | QTime gyToTime (int y); |
88 | 88 | ||
89 | void setStartHour(int startHour); | 89 | void setStartHour(int startHour); |
90 | 90 | ||
91 | KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); | 91 | KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); |
92 | KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); | 92 | KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); |
93 | void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | 93 | void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, |
94 | int YTop,int YBottom); | 94 | int YTop,int YBottom); |
95 | 95 | ||
96 | void changeColumns(int columns); | 96 | void changeColumns(int columns); |
97 | 97 | ||
98 | int columns() { return mColumns; } | 98 | int columns() { return mColumns; } |
99 | int rows() { return mRows; } | 99 | int rows() { return mRows; } |
100 | 100 | ||
101 | int gridSpacingX() const { return mGridSpacingX; } | 101 | int gridSpacingX() const { return mGridSpacingX; } |
102 | int gridSpacingY() const { return mGridSpacingY; } | 102 | int gridSpacingY() const { return mGridSpacingY; } |
103 | 103 | ||
104 | // virtual QSizePolicy sizePolicy() const; | 104 | // virtual QSizePolicy sizePolicy() const; |
105 | 105 | ||
106 | void clear(); | 106 | void clear(); |
107 | 107 | ||
108 | void clearSelection(); | 108 | void clearSelection(); |
109 | void hideUnused(); | 109 | void hideUnused(); |
110 | 110 | ||
111 | /** Calculates the minimum width */ | 111 | /** Calculates the minimum width */ |
112 | virtual int minimumWidth() const; | 112 | virtual int minimumWidth() const; |
113 | /** Update configuration from preference settings */ | 113 | /** Update configuration from preference settings */ |
114 | void updateConfig(); | 114 | void updateConfig(); |
115 | 115 | ||
116 | void checkScrollBoundaries(); | 116 | void checkScrollBoundaries(); |
117 | 117 | ||
118 | void setHolidayMask(QMemArray<bool> *); | 118 | void setHolidayMask(QMemArray<bool> *); |
119 | void setDateList(const DateList &selectedDates); | 119 | void setDateList(const DateList &selectedDates); |
120 | DateList dateList() const; | 120 | DateList dateList() const; |
121 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); | 121 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); |
122 | void finishUpdate(); | 122 | void finishUpdate(); |
123 | void printSelection(); | 123 | void printSelection(); |
124 | void storePosition(); | 124 | void storePosition(); |
125 | void restorePosition(); | 125 | void restorePosition(); |
126 | 126 | ||
127 | 127 | ||
128 | public slots: | 128 | public slots: |
129 | void newItem( int ); | ||
129 | void moveChild( QWidget *, int, int ); | 130 | void moveChild( QWidget *, int, int ); |
130 | void scrollUp(); | 131 | void scrollUp(); |
131 | void scrollDown(); | 132 | void scrollDown(); |
132 | void updateTodo( Todo * t, int , bool ); | 133 | void updateTodo( Todo * t, int , bool ); |
133 | void popupAlarm(); | 134 | void popupAlarm(); |
134 | 135 | ||
135 | void checkScrollBoundaries(int); | 136 | void checkScrollBoundaries(int); |
136 | 137 | ||
137 | /** Deselect selected items. This function does not emit any signals. */ | 138 | /** Deselect selected items. This function does not emit any signals. */ |
138 | void deselectItem(); | 139 | void deselectItem(); |
139 | /** Select item. If the argument is 0, the currently selected item gets | 140 | /** Select item. If the argument is 0, the currently selected item gets |
140 | deselected. This function emits the itemSelected(bool) signal to inform | 141 | deselected. This function emits the itemSelected(bool) signal to inform |
141 | about selection/deseelction of events. */ | 142 | about selection/deseelction of events. */ |
142 | void selectItem(KOAgendaItem *); | 143 | void selectItem(KOAgendaItem *); |
143 | void finishResize(); | 144 | void finishResize(); |
144 | 145 | ||
145 | signals: | 146 | signals: |
146 | void newEventSignal(); | 147 | void newEventSignal(); |
147 | void newEventSignal(int gx,int gy); | 148 | void newEventSignal(int gx,int gy); |
149 | void newTodoSignal(int gx,int gy); | ||
148 | void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); | 150 | void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); |
149 | void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); | 151 | void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); |
150 | void newStartSelectSignal(); | 152 | void newStartSelectSignal(); |
151 | void showIncidenceSignal(Incidence *); | 153 | void showIncidenceSignal(Incidence *); |
152 | void editIncidenceSignal(Incidence *); | 154 | void editIncidenceSignal(Incidence *); |
153 | void deleteIncidenceSignal(Incidence *); | 155 | void deleteIncidenceSignal(Incidence *); |
154 | void showIncidencePopupSignal(Incidence *); | 156 | void showIncidencePopupSignal(Incidence *); |
155 | 157 | ||
156 | void itemModified(KOAgendaItem *item, int ); | 158 | void itemModified(KOAgendaItem *item, int ); |
157 | void incidenceSelected(Incidence *); | 159 | void incidenceSelected(Incidence *); |
158 | 160 | ||
159 | void lowerYChanged(int); | 161 | void lowerYChanged(int); |
160 | void upperYChanged(int); | 162 | void upperYChanged(int); |
161 | 163 | ||
162 | void startDragSignal(Incidence *); | 164 | void startDragSignal(Incidence *); |
163 | void addToCalSignal(Incidence *, Incidence *); | 165 | void addToCalSignal(Incidence *, Incidence *); |
164 | void resizedSignal(); | 166 | void resizedSignal(); |
165 | 167 | ||
166 | protected: | 168 | protected: |
167 | QPainter mPixPainter; | 169 | QPainter mPixPainter; |
168 | QPixmap mPaintPixmap; | 170 | QPixmap mPaintPixmap; |
169 | QPixmap mHighlightPixmap; | 171 | QPixmap mHighlightPixmap; |
170 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 172 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
171 | virtual void resizeEvent ( QResizeEvent * ); | 173 | virtual void resizeEvent ( QResizeEvent * ); |
172 | 174 | ||
173 | /** Handles mouse events. Called from eventFilter */ | 175 | /** Handles mouse events. Called from eventFilter */ |
174 | virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); | 176 | virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); |
175 | 177 | ||
176 | /** Start selecting time span. */ | 178 | /** Start selecting time span. */ |
177 | void startSelectAction(QPoint viewportPos); | 179 | void startSelectAction(QPoint viewportPos); |
178 | 180 | ||
179 | /** Select time span. */ | 181 | /** Select time span. */ |
180 | void performSelectAction(QPoint viewportPos); | 182 | void performSelectAction(QPoint viewportPos); |
181 | 183 | ||
182 | /** Emd selecting time span. */ | 184 | /** Emd selecting time span. */ |
183 | void endSelectAction(); | 185 | void endSelectAction( bool emitNewEvent = false ); |
184 | 186 | ||
185 | /** Start moving/resizing agenda item */ | 187 | /** Start moving/resizing agenda item */ |
186 | void startItemAction(QPoint viewportPos); | 188 | void startItemAction(QPoint viewportPos); |
187 | 189 | ||
188 | /** Move/resize agenda item */ | 190 | /** Move/resize agenda item */ |
189 | void performItemAction(QPoint viewportPos); | 191 | void performItemAction(QPoint viewportPos); |
190 | 192 | ||
191 | /** End moving/resizing agenda item */ | 193 | /** End moving/resizing agenda item */ |
192 | void endItemAction(); | 194 | void endItemAction(); |
193 | 195 | ||
194 | /** Set cursor, when no item action is in progress */ | 196 | /** Set cursor, when no item action is in progress */ |
195 | void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); | 197 | void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); |
196 | 198 | ||
197 | /** Place agenda item in agenda and adjust other cells if necessary */ | 199 | /** Place agenda item in agenda and adjust other cells if necessary */ |
198 | void placeSubCells(KOAgendaItem *placeItem); | 200 | void placeSubCells(KOAgendaItem *placeItem); |
199 | 201 | ||
200 | /** Process the keyevent, including the ignored keyevents of eventwidgets. | 202 | /** Process the keyevent, including the ignored keyevents of eventwidgets. |
201 | * Implements pgup/pgdn and cursor key navigation in the view. | 203 | * Implements pgup/pgdn and cursor key navigation in the view. |
202 | */ | 204 | */ |
203 | void keyPressEvent( QKeyEvent * ); | 205 | void keyPressEvent( QKeyEvent * ); |
204 | 206 | ||
205 | void calculateWorkingHours(); | 207 | void calculateWorkingHours(); |
206 | 208 | ||
207 | virtual void contentsMousePressEvent ( QMouseEvent * ); | 209 | virtual void contentsMousePressEvent ( QMouseEvent * ); |
208 | 210 | ||
209 | private: | 211 | private: |
212 | bool blockNewEvent; | ||
210 | void init(); | 213 | void init(); |
211 | void marcus_bains(); | 214 | void marcus_bains(); |
212 | bool mAllDayMode; | 215 | bool mAllDayMode; |
213 | bool blockResize; | 216 | bool blockResize; |
214 | QTimer mResizeTimer; | 217 | QTimer mResizeTimer; |
215 | double mContentPosition; | 218 | double mContentPosition; |
216 | 219 | ||
217 | // Width and height of agenda cells | 220 | // Width and height of agenda cells |
218 | int mGridSpacingX; | 221 | int mGridSpacingX; |
219 | int mGridSpacingY; | 222 | int mGridSpacingY; |
220 | 223 | ||
221 | // size of border, where mouse action will resize the KOAgendaItem | 224 | // size of border, where mouse action will resize the KOAgendaItem |
222 | int mResizeBorderWidth; | 225 | int mResizeBorderWidth; |
223 | 226 | ||
224 | // size of border, where mouse mve will cause a scroll of the agenda | 227 | // size of border, where mouse mve will cause a scroll of the agenda |
225 | int mScrollBorderWidth; | 228 | int mScrollBorderWidth; |
226 | int mScrollDelay; | 229 | int mScrollDelay; |
227 | int mScrollOffset; | 230 | int mScrollOffset; |
228 | 231 | ||
229 | QTimer mScrollUpTimer; | 232 | QTimer mScrollUpTimer; |
230 | QTimer mScrollDownTimer; | 233 | QTimer mScrollDownTimer; |
231 | 234 | ||
232 | // Number of Columns/Rows of agenda grid | 235 | // Number of Columns/Rows of agenda grid |
233 | int mColumns; | 236 | int mColumns; |
234 | int mRows; | 237 | int mRows; |
235 | 238 | ||
236 | // Cells to store Move and Resize coordiantes | 239 | // Cells to store Move and Resize coordiantes |
237 | int mStartCellX; | 240 | int mStartCellX; |
238 | int mStartCellY; | 241 | int mStartCellY; |
239 | int mCurrentCellX; | 242 | int mCurrentCellX; |
240 | int mCurrentCellY; | 243 | int mCurrentCellY; |
241 | 244 | ||
242 | // Working Hour coordiantes | 245 | // Working Hour coordiantes |
243 | bool mWorkingHoursEnable; | 246 | bool mWorkingHoursEnable; |
244 | int mWorkingHoursYTop; | 247 | int mWorkingHoursYTop; |
245 | int mWorkingHoursYBottom; | 248 | int mWorkingHoursYBottom; |
246 | 249 | ||
247 | // Selection | 250 | // Selection |
248 | int mSelectionCellX; | 251 | int mSelectionCellX; |
249 | int mSelectionYTop; | 252 | int mSelectionYTop; |
250 | int mSelectionHeight; | 253 | int mSelectionHeight; |
251 | 254 | ||
252 | // List of dates to be displayed | 255 | // List of dates to be displayed |
253 | DateList mSelectedDates; | 256 | DateList mSelectedDates; |
254 | 257 | ||
255 | // The KOAgendaItem, which has been right-clicked last | 258 | // The KOAgendaItem, which has been right-clicked last |
256 | KOAgendaItem *mClickedItem; | 259 | KOAgendaItem *mClickedItem; |
257 | 260 | ||
258 | // The KOAgendaItem, which is being moved/resized | 261 | // The KOAgendaItem, which is being moved/resized |
259 | QGuardedPtr<KOAgendaItem> mActionItem; | 262 | QGuardedPtr<KOAgendaItem> mActionItem; |
260 | 263 | ||
261 | // Currently selected item | 264 | // Currently selected item |
262 | QGuardedPtr<KOAgendaItem> mSelectedItem; | 265 | QGuardedPtr<KOAgendaItem> mSelectedItem; |
263 | 266 | ||
264 | // The Marcus Bains Line widget. | 267 | // The Marcus Bains Line widget. |
265 | MarcusBains *mMarcusBains; | 268 | MarcusBains *mMarcusBains; |
266 | void computeSizes(); | 269 | void computeSizes(); |
267 | 270 | ||
268 | MouseActionType mActionType; | 271 | MouseActionType mActionType; |
269 | 272 | ||
270 | bool mItemMoved; | 273 | bool mItemMoved; |
271 | 274 | ||
272 | // List of all Items contained in agenda | 275 | // List of all Items contained in agenda |
273 | QPtrList<KOAgendaItem> mItems; | 276 | QPtrList<KOAgendaItem> mItems; |
274 | QPtrList<KOAgendaItem> mUnusedItems; | 277 | QPtrList<KOAgendaItem> mUnusedItems; |
275 | KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); | 278 | KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); |
276 | QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems | 279 | QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems |
280 | QPopupMenu *mNewItemPopup; | ||
277 | 281 | ||
278 | int mOldLowerScrollValue; | 282 | int mOldLowerScrollValue; |
279 | int mOldUpperScrollValue; | 283 | int mOldUpperScrollValue; |
280 | KOAgendaItem * getItemForTodo ( Todo * todo ); | 284 | KOAgendaItem * getItemForTodo ( Todo * todo ); |
281 | QMemArray<bool> *mHolidayMask; | 285 | QMemArray<bool> *mHolidayMask; |
282 | int mCurPixWid; | 286 | int mCurPixWid; |
283 | int mCurPixHei; | 287 | int mCurPixHei; |
284 | }; | 288 | }; |
285 | 289 | ||
286 | #endif // KOAGENDA_H | 290 | #endif // KOAGENDA_H |