-rw-r--r-- | korganizer/kodaymatrix.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index b96e08f..6edf7cd 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h | |||
@@ -1,138 +1,146 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> | 3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> |
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 _KODAYMAT_H | 23 | #ifndef _KODAYMAT_H |
24 | #define _KODAYMAT_H | 24 | #define _KODAYMAT_H |
25 | 25 | ||
26 | #include <libkcal/calendar.h> | 26 | #include <libkcal/calendar.h> |
27 | 27 | ||
28 | #include <qstring.h> | 28 | #include <qstring.h> |
29 | #include <qframe.h> | 29 | #include <q3frame.h> |
30 | #include <qcolor.h> | 30 | #include <qcolor.h> |
31 | #include <qpen.h> | 31 | #include <qpen.h> |
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qtooltip.h> | 33 | #include <qtooltip.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qbitarray.h> | 35 | #include <qbitarray.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | //Added by qt3to4: | ||
38 | #include <QDragMoveEvent> | ||
39 | #include <QDropEvent> | ||
40 | #include <QDragLeaveEvent> | ||
41 | #include <QPaintEvent> | ||
42 | #include <QResizeEvent> | ||
43 | #include <QMouseEvent> | ||
44 | #include <QDragEnterEvent> | ||
37 | 45 | ||
38 | class QDragEnterEvent; | 46 | class QDragEnterEvent; |
39 | class QDragMoveEvent; | 47 | class QDragMoveEvent; |
40 | class QDragLeaveEvent; | 48 | class QDragLeaveEvent; |
41 | class QDropEvent; | 49 | class QDropEvent; |
42 | 50 | ||
43 | class KODayMatrix; | 51 | class KODayMatrix; |
44 | class KODaymatrixWhatsThis; | 52 | class KODaymatrixWhatsThis; |
45 | 53 | ||
46 | using namespace KCal; | 54 | using namespace KCal; |
47 | 55 | ||
48 | 56 | ||
49 | /** | 57 | /** |
50 | * small helper class to dynamically show tooltips inside the day matrix. | 58 | * small helper class to dynamically show tooltips inside the day matrix. |
51 | * This class asks the day matrix object for a appropriate label which | 59 | * This class asks the day matrix object for a appropriate label which |
52 | * is in our special case the name of the holiday or null if this day is no holiday. | 60 | * is in our special case the name of the holiday or null if this day is no holiday. |
53 | */ | 61 | */ |
54 | class DynamicTip : public QToolTip | 62 | class DynamicTip /* TODO:hacker: : public QToolTip */ |
55 | { | 63 | { |
56 | public: | 64 | public: |
57 | 65 | ||
58 | /** | 66 | /** |
59 | * Constructor that expects a KODayMatrix object as parent. | 67 | * Constructor that expects a KODayMatrix object as parent. |
60 | * | 68 | * |
61 | * @param parent the parent KODayMatrix control. | 69 | * @param parent the parent KODayMatrix control. |
62 | */ | 70 | */ |
63 | DynamicTip(QWidget* parent ); | 71 | DynamicTip(QWidget* parent ); |
64 | 72 | ||
65 | protected: | 73 | protected: |
66 | 74 | ||
67 | /** | 75 | /** |
68 | * Qt's callback to ask the object to provide an approrpiate text for the | 76 | * Qt's callback to ask the object to provide an approrpiate text for the |
69 | * tooltip to be shown. | 77 | * tooltip to be shown. |
70 | * | 78 | * |
71 | * @param pos coordinates of the mouse. | 79 | * @param pos coordinates of the mouse. |
72 | */ | 80 | */ |
73 | void maybeTip( const QPoint & pos); | 81 | void maybeTip( const QPoint & pos); |
74 | 82 | ||
75 | private: | 83 | private: |
76 | 84 | ||
77 | /** the parent control this tooltip is designed for. */ | 85 | /** the parent control this tooltip is designed for. */ |
78 | KODayMatrix* matrix; | 86 | KODayMatrix* matrix; |
79 | }; | 87 | }; |
80 | 88 | ||
81 | /** | 89 | /** |
82 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. | 90 | * replacement for kdpdatebuton.cpp that used 42 widgets for the day matrix to be displayed. |
83 | * Cornelius thought this was a waste of memory and a lot of overhead. | 91 | * Cornelius thought this was a waste of memory and a lot of overhead. |
84 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame | 92 | * In addition the selection was not very intuitive so I decided to rewrite it using a QFrame |
85 | * that draws the labels and allows for dragging selection while maintaining nearly full | 93 | * that draws the labels and allows for dragging selection while maintaining nearly full |
86 | * compatibility in behaviour with its predecessor. | 94 | * compatibility in behaviour with its predecessor. |
87 | * | 95 | * |
88 | * The following functionality has been changed: | 96 | * The following functionality has been changed: |
89 | * | 97 | * |
90 | * o when shifting events in the agenda view from one day to another the day matrix is updated now | 98 | * o when shifting events in the agenda view from one day to another the day matrix is updated now |
91 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. | 99 | * o TODO ET dragging an event to the matrix will MOVE not COPY the event to the new date. |
92 | * o no support for Ctrl+click to create groups of dates | 100 | * o no support for Ctrl+click to create groups of dates |
93 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it | 101 | * (This has not really been supported in the predecessor. It was not very intuitive nor was it |
94 | * user friendly.) | 102 | * user friendly.) |
95 | * This feature has been replaced with dragging a selection on the matrix. The matrix will | 103 | * This feature has been replaced with dragging a selection on the matrix. The matrix will |
96 | * automatically choose the appropriate selection (e.g. you are not any longer able to select | 104 | * automatically choose the appropriate selection (e.g. you are not any longer able to select |
97 | * two distinct groups of date selections as in the old class) | 105 | * two distinct groups of date selections as in the old class) |
98 | * o now that you can select more then a week it can happen that not all selected days are | 106 | * o now that you can select more then a week it can happen that not all selected days are |
99 | * displayed in the matrix. However this is preferred to the alternative which would mean to | 107 | * displayed in the matrix. However this is preferred to the alternative which would mean to |
100 | * adjust the selection and leave some days undisplayed while scrolling through the months | 108 | * adjust the selection and leave some days undisplayed while scrolling through the months |
101 | * | 109 | * |
102 | * @short day matrix widget of the KDateNavigator | 110 | * @short day matrix widget of the KDateNavigator |
103 | * | 111 | * |
104 | * @author Eitzenberger Thomas | 112 | * @author Eitzenberger Thomas |
105 | */ | 113 | */ |
106 | class KODayMatrix: public QFrame { | 114 | class KODayMatrix: public Q3Frame { |
107 | 115 | ||
108 | Q_OBJECT | 116 | Q_OBJECT |
109 | 117 | ||
110 | public: | 118 | public: |
111 | 119 | ||
112 | /** constructor to create a day matrix widget. | 120 | /** constructor to create a day matrix widget. |
113 | * | 121 | * |
114 | * @param parent widget that is the parent of the day matrix. Normally this should | 122 | * @param parent widget that is the parent of the day matrix. Normally this should |
115 | * be a KDateNavigator | 123 | * be a KDateNavigator |
116 | * @param calendar instance of a calendar on which all calculations are based | 124 | * @param calendar instance of a calendar on which all calculations are based |
117 | * @param date start date of the matrix (is expected to be already fixed). It is | 125 | * @param date start date of the matrix (is expected to be already fixed). It is |
118 | * assumed that this date is the first week day to be shown in the matrix. | 126 | * assumed that this date is the first week day to be shown in the matrix. |
119 | * @param name name of the widget | 127 | * @param name name of the widget |
120 | */ | 128 | */ |
121 | KODayMatrix( QWidget *parent, const char *name ); | 129 | KODayMatrix( QWidget *parent, const char *name ); |
122 | //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); | 130 | //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); |
123 | 131 | ||
124 | /** destructor that deallocates all dynamically allocated private members. | 132 | /** destructor that deallocates all dynamically allocated private members. |
125 | */ | 133 | */ |
126 | ~KODayMatrix(); | 134 | ~KODayMatrix(); |
127 | 135 | ||
128 | /** updates the day matrix to start with the given date. Does all the necessary | 136 | /** updates the day matrix to start with the given date. Does all the necessary |
129 | * checks for holidays or events on a day and stores them for display later on. | 137 | * checks for holidays or events on a day and stores them for display later on. |
130 | * Does NOT update the view visually. Call repaint() for this. | 138 | * Does NOT update the view visually. Call repaint() for this. |
131 | * | 139 | * |
132 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this | 140 | * @param actdate recalculates the day matrix to show NUMDAYS starting from this |
133 | * date. | 141 | * date. |
134 | */ | 142 | */ |
135 | void updateView(QDate actdate); | 143 | void updateView(QDate actdate); |
136 | void updateEvents(); | 144 | void updateEvents(); |
137 | 145 | ||
138 | /** returns the QDate object associated with day indexed by the | 146 | /** returns the QDate object associated with day indexed by the |