-rw-r--r-- | korganizer/komonthview.cpp | 65 | ||||
-rw-r--r-- | korganizer/komonthview.h | 4 |
2 files changed, 54 insertions, 15 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 1c2d6a2..264cf28 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -277,440 +277,453 @@ void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | |||
277 | emit rightClick(); | 277 | emit rightClick(); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) | 281 | MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) |
282 | : QListBoxItem() | 282 | : QListBoxItem() |
283 | { | 283 | { |
284 | mblockRepaint = true; | 284 | mblockRepaint = true; |
285 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 285 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
286 | recycle( incidence, s ); | 286 | recycle( incidence, s ); |
287 | } | 287 | } |
288 | void MonthViewItem::recycle( Incidence *incidence, const QString & s) | 288 | void MonthViewItem::recycle( Incidence *incidence, const QString & s) |
289 | { | 289 | { |
290 | mDisplayHighlighted = false; | 290 | mDisplayHighlighted = false; |
291 | setText( s ); | 291 | setText( s ); |
292 | mMultiday = 0; | 292 | mMultiday = 0; |
293 | mIncidence = incidence; | 293 | mIncidence = incidence; |
294 | mRecur = false; | 294 | mRecur = false; |
295 | mAlarm = false; | 295 | mAlarm = false; |
296 | mReply = false; | 296 | mReply = false; |
297 | mInfo = false; | 297 | mInfo = false; |
298 | mdayPos = 0; | 298 | mdayPos = 0; |
299 | } | 299 | } |
300 | 300 | ||
301 | bool MonthViewItem::setHighlightedFalse() | 301 | bool MonthViewItem::setHighlightedFalse() |
302 | { | 302 | { |
303 | if ( !mDisplayHighlighted ) | 303 | if ( !mDisplayHighlighted ) |
304 | return false; | 304 | return false; |
305 | mDisplayHighlighted = false; | 305 | mDisplayHighlighted = false; |
306 | return true; | 306 | return true; |
307 | } | 307 | } |
308 | 308 | ||
309 | bool MonthViewItem::setHighlighted( Incidence * inc ) | 309 | bool MonthViewItem::setHighlighted( Incidence * inc ) |
310 | { | 310 | { |
311 | if ( inc == mIncidence ) { | 311 | if ( inc == mIncidence ) { |
312 | if ( mDisplayHighlighted ) | 312 | if ( mDisplayHighlighted ) |
313 | return false; | 313 | return false; |
314 | mDisplayHighlighted = true; | 314 | mDisplayHighlighted = true; |
315 | return true; | 315 | return true; |
316 | } else { | 316 | } else { |
317 | if ( !mDisplayHighlighted ) | 317 | if ( !mDisplayHighlighted ) |
318 | return false; | 318 | return false; |
319 | mDisplayHighlighted = false; | 319 | mDisplayHighlighted = false; |
320 | return true; | 320 | return true; |
321 | } | 321 | } |
322 | return false; | 322 | return false; |
323 | } | 323 | } |
324 | void MonthViewItem::paint(QPainter *p) | 324 | void MonthViewItem::paint(QPainter *p) |
325 | { | 325 | { |
326 | if ( mblockRepaint || !mIncidence ) { | 326 | if ( mblockRepaint || !mIncidence ) { |
327 | return; | 327 | return; |
328 | } | 328 | } |
329 | #if QT_VERSION >= 0x030000 | 329 | #if QT_VERSION >= 0x030000 |
330 | bool sel = isSelected(); | 330 | bool sel = isSelected(); |
331 | #else | 331 | #else |
332 | bool sel = selected(); | 332 | bool sel = selected(); |
333 | #endif | 333 | #endif |
334 | int heihei = height( listBox () ); | 334 | int heihei = height( listBox () ); |
335 | int x = 1; | 335 | int x = 1; |
336 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHighlighted || sel ) | 336 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHighlighted || sel ) |
337 | { | 337 | { |
338 | 338 | ||
339 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 339 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
340 | sel ||mDisplayHighlighted ? QColorGroup::Highlight : QColorGroup::Background ) ); | 340 | sel ||mDisplayHighlighted ? QColorGroup::Highlight : QColorGroup::Background ) ); |
341 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); | 341 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); |
342 | } | 342 | } |
343 | 343 | ||
344 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 344 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
345 | int size = PIXMAP_SIZE; | 345 | int size = PIXMAP_SIZE; |
346 | if ( QApplication::desktop()->width() < 300 ) | 346 | if ( QApplication::desktop()->width() < 300 ) |
347 | size = 3; | 347 | size = 3; |
348 | int y = (heihei - size -1 ) /2; | 348 | int y = (heihei - size -1 ) /2; |
349 | 349 | ||
350 | if ( mIncidence->calID() > 1 ) { | 350 | if ( mIncidence->calID() > 1 ) { |
351 | p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); | 351 | p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); |
352 | p->drawRect ( x, y-2,size,size+4); | 352 | p->drawRect ( x, y-2,size,size+4); |
353 | x += size + 1; | 353 | x += size + 1; |
354 | } | 354 | } |
355 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 355 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
356 | if ( mInfo ) { | 356 | if ( mInfo ) { |
357 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 357 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
358 | x += size + 1; | 358 | x += size + 1; |
359 | } | 359 | } |
360 | if ( mRecur ) { | 360 | if ( mRecur ) { |
361 | p->fillRect ( x, y,size,size, Qt::blue ); | 361 | p->fillRect ( x, y,size,size, Qt::blue ); |
362 | x += size + 1; | 362 | x += size + 1; |
363 | } | 363 | } |
364 | if ( mAlarm ) { | 364 | if ( mAlarm ) { |
365 | p->fillRect ( x, y,size,size, Qt::red ); | 365 | p->fillRect ( x, y,size,size, Qt::red ); |
366 | x += size + 1; | 366 | x += size + 1; |
367 | } | 367 | } |
368 | if ( mReply ) { | 368 | if ( mReply ) { |
369 | p->fillRect ( x, y,size,size, Qt::yellow ); | 369 | p->fillRect ( x, y,size,size, Qt::yellow ); |
370 | x += size + 1; | 370 | x += size + 1; |
371 | } | 371 | } |
372 | } | 372 | } |
373 | |||
374 | |||
375 | |||
376 | |||
377 | if ( sel ) p->setPen( Qt::white ); | ||
378 | else p->setPen( palette().color( QPalette::Normal,QColorGroup::Foreground ) ); | ||
379 | |||
380 | #if 0 | ||
381 | p->setPen( palette().color( QPalette::Normal, sel ? \ | ||
382 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | ||
383 | #endif | ||
384 | QColor textColor = p->pen().color(); | ||
385 | |||
386 | |||
373 | if ( mMultiday ) { | 387 | if ( mMultiday ) { |
374 | int yyy = y+(size/2); | 388 | int yyy = y+(size/2); |
375 | int sizeM = size+2; | 389 | int sizeM = size+2; |
376 | p->setBrush( QBrush( p->pen().color() ) ); | 390 | p->setBrush( QBrush( textColor ) ); |
377 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 391 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
378 | if ( mMultiday == 2 || mMultiday == 3 ) { | 392 | if ( mMultiday == 2 || mMultiday == 3 ) { |
379 | QPointArray pa ( 3 ); | 393 | QPointArray pa ( 3 ); |
380 | pa.setPoint (0, x, yyy ); | 394 | pa.setPoint (0, x, yyy ); |
381 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 395 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
382 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 396 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
383 | p->drawPolygon( pa ); | 397 | p->drawPolygon( pa ); |
384 | } | 398 | } |
385 | if ( mMultiday == 2 || mMultiday == 1 ) { | 399 | if ( mMultiday == 2 || mMultiday == 1 ) { |
386 | QPointArray pa ( 3 ); | 400 | QPointArray pa ( 3 ); |
387 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 401 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
388 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 402 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
389 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 403 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
390 | p->drawPolygon( pa ); | 404 | p->drawPolygon( pa ); |
391 | } | 405 | } |
392 | if ( mMultiday == 1 ) { | 406 | if ( mMultiday == 1 ) { |
393 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 407 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
394 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 408 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
395 | } | 409 | } |
396 | if ( mMultiday == 3 ) { | 410 | if ( mMultiday == 3 ) { |
397 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 411 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
398 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 412 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
399 | 413 | ||
400 | } | 414 | } |
401 | x += sizeM/2 + 1; | 415 | x += sizeM/2 + 1; |
402 | x += sizeM + 1; | 416 | x += sizeM + 1; |
403 | } | 417 | } |
404 | 418 | ||
405 | if ( mIncidence->typeID() == todoID ){ | 419 | if ( mIncidence->typeID() == todoID ){ |
406 | Todo* td = ( Todo* ) mIncidence; | 420 | Todo* td = ( Todo* ) mIncidence; |
407 | if ( td->isCompleted() ) { | 421 | if ( td->isCompleted() ) { |
408 | int half = size/2; | 422 | int half = size/2; |
409 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 423 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
410 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 424 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
411 | x += half+half + 4; | 425 | x += half+half + 4; |
412 | 426 | ||
413 | } else { | 427 | } else { |
414 | int val = td->percentComplete()/20; | 428 | int val = td->percentComplete()/20; |
415 | p->fillRect ( x+1, y-2, val ,size+4,p->pen().color() ); | 429 | p->fillRect ( x+1, y-2, val ,size+4,textColor ); |
416 | p->drawRect ( x, y-2,7,size+4); | 430 | p->drawRect ( x, y-2,7,size+4); |
417 | x += size + 3; | 431 | x += size + 3; |
418 | } | 432 | } |
419 | } | 433 | } |
420 | QFontMetrics fm = p->fontMetrics(); | 434 | QFontMetrics fm = p->fontMetrics(); |
421 | int yPos; | 435 | int yPos; |
422 | int pmheight = size; | 436 | int pmheight = size; |
423 | if( pmheight < fm.height() ) | 437 | if( pmheight < fm.height() ) |
424 | yPos = fm.ascent() + fm.leading()/2; | 438 | yPos = fm.ascent() + fm.leading()/2; |
425 | else | 439 | else |
426 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 440 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
427 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 441 | |
428 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | ||
429 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { | 442 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { |
430 | p->drawText( x, yPos, text() ); | 443 | p->drawText( x, yPos, text() ); |
431 | if ( mIncidence->cancelled() ) { | 444 | if ( mIncidence->cancelled() ) { |
432 | int wid = fm.width( text() ); | 445 | int wid = fm.width( text() ); |
433 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 446 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
434 | } | 447 | } |
435 | } else { | 448 | } else { |
436 | QString pText = text(); | 449 | QString pText = text(); |
437 | if( pText.mid(2,1) == ":" ) | 450 | if( pText.mid(2,1) == ":" ) |
438 | pText = pText.mid( 6 ); | 451 | pText = pText.mid( 6 ); |
439 | p->drawText( x, yPos, pText ); | 452 | p->drawText( x, yPos, pText ); |
440 | if ( mIncidence->cancelled() ) { | 453 | if ( mIncidence->cancelled() ) { |
441 | int wid = fm.width( pText ); | 454 | int wid = fm.width( pText ); |
442 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 455 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
443 | } | 456 | } |
444 | } | 457 | } |
445 | } | 458 | } |
446 | 459 | ||
447 | int MonthViewItem::height(const QListBox *lb) const | 460 | int MonthViewItem::height(const QListBox *lb) const |
448 | { | 461 | { |
449 | int ret = 10; | 462 | int ret = 10; |
450 | if ( lb ) | 463 | if ( lb ) |
451 | ret = lb->fontMetrics().lineSpacing()+1; | 464 | ret = lb->fontMetrics().lineSpacing()+1; |
452 | return ret; | 465 | return ret; |
453 | } | 466 | } |
454 | 467 | ||
455 | int MonthViewItem::width(const QListBox *lb) const | 468 | int MonthViewItem::width(const QListBox *lb) const |
456 | { | 469 | { |
457 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { | 470 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { |
458 | int size = PIXMAP_SIZE; | 471 | int size = PIXMAP_SIZE; |
459 | if ( QApplication::desktop()->width() < 300 ) | 472 | if ( QApplication::desktop()->width() < 300 ) |
460 | size = 3; | 473 | size = 3; |
461 | int x = 1; | 474 | int x = 1; |
462 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 475 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
463 | if ( mInfo ) { | 476 | if ( mInfo ) { |
464 | x += size + 1; | 477 | x += size + 1; |
465 | } | 478 | } |
466 | if( mRecur ) { | 479 | if( mRecur ) { |
467 | x += size+1; | 480 | x += size+1; |
468 | } | 481 | } |
469 | if( mAlarm ) { | 482 | if( mAlarm ) { |
470 | x += size+1; | 483 | x += size+1; |
471 | } | 484 | } |
472 | if( mReply ) { | 485 | if( mReply ) { |
473 | x += size+1; | 486 | x += size+1; |
474 | } | 487 | } |
475 | } | 488 | } |
476 | if( mMultiday ) { | 489 | if( mMultiday ) { |
477 | x += size+1+2+size/2; | 490 | x += size+1+2+size/2; |
478 | } | 491 | } |
479 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 492 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
480 | } | 493 | } |
481 | if ( ! lb ) | 494 | if ( ! lb ) |
482 | return 10; | 495 | return 10; |
483 | return lb->width(); | 496 | return lb->width(); |
484 | } | 497 | } |
485 | 498 | ||
486 | 499 | ||
487 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 500 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
488 | : KNoScrollListBox( par ), | 501 | : KNoScrollListBox( par ), |
489 | mMonthView( parent ) | 502 | mMonthView( parent ) |
490 | { | 503 | { |
491 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); | 504 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); |
492 | currentPalette = 0; | 505 | currentPalette = 0; |
493 | // mLabel = new QLabel( this );QPushButton | 506 | // mLabel = new QLabel( this );QPushButton |
494 | mLabel = new QPushButton( this ); | 507 | mLabel = new QPushButton( this ); |
495 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 508 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
496 | //mLabel->setLineWidth( 1 ); | 509 | //mLabel->setLineWidth( 1 ); |
497 | //mLabel->setAlignment( AlignCenter ); | 510 | //mLabel->setAlignment( AlignCenter ); |
498 | mLabel->setFlat( true ); | 511 | mLabel->setFlat( true ); |
499 | mLabel->setFocusPolicy(NoFocus); | 512 | mLabel->setFocusPolicy(NoFocus); |
500 | //mItemList = new KNoScrollListBox( this ); | 513 | //mItemList = new KNoScrollListBox( this ); |
501 | setMinimumSize( 10, 10 ); | 514 | setMinimumSize( 10, 10 ); |
502 | setFrameStyle( QFrame::Panel | QFrame::Plain ); | 515 | setFrameStyle( QFrame::Panel | QFrame::Plain ); |
503 | setLineWidth( 1 ); | 516 | setLineWidth( 1 ); |
504 | //topLayout->addWidget( mItemList ); | 517 | //topLayout->addWidget( mItemList ); |
505 | mLabel->raise(); | 518 | mLabel->raise(); |
506 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 519 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
507 | mStandardPalette = palette(); | 520 | mStandardPalette = palette(); |
508 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 521 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
509 | 522 | ||
510 | enableScrollBars( false ); | 523 | enableScrollBars( false ); |
511 | updateConfig(); | 524 | updateConfig(); |
512 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 525 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
513 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 526 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
514 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), | 527 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), |
515 | SLOT( defaultAction( QListBoxItem * ) ) ); | 528 | SLOT( defaultAction( QListBoxItem * ) ) ); |
516 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, | 529 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, |
517 | const QPoint &) ), | 530 | const QPoint &) ), |
518 | SLOT( contextMenu( QListBoxItem * ) ) ); | 531 | SLOT( contextMenu( QListBoxItem * ) ) ); |
519 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), | 532 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), |
520 | SLOT( selection( QListBoxItem * ) ) ); | 533 | SLOT( selection( QListBoxItem * ) ) ); |
521 | 534 | ||
522 | /* | 535 | /* |
523 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 536 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
524 | SLOT( selection( QListBoxItem * ) ) ); | 537 | SLOT( selection( QListBoxItem * ) ) ); |
525 | */ | 538 | */ |
526 | } | 539 | } |
527 | #ifdef DESKTOP_VERSION | 540 | #ifdef DESKTOP_VERSION |
528 | QToolTipGroup *MonthViewCell::toolTipGroup() | 541 | QToolTipGroup *MonthViewCell::toolTipGroup() |
529 | { | 542 | { |
530 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 543 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
531 | return mToolTipGroup; | 544 | return mToolTipGroup; |
532 | } | 545 | } |
533 | #endif | 546 | #endif |
534 | 547 | ||
535 | void MonthViewCell::setDate( const QDate &date ) | 548 | void MonthViewCell::setDate( const QDate &date ) |
536 | { | 549 | { |
537 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 550 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
538 | mDate = date; | 551 | mDate = date; |
539 | 552 | ||
540 | 553 | ||
541 | 554 | ||
542 | //resizeEvent( 0 ); | 555 | //resizeEvent( 0 ); |
543 | } | 556 | } |
544 | 557 | ||
545 | QDate MonthViewCell::date() const | 558 | QDate MonthViewCell::date() const |
546 | { | 559 | { |
547 | return mDate; | 560 | return mDate; |
548 | } | 561 | } |
549 | 562 | ||
550 | void MonthViewCell::setPrimary( bool primary ) | 563 | void MonthViewCell::setPrimary( bool primary ) |
551 | { | 564 | { |
552 | mPrimary = primary; | 565 | mPrimary = primary; |
553 | //setMyPalette(); | 566 | //setMyPalette(); |
554 | } | 567 | } |
555 | void MonthViewCell::setMyPalette() | 568 | void MonthViewCell::setMyPalette() |
556 | { | 569 | { |
557 | 570 | ||
558 | if ( mHoliday) { | 571 | if ( mHoliday) { |
559 | if ( currentPalette == 1 ) return; | 572 | if ( currentPalette == 1 ) return; |
560 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 573 | mLabel->setPalette( QPalette ( mHolidayPalette.color( QPalette::Normal,QColorGroup::Base),mHolidayPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
561 | setPalette( mHolidayPalette ); | 574 | setPalette( mHolidayPalette ); |
562 | //mLabel->setPalette( mHolidayPalette ); | 575 | //mLabel->setPalette( mHolidayPalette ); |
563 | currentPalette = 1; | 576 | currentPalette = 1; |
564 | 577 | ||
565 | } else { | 578 | } else { |
566 | if ( mPrimary ) { | 579 | if ( mPrimary ) { |
567 | if ( currentPalette == 2 ) return; | 580 | if ( currentPalette == 2 ) return; |
568 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 581 | mLabel->setPalette( QPalette ( mPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
569 | //mLabel->setPalette( mPrimaryPalette ); | 582 | //mLabel->setPalette( mPrimaryPalette ); |
570 | setPalette( mPrimaryPalette ); | 583 | setPalette( mPrimaryPalette ); |
571 | currentPalette = 2; | 584 | currentPalette = 2; |
572 | 585 | ||
573 | } else { | 586 | } else { |
574 | if ( currentPalette == 3 ) return; | 587 | if ( currentPalette == 3 ) return; |
575 | setPalette( mNonPrimaryPalette ); | 588 | setPalette( mNonPrimaryPalette ); |
576 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); | 589 | mLabel->setPalette( QPalette ( mNonPrimaryPalette.color( QPalette::Normal,QColorGroup::Base),mNonPrimaryPalette.color(QPalette::Normal,QColorGroup::Base ) )); |
577 | //mLabel->setPalette( mNonPrimaryPalette );; | 590 | //mLabel->setPalette( mNonPrimaryPalette );; |
578 | currentPalette = 3; | 591 | currentPalette = 3; |
579 | } | 592 | } |
580 | } | 593 | } |
581 | //QPalette pal = palette(); | 594 | //QPalette pal = palette(); |
582 | 595 | ||
583 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); | 596 | //mLabel->setPalette( QPalette ( pal.color( QPalette::Normal,QColorGroup::Base),pal.color(QPalette::Normal,QColorGroup::Base ) )); |
584 | } | 597 | } |
585 | QPalette MonthViewCell::getPalette () | 598 | QPalette MonthViewCell::getPalette () |
586 | { | 599 | { |
587 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) | 600 | if ( !KOPrefs::instance()->mMonthViewUsesDayColors ) |
588 | return mStandardPalette; | 601 | return mStandardPalette; |
589 | if ( mHoliday) { | 602 | if ( mHoliday) { |
590 | return mHolidayPalette ; | 603 | return mHolidayPalette ; |
591 | } else { | 604 | } else { |
592 | if ( mPrimary ) { | 605 | if ( mPrimary ) { |
593 | return mPrimaryPalette ; | 606 | return mPrimaryPalette ; |
594 | } | 607 | } |
595 | } | 608 | } |
596 | return mNonPrimaryPalette; | 609 | return mNonPrimaryPalette; |
597 | } | 610 | } |
598 | bool MonthViewCell::isPrimary() const | 611 | bool MonthViewCell::isPrimary() const |
599 | { | 612 | { |
600 | return mPrimary; | 613 | return mPrimary; |
601 | } | 614 | } |
602 | 615 | ||
603 | void MonthViewCell::setHoliday( bool holiday ) | 616 | void MonthViewCell::setHoliday( bool holiday ) |
604 | { | 617 | { |
605 | mHoliday = holiday; | 618 | mHoliday = holiday; |
606 | //setMyPalette(); | 619 | //setMyPalette(); |
607 | } | 620 | } |
608 | 621 | ||
609 | void MonthViewCell::setHoliday( const QString &holiday ) | 622 | void MonthViewCell::setHoliday( const QString &holiday ) |
610 | { | 623 | { |
611 | mHolidayString = holiday; | 624 | mHolidayString = holiday; |
612 | 625 | ||
613 | if ( !holiday.isEmpty() ) { | 626 | if ( !holiday.isEmpty() ) { |
614 | setHoliday( true ); | 627 | setHoliday( true ); |
615 | } | 628 | } |
616 | } | 629 | } |
617 | 630 | ||
618 | void MonthViewCell::startUpdateCell() | 631 | void MonthViewCell::startUpdateCell() |
619 | { | 632 | { |
620 | 633 | blockSignals( true ); | |
621 | mdayCount = 0; | 634 | mdayCount = 0; |
622 | setFocusPolicy(NoFocus); | 635 | setFocusPolicy(NoFocus); |
623 | if ( !mMonthView->isUpdatePossible() ) | 636 | if ( !mMonthView->isUpdatePossible() ) |
624 | return; | 637 | return; |
625 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 638 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
626 | while ( mitem ) { | 639 | while ( mitem ) { |
627 | mitem->setBlockRepaint( true ); | 640 | mitem->setBlockRepaint( true ); |
628 | mitem = (MonthViewItem *)mitem->next(); | 641 | mitem = (MonthViewItem *)mitem->next(); |
629 | } | 642 | } |
630 | if ( mAvailItemList.count() > 20 ) { | 643 | if ( mAvailItemList.count() > 20 ) { |
631 | mAvailItemList.setAutoDelete( true ); | 644 | mAvailItemList.setAutoDelete( true ); |
632 | mAvailItemList.clear(); | 645 | mAvailItemList.clear(); |
633 | mAvailItemList.setAutoDelete( false ); | 646 | mAvailItemList.setAutoDelete( false ); |
634 | clear(); | 647 | clear(); |
635 | } | 648 | } |
636 | 649 | ||
637 | setPrimary( mDate.month()%2 ); | 650 | setPrimary( mDate.month()%2 ); |
638 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 651 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
639 | if ( mDate == QDate::currentDate() ) { | 652 | if ( mDate == QDate::currentDate() ) { |
640 | setLineWidth( 3 ); | 653 | setLineWidth( 3 ); |
641 | } else { | 654 | } else { |
642 | setLineWidth( 1 ); | 655 | setLineWidth( 1 ); |
643 | } | 656 | } |
644 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); | 657 | MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem (); |
645 | //clear(); | 658 | //clear(); |
646 | while ( CurrentAvailItem ) { | 659 | while ( CurrentAvailItem ) { |
647 | MonthViewItem *item = CurrentAvailItem; | 660 | MonthViewItem *item = CurrentAvailItem; |
648 | //item->setHighlightedFalse(); | 661 | //item->setHighlightedFalse(); |
649 | item->recycle( 0, ""); | 662 | item->recycle( 0, ""); |
650 | CurrentAvailItem = (MonthViewItem *)item->next(); | 663 | CurrentAvailItem = (MonthViewItem *)item->next(); |
651 | mAvailItemList.append( item ); | 664 | mAvailItemList.append( item ); |
652 | takeItem ( item ); | 665 | takeItem ( item ); |
653 | } | 666 | } |
654 | 667 | ||
655 | #ifdef DESKTOP_VERSION | 668 | #ifdef DESKTOP_VERSION |
656 | QToolTip::remove(this); | 669 | QToolTip::remove(this); |
657 | #endif | 670 | #endif |
658 | mToolTip.clear(); | 671 | mToolTip.clear(); |
659 | //qApp->processEvents(); | 672 | //qApp->processEvents(); |
660 | #if 0 | 673 | #if 0 |
661 | if ( !mHolidayString.isEmpty() ) { | 674 | if ( !mHolidayString.isEmpty() ) { |
662 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 675 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
663 | item->setPalette( mHolidayPalette ); | 676 | item->setPalette( mHolidayPalette ); |
664 | insertItem( item ); | 677 | insertItem( item ); |
665 | mToolTip.append ( mHolidayString ); | 678 | mToolTip.append ( mHolidayString ); |
666 | } | 679 | } |
667 | #endif | 680 | #endif |
668 | } | 681 | } |
669 | 682 | ||
670 | int MonthViewCell::insertEvent(Event *event) | 683 | int MonthViewCell::insertEvent(Event *event) |
671 | { | 684 | { |
672 | bool useToolTips = true; | 685 | bool useToolTips = true; |
673 | #ifndef DESKTOP_VERSION | 686 | #ifndef DESKTOP_VERSION |
674 | useToolTips = false; | 687 | useToolTips = false; |
675 | #endif | 688 | #endif |
676 | QString mToolTipText; | 689 | QString mToolTipText; |
677 | setFocusPolicy(WheelFocus); | 690 | setFocusPolicy(WheelFocus); |
678 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 691 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
679 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 692 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
680 | return mdayCount; | 693 | return mdayCount; |
681 | else | 694 | else |
682 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 695 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
683 | return mdayCount; | 696 | return mdayCount; |
684 | } | 697 | } |
685 | 698 | ||
686 | if ( event->isHoliday()) { | 699 | if ( event->isHoliday()) { |
687 | setHoliday( true ); | 700 | setHoliday( true ); |
688 | if ( mDate.dayOfWeek() == 7 ) | 701 | if ( mDate.dayOfWeek() == 7 ) |
689 | setLineWidth( 3 ); | 702 | setLineWidth( 3 ); |
690 | } | 703 | } |
691 | QString text; | 704 | QString text; |
692 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 705 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
693 | if (event->isMultiDay()) { | 706 | if (event->isMultiDay()) { |
694 | QString prefix = "<->";multiday = 2; | 707 | QString prefix = "<->";multiday = 2; |
695 | QString time; | 708 | QString time; |
696 | if ( event->doesRecur() ) { | 709 | if ( event->doesRecur() ) { |
697 | if ( event->recursOn( mDate) ) { | 710 | if ( event->recursOn( mDate) ) { |
698 | prefix ="->" ;multiday = 1; | 711 | prefix ="->" ;multiday = 1; |
699 | } | 712 | } |
700 | else { | 713 | else { |
701 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 714 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
702 | if ( event->recursOn( mDate.addDays( -days)) ) { | 715 | if ( event->recursOn( mDate.addDays( -days)) ) { |
703 | prefix ="<-" ;multiday = 3; | 716 | prefix ="<-" ;multiday = 3; |
704 | } | 717 | } |
705 | } | 718 | } |
706 | 719 | ||
707 | } else { | 720 | } else { |
708 | if (mDate == event->dtStart().date()) { | 721 | if (mDate == event->dtStart().date()) { |
709 | prefix ="->" ;multiday = 1; | 722 | prefix ="->" ;multiday = 1; |
710 | } else if (mDate == event->dtEnd().date()) { | 723 | } else if (mDate == event->dtEnd().date()) { |
711 | prefix ="<-" ;multiday = 3; | 724 | prefix ="<-" ;multiday = 3; |
712 | } | 725 | } |
713 | } | 726 | } |
714 | if ( !event->doesFloat() ) { | 727 | if ( !event->doesFloat() ) { |
715 | if ( mDate == event->dtStart().date () ) | 728 | if ( mDate == event->dtStart().date () ) |
716 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 729 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
@@ -788,346 +801,346 @@ int MonthViewCell::insertEvent(Event *event) | |||
788 | } else | 801 | } else |
789 | item->setReply(false); | 802 | item->setReply(false); |
790 | #endif | 803 | #endif |
791 | 804 | ||
792 | item->setMultiDay( multiday ); | 805 | item->setMultiDay( multiday ); |
793 | if ( multiday ) { | 806 | if ( multiday ) { |
794 | insertItem( item ,mdayCount); | 807 | insertItem( item ,mdayCount); |
795 | ++mdayCount; | 808 | ++mdayCount; |
796 | } else { | 809 | } else { |
797 | uint i = mdayCount; | 810 | uint i = mdayCount; |
798 | uint pos = mdayCount; | 811 | uint pos = mdayCount; |
799 | uint itcount = count(); | 812 | uint itcount = count(); |
800 | if ( itcount > 1000 ) { | 813 | if ( itcount > 1000 ) { |
801 | qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); | 814 | qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); |
802 | itcount = 0; | 815 | itcount = 0; |
803 | } | 816 | } |
804 | for ( i = pos; i < itcount;++i ) { | 817 | for ( i = pos; i < itcount;++i ) { |
805 | // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); | 818 | // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); |
806 | QListBoxItem* it = this->item ( i ); | 819 | QListBoxItem* it = this->item ( i ); |
807 | if ( it && text < it->text() ) { | 820 | if ( it && text < it->text() ) { |
808 | pos = i; | 821 | pos = i; |
809 | break; | 822 | break; |
810 | } | 823 | } |
811 | ++pos; | 824 | ++pos; |
812 | } | 825 | } |
813 | insertItem( item ,pos); | 826 | insertItem( item ,pos); |
814 | } | 827 | } |
815 | if ( useToolTips ) { | 828 | if ( useToolTips ) { |
816 | mToolTip.append( mToolTipText ); | 829 | mToolTip.append( mToolTipText ); |
817 | } | 830 | } |
818 | return mdayCount; | 831 | return mdayCount; |
819 | } | 832 | } |
820 | void MonthViewCell::insertTodo(Todo *todo) | 833 | void MonthViewCell::insertTodo(Todo *todo) |
821 | { | 834 | { |
822 | setFocusPolicy(WheelFocus); | 835 | setFocusPolicy(WheelFocus); |
823 | QString text; | 836 | QString text; |
824 | if (todo->hasDueDate()) { | 837 | if (todo->hasDueDate()) { |
825 | if (!todo->doesFloat()) { | 838 | if (!todo->doesFloat()) { |
826 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 839 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
827 | text += " "; | 840 | text += " "; |
828 | } | 841 | } |
829 | } | 842 | } |
830 | text += todo->summary(); | 843 | text += todo->summary(); |
831 | MonthViewItem *item ; | 844 | MonthViewItem *item ; |
832 | if ( mAvailItemList.count() ) { | 845 | if ( mAvailItemList.count() ) { |
833 | item = mAvailItemList.first(); | 846 | item = mAvailItemList.first(); |
834 | mAvailItemList.remove( item ); | 847 | mAvailItemList.remove( item ); |
835 | item->recycle( todo, text ); | 848 | item->recycle( todo, text ); |
836 | } else { | 849 | } else { |
837 | item = new MonthViewItem( todo, text ); | 850 | item = new MonthViewItem( todo, text ); |
838 | } | 851 | } |
839 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 852 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
840 | //item->setPalette( mStandardPalette ); | 853 | //item->setPalette( mStandardPalette ); |
841 | QPalette pal; | 854 | QPalette pal; |
842 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 855 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
843 | QStringList categories = todo->categories(); | 856 | QStringList categories = todo->categories(); |
844 | QString cat = categories.first(); | 857 | QString cat = categories.first(); |
845 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 858 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
846 | pal = getPalette(); | 859 | pal = getPalette(); |
847 | if (cat.isEmpty()) { | 860 | if (cat.isEmpty()) { |
848 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 861 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
849 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); | 862 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); |
850 | } else { | 863 | } else { |
851 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 864 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
852 | } | 865 | } |
853 | 866 | ||
854 | } else { | 867 | } else { |
855 | if (cat.isEmpty()) { | 868 | if (cat.isEmpty()) { |
856 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 869 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
857 | pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); | 870 | pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); |
858 | } else { | 871 | } else { |
859 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 872 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
860 | } | 873 | } |
861 | } | 874 | } |
862 | 875 | ||
863 | } else { | 876 | } else { |
864 | pal = mStandardPalette ; | 877 | pal = mStandardPalette ; |
865 | } | 878 | } |
866 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); | 879 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); |
867 | item->setPalette( pal ); | 880 | item->setPalette( pal ); |
868 | item->setRecur( todo->recurrence()->doesRecur() ); | 881 | item->setRecur( todo->recurrence()->doesRecur() ); |
869 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); | 882 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); |
870 | item->setMoreInfo( todo->description().length() > 0 ); | 883 | item->setMoreInfo( todo->description().length() > 0 ); |
871 | insertItem( item , count()); | 884 | insertItem( item , count()); |
872 | #ifdef DESKTOP_VERSION | 885 | #ifdef DESKTOP_VERSION |
873 | mToolTip.append( text ); | 886 | mToolTip.append( text ); |
874 | #endif | 887 | #endif |
875 | } | 888 | } |
876 | void MonthViewCell::repaintfinishUpdateCell() | 889 | void MonthViewCell::repaintfinishUpdateCell() |
877 | { | 890 | { |
878 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 891 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
879 | while ( mitem ) { | 892 | while ( mitem ) { |
880 | mitem->setBlockRepaint( false ); | 893 | mitem->setBlockRepaint( false ); |
881 | updateItem ( mitem ); | 894 | updateItem ( mitem ); |
882 | mitem = (MonthViewItem *)mitem->next(); | 895 | mitem = (MonthViewItem *)mitem->next(); |
883 | } | 896 | } |
897 | blockSignals( false ); | ||
884 | } | 898 | } |
885 | void MonthViewCell::finishUpdateCell() | 899 | void MonthViewCell::finishUpdateCell() |
886 | { | 900 | { |
887 | 901 | ||
888 | 902 | ||
889 | 903 | ||
890 | #ifdef DESKTOP_VERSION | 904 | #ifdef DESKTOP_VERSION |
891 | if (mToolTip.count() > 0 ) { | 905 | if (mToolTip.count() > 0 ) { |
892 | mToolTip.sort(); | 906 | mToolTip.sort(); |
893 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 907 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
894 | } | 908 | } |
895 | #endif | 909 | #endif |
896 | //sort(); | 910 | //sort(); |
897 | //setMyPalette(); | 911 | //setMyPalette(); |
898 | setMyPalette(); | 912 | setMyPalette(); |
899 | 913 | ||
900 | resizeEvent( 0 ); | 914 | resizeEvent( 0 ); |
901 | 915 | ||
902 | } | 916 | } |
903 | void MonthViewCell::updateCell() | 917 | void MonthViewCell::updateCell() |
904 | { | 918 | { |
905 | if ( !mMonthView->isUpdatePossible() ) | 919 | if ( !mMonthView->isUpdatePossible() ) |
906 | return; | 920 | return; |
907 | startUpdateCell(); | 921 | startUpdateCell(); |
908 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 922 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
909 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 923 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
910 | Event *event; | 924 | Event *event; |
911 | for( event = events.first(); event; event = events.next() ) { // for event | 925 | for( event = events.first(); event; event = events.next() ) { // for event |
912 | insertEvent(event); | 926 | insertEvent(event); |
913 | } | 927 | } |
914 | // insert due todos | 928 | // insert due todos |
915 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 929 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
916 | Todo *todo; | 930 | Todo *todo; |
917 | for(todo = todos.first(); todo; todo = todos.next()) { | 931 | for(todo = todos.first(); todo; todo = todos.next()) { |
918 | insertTodo( todo ); | 932 | insertTodo( todo ); |
919 | } | 933 | } |
920 | finishUpdateCell(); | 934 | finishUpdateCell(); |
921 | // if ( isVisible()) | 935 | // if ( isVisible()) |
922 | //qApp->processEvents(); | 936 | //qApp->processEvents(); |
923 | } | 937 | } |
924 | 938 | ||
925 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 939 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
926 | { | 940 | { |
927 | 941 | ||
928 | if ( bigFont ) { | 942 | if ( bigFont ) { |
929 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 943 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
930 | int ps = fo.pointSize() + 2; | 944 | int ps = fo.pointSize() + 2; |
931 | if ( ps < 18 ) | 945 | if ( ps < 18 ) |
932 | ps += 2; | 946 | ps += 2; |
933 | fo.setPointSize( ps ); | 947 | fo.setPointSize( ps ); |
934 | setFont( fo ); | 948 | setFont( fo ); |
935 | } else | 949 | } else |
936 | setFont( KOPrefs::instance()->mMonthViewFont ); | 950 | setFont( KOPrefs::instance()->mMonthViewFont ); |
937 | 951 | ||
938 | QFontMetrics fm( font() ); | 952 | QFontMetrics fm( font() ); |
939 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); | 953 | mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); |
940 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); | 954 | mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); |
941 | mHolidayPalette = mStandardPalette; | 955 | mHolidayPalette = mStandardPalette; |
942 | mPrimaryPalette = mStandardPalette; | 956 | mPrimaryPalette = mStandardPalette; |
943 | mNonPrimaryPalette = mStandardPalette; | 957 | mNonPrimaryPalette = mStandardPalette; |
944 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { | 958 | if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { |
945 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); | 959 | mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); |
946 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); | 960 | mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); |
947 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); | 961 | mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); |
948 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); | 962 | mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); |
949 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); | 963 | mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); |
950 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); | 964 | mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); |
951 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); | 965 | mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); |
952 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); | 966 | mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); |
953 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); | 967 | mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); |
954 | } | 968 | } |
955 | //updateCell(); | 969 | //updateCell(); |
956 | } | 970 | } |
957 | 971 | ||
958 | void MonthViewCell::enableScrollBars( bool enabled ) | 972 | void MonthViewCell::enableScrollBars( bool enabled ) |
959 | { | 973 | { |
960 | 974 | ||
961 | return; | 975 | return; |
962 | if ( enabled ) { | 976 | if ( enabled ) { |
963 | QListBoxItem *fi = firstItem (); | 977 | QListBoxItem *fi = firstItem (); |
964 | if (fi ) { | 978 | if (fi ) { |
965 | int ihei = fi->height( this ); | 979 | int ihei = fi->height( this ); |
966 | int hei = numRows () * ihei; | 980 | int hei = numRows () * ihei; |
967 | if ( hei < height() - horizontalScrollBar()->height () ) { | 981 | if ( hei < height() - horizontalScrollBar()->height () ) { |
968 | setVScrollBarMode(QScrollView::AlwaysOff); | 982 | setVScrollBarMode(QScrollView::AlwaysOff); |
969 | } | 983 | } |
970 | else | 984 | else |
971 | setVScrollBarMode(QScrollView::Auto); | 985 | setVScrollBarMode(QScrollView::Auto); |
972 | if ( ihei *3 > height() ) { | 986 | if ( ihei *3 > height() ) { |
973 | setHScrollBarMode(QScrollView::AlwaysOff); | 987 | setHScrollBarMode(QScrollView::AlwaysOff); |
974 | } | 988 | } |
975 | else { | 989 | else { |
976 | setHScrollBarMode(QScrollView::Auto); | 990 | setHScrollBarMode(QScrollView::Auto); |
977 | } | 991 | } |
978 | } else { | 992 | } else { |
979 | setVScrollBarMode(QScrollView::Auto); | 993 | setVScrollBarMode(QScrollView::Auto); |
980 | setHScrollBarMode(QScrollView::Auto); | 994 | setHScrollBarMode(QScrollView::Auto); |
981 | } | 995 | } |
982 | } else { | 996 | } else { |
983 | setVScrollBarMode(QScrollView::AlwaysOff); | 997 | setVScrollBarMode(QScrollView::AlwaysOff); |
984 | setHScrollBarMode(QScrollView::AlwaysOff); | 998 | setHScrollBarMode(QScrollView::AlwaysOff); |
985 | } | 999 | } |
986 | } | 1000 | } |
987 | 1001 | ||
988 | Incidence *MonthViewCell::selectedIncidence() | 1002 | Incidence *MonthViewCell::selectedIncidence() |
989 | { | 1003 | { |
990 | int index = currentItem(); | 1004 | int index = currentItem(); |
991 | if ( index < 0 ) return 0; | 1005 | if ( index < 0 ) return 0; |
992 | 1006 | ||
993 | MonthViewItem *mitem = | 1007 | MonthViewItem *mitem = |
994 | static_cast<MonthViewItem *>( item( index ) ); | 1008 | static_cast<MonthViewItem *>( item( index ) ); |
995 | 1009 | ||
996 | if ( !mitem ) return 0; | 1010 | if ( !mitem ) return 0; |
997 | 1011 | ||
998 | return mitem->incidence(); | 1012 | return mitem->incidence(); |
999 | } | 1013 | } |
1000 | 1014 | ||
1001 | QDate MonthViewCell::selectedIncidenceDate() | 1015 | QDate MonthViewCell::selectedIncidenceDate() |
1002 | { | 1016 | { |
1003 | QDate qd; | 1017 | QDate qd; |
1004 | int index = currentItem(); | 1018 | int index = currentItem(); |
1005 | if ( index < 0 ) return qd; | 1019 | if ( index < 0 ) return qd; |
1006 | return mDate; | 1020 | return mDate; |
1007 | } | 1021 | } |
1008 | 1022 | ||
1009 | void MonthViewCell::deselect() | 1023 | void MonthViewCell::deselect() |
1010 | { | 1024 | { |
1011 | clearSelection(); | 1025 | clearSelection(); |
1012 | enableScrollBars( false ); | 1026 | enableScrollBars( false ); |
1013 | // updateCell(); | 1027 | // updateCell(); |
1014 | } | 1028 | } |
1015 | void MonthViewCell::select() | 1029 | void MonthViewCell::select() |
1016 | { | 1030 | { |
1017 | ;// updateCell(); | 1031 | ;// updateCell(); |
1018 | } | 1032 | } |
1019 | 1033 | ||
1020 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) | 1034 | void MonthViewCell::resizeEvent ( QResizeEvent * e ) |
1021 | { | 1035 | { |
1022 | if ( !mMonthView->isUpdatePossible() ) | 1036 | if ( !mMonthView->isUpdatePossible() ) |
1023 | return; | 1037 | return; |
1024 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); | 1038 | //qDebug("++++++++++++++MonthViewCell::resizeEvent %d %d ", width(), height()); |
1025 | deselect(); | 1039 | deselect(); |
1026 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); | 1040 | mLabel->setMaximumHeight( height() - lineWidth()*2 ); |
1027 | 1041 | ||
1028 | QString text; | 1042 | QString text; |
1029 | mLabel->setText( text ); | 1043 | //mLabel->setText( text ); |
1030 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 1044 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
1031 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 1045 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
1032 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; | 1046 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); |
1033 | mLabel->resize( mLabelBigSize ); | 1047 | mLabel->resize( mLabelBigSize ); |
1034 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | ||
1035 | } else { | 1048 | } else { |
1036 | mLabel->resize( mLabelSize ); | 1049 | mLabel->resize( mLabelSize ); |
1037 | text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); | 1050 | text = QString::number( mDate.day() ); |
1038 | } | 1051 | } |
1039 | mLabel->setText( text ); | 1052 | mLabel->setText( text ); |
1040 | 1053 | ||
1041 | int size = height() - mLabel->height() - lineWidth()-1; | 1054 | int size = height() - mLabel->height() - lineWidth()-1; |
1042 | //qDebug("LW %d ", lineWidth()); | 1055 | //qDebug("LW %d ", lineWidth()); |
1043 | if ( size > 0 ) | 1056 | if ( size > 0 ) |
1044 | verticalScrollBar()->setMaximumHeight( size ); | 1057 | verticalScrollBar()->setMaximumHeight( size ); |
1045 | size = width() - mLabel->width() -lineWidth()-1; | 1058 | size = width() - mLabel->width() -lineWidth()-1; |
1046 | if ( size > 0 ) | 1059 | if ( size > 0 ) |
1047 | horizontalScrollBar()->setMaximumWidth( size ); | 1060 | horizontalScrollBar()->setMaximumWidth( size ); |
1048 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); | 1061 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
1049 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 1062 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
1050 | // mItemList->resize ( width(), height () ); | 1063 | // mItemList->resize ( width(), height () ); |
1051 | if ( e ) | 1064 | if ( e ) |
1052 | KNoScrollListBox::resizeEvent ( e ); | 1065 | KNoScrollListBox::resizeEvent ( e ); |
1053 | } | 1066 | } |
1054 | 1067 | ||
1055 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 1068 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
1056 | { | 1069 | { |
1057 | 1070 | ||
1058 | if ( !item ) { | 1071 | if ( !item ) { |
1059 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1072 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1060 | emit newEventSignal( dt ); | 1073 | emit newEventSignal( dt ); |
1061 | return; | 1074 | return; |
1062 | } | 1075 | } |
1063 | 1076 | ||
1064 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1077 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1065 | Incidence *incidence = eventItem->incidence(); | 1078 | Incidence *incidence = eventItem->incidence(); |
1066 | if ( incidence ) mMonthView->defaultAction( incidence ); | 1079 | if ( incidence ) mMonthView->defaultAction( incidence ); |
1067 | } | 1080 | } |
1068 | void MonthViewCell::showDay() | 1081 | void MonthViewCell::showDay() |
1069 | { | 1082 | { |
1070 | emit showDaySignal( date() ); | 1083 | emit showDaySignal( date() ); |
1071 | } | 1084 | } |
1072 | void MonthViewCell::newEvent() | 1085 | void MonthViewCell::newEvent() |
1073 | { | 1086 | { |
1074 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1087 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1075 | emit newEventSignal( dt ); | 1088 | emit newEventSignal( dt ); |
1076 | } | 1089 | } |
1077 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 1090 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
1078 | { | 1091 | { |
1079 | mMonthView->setSelectedCell( this ); | 1092 | mMonthView->setSelectedCell( this ); |
1080 | if ( item == 0 ) { | 1093 | if ( item == 0 ) { |
1081 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1094 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1082 | emit newEventSignal( dt ); | 1095 | emit newEventSignal( dt ); |
1083 | return; | 1096 | return; |
1084 | } | 1097 | } |
1085 | 1098 | ||
1086 | } | 1099 | } |
1087 | 1100 | ||
1088 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 1101 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
1089 | { | 1102 | { |
1090 | mMonthView->setPopupCell( this ); | 1103 | mMonthView->setPopupCell( this ); |
1091 | if ( !item ) { | 1104 | if ( !item ) { |
1092 | mMonthView->showContextMenu( 0 ); | 1105 | mMonthView->showContextMenu( 0 ); |
1093 | return; | 1106 | return; |
1094 | } | 1107 | } |
1095 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1108 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1096 | Incidence *incidence = eventItem->incidence(); | 1109 | Incidence *incidence = eventItem->incidence(); |
1097 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 1110 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
1098 | } | 1111 | } |
1099 | 1112 | ||
1100 | void MonthViewCell::selection( QListBoxItem *item ) | 1113 | void MonthViewCell::selection( QListBoxItem *item ) |
1101 | { | 1114 | { |
1102 | if ( !item ) { | 1115 | if ( !item ) { |
1103 | emit highlightIncidence( 0 , this, 0 ); | 1116 | emit highlightIncidence( 0 , this, 0 ); |
1104 | return; | 1117 | return; |
1105 | } | 1118 | } |
1106 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); | 1119 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); |
1107 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); | 1120 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); |
1108 | mMonthView->setSelectedCell( this ); | 1121 | mMonthView->setSelectedCell( this ); |
1109 | } | 1122 | } |
1110 | 1123 | ||
1111 | void MonthViewCell::deHighLight() | 1124 | void MonthViewCell::deHighLight() |
1112 | { | 1125 | { |
1113 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1126 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1114 | while ( mitem ) { | 1127 | while ( mitem ) { |
1115 | if ( mitem->setHighlightedFalse() ) | 1128 | if ( mitem->setHighlightedFalse() ) |
1116 | updateItem ( mitem ); | 1129 | updateItem ( mitem ); |
1117 | mitem = (MonthViewItem *)mitem->next(); | 1130 | mitem = (MonthViewItem *)mitem->next(); |
1118 | } | 1131 | } |
1119 | } | 1132 | } |
1120 | // returns true if no inc found | 1133 | // returns true if no inc found |
1121 | bool MonthViewCell::doHighLight( Incidence * inc ) | 1134 | bool MonthViewCell::doHighLight( Incidence * inc ) |
1122 | { | 1135 | { |
1123 | 1136 | ||
1124 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1137 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1125 | while ( mitem ) { | 1138 | while ( mitem ) { |
1126 | if ( mitem->incidence() == inc ) { | 1139 | if ( mitem->incidence() == inc ) { |
1127 | if ( mitem->setHighlighted( inc ) ) | 1140 | if ( mitem->setHighlighted( inc ) ) |
1128 | updateItem ( mitem ); | 1141 | updateItem ( mitem ); |
1129 | return false; | 1142 | return false; |
1130 | } | 1143 | } |
1131 | mitem = (MonthViewItem *)mitem->next(); | 1144 | mitem = (MonthViewItem *)mitem->next(); |
1132 | } | 1145 | } |
1133 | return true; | 1146 | return true; |
@@ -1244,239 +1257,264 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | |||
1244 | connect( cell, SIGNAL( prevCell() ), | 1257 | connect( cell, SIGNAL( prevCell() ), |
1245 | SLOT( prevCell() ) ); | 1258 | SLOT( prevCell() ) ); |
1246 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), | 1259 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), |
1247 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); | 1260 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); |
1248 | } | 1261 | } |
1249 | } | 1262 | } |
1250 | mCellsW.resize( mDaysPerWeek ); | 1263 | mCellsW.resize( mDaysPerWeek ); |
1251 | for( col = 0; col < mDaysPerWeek; ++col ) { | 1264 | for( col = 0; col < mDaysPerWeek; ++col ) { |
1252 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); | 1265 | MonthViewCell *cell = new MonthViewCell( this, mWeekView ); |
1253 | mCellsW.insert( col, cell ); | 1266 | mCellsW.insert( col, cell ); |
1254 | 1267 | ||
1255 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), | 1268 | connect( cell, SIGNAL( defaultAction( Incidence * ) ), |
1256 | SLOT( defaultAction( Incidence * ) ) ); | 1269 | SLOT( defaultAction( Incidence * ) ) ); |
1257 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), | 1270 | connect( cell, SIGNAL( newEventSignal( QDateTime ) ), |
1258 | SIGNAL( newEventSignal( QDateTime ) ) ); | 1271 | SIGNAL( newEventSignal( QDateTime ) ) ); |
1259 | connect( cell, SIGNAL( showDaySignal( QDate ) ), | 1272 | connect( cell, SIGNAL( showDaySignal( QDate ) ), |
1260 | SIGNAL( showDaySignal( QDate ) ) ); | 1273 | SIGNAL( showDaySignal( QDate ) ) ); |
1261 | connect( cell, SIGNAL( nextCell() ), | 1274 | connect( cell, SIGNAL( nextCell() ), |
1262 | SLOT( nextCell() ) ); | 1275 | SLOT( nextCell() ) ); |
1263 | connect( cell, SIGNAL( prevCell() ), | 1276 | connect( cell, SIGNAL( prevCell() ), |
1264 | SLOT( prevCell() ) ); | 1277 | SLOT( prevCell() ) ); |
1265 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), | 1278 | connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), |
1266 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); | 1279 | SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); |
1267 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); | 1280 | cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); |
1268 | } | 1281 | } |
1269 | 1282 | ||
1270 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); | 1283 | //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); |
1271 | mContextMenu = eventPopup(); | 1284 | mContextMenu = eventPopup(); |
1272 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1285 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1273 | i18n("New Event..."),this, | 1286 | i18n("New Event..."),this, |
1274 | SLOT(slotNewEvent()),false); | 1287 | SLOT(slotNewEvent()),false); |
1275 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1288 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1276 | i18n("New Todo..."),this, | 1289 | i18n("New Todo..."),this, |
1277 | SLOT(slotNewTodo()),false); | 1290 | SLOT(slotNewTodo()),false); |
1278 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), | 1291 | mContextMenu->addAdditionalItem(QIconSet(QPixmap()), |
1279 | i18n("Journal"),this, | 1292 | i18n("Journal"),this, |
1280 | SLOT(slotEditJournal()),false); | 1293 | SLOT(slotEditJournal()),false); |
1281 | 1294 | ||
1282 | 1295 | ||
1283 | 1296 | ||
1284 | QString pathString = ""; | 1297 | QString pathString = ""; |
1285 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 1298 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
1286 | if ( QApplication::desktop()->width() < 480 ) | 1299 | if ( QApplication::desktop()->width() < 480 ) |
1287 | pathString += "icons16/"; | 1300 | pathString += "icons16/"; |
1288 | } else | 1301 | } else |
1289 | pathString += "iconsmini/"; | 1302 | pathString += "iconsmini/"; |
1290 | mNewItemMenu = new QPopupMenu( this ); | 1303 | mNewItemMenu = new QPopupMenu( this ); |
1291 | mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); | 1304 | mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); |
1292 | mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); | 1305 | mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); |
1293 | mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); | 1306 | mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); |
1294 | 1307 | ||
1295 | // updateConfig(); //useless here... | 1308 | // updateConfig(); //useless here... |
1296 | // ... but we need mWidthLongDayLabel computed | 1309 | // ... but we need mWidthLongDayLabel computed |
1297 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1310 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1298 | mWidthLongDayLabel = 0; | 1311 | mWidthLongDayLabel = 0; |
1299 | for (int i = 0; i < 7; i++) { | 1312 | for (int i = 0; i < 7; i++) { |
1300 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1313 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1301 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1314 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1302 | } | 1315 | } |
1303 | 1316 | ||
1304 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); | 1317 | //mWeekLabels[mNumWeeks]->setText( i18n("W")); |
1305 | 1318 | ||
1306 | #if 0 | 1319 | #if 0 |
1307 | if ( mShowWeekView ) | 1320 | if ( mShowWeekView ) |
1308 | mWidStack->raiseWidget( mWeekView ); | 1321 | mWidStack->raiseWidget( mWeekView ); |
1309 | else | 1322 | else |
1310 | mWidStack->raiseWidget( mMonthView ); | 1323 | mWidStack->raiseWidget( mMonthView ); |
1311 | #endif | 1324 | #endif |
1312 | 1325 | ||
1313 | emit incidenceSelected( 0 ); | 1326 | emit incidenceSelected( 0 ); |
1314 | 1327 | ||
1315 | mComputeLayoutTimer = new QTimer( this ); | 1328 | mComputeLayoutTimer = new QTimer( this ); |
1316 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); | 1329 | connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); |
1317 | 1330 | ||
1318 | 1331 | ||
1319 | #ifndef DESKTOP_VERSION | 1332 | #ifndef DESKTOP_VERSION |
1320 | resize( QApplication::desktop()->size() ); | 1333 | resize( QApplication::desktop()->size() ); |
1321 | #else | 1334 | #else |
1322 | resize(640, 480 ); | 1335 | resize(640, 480 ); |
1323 | updatePossible = true; | 1336 | updatePossible = true; |
1324 | #endif | 1337 | #endif |
1325 | computeLayout(); | 1338 | computeLayout(); |
1326 | 1339 | ||
1327 | if ( mShowWeekView ) | 1340 | if ( mShowWeekView ) |
1328 | mWidStack->raiseWidget( mWeekView ); | 1341 | mWidStack->raiseWidget( mWeekView ); |
1329 | else | 1342 | else |
1330 | mWidStack->raiseWidget( mMonthView ); | 1343 | mWidStack->raiseWidget( mMonthView ); |
1331 | } | 1344 | } |
1332 | 1345 | ||
1333 | KOMonthView::~KOMonthView() | 1346 | KOMonthView::~KOMonthView() |
1334 | { | 1347 | { |
1335 | delete mContextMenu; | 1348 | delete mContextMenu; |
1336 | } | 1349 | } |
1337 | 1350 | ||
1338 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) | 1351 | void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) |
1339 | { | 1352 | { |
1340 | qDebug("11 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | ||
1341 | static Incidence * lastInc = 0; | 1353 | static Incidence * lastInc = 0; |
1342 | static MonthViewCell * lastCell = 0; | 1354 | static MonthViewCell * lastCell = 0; |
1343 | 1355 | ||
1344 | if ( lastInc == inc && lastCell == mc ) | 1356 | if ( lastInc == inc && lastCell == mc ) |
1345 | return; | 1357 | return; |
1346 | lastInc = inc; | 1358 | lastInc = inc; |
1347 | lastCell = mc; | 1359 | lastCell = mc; |
1348 | qDebug("222 KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); | 1360 | //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); |
1349 | 1361 | ||
1350 | bool weekview = false; | 1362 | bool weekview = false; |
1351 | int index = 0; | 1363 | int index = 0; |
1352 | for (uint i = 0; i < mCellsW.count(); ++i) { | 1364 | for (uint i = 0; i < mCellsW.count(); ++i) { |
1353 | if ( mCellsW[i] == mc ) { | 1365 | if ( mCellsW[i] == mc ) { |
1354 | weekview = true; | 1366 | weekview = true; |
1355 | index = i; | 1367 | index = i; |
1356 | break; | 1368 | break; |
1357 | } | 1369 | } |
1358 | } | 1370 | } |
1359 | QPtrVector<MonthViewCell> *cells; | 1371 | QPtrVector<MonthViewCell> *cells; |
1360 | if ( weekview ) | 1372 | if ( weekview ) |
1361 | cells = &mCellsW; | 1373 | cells = &mCellsW; |
1362 | else { | 1374 | else { |
1363 | for (uint i = 0; i < mCells.count(); ++i) { | 1375 | for (uint i = 0; i < mCells.count(); ++i) { |
1364 | if ( mCells[i] == mc ) { | 1376 | if ( mCells[i] == mc ) { |
1365 | index = i; | 1377 | index = i; |
1366 | break; | 1378 | break; |
1367 | } | 1379 | } |
1368 | } | 1380 | } |
1369 | cells = &mCells; | 1381 | cells = &mCells; |
1370 | } | 1382 | } |
1371 | for (uint i = 0; i < (*cells).count(); ++i) { | 1383 | for (uint i = 0; i < (*cells).count(); ++i) { |
1372 | (*cells)[i]->deHighLight(); | 1384 | (*cells)[i]->deHighLight(); |
1373 | } | 1385 | } |
1374 | if ( ! inc ) | 1386 | if ( ! inc ) |
1375 | return; | 1387 | return; |
1388 | |||
1389 | int count = (*cells).count(); | ||
1390 | bool goLeft = (mday > 1 && index > 0); | ||
1391 | bool goRight = (mday < 3 && mday > 0 && index < count -1); | ||
1392 | for (uint iii = 1; iii < count; ++iii) { | ||
1393 | if ( goLeft ) { | ||
1394 | int left = index - iii; | ||
1395 | if ( left >= 0 ) { | ||
1396 | if ( (*cells)[(uint)left]->doHighLight(inc) ) | ||
1397 | goLeft = false; | ||
1398 | } else | ||
1399 | goLeft = false; | ||
1400 | } | ||
1401 | if ( goRight ) { | ||
1402 | int right = index + iii; | ||
1403 | if ( right < count ) { | ||
1404 | if ( (*cells)[right]->doHighLight(inc) ) | ||
1405 | goRight = false; | ||
1406 | |||
1407 | } else | ||
1408 | goRight = false; | ||
1409 | } | ||
1410 | |||
1411 | } | ||
1412 | #if 0 | ||
1376 | if ( mday > 1 && index > 0 ) | 1413 | if ( mday > 1 && index > 0 ) |
1377 | for (int i = index-1; i >= 0; --i) { | 1414 | for (int i = index-1; i >= 0; --i) { |
1378 | //qDebug("index %d iii %d ", index, i); | 1415 | //qDebug("index %d iii %d ", index, i); |
1379 | if ( (*cells)[(uint)i]->doHighLight(inc) ) | 1416 | if ( (*cells)[(uint)i]->doHighLight(inc) ) |
1380 | break; | 1417 | break; |
1381 | } | 1418 | } |
1382 | if ( mday < 3 && mday > 0 && index < (*cells).count()-1) | 1419 | if ( mday < 3 && mday > 0 && index < (*cells).count()-1) |
1383 | for (uint i = index+1; i < (*cells).count(); ++i) { | 1420 | for (uint i = index+1; i < (*cells).count(); ++i) { |
1384 | if ( (*cells)[i]->doHighLight(inc) ) | 1421 | if ( (*cells)[i]->doHighLight(inc) ) |
1385 | break; | 1422 | break; |
1386 | } | 1423 | } |
1424 | #endif | ||
1387 | 1425 | ||
1388 | } | 1426 | } |
1389 | void KOMonthView::selectInternalWeekNum ( int n ) | 1427 | void KOMonthView::selectInternalWeekNum ( int n ) |
1390 | { | 1428 | { |
1391 | switchView(); | 1429 | switchView(); |
1392 | if ( !KOPrefs::instance()->mMonthViewWeek ) | 1430 | if ( !KOPrefs::instance()->mMonthViewWeek ) |
1393 | emit selectMonth (); | 1431 | emit selectMonth (); |
1394 | else | 1432 | else |
1395 | emit selectWeekNum ( n ); | 1433 | emit selectWeekNum ( n ); |
1396 | } | 1434 | } |
1397 | 1435 | ||
1398 | int KOMonthView::currentWeek() | 1436 | int KOMonthView::currentWeek() |
1399 | { | 1437 | { |
1400 | if ( mShowWeekView ) | 1438 | if ( mShowWeekView ) |
1401 | return mWeekLabelsW[0]->getWeekNum(); | 1439 | return mWeekLabelsW[0]->getWeekNum(); |
1402 | return mWeekLabels[0]->getWeekNum(); | 1440 | return mWeekLabels[0]->getWeekNum(); |
1403 | } | 1441 | } |
1404 | void KOMonthView::switchView() | 1442 | void KOMonthView::switchView() |
1405 | { | 1443 | { |
1406 | if ( selectedCell( ) ) | 1444 | if ( selectedCell( ) ) |
1407 | selectedCell()->deselect(); | 1445 | selectedCell()->deselect(); |
1408 | mShowWeekView = !mShowWeekView; | 1446 | mShowWeekView = !mShowWeekView; |
1409 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; | 1447 | KOPrefs::instance()->mMonthViewWeek = mShowWeekView; |
1410 | if ( clPending ) { | 1448 | if ( clPending ) { |
1411 | computeLayout(); | 1449 | computeLayout(); |
1412 | updateConfig(); | 1450 | updateConfig(); |
1413 | } | 1451 | } |
1414 | if ( mShowWeekView ) | 1452 | if ( mShowWeekView ) |
1415 | mWidStack->raiseWidget( mWeekView ); | 1453 | mWidStack->raiseWidget( mWeekView ); |
1416 | else | 1454 | else |
1417 | mWidStack->raiseWidget( mMonthView ); | 1455 | mWidStack->raiseWidget( mMonthView ); |
1418 | clPending = false; | 1456 | clPending = false; |
1419 | } | 1457 | } |
1420 | 1458 | ||
1421 | int KOMonthView::maxDatesHint() | 1459 | int KOMonthView::maxDatesHint() |
1422 | { | 1460 | { |
1423 | return mNumCells; | 1461 | return mNumCells; |
1424 | } | 1462 | } |
1425 | 1463 | ||
1426 | int KOMonthView::currentDateCount() | 1464 | int KOMonthView::currentDateCount() |
1427 | { | 1465 | { |
1428 | return mNumCells; | 1466 | return mNumCells; |
1429 | } | 1467 | } |
1430 | 1468 | ||
1431 | QPtrList<Incidence> KOMonthView::selectedIncidences() | 1469 | QPtrList<Incidence> KOMonthView::selectedIncidences() |
1432 | { | 1470 | { |
1433 | QPtrList<Incidence> selected; | 1471 | QPtrList<Incidence> selected; |
1434 | 1472 | ||
1435 | if ( mSelectedCell ) { | 1473 | if ( mSelectedCell ) { |
1436 | Incidence *incidence = mSelectedCell->selectedIncidence(); | 1474 | Incidence *incidence = mSelectedCell->selectedIncidence(); |
1437 | if ( incidence ) selected.append( incidence ); | 1475 | if ( incidence ) selected.append( incidence ); |
1438 | } | 1476 | } |
1439 | 1477 | ||
1440 | return selected; | 1478 | return selected; |
1441 | } | 1479 | } |
1442 | 1480 | ||
1443 | DateList KOMonthView::selectedDates() | 1481 | DateList KOMonthView::selectedDates() |
1444 | { | 1482 | { |
1445 | DateList selected; | 1483 | DateList selected; |
1446 | 1484 | ||
1447 | if ( mSelectedCell ) { | 1485 | if ( mSelectedCell ) { |
1448 | QDate qd = mSelectedCell->selectedIncidenceDate(); | 1486 | QDate qd = mSelectedCell->selectedIncidenceDate(); |
1449 | if ( qd.isValid() ) selected.append( qd ); | 1487 | if ( qd.isValid() ) selected.append( qd ); |
1450 | } | 1488 | } |
1451 | 1489 | ||
1452 | return selected; | 1490 | return selected; |
1453 | } | 1491 | } |
1454 | 1492 | ||
1455 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 1493 | void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
1456 | const QDate &td) | 1494 | const QDate &td) |
1457 | { | 1495 | { |
1458 | #ifndef KORG_NOPRINTER | 1496 | #ifndef KORG_NOPRINTER |
1459 | calPrinter->preview(CalPrinter::Month, fd, td); | 1497 | calPrinter->preview(CalPrinter::Month, fd, td); |
1460 | #endif | 1498 | #endif |
1461 | } | 1499 | } |
1462 | 1500 | ||
1463 | void KOMonthView::updateConfig() | 1501 | void KOMonthView::updateConfig() |
1464 | { | 1502 | { |
1465 | 1503 | ||
1466 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); | 1504 | int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); |
1467 | 1505 | ||
1468 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { | 1506 | if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { |
1469 | mWeekStartsMonday = true; | 1507 | mWeekStartsMonday = true; |
1470 | } | 1508 | } |
1471 | QFontMetrics fontmetric(mDayLabels[0]->font()); | 1509 | QFontMetrics fontmetric(mDayLabels[0]->font()); |
1472 | mWidthLongDayLabel = 0; | 1510 | mWidthLongDayLabel = 0; |
1473 | 1511 | ||
1474 | for (int i = 0; i < 7; i++) { | 1512 | for (int i = 0; i < 7; i++) { |
1475 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); | 1513 | int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); |
1476 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; | 1514 | if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; |
1477 | } | 1515 | } |
1478 | bool temp = mShowSatSunComp ; | 1516 | bool temp = mShowSatSunComp ; |
1479 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; | 1517 | mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; |
1480 | if ( ! mShowWeekView ) { | 1518 | if ( ! mShowWeekView ) { |
1481 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) | 1519 | if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) |
1482 | computeLayout(); | 1520 | computeLayout(); |
@@ -1628,193 +1666,194 @@ void KOMonthView::updateView() | |||
1628 | cells = &mCellsW; | 1666 | cells = &mCellsW; |
1629 | } else { | 1667 | } else { |
1630 | cells = &mCells; | 1668 | cells = &mCells; |
1631 | } | 1669 | } |
1632 | #if 1 | 1670 | #if 1 |
1633 | int i; | 1671 | int i; |
1634 | int timeSpan = (*cells).size()-1; | 1672 | int timeSpan = (*cells).size()-1; |
1635 | if ( KOPrefs::instance()->mMonthViewWeek ) | 1673 | if ( KOPrefs::instance()->mMonthViewWeek ) |
1636 | timeSpan = 6; | 1674 | timeSpan = 6; |
1637 | for( i = 0; i < timeSpan + 1; ++i ) { | 1675 | for( i = 0; i < timeSpan + 1; ++i ) { |
1638 | (*cells)[i]->startUpdateCell(); | 1676 | (*cells)[i]->startUpdateCell(); |
1639 | } | 1677 | } |
1640 | 1678 | ||
1641 | QPtrList<Event> events = calendar()->events(); | 1679 | QPtrList<Event> events = calendar()->events(); |
1642 | Event *event; | 1680 | Event *event; |
1643 | QDateTime dt; | 1681 | QDateTime dt; |
1644 | bool ok; | 1682 | bool ok; |
1645 | QDate endDate = mStartDate.addDays( timeSpan ); | 1683 | QDate endDate = mStartDate.addDays( timeSpan ); |
1646 | for( event = events.first(); event; event = events.next() ) { // for event | 1684 | for( event = events.first(); event; event = events.next() ) { // for event |
1647 | if ( event->doesRecur() ) { | 1685 | if ( event->doesRecur() ) { |
1648 | bool last; | 1686 | bool last; |
1649 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 1687 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
1650 | QDateTime incidenceEnd; | 1688 | QDateTime incidenceEnd; |
1651 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 1689 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
1652 | bool invalid = false; | 1690 | bool invalid = false; |
1653 | while( true ) { | 1691 | while( true ) { |
1654 | if ( incidenceStart.isValid() ) { | 1692 | if ( incidenceStart.isValid() ) { |
1655 | incidenceEnd = incidenceStart.addDays( eventlen ); | 1693 | incidenceEnd = incidenceStart.addDays( eventlen ); |
1656 | int st = incidenceStart.date().daysTo( endDate ); | 1694 | int st = incidenceStart.date().daysTo( endDate ); |
1657 | if ( st >= 0 ) { // start before timeend | 1695 | if ( st >= 0 ) { // start before timeend |
1658 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 1696 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
1659 | if ( end >= 0 ) { // end after timestart --- got one! | 1697 | if ( end >= 0 ) { // end after timestart --- got one! |
1660 | //normalize | 1698 | //normalize |
1661 | st = timeSpan - st; | 1699 | st = timeSpan - st; |
1662 | if ( st < 0 ) st = 0; | 1700 | if ( st < 0 ) st = 0; |
1663 | if ( end > timeSpan ) end = timeSpan; | 1701 | if ( end > timeSpan ) end = timeSpan; |
1664 | int iii; | 1702 | int iii; |
1665 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 1703 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
1666 | for ( iii = st;iii<= end;++iii) | 1704 | for ( iii = st;iii<= end;++iii) |
1667 | (*cells)[iii]->insertEvent( event ); | 1705 | (*cells)[iii]->insertEvent( event ); |
1668 | } | 1706 | } |
1669 | } | 1707 | } |
1670 | } else { | 1708 | } else { |
1671 | if ( invalid ) | 1709 | if ( invalid ) |
1672 | break; | 1710 | break; |
1673 | invalid = true; | 1711 | invalid = true; |
1674 | //qDebug("invalid %s", event->summary().latin1()); | 1712 | //qDebug("invalid %s", event->summary().latin1()); |
1675 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 1713 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
1676 | } | 1714 | } |
1677 | if ( last ) | 1715 | if ( last ) |
1678 | break; | 1716 | break; |
1679 | bool ok; | 1717 | bool ok; |
1680 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 1718 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
1681 | if ( ! ok ) | 1719 | if ( ! ok ) |
1682 | break; | 1720 | break; |
1683 | if ( incidenceStart.date() > endDate ) | 1721 | if ( incidenceStart.date() > endDate ) |
1684 | break; | 1722 | break; |
1685 | } | 1723 | } |
1686 | } else { // no recur | 1724 | } else { // no recur |
1687 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1725 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1688 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1726 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1689 | continue; | 1727 | continue; |
1690 | int st = event->dtStart().date().daysTo( endDate ); | 1728 | int st = event->dtStart().date().daysTo( endDate ); |
1691 | if ( st >= 0 ) { // start before timeend | 1729 | if ( st >= 0 ) { // start before timeend |
1692 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 1730 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
1693 | if ( end >= 0 ) { // end after timestart --- got one! | 1731 | if ( end >= 0 ) { // end after timestart --- got one! |
1694 | //normalize | 1732 | //normalize |
1695 | st = timeSpan - st; | 1733 | st = timeSpan - st; |
1696 | if ( st < 0 ) st = 0; | 1734 | if ( st < 0 ) st = 0; |
1697 | if ( end > timeSpan ) end = timeSpan; | 1735 | if ( end > timeSpan ) end = timeSpan; |
1698 | int iii; | 1736 | int iii; |
1699 | for ( iii = st;iii<= end;++iii) | 1737 | for ( iii = st;iii<= end;++iii) |
1700 | (*cells)[iii]->insertEvent( event ); | 1738 | (*cells)[iii]->insertEvent( event ); |
1701 | } | 1739 | } |
1702 | } | 1740 | } |
1703 | } | 1741 | } |
1704 | } | 1742 | } |
1705 | // insert due todos | 1743 | // insert due todos |
1706 | QPtrList<Todo> todos = calendar()->todos( ); | 1744 | QPtrList<Todo> todos = calendar()->todos( ); |
1707 | Todo *todo; | 1745 | Todo *todo; |
1708 | for(todo = todos.first(); todo; todo = todos.next()) { | 1746 | for(todo = todos.first(); todo; todo = todos.next()) { |
1709 | //insertTodo( todo ); | 1747 | //insertTodo( todo ); |
1710 | if ( todo->hasDueDate() ) { | 1748 | if ( todo->hasDueDate() ) { |
1711 | int day = mStartDate.daysTo( todo->dtDue().date() ); | 1749 | int day = mStartDate.daysTo( todo->dtDue().date() ); |
1712 | if ( day >= 0 && day < timeSpan + 1) { | 1750 | if ( day >= 0 && day < timeSpan + 1) { |
1713 | (*cells)[day]->insertTodo( todo ); | 1751 | (*cells)[day]->insertTodo( todo ); |
1714 | } | 1752 | } |
1715 | } | 1753 | } |
1716 | } | 1754 | } |
1717 | 1755 | ||
1718 | for( i = 0; i < timeSpan+1; ++i ) { | 1756 | for( i = 0; i < timeSpan+1; ++i ) { |
1719 | (*cells)[i]->finishUpdateCell(); | 1757 | (*cells)[i]->finishUpdateCell(); |
1720 | } | 1758 | } |
1721 | processSelectionChange(); | 1759 | processSelectionChange(); |
1722 | //qApp->processEvents(); | 1760 | //qApp->processEvents(); |
1723 | for( i = 0; i < timeSpan+1; ++i ) { | 1761 | for( i = 0; i < timeSpan+1; ++i ) { |
1724 | (*cells)[i]->repaintfinishUpdateCell(); | 1762 | //(*cells)[i]->repaintfinishUpdateCell(); |
1763 | QTimer::singleShot( 0, (*cells)[i], SLOT ( repaintfinishUpdateCell() ) ); | ||
1725 | } | 1764 | } |
1726 | setKeyBFocus(); | 1765 | setKeyBFocus(); |
1727 | #else | 1766 | #else |
1728 | // old code | 1767 | // old code |
1729 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); | 1768 | //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); |
1730 | int i; | 1769 | int i; |
1731 | for( i = 0; i < (*cells).count(); ++i ) { | 1770 | for( i = 0; i < (*cells).count(); ++i ) { |
1732 | (*cells)[i]->updateCell(); | 1771 | (*cells)[i]->updateCell(); |
1733 | } | 1772 | } |
1734 | 1773 | ||
1735 | //qDebug("KOMonthView::updateView() "); | 1774 | //qDebug("KOMonthView::updateView() "); |
1736 | processSelectionChange(); | 1775 | processSelectionChange(); |
1737 | // qDebug("---------------------------------------------------------------------+ "); | 1776 | // qDebug("---------------------------------------------------------------------+ "); |
1738 | (*cells)[0]->setFocus(); | 1777 | (*cells)[0]->setFocus(); |
1739 | #endif | 1778 | #endif |
1740 | 1779 | ||
1741 | //qDebug("update time %d ", ti.elapsed()); | 1780 | //qDebug("update time %d ", ti.elapsed()); |
1742 | } | 1781 | } |
1743 | 1782 | ||
1744 | void KOMonthView::setKeyBoardFocus() | 1783 | void KOMonthView::setKeyBoardFocus() |
1745 | { | 1784 | { |
1746 | //qDebug("KOMonthView::setKeyBoardFocus() "); | 1785 | //qDebug("KOMonthView::setKeyBoardFocus() "); |
1747 | bool shootAgain = false; | 1786 | bool shootAgain = false; |
1748 | if ( mShowWeekView ) { | 1787 | if ( mShowWeekView ) { |
1749 | shootAgain = !mWeekLabelsW[1]->hasFocus(); | 1788 | shootAgain = !mWeekLabelsW[1]->hasFocus(); |
1750 | mWeekLabelsW[1]->setFocus(); | 1789 | mWeekLabelsW[1]->setFocus(); |
1751 | } | 1790 | } |
1752 | else { | 1791 | else { |
1753 | shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); | 1792 | shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); |
1754 | mWeekLabels[mNumWeeks]->setFocus(); | 1793 | mWeekLabels[mNumWeeks]->setFocus(); |
1755 | } | 1794 | } |
1756 | if ( shootAgain ) { | 1795 | if ( shootAgain ) { |
1757 | QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); | 1796 | QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) ); |
1758 | } | 1797 | } |
1759 | } | 1798 | } |
1760 | void KOMonthView::setKeyBFocus() | 1799 | void KOMonthView::setKeyBFocus() |
1761 | { | 1800 | { |
1762 | //qDebug("KOMonthView::setKeyBFocus() "); | 1801 | //qDebug("KOMonthView::setKeyBFocus() "); |
1763 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); | 1802 | QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); |
1764 | } | 1803 | } |
1765 | void KOMonthView::resizeEvent(QResizeEvent * e) | 1804 | void KOMonthView::resizeEvent(QResizeEvent * e) |
1766 | { | 1805 | { |
1767 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); | 1806 | //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); |
1768 | if ( isVisible() ) { | 1807 | if ( isVisible() ) { |
1769 | //qDebug("KOMonthView::isVisible "); | 1808 | //qDebug("KOMonthView::isVisible "); |
1770 | slotComputeLayout(); | 1809 | slotComputeLayout(); |
1771 | } else | 1810 | } else |
1772 | mComputeLayoutTimer->start( 100 ); | 1811 | mComputeLayoutTimer->start( 100 ); |
1773 | } | 1812 | } |
1774 | 1813 | ||
1775 | void KOMonthView::slotComputeLayout() | 1814 | void KOMonthView::slotComputeLayout() |
1776 | { | 1815 | { |
1777 | mComputeLayoutTimer->stop(); | 1816 | mComputeLayoutTimer->stop(); |
1778 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); | 1817 | //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); |
1779 | computeLayout(); | 1818 | computeLayout(); |
1780 | clPending = true; | 1819 | clPending = true; |
1781 | setKeyBFocus(); | 1820 | setKeyBFocus(); |
1782 | } | 1821 | } |
1783 | void KOMonthView::computeLayoutWeek() | 1822 | void KOMonthView::computeLayoutWeek() |
1784 | { | 1823 | { |
1785 | static int lastWid = 0; | 1824 | static int lastWid = 0; |
1786 | static int lastHei = 0; | 1825 | static int lastHei = 0; |
1787 | int daysToShow; | 1826 | int daysToShow; |
1788 | bool combinedSatSun = false; | 1827 | bool combinedSatSun = false; |
1789 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { | 1828 | if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { |
1790 | daysToShow = 6; | 1829 | daysToShow = 6; |
1791 | combinedSatSun = true; | 1830 | combinedSatSun = true; |
1792 | } | 1831 | } |
1793 | int tWid = topLevelWidget()->size().width(); | 1832 | int tWid = topLevelWidget()->size().width(); |
1794 | int tHei = topLevelWidget()->size().height(); | 1833 | int tHei = topLevelWidget()->size().height(); |
1795 | 1834 | ||
1796 | int wid = width();//e | 1835 | int wid = width();//e |
1797 | int hei = height()-1-mNavigatorBar->height(); | 1836 | int hei = height()-1-mNavigatorBar->height(); |
1798 | 1837 | ||
1799 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) | 1838 | if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) |
1800 | return; | 1839 | return; |
1801 | 1840 | ||
1802 | if ( lastWid == width() && lastHei == height() ) { | 1841 | if ( lastWid == width() && lastHei == height() ) { |
1803 | //qDebug("KOListWeekView::No compute layout needed "); | 1842 | //qDebug("KOListWeekView::No compute layout needed "); |
1804 | return; | 1843 | return; |
1805 | } | 1844 | } |
1806 | lastWid = width(); | 1845 | lastWid = width(); |
1807 | lastHei = height(); | 1846 | lastHei = height(); |
1808 | 1847 | ||
1809 | 1848 | ||
1810 | if ( wid < hei ) | 1849 | if ( wid < hei ) |
1811 | daysToShow = 2; | 1850 | daysToShow = 2; |
1812 | else | 1851 | else |
1813 | daysToShow = 3; | 1852 | daysToShow = 3; |
1814 | mShowSatSunComp = true; | 1853 | mShowSatSunComp = true; |
1815 | combinedSatSun = true; | 1854 | combinedSatSun = true; |
1816 | 1855 | ||
1817 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); | 1856 | //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); |
1818 | QFontMetrics fm ( mWeekLabels[0]->font() ); | 1857 | QFontMetrics fm ( mWeekLabels[0]->font() ); |
1819 | int weeklabelwid = fm.width( "888" ); | 1858 | int weeklabelwid = fm.width( "888" ); |
1820 | wid -= weeklabelwid; | 1859 | wid -= weeklabelwid; |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 0f3aa54..0bd6b1c 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -74,221 +74,221 @@ private slots : | |||
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 highlightIncidence( Incidence * , MonthViewCell*, int ); | 89 | void highlightIncidence( 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 *,const QString & title ); | 108 | MonthViewItem( Incidence *,const QString & title ); |
109 | void recycle( Incidence *incidence, const QString & s); | 109 | void recycle( Incidence *incidence, const QString & s); |
110 | void setRecur(bool on) { mRecur = on; } | 110 | void setRecur(bool on) { mRecur = on; } |
111 | void setAlarm(bool on) { mAlarm = on; } | 111 | void setAlarm(bool on) { mAlarm = on; } |
112 | void setReply(bool on) { mReply = on; } | 112 | void setReply(bool on) { mReply = on; } |
113 | void setMoreInfo(bool on) { mInfo = on; } | 113 | void setMoreInfo(bool on) { mInfo = on; } |
114 | void setMultiDay(int type) { mMultiday = type; } | 114 | void setMultiDay(int type) { mMultiday = type; } |
115 | int multiDay() { return mMultiday; } | 115 | int multiDay() { return mMultiday; } |
116 | void setMultiDayPos(int type) { mdayPos = type; } | 116 | void setMultiDayPos(int type) { mdayPos = type; } |
117 | int gettMultiDayPos() { return mdayPos; } | 117 | int gettMultiDayPos() { return mdayPos; } |
118 | void setBlockRepaint(bool on) { mblockRepaint = on; } | 118 | void setBlockRepaint(bool on) { mblockRepaint = on; } |
119 | bool setHighlighted( Incidence * ); | 119 | bool setHighlighted( Incidence * ); |
120 | 120 | ||
121 | void setPalette(const QPalette &p) { mPalette = p; } | 121 | void setPalette(const QPalette &p) { mPalette = p; } |
122 | QPalette palette() const { return mPalette; } | 122 | QPalette palette() const { return mPalette; } |
123 | bool setHighlightedFalse(); | 123 | bool setHighlightedFalse(); |
124 | Incidence *incidence() const { return mIncidence; } | 124 | Incidence *incidence() const { return mIncidence; } |
125 | 125 | ||
126 | protected: | 126 | protected: |
127 | virtual void paint(QPainter *); | 127 | virtual void paint(QPainter *); |
128 | virtual int height(const QListBox *) const; | 128 | virtual int height(const QListBox *) const; |
129 | virtual int width(const QListBox *) const; | 129 | virtual int width(const QListBox *) const; |
130 | 130 | ||
131 | private: | 131 | private: |
132 | int mdayPos; | 132 | int mdayPos; |
133 | bool isWeekItem; | 133 | bool isWeekItem; |
134 | bool mblockRepaint; | 134 | bool mblockRepaint; |
135 | int mMultiday; | 135 | int mMultiday; |
136 | bool mRecur; | 136 | bool mRecur; |
137 | bool mAlarm; | 137 | bool mAlarm; |
138 | bool mReply; | 138 | bool mReply; |
139 | bool mInfo; | 139 | bool mInfo; |
140 | bool mDisplayHighlighted; | 140 | bool mDisplayHighlighted; |
141 | 141 | ||
142 | QPalette mPalette; | 142 | QPalette mPalette; |
143 | QDate mDate; | 143 | QDate mDate; |
144 | 144 | ||
145 | Incidence *mIncidence; | 145 | Incidence *mIncidence; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | 148 | ||
149 | class KOMonthView; | 149 | class KOMonthView; |
150 | 150 | ||
151 | class MonthViewCell : public KNoScrollListBox | 151 | class MonthViewCell : public KNoScrollListBox |
152 | { | 152 | { |
153 | Q_OBJECT | 153 | Q_OBJECT |
154 | public: | 154 | public: |
155 | MonthViewCell(KOMonthView *,QWidget* ); | 155 | MonthViewCell(KOMonthView *,QWidget* ); |
156 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} | 156 | ~MonthViewCell() {mAvailItemList.setAutoDelete( true );} |
157 | 157 | ||
158 | void setDate( const QDate & ); | 158 | void setDate( const QDate & ); |
159 | QDate date() const; | 159 | QDate date() const; |
160 | 160 | ||
161 | void setPrimary( bool ); | 161 | void setPrimary( bool ); |
162 | bool isPrimary() const; | 162 | bool isPrimary() const; |
163 | 163 | ||
164 | void setHoliday( bool ); | 164 | void setHoliday( bool ); |
165 | void setHoliday( const QString & ); | 165 | void setHoliday( const QString & ); |
166 | 166 | ||
167 | void updateCell(); | 167 | void updateCell(); |
168 | void startUpdateCell(); | 168 | void startUpdateCell(); |
169 | void finishUpdateCell(); | 169 | void finishUpdateCell(); |
170 | void repaintfinishUpdateCell(); | ||
171 | int insertEvent(Event *); | 170 | int insertEvent(Event *); |
172 | void insertTodo(Todo *); | 171 | void insertTodo(Todo *); |
173 | 172 | ||
174 | void updateConfig( bool bigFont = false ); | 173 | void updateConfig( bool bigFont = false ); |
175 | 174 | ||
176 | void enableScrollBars( bool ); | 175 | void enableScrollBars( bool ); |
177 | 176 | ||
178 | Incidence *selectedIncidence(); | 177 | Incidence *selectedIncidence(); |
179 | QDate selectedIncidenceDate(); | 178 | QDate selectedIncidenceDate(); |
180 | QPushButton * dateLabel() { return mLabel; } | 179 | QPushButton * dateLabel() { return mLabel; } |
181 | void deHighLight(); | ||
182 | bool doHighLight( Incidence *); | 180 | bool doHighLight( Incidence *); |
183 | void deselect(); | 181 | void deselect(); |
184 | void select(); | 182 | void select(); |
185 | #ifdef DESKTOP_VERSION | 183 | #ifdef DESKTOP_VERSION |
186 | static QToolTipGroup *toolTipGroup(); | 184 | static QToolTipGroup *toolTipGroup(); |
187 | #endif | 185 | #endif |
188 | signals: | 186 | signals: |
189 | void defaultAction( Incidence * ); | 187 | void defaultAction( Incidence * ); |
190 | void newEventSignal( QDateTime ); | 188 | void newEventSignal( QDateTime ); |
191 | void showDaySignal( QDate ); | 189 | void showDaySignal( QDate ); |
192 | 190 | ||
193 | protected: | 191 | protected: |
194 | QStringList mToolTip; | 192 | QStringList mToolTip; |
195 | void resizeEvent( QResizeEvent * ); | 193 | void resizeEvent( QResizeEvent * ); |
196 | 194 | ||
197 | public slots: | 195 | public slots: |
198 | void showDay(); | 196 | void showDay(); |
197 | void deHighLight(); | ||
198 | void repaintfinishUpdateCell(); | ||
199 | protected slots: | 199 | protected slots: |
200 | void defaultAction( QListBoxItem * ); | 200 | void defaultAction( QListBoxItem * ); |
201 | void contextMenu( QListBoxItem * ); | 201 | void contextMenu( QListBoxItem * ); |
202 | void selection( QListBoxItem * ); | 202 | void selection( QListBoxItem * ); |
203 | void cellClicked( QListBoxItem * ); | 203 | void cellClicked( QListBoxItem * ); |
204 | void newEvent(); | 204 | void newEvent(); |
205 | 205 | ||
206 | private: | 206 | private: |
207 | int mdayCount; | 207 | int mdayCount; |
208 | QPtrList <MonthViewItem> mAvailItemList; | 208 | QPtrList <MonthViewItem> mAvailItemList; |
209 | KOMonthView *mMonthView; | 209 | KOMonthView *mMonthView; |
210 | int currentPalette; | 210 | int currentPalette; |
211 | 211 | ||
212 | QDate mDate; | 212 | QDate mDate; |
213 | bool mPrimary; | 213 | bool mPrimary; |
214 | bool mHoliday; | 214 | bool mHoliday; |
215 | QString mHolidayString; | 215 | QString mHolidayString; |
216 | 216 | ||
217 | //QLabel *mLabel; | 217 | //QLabel *mLabel; |
218 | QPushButton *mLabel; | 218 | QPushButton *mLabel; |
219 | //QListBox *mItemList; | 219 | //QListBox *mItemList; |
220 | #ifdef DESKTOP_VERSION | 220 | #ifdef DESKTOP_VERSION |
221 | static QToolTipGroup *mToolTipGroup; | 221 | static QToolTipGroup *mToolTipGroup; |
222 | #endif | 222 | #endif |
223 | QSize mLabelSize; | 223 | QSize mLabelSize; |
224 | QSize mLabelBigSize; | 224 | QSize mLabelBigSize; |
225 | QPalette mHolidayPalette; | 225 | QPalette mHolidayPalette; |
226 | QPalette mStandardPalette; | 226 | QPalette mStandardPalette; |
227 | QPalette mPrimaryPalette; | 227 | QPalette mPrimaryPalette; |
228 | QPalette mNonPrimaryPalette; | 228 | QPalette mNonPrimaryPalette; |
229 | void setMyPalette(); | 229 | void setMyPalette(); |
230 | QPalette getPalette (); | 230 | QPalette getPalette (); |
231 | 231 | ||
232 | }; | 232 | }; |
233 | 233 | ||
234 | 234 | ||
235 | class KOMonthView: public KOEventView | 235 | class KOMonthView: public KOEventView |
236 | { | 236 | { |
237 | Q_OBJECT | 237 | Q_OBJECT |
238 | public: | 238 | public: |
239 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); | 239 | KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); |
240 | ~KOMonthView(); | 240 | ~KOMonthView(); |
241 | 241 | ||
242 | /** Returns maximum number of days supported by the komonthview */ | 242 | /** Returns maximum number of days supported by the komonthview */ |
243 | virtual int maxDatesHint(); | 243 | virtual int maxDatesHint(); |
244 | 244 | ||
245 | /** Returns number of currently shown dates. */ | 245 | /** Returns number of currently shown dates. */ |
246 | virtual int currentDateCount(); | 246 | virtual int currentDateCount(); |
247 | 247 | ||
248 | /** returns the currently selected events */ | 248 | /** returns the currently selected events */ |
249 | virtual QPtrList<Incidence> selectedIncidences(); | 249 | virtual QPtrList<Incidence> selectedIncidences(); |
250 | 250 | ||
251 | /** returns dates of the currently selected events */ | 251 | /** returns dates of the currently selected events */ |
252 | virtual DateList selectedDates(); | 252 | virtual DateList selectedDates(); |
253 | 253 | ||
254 | virtual void printPreview(CalPrinter *calPrinter, | 254 | virtual void printPreview(CalPrinter *calPrinter, |
255 | const QDate &, const QDate &); | 255 | const QDate &, const QDate &); |
256 | bool isMonthView() { return !mShowWeekView; } | 256 | bool isMonthView() { return !mShowWeekView; } |
257 | bool isUpdatePossible() { return updatePossible; } | 257 | bool isUpdatePossible() { return updatePossible; } |
258 | 258 | ||
259 | MonthViewCell * selectedCell(); | 259 | MonthViewCell * selectedCell(); |
260 | bool skipResize; | 260 | bool skipResize; |
261 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} | 261 | NavigatorBar* navigatorBar() { return mNavigatorBar ;} |
262 | void clearList(); | 262 | void clearList(); |
263 | public slots: | 263 | public slots: |
264 | void incidenceHighlighted( Incidence *, MonthViewCell*, int ); | 264 | void incidenceHighlighted( Incidence *, MonthViewCell*, int ); |
265 | void nextCell(); | 265 | void nextCell(); |
266 | void prevCell(); | 266 | void prevCell(); |
267 | virtual void updateView(); | 267 | virtual void updateView(); |
268 | virtual void updateConfig(); | 268 | virtual void updateConfig(); |
269 | virtual void showDates(const QDate &start, const QDate &end); | 269 | virtual void showDates(const QDate &start, const QDate &end); |
270 | virtual void showEvents(QPtrList<Event> eventList); | 270 | virtual void showEvents(QPtrList<Event> eventList); |
271 | 271 | ||
272 | void changeEventDisplay(Event *, int); | 272 | void changeEventDisplay(Event *, int); |
273 | 273 | ||
274 | void clearSelection(); | 274 | void clearSelection(); |
275 | 275 | ||
276 | void showContextMenu( Incidence * ); | 276 | void showContextMenu( Incidence * ); |
277 | 277 | ||
278 | void setSelectedCell( MonthViewCell * ); | 278 | void setSelectedCell( MonthViewCell * ); |
279 | void setPopupCell( MonthViewCell * ); | 279 | void setPopupCell( MonthViewCell * ); |
280 | void switchView(); | 280 | void switchView(); |
281 | void setKeyBoardFocus(); | 281 | void setKeyBoardFocus(); |
282 | void setKeyBFocus(); | 282 | void setKeyBFocus(); |
283 | 283 | ||
284 | protected slots: | 284 | protected slots: |
285 | void slotNewTodo(); | 285 | void slotNewTodo(); |
286 | void slotNewEvent(); | 286 | void slotNewEvent(); |
287 | void slotEditJournal(); | 287 | void slotEditJournal(); |
288 | void slotComputeLayout(); | 288 | void slotComputeLayout(); |
289 | void selectInternalWeekNum ( int ); | 289 | void selectInternalWeekNum ( int ); |
290 | void processSelectionChange(); | 290 | void processSelectionChange(); |
291 | signals: | 291 | signals: |
292 | void nextMonth(); | 292 | void nextMonth(); |
293 | void prevMonth(); | 293 | void prevMonth(); |
294 | void selectWeekNum ( int ); | 294 | void selectWeekNum ( int ); |