summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-04-22 13:00:34 (UTC)
committer zautrix <zautrix>2005-04-22 13:00:34 (UTC)
commit81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261 (patch) (unidiff)
treed5d622e8e5abd5326edc426398faef24ae52985c
parent33bc865668aef76416b45e365ba5825315d90564 (diff)
downloadkdepimpi-81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261.zip
kdepimpi-81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261.tar.gz
kdepimpi-81158fa914f6d0f3aeb049d28d2ecfb5f5c0e261.tar.bz2
fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp57
-rw-r--r--korganizer/kodaymatrix.h1
2 files changed, 46 insertions, 12 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 53ebdb2..4366265 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -107,209 +107,242 @@ KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
107 107
108 108
109{ 109{
110 mLastView = -1; 110 mLastView = -1;
111 oldW = 0; 111 oldW = 0;
112 oldH = 0; 112 oldH = 0;
113 myPix.resize( 150, 120 ); 113 myPix.resize( 150, 120 );
114 mRedrawNeeded = true; 114 mRedrawNeeded = true;
115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
116 mPendingUpdateBeforeRepaint = false; 116 mPendingUpdateBeforeRepaint = false;
117 mouseDown = false; 117 mouseDown = false;
118 // initialize dynamic arrays 118 // initialize dynamic arrays
119 bDays.resize ( NUMDAYS ); 119 bDays.resize ( NUMDAYS );
120 pDays.resize ( NUMDAYS ); 120 pDays.resize ( NUMDAYS );
121 hDays.resize ( NUMDAYS ); 121 hDays.resize ( NUMDAYS );
122 eDays.resize ( NUMDAYS ); 122 eDays.resize ( NUMDAYS );
123 days = new QDate[NUMDAYS]; 123 days = new QDate[NUMDAYS];
124 daylbls = new QString[NUMDAYS]; 124 daylbls = new QString[NUMDAYS];
125 //events = new int[NUMDAYS]; 125 //events = new int[NUMDAYS];
126 mToolTip = new DynamicTip(this); 126 mToolTip = new DynamicTip(this);
127 127
128 // set default values used for drawing the matrix 128 // set default values used for drawing the matrix
129 mDefaultBackColor = palette().active().base(); 129 mDefaultBackColor = palette().active().base();
130 mDefaultTextColor = palette().active().foreground(); 130 mDefaultTextColor = palette().active().foreground();
131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
133 mSelectedDaysColor = QColor("white"); 133 mSelectedDaysColor = QColor("white");
134 mTodayMarginWidth = 2; 134 mTodayMarginWidth = 2;
135 mSelEnd = mSelStart = NOSELECTION; 135 mSelEnd = mSelStart = NOSELECTION;
136 136
137 setAcceptDrops(true); 137 setAcceptDrops(true);
138 //setFont( QFont("Arial", 10) ); 138 //setFont( QFont("Arial", 10) );
139 139
140 mUpdateTimer = new QTimer( this ); 140 mUpdateTimer = new QTimer( this );
141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
142 mRepaintTimer = new QTimer( this ); 142 mRepaintTimer = new QTimer( this );
143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
144 mDayChanged = false; 144 mDayChanged = false;
145 updateView(); 145 updateView();
146} 146}
147QString KODayMatrix::getWhatsThisText( QPoint p ) 147QString KODayMatrix::getWhatsThisText( QPoint p )
148{ 148{
149 149
150 int tmp = getDayIndexFrom(p.x(), p.y()); 150 int tmp = getDayIndexFrom(p.x(), p.y());
151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
152 return QString(); 152 return QString();
153 QDate mDate = days[tmp]; 153 QDate mDate = days[tmp];
154 QPtrList<Event> eventlist = mCalendar->events(mDate); 154 QPtrList<Event> eventlist = mCalendar->events(mDate);
155 Event *event; 155 Event *event;
156 QStringList mToolTip; 156 QStringList mToolTip;
157 for(event=eventlist.first();event != 0;event=eventlist.next()) { 157 for(event=eventlist.first();event != 0;event=eventlist.next()) {
158 QString mToolTipText; 158 QString mToolTipText;
159 QString text; 159 QString text;
160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
161 if (event->isMultiDay()) { 161 if (event->isMultiDay()) {
162 QString prefix = "<->";multiday = 2; 162 QString prefix = "<->";multiday = 2;
163 QString time; 163 QString time;
164 if ( event->doesRecur() ) { 164 if ( event->doesRecur() ) {
165 if ( event->recursOn( mDate) ) { 165 if ( event->recursOn( mDate) ) {
166 prefix ="->" ;multiday = 1; 166 prefix ="->" ;multiday = 1;
167 } 167 }
168 else { 168 else {
169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 169 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
170 if ( event->recursOn( mDate.addDays( -days)) ) { 170 if ( event->recursOn( mDate.addDays( -days)) ) {
171 prefix ="<-" ;multiday = 3; 171 prefix ="<-" ;multiday = 3;
172 } 172 }
173 } 173 }
174 } else { 174 } else {
175 if (mDate == event->dtStart().date()) { 175 if (mDate == event->dtStart().date()) {
176 prefix ="->" ;multiday = 1; 176 prefix ="->" ;multiday = 1;
177 } else if (mDate == event->dtEnd().date()) { 177 } else if (mDate == event->dtEnd().date()) {
178 prefix ="<-" ;multiday = 3; 178 prefix ="<-" ;multiday = 3;
179 } 179 }
180 } 180 }
181 if ( !event->doesFloat() ) { 181 if ( !event->doesFloat() ) {
182 if ( mDate == event->dtStart().date () ) 182 if ( mDate == event->dtStart().date () )
183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 183 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
184 else if ( mDate == event->dtEnd().date () ) 184 else if ( mDate == event->dtEnd().date () )
185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 185 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
186 186
187 } 187 }
188 text = time + event->summary(); 188 text = time + event->summary();
189 mToolTipText += prefix + text; 189 mToolTipText += prefix + text;
190 } else { 190 } else {
191 if (event->doesFloat()) { 191 if (event->doesFloat()) {
192 text = event->summary(); 192 text = event->summary();
193 mToolTipText += text; 193 mToolTipText += text;
194 } 194 }
195 else { 195 else {
196 text = KGlobal::locale()->formatTime(event->dtStart().time()); 196 text = KGlobal::locale()->formatTime(event->dtStart().time());
197 text += " " + event->summary(); 197 text += " " + event->summary();
198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 198 mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
199 } 199 }
200 } 200 }
201 if ( !event->location().isEmpty() ) 201 if ( !event->location().isEmpty() )
202 mToolTipText += " (" + event->location() + ")"; 202 mToolTipText += " (" + event->location() + ")";
203#if QT_VERSION >= 0x030000
204 mToolTipText.replace( '<' , "&lt;" );
205 mToolTipText.replace( '>' , "&gt;" );
206#else
207 if ( mToolTipText.find ('<') >= 0 ) {
208 mToolTipText.replace( QRegExp("<") , "&lt;" );
209 }
210 if ( mToolTipText.find ('>') >= 0 ) {
211 mToolTipText.replace( QRegExp(">") , "&gt;" );
212 }
213#endif
214 //qDebug("TTT: %s ", mToolTipText.latin1()); 203 //qDebug("TTT: %s ", mToolTipText.latin1());
215 mToolTip.append( mToolTipText ); 204 mToolTip.append( deTag( mToolTipText ) );
205 }
206 if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
207 QPtrList<Todo> todolist = mCalendar->todos(mDate);
208 Todo *todo;
209 for(todo=todolist.first();todo != 0;todo=todolist.next()) {
210 QString mToolTipText;
211 if ( !todo->doesFloat() )
212 mToolTipText += KGlobal::locale()->formatTime(todo->dtDue().time())+" ";
213 mToolTipText += todo->summary();
214 if ( !todo->location().isEmpty() )
215 mToolTipText += " (" + todo->location() + ")";
216 mToolTipText = deTag( mToolTipText);
217 mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText;
218 mToolTip.append( mToolTipText );
219 }
216 } 220 }
217 mToolTip.sort(); 221 mToolTip.sort();
222 if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
223 Journal *j = mCalendar->journal( mDate );
224 if ( j ) {
225 QString mToolTipText = j->description().left(100);
226 if ( j->description().length() > 100 )
227 mToolTipText += " ...";
228 mToolTipText = deTag( mToolTipText);
229 mToolTipText = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText;
230 mToolTip.append( mToolTipText );
231 }
232 }
218 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); 233 return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>");
219} 234}
235
236
237QString KODayMatrix::deTag( QString mToolTipText )
238{
239
240#if QT_VERSION >= 0x030000
241 mToolTipText.replace( '<' , "&lt;" );
242 mToolTipText.replace( '>' , "&gt;" );
243#else
244 if ( mToolTipText.find ('<') >= 0 ) {
245 mToolTipText.replace( QRegExp("<") , "&lt;" );
246 }
247 if ( mToolTipText.find ('>') >= 0 ) {
248 mToolTipText.replace( QRegExp(">") , "&gt;" );
249 }
250#endif
251 return mToolTipText;
252}
220void KODayMatrix::setCalendar( Calendar *cal ) 253void KODayMatrix::setCalendar( Calendar *cal )
221{ 254{
222 mCalendar = cal; 255 mCalendar = cal;
223 256
224 setAcceptDrops( mCalendar ); 257 setAcceptDrops( mCalendar );
225 258
226 updateEvents(); 259 updateEvents();
227} 260}
228 261
229QColor KODayMatrix::getShadedColor(QColor color) 262QColor KODayMatrix::getShadedColor(QColor color)
230{ 263{
231 QColor shaded; 264 QColor shaded;
232 int h=0; 265 int h=0;
233 int s=0; 266 int s=0;
234 int v=0; 267 int v=0;
235 color.hsv(&h,&s,&v); 268 color.hsv(&h,&s,&v);
236 s = s/4; 269 s = s/4;
237 v = 192+v/4; 270 v = 192+v/4;
238 shaded.setHsv(h,s,v); 271 shaded.setHsv(h,s,v);
239 272
240 return shaded; 273 return shaded;
241} 274}
242 275
243KODayMatrix::~KODayMatrix() 276KODayMatrix::~KODayMatrix()
244{ 277{
245#if QT_VERSION >= 0x030000 278#if QT_VERSION >= 0x030000
246 279
247#else 280#else
248 delete mKODaymatrixWhatsThis; 281 delete mKODaymatrixWhatsThis;
249#endif 282#endif
250 283
251 // delete mKODaymatrixWhatsThis; 284 // delete mKODaymatrixWhatsThis;
252 delete [] days; 285 delete [] days;
253 delete [] daylbls; 286 delete [] daylbls;
254 //delete [] events; 287 //delete [] events;
255 delete mToolTip; 288 delete mToolTip;
256} 289}
257 290
258/* 291/*
259void KODayMatrix::setStartDate(QDate start) 292void KODayMatrix::setStartDate(QDate start)
260{ 293{
261 updateView(start); 294 updateView(start);
262} 295}
263*/ 296*/
264 297
265void KODayMatrix::addSelectedDaysTo(DateList& selDays) 298void KODayMatrix::addSelectedDaysTo(DateList& selDays)
266{ 299{
267 300
268 if (mSelStart == NOSELECTION) { 301 if (mSelStart == NOSELECTION) {
269 return; 302 return;
270 } 303 }
271 304
272 //cope with selection being out of matrix limits at top (< 0) 305 //cope with selection being out of matrix limits at top (< 0)
273 int i0 = mSelStart; 306 int i0 = mSelStart;
274 if (i0 < 0) { 307 if (i0 < 0) {
275 for (int i = i0; i < 0; i++) { 308 for (int i = i0; i < 0; i++) {
276 selDays.append(days[0].addDays(i)); 309 selDays.append(days[0].addDays(i));
277 } 310 }
278 i0 = 0; 311 i0 = 0;
279 } 312 }
280 313
281 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) 314 //cope with selection being out of matrix limits at bottom (> NUMDAYS-1)
282 if (mSelEnd > NUMDAYS-1) { 315 if (mSelEnd > NUMDAYS-1) {
283 for (int i = i0; i <= NUMDAYS-1; i++) { 316 for (int i = i0; i <= NUMDAYS-1; i++) {
284 selDays.append(days[i]); 317 selDays.append(days[i]);
285 } 318 }
286 for (int i = NUMDAYS; i < mSelEnd; i++) { 319 for (int i = NUMDAYS; i < mSelEnd; i++) {
287 selDays.append(days[0].addDays(i)); 320 selDays.append(days[0].addDays(i));
288 } 321 }
289 322
290 // apply normal routine to selection being entirely within matrix limits 323 // apply normal routine to selection being entirely within matrix limits
291 } else { 324 } else {
292 for (int i = i0; i <= mSelEnd; i++) { 325 for (int i = i0; i <= mSelEnd; i++) {
293 selDays.append(days[i]); 326 selDays.append(days[i]);
294 } 327 }
295 } 328 }
296} 329}
297 330
298bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) 331bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
299{ 332{
300 mRedrawNeeded = true; 333 mRedrawNeeded = true;
301 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); 334 bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION );
302 mSelStart = startdate.daysTo(start); 335 mSelStart = startdate.daysTo(start);
303 if ( mSelStart < 0 ) 336 if ( mSelStart < 0 )
304 mSelStart = 0; 337 mSelStart = 0;
305 mSelEnd = startdate.daysTo(end); 338 mSelEnd = startdate.daysTo(end);
306 if ( mSelEnd > NUMDAYS-1 ) 339 if ( mSelEnd > NUMDAYS-1 )
307 mSelEnd = NUMDAYS-1; 340 mSelEnd = NUMDAYS-1;
308 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { 341 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) {
309 clearSelection(); 342 clearSelection();
310 if ( noSel ) 343 if ( noSel )
311 return false; 344 return false;
312 } 345 }
313 346
314 return true; 347 return true;
315} 348}
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index a3216d6..b96e08f 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -114,192 +114,193 @@ public:
114 * @param parent widget that is the parent of the day matrix. Normally this should 114 * @param parent widget that is the parent of the day matrix. Normally this should
115 * be a KDateNavigator 115 * be a KDateNavigator
116 * @param calendar instance of a calendar on which all calculations are based 116 * @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 117 * @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. 118 * assumed that this date is the first week day to be shown in the matrix.
119 * @param name name of the widget 119 * @param name name of the widget
120 */ 120 */
121 KODayMatrix( QWidget *parent, const char *name ); 121 KODayMatrix( QWidget *parent, const char *name );
122 //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name ); 122 //KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name );
123 123
124 /** destructor that deallocates all dynamically allocated private members. 124 /** destructor that deallocates all dynamically allocated private members.
125 */ 125 */
126 ~KODayMatrix(); 126 ~KODayMatrix();
127 127
128 /** updates the day matrix to start with the given date. Does all the necessary 128 /** 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. 129 * 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. 130 * Does NOT update the view visually. Call repaint() for this.
131 * 131 *
132 * @param actdate recalculates the day matrix to show NUMDAYS starting from this 132 * @param actdate recalculates the day matrix to show NUMDAYS starting from this
133 * date. 133 * date.
134 */ 134 */
135 void updateView(QDate actdate); 135 void updateView(QDate actdate);
136 void updateEvents(); 136 void updateEvents();
137 137
138 /** returns the QDate object associated with day indexed by the 138 /** returns the QDate object associated with day indexed by the
139 * supplied offset. 139 * supplied offset.
140 */ 140 */
141 const QDate& getDate(int offset); 141 const QDate& getDate(int offset);
142 void setCalendar( Calendar * ); 142 void setCalendar( Calendar * );
143 /** returns the official name of this holy day or 0 if there is no label 143 /** returns the official name of this holy day or 0 if there is no label
144 * for this day. 144 * for this day.
145 */ 145 */
146 QString getHolidayLabel(int offset); 146 QString getHolidayLabel(int offset);
147 147
148 /** adds all actual selected days from mSelStart to mSelEnd to the supplied 148 /** adds all actual selected days from mSelStart to mSelEnd to the supplied
149 * DateList. 149 * DateList.
150 */ 150 */
151 void addSelectedDaysTo(DateList&); 151 void addSelectedDaysTo(DateList&);
152 152
153 /** sets the actual to be displayed selection in the day matrix starting from 153 /** sets the actual to be displayed selection in the day matrix starting from
154 * start and ending with end. Theview must be manually updated by calling 154 * start and ending with end. Theview must be manually updated by calling
155 * repaint. (?) 155 * repaint. (?)
156 */ 156 */
157 bool setSelectedDaysFrom(const QDate& start, const QDate& end); 157 bool setSelectedDaysFrom(const QDate& start, const QDate& end);
158 void clearSelection(); 158 void clearSelection();
159 159
160 /** Is today visible in the view? Keep this in sync with 160 /** Is today visible in the view? Keep this in sync with
161 * the values today (below) can take. 161 * the values today (below) can take.
162 */ 162 */
163 bool isTodayVisible() const { return today>=0; } ; 163 bool isTodayVisible() const { return today>=0; } ;
164 164
165 /** If today is visible, then we can find out if today is 165 /** If today is visible, then we can find out if today is
166 * near the beginning or the end of the month. 166 * near the beginning or the end of the month.
167 * This is dependent on today remaining the index 167 * This is dependent on today remaining the index
168 * in the array of visible dates and going from 168 * in the array of visible dates and going from
169 * top left (0) to bottom right (41). 169 * top left (0) to bottom right (41).
170 */ 170 */
171 bool isBeginningOfMonth() const { return today<=8; } ; 171 bool isBeginningOfMonth() const { return today<=8; } ;
172 bool isEndOfMonth() const { return today>=27; } ; 172 bool isEndOfMonth() const { return today>=27; } ;
173 QString getWhatsThisText( QPoint ) ; 173 QString getWhatsThisText( QPoint ) ;
174 QSize sizeHint() const; 174 QSize sizeHint() const;
175 QRect frameRect () const { int wid = frameWidth(); return QRect(0+wid,0+wid,width()-wid-wid,height()-wid-wid);} 175 QRect frameRect () const { int wid = frameWidth(); return QRect(0+wid,0+wid,width()-wid-wid,height()-wid-wid);}
176public slots: 176public slots:
177 /** Recalculates all the flags of the days in the matrix like holidays or events 177 /** Recalculates all the flags of the days in the matrix like holidays or events
178 * on a day (Actually calls above method with the actual startdate). 178 * on a day (Actually calls above method with the actual startdate).
179 */ 179 */
180 void updateView(); 180 void updateView();
181 void updateViewTimed(); 181 void updateViewTimed();
182 void repaintViewTimed(); 182 void repaintViewTimed();
183 183
184 /** 184 /**
185 * Calculate which square in the matrix should be 185 * Calculate which square in the matrix should be
186 * hilighted to indicate it's today. 186 * hilighted to indicate it's today.
187 */ 187 */
188 void recalculateToday(); 188 void recalculateToday();
189 189
190/* 190/*
191 void setStartDate(QDate); 191 void setStartDate(QDate);
192*/ 192*/
193 193
194signals: 194signals:
195 195
196 /** emitted if the user selects a block of days with the mouse by dragging a rectangle 196 /** emitted if the user selects a block of days with the mouse by dragging a rectangle
197 * inside the matrix 197 * inside the matrix
198 * 198 *
199 * @param daylist list of days that have been selected by the user 199 * @param daylist list of days that have been selected by the user
200 */ 200 */
201 void selected( const KCal::DateList &daylist ); 201 void selected( const KCal::DateList &daylist );
202 202
203 /** emitted if the user has dropped an event inside the matrix 203 /** emitted if the user has dropped an event inside the matrix
204 * 204 *
205 * @param event the dropped calendar event 205 * @param event the dropped calendar event
206 */ 206 */
207 void eventDropped(Event *event); 207 void eventDropped(Event *event);
208 208
209protected: 209protected:
210 QString deTag( QString mToolTipText );
210 211
211 void paintEvent(QPaintEvent *ev); 212 void paintEvent(QPaintEvent *ev);
212 213
213 void mousePressEvent (QMouseEvent* e); 214 void mousePressEvent (QMouseEvent* e);
214 215
215 void mouseReleaseEvent (QMouseEvent* e); 216 void mouseReleaseEvent (QMouseEvent* e);
216 217
217 void mouseMoveEvent (QMouseEvent* e); 218 void mouseMoveEvent (QMouseEvent* e);
218 219
219 void dragEnterEvent(QDragEnterEvent *); 220 void dragEnterEvent(QDragEnterEvent *);
220 221
221 void dragMoveEvent(QDragMoveEvent *); 222 void dragMoveEvent(QDragMoveEvent *);
222 223
223 void dragLeaveEvent(QDragLeaveEvent *); 224 void dragLeaveEvent(QDragLeaveEvent *);
224 225
225 void dropEvent(QDropEvent *); 226 void dropEvent(QDropEvent *);
226 227
227 void resizeEvent(QResizeEvent *); 228 void resizeEvent(QResizeEvent *);
228 229
229private: 230private:
230 int mLastView; 231 int mLastView;
231 void computeEvent(Event *even, int dayindex ); 232 void computeEvent(Event *even, int dayindex );
232 int oldW, oldH; 233 int oldW, oldH;
233 bool mRedrawNeeded; 234 bool mRedrawNeeded;
234 KODaymatrixWhatsThis* mKODaymatrixWhatsThis; 235 KODaymatrixWhatsThis* mKODaymatrixWhatsThis;
235 bool mouseDown; 236 bool mouseDown;
236 QBitArray bDays; 237 QBitArray bDays;
237 QBitArray hDays; 238 QBitArray hDays;
238 QBitArray eDays; 239 QBitArray eDays;
239 QBitArray pDays; 240 QBitArray pDays;
240 QPixmap myPix; 241 QPixmap myPix;
241 QTimer* mUpdateTimer; 242 QTimer* mUpdateTimer;
242 QTimer* mRepaintTimer; 243 QTimer* mRepaintTimer;
243 bool mDayChanged; 244 bool mDayChanged;
244 bool mPendingUpdateBeforeRepaint; 245 bool mPendingUpdateBeforeRepaint;
245 246
246 /** returns the index of the day located at the matrix's widget (x,y) position. 247 /** returns the index of the day located at the matrix's widget (x,y) position.
247 * 248 *
248 * @param x horizontal coordinate 249 * @param x horizontal coordinate
249 * @param y vertical coordinate 250 * @param y vertical coordinate
250 */ 251 */
251 int getDayIndexFrom(int x, int y); 252 int getDayIndexFrom(int x, int y);
252 253
253 /** calculates a "shaded" color from the supplied color object. 254 /** calculates a "shaded" color from the supplied color object.
254 * (Copied from Cornelius's kdpdatebutton.cpp) 255 * (Copied from Cornelius's kdpdatebutton.cpp)
255 * 256 *
256 * @param color source based on which a shaded color should be calculated. 257 * @param color source based on which a shaded color should be calculated.
257 */ 258 */
258 QColor getShadedColor(QColor color); 259 QColor getShadedColor(QColor color);
259 260
260 /** number of days to be displayed. For now there is no support for any other number then 42. 261 /** number of days to be displayed. For now there is no support for any other number then 42.
261 so change it at your own risk :o) */ 262 so change it at your own risk :o) */
262 static const int NUMDAYS; 263 static const int NUMDAYS;
263 264
264 /** calendar instance to be queried for holidays, events, ... */ 265 /** calendar instance to be queried for holidays, events, ... */
265 Calendar *mCalendar; 266 Calendar *mCalendar;
266 267
267 /** starting date of the matrix */ 268 /** starting date of the matrix */
268 QDate startdate; 269 QDate startdate;
269 270
270 /** array of day labels to optimeize drawing performance. */ 271 /** array of day labels to optimeize drawing performance. */
271 QString *daylbls; 272 QString *daylbls;
272 273
273 /** array of days displayed to reduce memory consumption by 274 /** array of days displayed to reduce memory consumption by
274 subsequently calling QDate::addDays(). */ 275 subsequently calling QDate::addDays(). */
275 QDate *days; 276 QDate *days;
276 277
277 /** array of storing the number of events on a given day. 278 /** array of storing the number of events on a given day.
278 * used for drawing a bold font if there is at least one event on that day. 279 * used for drawing a bold font if there is at least one event on that day.
279 */ 280 */
280 //int *events; 281 //int *events;
281 282
282 /** stores holiday names of the days shown in the matrix. */ 283 /** stores holiday names of the days shown in the matrix. */
283 QMap<int,QString> mHolidays; 284 QMap<int,QString> mHolidays;
284 285
285 /** indey of today or -1 if today is not visible in the matrix. */ 286 /** indey of today or -1 if today is not visible in the matrix. */
286 int today; 287 int today;
287 288
288 /** index of day where dragged selection was initiated. 289 /** index of day where dragged selection was initiated.
289 used to detect "negative" timely selections */ 290 used to detect "negative" timely selections */
290 int mSelInit; 291 int mSelInit;
291 292
292 /** if mSelStart has this value it indicates that there is no 293 /** if mSelStart has this value it indicates that there is no
293 actual selection in the matrix. */ 294 actual selection in the matrix. */
294 static const int NOSELECTION; 295 static const int NOSELECTION;
295 296
296 /** index of first selected day. */ 297 /** index of first selected day. */
297 int mSelStart; 298 int mSelStart;
298 299
299 /** index of last selected day. */ 300 /** index of last selected day. */
300 int mSelEnd; 301 int mSelEnd;
301 302
302 /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */ 303 /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */
303 DynamicTip* mToolTip; 304 DynamicTip* mToolTip;
304 305
305 306