-rw-r--r-- | korganizer/komonthview.cpp | 14 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 9b0389d..00e5a6f 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -182,256 +182,268 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | if ( count() ) { | 184 | if ( count() ) { |
185 | if ( currentItem() == 0 ) { | 185 | if ( currentItem() == 0 ) { |
186 | emit prevCell(); | 186 | emit prevCell(); |
187 | } else { | 187 | } else { |
188 | setCurrentItem((currentItem()+count()-1)%count()); | 188 | setCurrentItem((currentItem()+count()-1)%count()); |
189 | if(!itemVisible(currentItem())) { | 189 | if(!itemVisible(currentItem())) { |
190 | if((unsigned int) currentItem() == (count()-1)) { | 190 | if((unsigned int) currentItem() == (count()-1)) { |
191 | setTopItem(currentItem()-numItemsVisible()+1); | 191 | setTopItem(currentItem()-numItemsVisible()+1); |
192 | } else { | 192 | } else { |
193 | setTopItem(topItem()-1); | 193 | setTopItem(topItem()-1); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } | 197 | } |
198 | break; | 198 | break; |
199 | case Key_Down: | 199 | case Key_Down: |
200 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 200 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
201 | e->ignore(); | 201 | e->ignore(); |
202 | break; | 202 | break; |
203 | } | 203 | } |
204 | if ( count () ) { | 204 | if ( count () ) { |
205 | if ( currentItem()+1 == count () ) { | 205 | if ( currentItem()+1 == count () ) { |
206 | emit nextCell(); | 206 | emit nextCell(); |
207 | } else { | 207 | } else { |
208 | setCurrentItem((currentItem()+1)%count()); | 208 | setCurrentItem((currentItem()+1)%count()); |
209 | if(!itemVisible(currentItem())) { | 209 | if(!itemVisible(currentItem())) { |
210 | if(currentItem() == 0) { | 210 | if(currentItem() == 0) { |
211 | setTopItem(0); | 211 | setTopItem(0); |
212 | } else { | 212 | } else { |
213 | setTopItem(topItem()+1); | 213 | setTopItem(topItem()+1); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
218 | break; | 218 | break; |
219 | case Key_I: | 219 | case Key_I: |
220 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); | 220 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); |
221 | e->ignore(); | 221 | e->ignore(); |
222 | break; | 222 | break; |
223 | case Key_Return: | 223 | case Key_Return: |
224 | case Key_Enter: | 224 | case Key_Enter: |
225 | { | 225 | { |
226 | if ( currentItem() >= 0 ) { | 226 | if ( currentItem() >= 0 ) { |
227 | emit doubleClicked( item( currentItem() ) ); | 227 | emit doubleClicked( item( currentItem() ) ); |
228 | e->accept(); | 228 | e->accept(); |
229 | } else { | 229 | } else { |
230 | e->ignore(); | 230 | e->ignore(); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | break; | 233 | break; |
234 | case Key_Shift: | 234 | case Key_Shift: |
235 | emit shiftDown(); | 235 | emit shiftDown(); |
236 | break; | 236 | break; |
237 | default: | 237 | default: |
238 | e->ignore(); | 238 | e->ignore(); |
239 | break; | 239 | break; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | void KNoScrollListBox::oneDown() | 243 | void KNoScrollListBox::oneDown() |
244 | { | 244 | { |
245 | if ( count () ) { | 245 | if ( count () ) { |
246 | if ( currentItem()+1 == count () ) { | 246 | if ( currentItem()+1 == count () ) { |
247 | emit nextCell(); | 247 | emit nextCell(); |
248 | } else { | 248 | } else { |
249 | resetOnFocusIn = false; | 249 | resetOnFocusIn = false; |
250 | setCurrentItem((currentItem()+1)%count()); | 250 | setCurrentItem((currentItem()+1)%count()); |
251 | if(!itemVisible(currentItem())) { | 251 | if(!itemVisible(currentItem())) { |
252 | if(currentItem() == 0) { | 252 | if(currentItem() == 0) { |
253 | setTopItem(0); | 253 | setTopItem(0); |
254 | } else { | 254 | } else { |
255 | setTopItem(topItem()+1); | 255 | setTopItem(topItem()+1); |
256 | } | 256 | } |
257 | } | 257 | } |
258 | } | 258 | } |
259 | } | 259 | } |
260 | } | 260 | } |
261 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 261 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
262 | { | 262 | { |
263 | switch(e->key()) { | 263 | switch(e->key()) { |
264 | case Key_Shift: | 264 | case Key_Shift: |
265 | emit shiftUp(); | 265 | emit shiftUp(); |
266 | break; | 266 | break; |
267 | default: | 267 | default: |
268 | break; | 268 | break; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 272 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
273 | { | 273 | { |
274 | QListBox::mousePressEvent(e); | 274 | QListBox::mousePressEvent(e); |
275 | 275 | ||
276 | if(e->button() == RightButton) { | 276 | if(e->button() == RightButton) { |
277 | emit rightClick(); | 277 | emit rightClick(); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 281 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
282 | : QListBoxItem() | 282 | : QListBoxItem() |
283 | { | 283 | { |
284 | mDisplayHightlighted = false; | 284 | mDisplayHightlighted = false; |
285 | mblockRepaint = true; | 285 | mblockRepaint = true; |
286 | setText( s ); | 286 | setText( s ); |
287 | mMultiday = 0; | 287 | mMultiday = 0; |
288 | mIncidence = incidence; | 288 | mIncidence = incidence; |
289 | mDate = qd; | 289 | mDate = qd; |
290 | mRecur = false; | 290 | mRecur = false; |
291 | mAlarm = false; | 291 | mAlarm = false; |
292 | mReply = false; | 292 | mReply = false; |
293 | mInfo = false; | 293 | mInfo = false; |
294 | mdayPos = 0; | 294 | mdayPos = 0; |
295 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 295 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
296 | } | 296 | } |
297 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) | 297 | void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s) |
298 | { | 298 | { |
299 | mDisplayHightlighted = false; | 299 | mDisplayHightlighted = false; |
300 | setText( s ); | 300 | setText( s ); |
301 | mMultiday = 0; | 301 | mMultiday = 0; |
302 | mIncidence = incidence; | 302 | mIncidence = incidence; |
303 | mDate = qd; | 303 | mDate = qd; |
304 | mRecur = false; | 304 | mRecur = false; |
305 | mAlarm = false; | 305 | mAlarm = false; |
306 | mReply = false; | 306 | mReply = false; |
307 | mInfo = false; | 307 | mInfo = false; |
308 | mdayPos = 0; | 308 | mdayPos = 0; |
309 | } | 309 | } |
310 | void MonthViewItem::clearData() | ||
311 | { | ||
312 | mDisplayHightlighted = false; | ||
313 | setText( "" ); | ||
314 | mMultiday = 0; | ||
315 | mIncidence = 0; | ||
316 | mRecur = false; | ||
317 | mAlarm = false; | ||
318 | mReply = false; | ||
319 | mInfo = false; | ||
320 | mdayPos = 0; | ||
321 | } | ||
310 | bool MonthViewItem::setHighlightedFalse() | 322 | bool MonthViewItem::setHighlightedFalse() |
311 | { | 323 | { |
312 | if ( !mDisplayHightlighted ) | 324 | if ( !mDisplayHightlighted ) |
313 | return false; | 325 | return false; |
314 | mDisplayHightlighted = false; | 326 | mDisplayHightlighted = false; |
315 | return true; | 327 | return true; |
316 | } | 328 | } |
317 | 329 | ||
318 | bool MonthViewItem::setHighlighted( Incidence * inc ) | 330 | bool MonthViewItem::setHighlighted( Incidence * inc ) |
319 | { | 331 | { |
320 | if ( inc == mIncidence ) { | 332 | if ( inc == mIncidence ) { |
321 | if ( mDisplayHightlighted ) | 333 | if ( mDisplayHightlighted ) |
322 | return false; | 334 | return false; |
323 | mDisplayHightlighted = true; | 335 | mDisplayHightlighted = true; |
324 | return true; | 336 | return true; |
325 | } else { | 337 | } else { |
326 | if ( !mDisplayHightlighted ) | 338 | if ( !mDisplayHightlighted ) |
327 | return false; | 339 | return false; |
328 | mDisplayHightlighted = false; | 340 | mDisplayHightlighted = false; |
329 | return true; | 341 | return true; |
330 | } | 342 | } |
331 | return false; | 343 | return false; |
332 | } | 344 | } |
333 | void MonthViewItem::paint(QPainter *p) | 345 | void MonthViewItem::paint(QPainter *p) |
334 | { | 346 | { |
335 | if ( mblockRepaint ) { | 347 | if ( mblockRepaint ) { |
336 | return; | 348 | return; |
337 | } | 349 | } |
338 | #if QT_VERSION >= 0x030000 | 350 | #if QT_VERSION >= 0x030000 |
339 | bool sel = isSelected(); | 351 | bool sel = isSelected(); |
340 | #else | 352 | #else |
341 | bool sel = selected(); | 353 | bool sel = selected(); |
342 | #endif | 354 | #endif |
343 | int heihei = height( listBox () ); | 355 | int heihei = height( listBox () ); |
344 | int x = 1; | 356 | int x = 1; |
345 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted ) | 357 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted ) |
346 | { | 358 | { |
347 | if ( mDisplayHightlighted ) | 359 | if ( mDisplayHightlighted ) |
348 | sel = true; | 360 | sel = true; |
349 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 361 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
350 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 362 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
351 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); | 363 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); |
352 | } | 364 | } |
353 | 365 | ||
354 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 366 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
355 | int size = PIXMAP_SIZE; | 367 | int size = PIXMAP_SIZE; |
356 | if ( QApplication::desktop()->width() < 300 ) | 368 | if ( QApplication::desktop()->width() < 300 ) |
357 | size = 3; | 369 | size = 3; |
358 | int y = (heihei - size -1 ) /2; | 370 | int y = (heihei - size -1 ) /2; |
359 | 371 | ||
360 | if ( mIncidence->calID() > 1 ) { | 372 | if ( mIncidence->calID() > 1 ) { |
361 | p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); | 373 | p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); |
362 | p->drawRect ( x, y-2,size,size+4); | 374 | p->drawRect ( x, y-2,size,size+4); |
363 | x += size + 1; | 375 | x += size + 1; |
364 | } | 376 | } |
365 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 377 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
366 | if ( mInfo ) { | 378 | if ( mInfo ) { |
367 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 379 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
368 | x += size + 1; | 380 | x += size + 1; |
369 | } | 381 | } |
370 | if ( mRecur ) { | 382 | if ( mRecur ) { |
371 | p->fillRect ( x, y,size,size, Qt::blue ); | 383 | p->fillRect ( x, y,size,size, Qt::blue ); |
372 | x += size + 1; | 384 | x += size + 1; |
373 | } | 385 | } |
374 | if ( mAlarm ) { | 386 | if ( mAlarm ) { |
375 | p->fillRect ( x, y,size,size, Qt::red ); | 387 | p->fillRect ( x, y,size,size, Qt::red ); |
376 | x += size + 1; | 388 | x += size + 1; |
377 | } | 389 | } |
378 | if ( mReply ) { | 390 | if ( mReply ) { |
379 | p->fillRect ( x, y,size,size, Qt::yellow ); | 391 | p->fillRect ( x, y,size,size, Qt::yellow ); |
380 | x += size + 1; | 392 | x += size + 1; |
381 | } | 393 | } |
382 | } | 394 | } |
383 | if ( mMultiday ) { | 395 | if ( mMultiday ) { |
384 | int yyy = y+(size/2); | 396 | int yyy = y+(size/2); |
385 | int sizeM = size+2; | 397 | int sizeM = size+2; |
386 | p->setBrush( QBrush::SolidPattern ); | 398 | p->setBrush( QBrush::SolidPattern ); |
387 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 399 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
388 | if ( mMultiday == 2 || mMultiday == 3 ) { | 400 | if ( mMultiday == 2 || mMultiday == 3 ) { |
389 | QPointArray pa ( 3 ); | 401 | QPointArray pa ( 3 ); |
390 | pa.setPoint (0, x, yyy ); | 402 | pa.setPoint (0, x, yyy ); |
391 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 403 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
392 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 404 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
393 | p->drawPolygon( pa ); | 405 | p->drawPolygon( pa ); |
394 | } | 406 | } |
395 | if ( mMultiday == 2 || mMultiday == 1 ) { | 407 | if ( mMultiday == 2 || mMultiday == 1 ) { |
396 | QPointArray pa ( 3 ); | 408 | QPointArray pa ( 3 ); |
397 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 409 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
398 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 410 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
399 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 411 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
400 | p->drawPolygon( pa ); | 412 | p->drawPolygon( pa ); |
401 | } | 413 | } |
402 | if ( mMultiday == 1 ) { | 414 | if ( mMultiday == 1 ) { |
403 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 415 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
404 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 416 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
405 | } | 417 | } |
406 | if ( mMultiday == 3 ) { | 418 | if ( mMultiday == 3 ) { |
407 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 419 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
408 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 420 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
409 | 421 | ||
410 | } | 422 | } |
411 | x += sizeM/2 + 1; | 423 | x += sizeM/2 + 1; |
412 | x += sizeM + 1; | 424 | x += sizeM + 1; |
413 | } | 425 | } |
414 | 426 | ||
415 | if ( mIncidence->typeID() == todoID ){ | 427 | if ( mIncidence->typeID() == todoID ){ |
416 | Todo* td = ( Todo* ) mIncidence; | 428 | Todo* td = ( Todo* ) mIncidence; |
417 | if ( td->isCompleted() ) { | 429 | if ( td->isCompleted() ) { |
418 | int half = size/2; | 430 | int half = size/2; |
419 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 431 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
420 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 432 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
421 | x += half+half + 4; | 433 | x += half+half + 4; |
422 | 434 | ||
423 | } else { | 435 | } else { |
424 | int val = td->percentComplete()/20; | 436 | int val = td->percentComplete()/20; |
425 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); | 437 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); |
426 | p->drawRect ( x, y-2,7,size+4); | 438 | p->drawRect ( x, y-2,7,size+4); |
427 | x += size + 3; | 439 | x += size + 3; |
428 | } | 440 | } |
429 | } | 441 | } |
430 | QFontMetrics fm = p->fontMetrics(); | 442 | QFontMetrics fm = p->fontMetrics(); |
431 | int yPos; | 443 | int yPos; |
432 | int pmheight = size; | 444 | int pmheight = size; |
433 | if( pmheight < fm.height() ) | 445 | if( pmheight < fm.height() ) |
434 | yPos = fm.ascent() + fm.leading()/2; | 446 | yPos = fm.ascent() + fm.leading()/2; |
435 | else | 447 | else |
436 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 448 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
437 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 449 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
@@ -530,256 +542,258 @@ MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | |||
530 | SLOT( selection( QListBoxItem * ) ) ); | 542 | SLOT( selection( QListBoxItem * ) ) ); |
531 | 543 | ||
532 | /* | 544 | /* |
533 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 545 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
534 | SLOT( selection( QListBoxItem * ) ) ); | 546 | SLOT( selection( QListBoxItem * ) ) ); |
535 | */ | 547 | */ |
536 | } | 548 | } |
537 | #ifdef DESKTOP_VERSION | 549 | #ifdef DESKTOP_VERSION |
538 | QToolTipGroup *MonthViewCell::toolTipGroup() | 550 | QToolTipGroup *MonthViewCell::toolTipGroup() |
539 | { | 551 | { |
540 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 552 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
541 | return mToolTipGroup; | 553 | return mToolTipGroup; |
542 | } | 554 | } |
543 | #endif | 555 | #endif |
544 | 556 | ||
545 | void MonthViewCell::setDate( const QDate &date ) | 557 | void MonthViewCell::setDate( const QDate &date ) |
546 | { | 558 | { |
547 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 559 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
548 | mDate = date; | 560 | mDate = date; |
549 | 561 | ||
550 | 562 | ||
551 | 563 | ||
552 | //resizeEvent( 0 ); | 564 | //resizeEvent( 0 ); |
553 | } | 565 | } |
554 | 566 | ||
555 | QDate MonthViewCell::date() const | 567 | QDate MonthViewCell::date() const |
556 | { | 568 | { |
557 | return mDate; | 569 | return mDate; |
558 | } | 570 | } |
559 | 571 | ||
560 | void MonthViewCell::setPrimary( bool primary ) | 572 | void MonthViewCell::setPrimary( bool primary ) |
561 | { | 573 | { |
562 | mPrimary = primary; | 574 | mPrimary = primary; |
563 | //setMyPalette(); | 575 | //setMyPalette(); |
564 | } | 576 | } |
565 | void MonthViewCell::setMyPalette() | 577 | void MonthViewCell::setMyPalette() |
566 | { | 578 | { |
567 | 579 | ||
568 | if ( mHoliday) { | 580 | if ( mHoliday) { |
569 | if ( currentPalette == 1 ) return; | 581 | if ( currentPalette == 1 ) return; |
570 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 582 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
571 | setPalette( mHolidayPalette ); | 583 | setPalette( mHolidayPalette ); |
572 | //mLabel->setPalette( mHolidayPalette ); | 584 | //mLabel->setPalette( mHolidayPalette ); |
573 | currentPalette = 1; | 585 | currentPalette = 1; |
574 | 586 | ||
575 | } else { | 587 | } else { |
576 | if ( mPrimary ) { | 588 | if ( mPrimary ) { |
577 | if ( currentPalette == 2 ) return; | 589 | if ( currentPalette == 2 ) return; |
578 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 590 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
579 | //mLabel->setPalette( mPrimaryPalette ); | 591 | //mLabel->setPalette( mPrimaryPalette ); |
580 | setPalette( mPrimaryPalette ); | 592 | setPalette( mPrimaryPalette ); |
581 | currentPalette = 2; | 593 | currentPalette = 2; |
582 | 594 | ||
583 | } else { | 595 | } else { |
584 | if ( currentPalette == 3 ) return; | 596 | if ( currentPalette == 3 ) return; |
585 | setPalette( mNonPrimaryPalette ); | 597 | setPalette( mNonPrimaryPalette ); |
586 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 598 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
587 | //mLabel->setPalette( mNonPrimaryPalette );; | 599 | //mLabel->setPalette( mNonPrimaryPalette );; |
588 | currentPalette = 3; | 600 | currentPalette = 3; |
589 | } | 601 | } |
590 | } | 602 | } |
591 | //QPalette pal = palette(); | 603 | //QPalette pal = palette(); |
592 | 604 | ||
593 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 605 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
594 | } | 606 | } |
595 | QPalette MonthViewCell::getPalette () | 607 | QPalette MonthViewCell::getPalette () |
596 | { | 608 | { |
597 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 609 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
598 | return mStandardPalette; | 610 | return mStandardPalette; |
599 | if ( mHoliday) { | 611 | if ( mHoliday) { |
600 | return mHolidayPalette ; | 612 | return mHolidayPalette ; |
601 | } else { | 613 | } else { |
602 | if ( mPrimary ) { | 614 | if ( mPrimary ) { |
603 | return mPrimaryPalette ; | 615 | return mPrimaryPalette ; |
604 | } | 616 | } |
605 | } | 617 | } |
606 | return mNonPrimaryPalette; | 618 | return mNonPrimaryPalette; |
607 | } | 619 | } |
608 | bool MonthViewCell::isPrimary() const | 620 | bool MonthViewCell::isPrimary() const |
609 | { | 621 | { |
610 | return mPrimary; | 622 | return mPrimary; |
611 | } | 623 | } |
612 | 624 | ||
613 | void MonthViewCell::setHoliday( bool holiday ) | 625 | void MonthViewCell::setHoliday( bool holiday ) |
614 | { | 626 | { |
615 | mHoliday = holiday; | 627 | mHoliday = holiday; |
616 | //setMyPalette(); | 628 | //setMyPalette(); |
617 | } | 629 | } |
618 | 630 | ||
619 | void MonthViewCell::setHoliday( const QString &holiday ) | 631 | void MonthViewCell::setHoliday( const QString &holiday ) |
620 | { | 632 | { |
621 | mHolidayString = holiday; | 633 | mHolidayString = holiday; |
622 | 634 | ||
623 | if ( !holiday.isEmpty() ) { | 635 | if ( !holiday.isEmpty() ) { |
624 | setHoliday( true ); | 636 | setHoliday( true ); |
625 | } | 637 | } |
626 | } | 638 | } |
627 | 639 | ||
628 | void MonthViewCell::startUpdateCell() | 640 | void MonthViewCell::startUpdateCell() |
629 | { | 641 | { |
630 | 642 | ||
631 | mdayCount = 0; | 643 | mdayCount = 0; |
632 | setFocusPolicy(NoFocus); | 644 | setFocusPolicy(NoFocus); |
633 | if ( !mMonthView->isUpdatePossible() ) | 645 | if ( !mMonthView->isUpdatePossible() ) |
634 | return; | 646 | return; |
635 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 647 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
636 | while ( mitem ) { | 648 | while ( mitem ) { |
637 | mitem->setBlockRepaint( true ); | 649 | mitem->setBlockRepaint( true ); |
638 | mitem = (MonthViewItem *)mitem->next(); | 650 | mitem = (MonthViewItem *)mitem->next(); |
639 | } | 651 | } |
640 | if ( mAvailItemList.count() > 20 ) { | 652 | if ( mAvailItemList.count() > 20 ) { |
641 | mAvailItemList.setAutoDelete( true ); | 653 | mAvailItemList.setAutoDelete( true ); |
642 | mAvailItemList.clear(); | 654 | mAvailItemList.clear(); |
643 | mAvailItemList.setAutoDelete( false ); | 655 | mAvailItemList.setAutoDelete( false ); |
644 | clear(); | 656 | clear(); |
645 | } | 657 | } |
646 | 658 | ||
647 | setPrimary( mDate.month()%2 ); | 659 | setPrimary( mDate.month()%2 ); |
648 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 660 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
649 | if ( mDate == QDate::currentDate() ) { | 661 | if ( mDate == QDate::currentDate() ) { |
650 | setLineWidth( 3 ); | 662 | setLineWidth( 3 ); |
651 | } else { | 663 | } else { |
652 | setLineWidth( 1 ); | 664 | setLineWidth( 1 ); |
653 | } | 665 | } |
654 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); | 666 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); |
655 | //clear(); | 667 | //clear(); |
656 | while ( CurrentAvailItem ) { | 668 | while ( CurrentAvailItem ) { |
657 | MonthViewItem *item = CurrentAvailItem; | 669 | MonthViewItem *item = CurrentAvailItem; |
670 | //item->setHighlightedFalse(); | ||
671 | item->clearData(); | ||
658 | CurrentAvailItem = (MonthViewItem *)item->next(); | 672 | CurrentAvailItem = (MonthViewItem *)item->next(); |
659 | mAvailItemList.append( item ); | 673 | mAvailItemList.append( item ); |
660 | takeItem ( item ); | 674 | takeItem ( item ); |
661 | } | 675 | } |
662 | 676 | ||
663 | #ifdef DESKTOP_VERSION | 677 | #ifdef DESKTOP_VERSION |
664 | QToolTip::remove(this); | 678 | QToolTip::remove(this); |
665 | #endif | 679 | #endif |
666 | mToolTip.clear(); | 680 | mToolTip.clear(); |
667 | //qApp->processEvents(); | 681 | //qApp->processEvents(); |
668 | #if 0 | 682 | #if 0 |
669 | if ( !mHolidayString.isEmpty() ) { | 683 | if ( !mHolidayString.isEmpty() ) { |
670 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 684 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
671 | item->setPalette( mHolidayPalette ); | 685 | item->setPalette( mHolidayPalette ); |
672 | insertItem( item ); | 686 | insertItem( item ); |
673 | mToolTip.append ( mHolidayString ); | 687 | mToolTip.append ( mHolidayString ); |
674 | } | 688 | } |
675 | #endif | 689 | #endif |
676 | } | 690 | } |
677 | 691 | ||
678 | int MonthViewCell::insertEvent(Event *event) | 692 | int MonthViewCell::insertEvent(Event *event) |
679 | { | 693 | { |
680 | bool useToolTips = true; | 694 | bool useToolTips = true; |
681 | #ifndef DESKTOP_VERSION | 695 | #ifndef DESKTOP_VERSION |
682 | useToolTips = false; | 696 | useToolTips = false; |
683 | #endif | 697 | #endif |
684 | QString mToolTipText; | 698 | QString mToolTipText; |
685 | setFocusPolicy(WheelFocus); | 699 | setFocusPolicy(WheelFocus); |
686 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 700 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
687 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 701 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
688 | return mdayCount; | 702 | return mdayCount; |
689 | else | 703 | else |
690 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 704 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
691 | return mdayCount; | 705 | return mdayCount; |
692 | } | 706 | } |
693 | 707 | ||
694 | if ( event->isHoliday()) { | 708 | if ( event->isHoliday()) { |
695 | setHoliday( true ); | 709 | setHoliday( true ); |
696 | if ( mDate.dayOfWeek() == 7 ) | 710 | if ( mDate.dayOfWeek() == 7 ) |
697 | setLineWidth( 3 ); | 711 | setLineWidth( 3 ); |
698 | } | 712 | } |
699 | QString text; | 713 | QString text; |
700 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 714 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
701 | if (event->isMultiDay()) { | 715 | if (event->isMultiDay()) { |
702 | QString prefix = "<->";multiday = 2; | 716 | QString prefix = "<->";multiday = 2; |
703 | QString time; | 717 | QString time; |
704 | if ( event->doesRecur() ) { | 718 | if ( event->doesRecur() ) { |
705 | if ( event->recursOn( mDate) ) { | 719 | if ( event->recursOn( mDate) ) { |
706 | prefix ="->" ;multiday = 1; | 720 | prefix ="->" ;multiday = 1; |
707 | } | 721 | } |
708 | else { | 722 | else { |
709 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 723 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
710 | if ( event->recursOn( mDate.addDays( -days)) ) { | 724 | if ( event->recursOn( mDate.addDays( -days)) ) { |
711 | prefix ="<-" ;multiday = 3; | 725 | prefix ="<-" ;multiday = 3; |
712 | } | 726 | } |
713 | } | 727 | } |
714 | 728 | ||
715 | } else { | 729 | } else { |
716 | if (mDate == event->dtStart().date()) { | 730 | if (mDate == event->dtStart().date()) { |
717 | prefix ="->" ;multiday = 1; | 731 | prefix ="->" ;multiday = 1; |
718 | } else if (mDate == event->dtEnd().date()) { | 732 | } else if (mDate == event->dtEnd().date()) { |
719 | prefix ="<-" ;multiday = 3; | 733 | prefix ="<-" ;multiday = 3; |
720 | } | 734 | } |
721 | } | 735 | } |
722 | if ( !event->doesFloat() ) { | 736 | if ( !event->doesFloat() ) { |
723 | if ( mDate == event->dtStart().date () ) | 737 | if ( mDate == event->dtStart().date () ) |
724 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 738 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
725 | else if ( mDate == event->dtEnd().date () ) | 739 | else if ( mDate == event->dtEnd().date () ) |
726 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 740 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
727 | 741 | ||
728 | } | 742 | } |
729 | text = time + event->summary(); | 743 | text = time + event->summary(); |
730 | if ( useToolTips ) | 744 | if ( useToolTips ) |
731 | mToolTipText += prefix + text; | 745 | mToolTipText += prefix + text; |
732 | } else { | 746 | } else { |
733 | if (event->doesFloat()) { | 747 | if (event->doesFloat()) { |
734 | text = event->summary(); | 748 | text = event->summary(); |
735 | if ( useToolTips ) | 749 | if ( useToolTips ) |
736 | mToolTipText += text; | 750 | mToolTipText += text; |
737 | } | 751 | } |
738 | else { | 752 | else { |
739 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 753 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
740 | text += " " + event->summary(); | 754 | text += " " + event->summary(); |
741 | if ( useToolTips ) | 755 | if ( useToolTips ) |
742 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 756 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
743 | } | 757 | } |
744 | } | 758 | } |
745 | if ( useToolTips && ! event->location().isEmpty() ) { | 759 | if ( useToolTips && ! event->location().isEmpty() ) { |
746 | mToolTipText += " (" + event->location() +")"; | 760 | mToolTipText += " (" + event->location() +")"; |
747 | } | 761 | } |
748 | MonthViewItem *item ; | 762 | MonthViewItem *item ; |
749 | 763 | ||
750 | if ( mAvailItemList.count() ) { | 764 | if ( mAvailItemList.count() ) { |
751 | item = mAvailItemList.first(); | 765 | item = mAvailItemList.first(); |
752 | mAvailItemList.remove( item ); | 766 | mAvailItemList.remove( item ); |
753 | item->recycle( event, mDate, text ); | 767 | item->recycle( event, mDate, text ); |
754 | } else { | 768 | } else { |
755 | item = new MonthViewItem( event, mDate, text ); | 769 | item = new MonthViewItem( event, mDate, text ); |
756 | } | 770 | } |
757 | 771 | ||
758 | QPalette pal; | 772 | QPalette pal; |
759 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 773 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
760 | QStringList categories = event->categories(); | 774 | QStringList categories = event->categories(); |
761 | QString cat = categories.first(); | 775 | QString cat = categories.first(); |
762 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 776 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
763 | pal = getPalette(); | 777 | pal = getPalette(); |
764 | if (cat.isEmpty()) { | 778 | if (cat.isEmpty()) { |
765 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 779 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
766 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); | 780 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); |
767 | } else { | 781 | } else { |
768 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 782 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
769 | } | 783 | } |
770 | 784 | ||
771 | } else { | 785 | } else { |
772 | if (cat.isEmpty()) { | 786 | if (cat.isEmpty()) { |
773 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 787 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
774 | pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); | 788 | pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); |
775 | } else { | 789 | } else { |
776 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 790 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
777 | } | 791 | } |
778 | } | 792 | } |
779 | 793 | ||
780 | } else { | 794 | } else { |
781 | pal = mStandardPalette ; | 795 | pal = mStandardPalette ; |
782 | } | 796 | } |
783 | item->setPalette( pal ); | 797 | item->setPalette( pal ); |
784 | item->setRecur( event->recurrence()->doesRecur() ); | 798 | item->setRecur( event->recurrence()->doesRecur() ); |
785 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); | 799 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 159af16..ac97860 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -1,237 +1,238 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2000,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 | 19 | ||
20 | #ifndef _KOMONTHVIEW_H | 20 | #ifndef _KOMONTHVIEW_H |
21 | #define _KOMONTHVIEW_H | 21 | #define _KOMONTHVIEW_H |
22 | 22 | ||
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qframe.h> | 24 | #include <qframe.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qpoint.h> | 27 | #include <qpoint.h> |
28 | #include <qwidgetstack.h> | 28 | #include <qwidgetstack.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qtimer.h> | 30 | #include <qtimer.h> |
31 | #include <qintdict.h> | 31 | #include <qintdict.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qvaluelist.h> | 33 | #include <qvaluelist.h> |
34 | #include <qptrvector.h> | 34 | #include <qptrvector.h> |
35 | 35 | ||
36 | #include <libkcal/calendar.h> | 36 | #include <libkcal/calendar.h> |
37 | #include <libkcal/event.h> | 37 | #include <libkcal/event.h> |
38 | 38 | ||
39 | #include "koeventview.h" | 39 | #include "koeventview.h" |
40 | #include "navigatorbar.h" | 40 | #include "navigatorbar.h" |
41 | 41 | ||
42 | #ifdef DESKTOP_VERSION | 42 | #ifdef DESKTOP_VERSION |
43 | class QToolTipGroup; | 43 | class QToolTipGroup; |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | class KNOWhatsThis; | 46 | class KNOWhatsThis; |
47 | class MonthViewCell; | 47 | class MonthViewCell; |
48 | class KOWeekButton : public QPushButton | 48 | class KOWeekButton : public QPushButton |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | public: | 51 | public: |
52 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : | 52 | KOWeekButton( QWidget *parent=0, const char *name=0 ) : |
53 | QPushButton( parent, name) | 53 | QPushButton( parent, name) |
54 | { | 54 | { |
55 | connect( this, SIGNAL( clicked() ), | 55 | connect( this, SIGNAL( clicked() ), |
56 | SLOT( bottonClicked() )); | 56 | SLOT( bottonClicked() )); |
57 | mNumber = -1; | 57 | mNumber = -1; |
58 | } | 58 | } |
59 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} | 59 | void setWeekNum ( int num ) {mNumber = num; setText( QString::number ( num ));} |
60 | int getWeekNum() { return mNumber;} | 60 | int getWeekNum() { return mNumber;} |
61 | signals: | 61 | signals: |
62 | void selectWeekNum ( int ); | 62 | void selectWeekNum ( int ); |
63 | private: | 63 | private: |
64 | void focusInEvent ( QFocusEvent * ){;} | 64 | void focusInEvent ( QFocusEvent * ){;} |
65 | int mNumber; | 65 | int mNumber; |
66 | void keyPressEvent ( QKeyEvent * e ) | 66 | void keyPressEvent ( QKeyEvent * e ) |
67 | { | 67 | { |
68 | e->ignore(); | 68 | e->ignore(); |
69 | } | 69 | } |
70 | 70 | ||
71 | private slots : | 71 | private slots : |
72 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } | 72 | void bottonClicked() { if ( mNumber > 0 ) emit selectWeekNum ( mNumber ); } |
73 | }; | 73 | }; |
74 | 74 | ||
75 | class KNoScrollListBox: public QListBox | 75 | class KNoScrollListBox: public QListBox |
76 | { | 76 | { |
77 | Q_OBJECT | 77 | Q_OBJECT |
78 | public: | 78 | public: |
79 | KNoScrollListBox(QWidget *parent=0, const char *name=0); | 79 | KNoScrollListBox(QWidget *parent=0, const char *name=0); |
80 | ~KNoScrollListBox(); | 80 | ~KNoScrollListBox(); |
81 | QString getWhatsThisText(QPoint p) ; | 81 | QString getWhatsThisText(QPoint p) ; |
82 | 82 | ||
83 | signals: | 83 | signals: |
84 | void shiftDown(); | 84 | void shiftDown(); |
85 | void shiftUp(); | 85 | void shiftUp(); |
86 | void rightClick(); | 86 | void rightClick(); |
87 | void nextCell(); | 87 | void nextCell(); |
88 | void prevCell(); | 88 | void prevCell(); |
89 | void highligtIncidence( Incidence * , MonthViewCell*, int ); | 89 | void highligtIncidence( Incidence * , MonthViewCell*, int ); |
90 | 90 | ||
91 | protected slots: | 91 | protected slots: |
92 | void oneDown(); | 92 | void oneDown(); |
93 | void keyPressEvent(QKeyEvent *); | 93 | void keyPressEvent(QKeyEvent *); |
94 | void keyReleaseEvent(QKeyEvent *); | 94 | void keyReleaseEvent(QKeyEvent *); |
95 | void mousePressEvent(QMouseEvent *); | 95 | void mousePressEvent(QMouseEvent *); |
96 | void focusInEvent ( QFocusEvent * ); | 96 | void focusInEvent ( QFocusEvent * ); |
97 | void focusOutEvent ( QFocusEvent * ); | 97 | void focusOutEvent ( QFocusEvent * ); |
98 | 98 | ||
99 | private: | 99 | private: |
100 | bool resetOnFocusIn; | 100 | bool resetOnFocusIn; |
101 | KNOWhatsThis * mWT; | 101 | KNOWhatsThis * mWT; |
102 | }; | 102 | }; |
103 | 103 | ||
104 | 104 | ||
105 | class MonthViewItem: public QListBoxItem | 105 | class MonthViewItem: public QListBoxItem |
106 | { | 106 | { |
107 | public: | 107 | public: |
108 | MonthViewItem( Incidence *, QDate qd, const QString & title ); | 108 | MonthViewItem( Incidence *, QDate qd, const QString & title ); |
109 | void recycle( Incidence *incidence, QDate qd, const QString & s); | 109 | void recycle( Incidence *incidence, QDate qd, const QString & s); |
110 | void clearData(); | ||
110 | void setRecur(bool on) { mRecur = on; } | 111 | void setRecur(bool on) { mRecur = on; } |
111 | void setAlarm(bool on) { mAlarm = on; } | 112 | void setAlarm(bool on) { mAlarm = on; } |
112 | void setReply(bool on) { mReply = on; } | 113 | void setReply(bool on) { mReply = on; } |
113 | void setMoreInfo(bool on) { mInfo = on; } | 114 | void setMoreInfo(bool on) { mInfo = on; } |
114 | void setMultiDay(int type) { mMultiday = type; } | 115 | void setMultiDay(int type) { mMultiday = type; } |
115 | int multiDay() { return mMultiday; } | 116 | int multiDay() { return mMultiday; } |
116 | void setMultiDayPos(int type) { mdayPos = type; } | 117 | void setMultiDayPos(int type) { mdayPos = type; } |
117 | int gettMultiDayPos() { return mdayPos; } | 118 | int gettMultiDayPos() { return mdayPos; } |
118 | void setBlockRepaint(bool on) { mblockRepaint = on; } | 119 | void setBlockRepaint(bool on) { mblockRepaint = on; } |
119 | bool setHighlighted( Incidence * ); | 120 | bool setHighlighted( Incidence * ); |
120 | 121 | ||
121 | void setPalette(const QPalette &p) { mPalette = p; } | 122 | void setPalette(const QPalette &p) { mPalette = p; } |
122 | QPalette palette() const { return mPalette; } | 123 | QPalette palette() const { return mPalette; } |
123 | bool setHighlightedFalse(); | 124 | bool setHighlightedFalse(); |
124 | Incidence *incidence() const { return mIncidence; } | 125 | Incidence *incidence() const { return mIncidence; } |
125 | QDate incidenceDate() { return mDate; } | 126 | QDate incidenceDate() { return mDate; } |
126 | 127 | ||
127 | protected: | 128 | protected: |
128 | virtual void paint(QPainter *); | 129 | virtual void paint(QPainter *); |
129 | virtual int height(const QListBox *) const; | 130 | virtual int height(const QListBox *) const; |
130 | virtual int width(const QListBox *) const; | 131 | virtual int width(const QListBox *) const; |
131 | 132 | ||
132 | private: | 133 | private: |
133 | int mdayPos; | 134 | int mdayPos; |
134 | bool isWeekItem; | 135 | bool isWeekItem; |
135 | bool mblockRepaint; | 136 | bool mblockRepaint; |
136 | int mMultiday; | 137 | int mMultiday; |
137 | bool mRecur; | 138 | bool mRecur; |
138 | bool mAlarm; | 139 | bool mAlarm; |
139 | bool mReply; | 140 | bool mReply; |
140 | bool mInfo; | 141 | bool mInfo; |
141 | bool mDisplayHightlighted; | 142 | bool mDisplayHightlighted; |
142 | 143 | ||
143 | QPalette mPalette; | 144 | QPalette mPalette; |
144 | QDate mDate; | 145 | QDate mDate; |
145 | 146 | ||
146 | Incidence *mIncidence; | 147 | Incidence *mIncidence; |
147 | }; | 148 | }; |
148 | 149 | ||
149 | 150 | ||
150 | class KOMonthView; | 151 | class KOMonthView; |
151 | 152 | ||
152 | class MonthViewCell : public KNoScrollListBox | 153 | class MonthViewCell : public KNoScrollListBox |
153 | { | 154 | { |
154 | Q_OBJECT | 155 | Q_OBJECT |
155 | public: | 156 | public: |
156 | MonthViewCell(KOMonthView *,QWidget* ); | 157 | MonthViewCell(KOMonthView *,QWidget* ); |
157 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} | 158 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} |
158 | 159 | ||
159 | void setDate( const QDate & ); | 160 | void setDate( const QDate & ); |
160 | QDate date() const; | 161 | QDate date() const; |
161 | 162 | ||
162 | void setPrimary( bool ); | 163 | void setPrimary( bool ); |
163 | bool isPrimary() const; | 164 | bool isPrimary() const; |
164 | 165 | ||
165 | void setHoliday( bool ); | 166 | void setHoliday( bool ); |
166 | void setHoliday( const QString & ); | 167 | void setHoliday( const QString & ); |
167 | 168 | ||
168 | void updateCell(); | 169 | void updateCell(); |
169 | void startUpdateCell(); | 170 | void startUpdateCell(); |
170 | void finishUpdateCell(); | 171 | void finishUpdateCell(); |
171 | void repaintfinishUpdateCell(); | 172 | void repaintfinishUpdateCell(); |
172 | int insertEvent(Event *); | 173 | int insertEvent(Event *); |
173 | void insertTodo(Todo *); | 174 | void insertTodo(Todo *); |
174 | 175 | ||
175 | void updateConfig( bool bigFont = false ); | 176 | void updateConfig( bool bigFont = false ); |
176 | 177 | ||
177 | void enableScrollBars( bool ); | 178 | void enableScrollBars( bool ); |
178 | 179 | ||
179 | Incidence *selectedIncidence(); | 180 | Incidence *selectedIncidence(); |
180 | QDate selectedIncidenceDate(); | 181 | QDate selectedIncidenceDate(); |
181 | QPushButton * dateLabel() { return mLabel; } | 182 | QPushButton * dateLabel() { return mLabel; } |
182 | void deHightLight(); | 183 | void deHightLight(); |
183 | bool doHightLight( Incidence *); | 184 | bool doHightLight( Incidence *); |
184 | void deselect(); | 185 | void deselect(); |
185 | void select(); | 186 | void select(); |
186 | #ifdef DESKTOP_VERSION | 187 | #ifdef DESKTOP_VERSION |
187 | static QToolTipGroup *toolTipGroup(); | 188 | static QToolTipGroup *toolTipGroup(); |
188 | #endif | 189 | #endif |
189 | signals: | 190 | signals: |
190 | void defaultAction( Incidence * ); | 191 | void defaultAction( Incidence * ); |
191 | void newEventSignal( QDateTime ); | 192 | void newEventSignal( QDateTime ); |
192 | void showDaySignal( QDate ); | 193 | void showDaySignal( QDate ); |
193 | 194 | ||
194 | protected: | 195 | protected: |
195 | QStringList mToolTip; | 196 | QStringList mToolTip; |
196 | void resizeEvent( QResizeEvent * ); | 197 | void resizeEvent( QResizeEvent * ); |
197 | 198 | ||
198 | public slots: | 199 | public slots: |
199 | void showDay(); | 200 | void showDay(); |
200 | protected slots: | 201 | protected slots: |
201 | void defaultAction( QListBoxItem * ); | 202 | void defaultAction( QListBoxItem * ); |
202 | void contextMenu( QListBoxItem * ); | 203 | void contextMenu( QListBoxItem * ); |
203 | void selection( QListBoxItem * ); | 204 | void selection( QListBoxItem * ); |
204 | void cellClicked( QListBoxItem * ); | 205 | void cellClicked( QListBoxItem * ); |
205 | void newEvent(); | 206 | void newEvent(); |
206 | 207 | ||
207 | private: | 208 | private: |
208 | int mdayCount; | 209 | int mdayCount; |
209 | QPtrList <MonthViewItem> mAvailItemList; | 210 | QPtrList <MonthViewItem> mAvailItemList; |
210 | KOMonthView *mMonthView; | 211 | KOMonthView *mMonthView; |
211 | int currentPalette; | 212 | int currentPalette; |
212 | 213 | ||
213 | QDate mDate; | 214 | QDate mDate; |
214 | bool mPrimary; | 215 | bool mPrimary; |
215 | bool mHoliday; | 216 | bool mHoliday; |
216 | QString mHolidayString; | 217 | QString mHolidayString; |
217 | 218 | ||
218 | //QLabel *mLabel; | 219 | //QLabel *mLabel; |
219 | QPushButton *mLabel; | 220 | QPushButton *mLabel; |
220 | //QListBox *mItemList; | 221 | //QListBox *mItemList; |
221 | #ifdef DESKTOP_VERSION | 222 | #ifdef DESKTOP_VERSION |
222 | static QToolTipGroup *mToolTipGroup; | 223 | static QToolTipGroup *mToolTipGroup; |
223 | #endif | 224 | #endif |
224 | QSize mLabelSize; | 225 | QSize mLabelSize; |
225 | QSize mLabelBigSize; | 226 | QSize mLabelBigSize; |
226 | QPalette mHolidayPalette; | 227 | QPalette mHolidayPalette; |
227 | QPalette mStandardPalette; | 228 | QPalette mStandardPalette; |
228 | QPalette mPrimaryPalette; | 229 | QPalette mPrimaryPalette; |
229 | QPalette mNonPrimaryPalette; | 230 | QPalette mNonPrimaryPalette; |
230 | void setMyPalette(); | 231 | void setMyPalette(); |
231 | QPalette getPalette (); | 232 | QPalette getPalette (); |
232 | 233 | ||
233 | }; | 234 | }; |
234 | 235 | ||
235 | 236 | ||
236 | class KOMonthView: public KOEventView | 237 | class KOMonthView: public KOEventView |
237 | { | 238 | { |