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