summaryrefslogtreecommitdiffabout
path: root/korganizer/koagenda.h
Unidiff
Diffstat (limited to 'korganizer/koagenda.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.h43
1 files changed, 26 insertions, 17 deletions
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 380ce62..0708341 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -2,143 +2,152 @@
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 <q3scrollview.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qmemarray.h> 28#include <q3memarray.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qpixmap.h> 30#include <qpixmap.h>
31#include <qguardedptr.h> 31#include <qpointer.h>
32//Added by qt3to4:
33#include <QResizeEvent>
34#include <Q3Frame>
35#include <QLabel>
36#include <QMouseEvent>
37#include <Q3PtrList>
38#include <Q3PopupMenu>
39#include <QKeyEvent>
40#include <QEvent>
32 41
33#include "koagendaitem.h" 42#include "koagendaitem.h"
34#include "koeventview.h" 43#include "koeventview.h"
35 44
36class QPopupMenu; 45class Q3PopupMenu;
37class QTime; 46class QTime;
38class KConfig; 47class KConfig;
39class QFrame; 48class Q3Frame;
40class KOAgenda; 49class KOAgenda;
41class KCal::Event; 50class KCal::Event;
42class KCal::Todo; 51class KCal::Todo;
43 52
44using namespace KCal; 53using namespace KCal;
45 54
46class MarcusBains : public QFrame { 55class MarcusBains : public Q3Frame {
47 Q_OBJECT 56 Q_OBJECT
48 public: 57 public:
49 MarcusBains(KOAgenda *agenda=0,const char *name=0); 58 MarcusBains(KOAgenda *agenda=0,const char *name=0);
50 virtual ~MarcusBains(); 59 virtual ~MarcusBains();
51 void hideMe(); 60 void hideMe();
52 public slots: 61 public slots:
53 void updateLocation(bool recalculate=false); 62 void updateLocation(bool recalculate=false);
54 void updateLoc(); 63 void updateLoc();
55 64
56 private: 65 private:
57 int todayColumn(); 66 int todayColumn();
58 QTimer *minutes; 67 QTimer *minutes;
59 QLabel *mTimeBox; 68 QLabel *mTimeBox;
60 KOAgenda *agenda; 69 KOAgenda *agenda;
61 QTime oldTime; 70 QTime oldTime;
62 int oldToday; 71 int oldToday;
63}; 72};
64 73
65 74
66class KOAgenda : public QScrollView 75class KOAgenda : public Q3ScrollView
67{ 76{
68 Q_OBJECT 77 Q_OBJECT
69 public: 78 public:
70 enum MouseActionType { NOP, MOVE, SELECT, 79 enum MouseActionType { NOP, MOVE, SELECT,
71 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT }; 80 RESIZETOP, RESIZEBOTTOM, RESIZELEFT, RESIZERIGHT };
72 81
73 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0, 82 KOAgenda ( int columns, int rows, int columnSize, QWidget * parent=0,
74 const char * name=0, WFlags f=0 ); 83 const char * name=0, Qt::WFlags f=0 );
75 KOAgenda ( int columns, QWidget * parent=0, 84 KOAgenda ( int columns, QWidget * parent=0,
76 const char * name=0, WFlags f=0 ); 85 const char * name=0, Qt::WFlags f=0 );
77 virtual ~KOAgenda(); 86 virtual ~KOAgenda();
78 bool mInvalidPixmap; 87 bool mInvalidPixmap;
79 88
80 Incidence *selectedIncidence() const; 89 Incidence *selectedIncidence() const;
81 QDate selectedIncidenceDate() const; 90 QDate selectedIncidenceDate() const;
82 91
83 virtual bool eventFilter ( QObject *, QEvent * ); 92 virtual bool eventFilter ( QObject *, QEvent * );
84 93
85 void contentsToGrid (int x, int y, int& gx, int& gy); 94 void contentsToGrid (int x, int y, int& gx, int& gy);
86 void gridToContents (int gx, int gy, int& x, int& y); 95 void gridToContents (int gx, int gy, int& x, int& y);
87 96
88 int timeToY (const QTime &time); 97 int timeToY (const QTime &time);
89 QTime gyToTime (int y); 98 QTime gyToTime (int y);
90 99
91 void setStartHour(int startHour); 100 void setStartHour(int startHour);
92 101
93 KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); 102 KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom);
94 KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); 103 KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd);
95 void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, 104 void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd,
96 int YTop,int YBottom); 105 int YTop,int YBottom);
97 106
98 void changeColumns(int columns); 107 void changeColumns(int columns);
99 108
100 int columns() { return mColumns; } 109 int columns() { return mColumns; }
101 int rows() { return mRows; } 110 int rows() { return mRows; }
102 111
103 int gridSpacingX() const { return mGridSpacingX; } 112 int gridSpacingX() const { return mGridSpacingX; }
104 int gridSpacingY() const { return mGridSpacingY; } 113 int gridSpacingY() const { return mGridSpacingY; }
105 114
106// virtual QSizePolicy sizePolicy() const; 115// virtual QSizePolicy sizePolicy() const;
107 116
108 void clear(); 117 void clear();
109 118
110 void clearSelection(); 119 void clearSelection();
111 void hideUnused(); 120 void hideUnused();
112 121
113 /** Calculates the minimum width */ 122 /** Calculates the minimum width */
114 virtual int minimumWidth() const; 123 virtual int minimumWidth() const;
115 /** Update configuration from preference settings */ 124 /** Update configuration from preference settings */
116 void updateConfig(); 125 void updateConfig();
117 126
118 void checkScrollBoundaries(); 127 void checkScrollBoundaries();
119 128
120 void setHolidayMask(QMemArray<bool> *); 129 void setHolidayMask(Q3MemArray<bool> *);
121 void setDateList(const DateList &selectedDates); 130 void setDateList(const DateList &selectedDates);
122 DateList dateList() const; 131 DateList dateList() const;
123 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); 132 void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false);
124 void finishUpdate(); 133 void finishUpdate();
125 void printSelection(); 134 void printSelection();
126 void storePosition(); 135 void storePosition();
127 void restorePosition(); 136 void restorePosition();
128 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; } 137 void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
129 void shrinkPixmap(); 138 void shrinkPixmap();
130 QTime getEndTime(); 139 QTime getEndTime();
131 bool invalidPixmap(); 140 bool invalidPixmap();
132 141
133 public slots: 142 public slots:
134 void slotContentMove(int,int); 143 void slotContentMove(int,int);
135 void categoryChanged(Incidence * inc); 144 void categoryChanged(Incidence * inc);
136 void slotClearSelection(); 145 void slotClearSelection();
137 void popupMenu(); 146 void popupMenu();
138 void newItem( int ); 147 void newItem( int );
139 void moveChild( QWidget *, int, int ); 148 void moveChild( QWidget *, int, int );
140 void scrollUp(); 149 void scrollUp();
141 void scrollDown(); 150 void scrollDown();
142 void updateTodo( Todo * t, int , bool ); 151 void updateTodo( Todo * t, int , bool );
143 void popupAlarm(); 152 void popupAlarm();
144 153
@@ -256,53 +265,53 @@ class KOAgenda : public QScrollView
256 265
257 // Cells to store Move and Resize coordiantes 266 // Cells to store Move and Resize coordiantes
258 int mStartCellX; 267 int mStartCellX;
259 int mStartCellY; 268 int mStartCellY;
260 int mCurrentCellX; 269 int mCurrentCellX;
261 int mCurrentCellY; 270 int mCurrentCellY;
262 271
263 // Working Hour coordiantes 272 // Working Hour coordiantes
264 bool mWorkingHoursEnable; 273 bool mWorkingHoursEnable;
265 int mWorkingHoursYTop; 274 int mWorkingHoursYTop;
266 int mWorkingHoursYBottom; 275 int mWorkingHoursYBottom;
267 276
268 // Selection 277 // Selection
269 int mSelectionCellX; 278 int mSelectionCellX;
270 int mSelectionYTop; 279 int mSelectionYTop;
271 int mSelectionHeight; 280 int mSelectionHeight;
272 281
273 // List of dates to be displayed 282 // List of dates to be displayed
274 DateList mSelectedDates; 283 DateList mSelectedDates;
275 284
276 // The KOAgendaItem, which has been right-clicked last 285 // The KOAgendaItem, which has been right-clicked last
277 KOAgendaItem *mClickedItem; 286 KOAgendaItem *mClickedItem;
278 287
279 // The KOAgendaItem, which is being moved/resized 288 // The KOAgendaItem, which is being moved/resized
280 QGuardedPtr<KOAgendaItem> mActionItem; 289 QPointer<KOAgendaItem> mActionItem;
281 290
282 // Currently selected item 291 // Currently selected item
283 QGuardedPtr<KOAgendaItem> mSelectedItem; 292 QPointer<KOAgendaItem> mSelectedItem;
284 293
285 // The Marcus Bains Line widget. 294 // The Marcus Bains Line widget.
286 MarcusBains *mMarcusBains; 295 MarcusBains *mMarcusBains;
287 void computeSizes(); 296 void computeSizes();
288 297
289 MouseActionType mActionType; 298 MouseActionType mActionType;
290 299
291 bool mItemMoved; 300 bool mItemMoved;
292 301
293 // List of all Items contained in agenda 302 // List of all Items contained in agenda
294 QPtrList<KOAgendaItem> mItems; 303 Q3PtrList<KOAgendaItem> mItems;
295 QPtrList<KOAgendaItem> mUnusedItems; 304 Q3PtrList<KOAgendaItem> mUnusedItems;
296 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport); 305 KOAgendaItem* getNewItem(Incidence * event,QDate qd, QWidget* viewport);
297 QPopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems 306 Q3PopupMenu *mItemPopup; // Right mouse button popup menu for KOAgendaItems
298 QPopupMenu *mNewItemPopup; 307 Q3PopupMenu *mNewItemPopup;
299 308
300 int mOldLowerScrollValue; 309 int mOldLowerScrollValue;
301 int mOldUpperScrollValue; 310 int mOldUpperScrollValue;
302 KOAgendaItem * getItemForTodo ( Todo * todo ); 311 KOAgendaItem * getItemForTodo ( Todo * todo );
303 QMemArray<bool> *mHolidayMask; 312 Q3MemArray<bool> *mHolidayMask;
304 int mCurPixWid; 313 int mCurPixWid;
305 int mCurPixHei; 314 int mCurPixHei;
306}; 315};
307 316
308#endif // KOAGENDA_H 317#endif // KOAGENDA_H