author | zautrix <zautrix> | 2005-07-04 22:01:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-04 22:01:37 (UTC) |
commit | d7931731fcf0ffeb5b5267f25fce741ebe1ced13 (patch) (unidiff) | |
tree | 87c5e91d5df7d80c6218b0f52323bfdeab24949e /korganizer | |
parent | 35f1ad23e06a0f6014d98c952e8b8652b5cffc49 (diff) | |
download | kdepimpi-d7931731fcf0ffeb5b5267f25fce741ebe1ced13.zip kdepimpi-d7931731fcf0ffeb5b5267f25fce741ebe1ced13.tar.gz kdepimpi-d7931731fcf0ffeb5b5267f25fce741ebe1ced13.tar.bz2 |
next pix wech
-rw-r--r-- | korganizer/koagendaitem.cpp | 24 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 |
3 files changed, 11 insertions, 16 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 9fe1be4..abb29f7 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -299,110 +299,113 @@ void KOAgendaItem::select(bool selected) | |||
299 | return; | 299 | return; |
300 | if ( firstMultiItem() ) | 300 | if ( firstMultiItem() ) |
301 | firstMultiItem()->select( selected ); | 301 | firstMultiItem()->select( selected ); |
302 | if ( !firstMultiItem() && nextMultiItem() ) { | 302 | if ( !firstMultiItem() && nextMultiItem() ) { |
303 | KOAgendaItem * placeItem = nextMultiItem(); | 303 | KOAgendaItem * placeItem = nextMultiItem(); |
304 | while ( placeItem ) { | 304 | while ( placeItem ) { |
305 | placeItem->select( selected ); | 305 | placeItem->select( selected ); |
306 | placeItem = placeItem->nextMultiItem(); | 306 | placeItem = placeItem->nextMultiItem(); |
307 | } | 307 | } |
308 | } | 308 | } |
309 | globalFlagBlockAgendaItemUpdate = 0; | 309 | globalFlagBlockAgendaItemUpdate = 0; |
310 | paintMe( selected ); | 310 | paintMe( selected ); |
311 | globalFlagBlockAgendaItemUpdate = 1; | 311 | globalFlagBlockAgendaItemUpdate = 1; |
312 | repaint( false ); | 312 | repaint( false ); |
313 | } | 313 | } |
314 | 314 | ||
315 | 315 | ||
316 | /* | 316 | /* |
317 | The eventFilter has to filter the mouse events of the agenda item childs. The | 317 | The eventFilter has to filter the mouse events of the agenda item childs. The |
318 | events are fed into the event handling method of KOAgendaItem. This allows the | 318 | events are fed into the event handling method of KOAgendaItem. This allows the |
319 | KOAgenda to handle the KOAgendaItems by using an eventFilter. | 319 | KOAgenda to handle the KOAgendaItems by using an eventFilter. |
320 | */ | 320 | */ |
321 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) | 321 | bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) |
322 | { | 322 | { |
323 | if (e->type() == QEvent::MouseButtonPress || | 323 | if (e->type() == QEvent::MouseButtonPress || |
324 | e->type() == QEvent::MouseButtonDblClick || | 324 | e->type() == QEvent::MouseButtonDblClick || |
325 | e->type() == QEvent::MouseButtonRelease || | 325 | e->type() == QEvent::MouseButtonRelease || |
326 | e->type() == QEvent::MouseMove) { | 326 | e->type() == QEvent::MouseMove) { |
327 | QMouseEvent *me = (QMouseEvent *)e; | 327 | QMouseEvent *me = (QMouseEvent *)e; |
328 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> | 328 | QPoint itemPos = this->mapFromGlobal(((QWidget *)object)-> |
329 | mapToGlobal(me->pos())); | 329 | mapToGlobal(me->pos())); |
330 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); | 330 | QMouseEvent returnEvent (e->type(),itemPos,me->button(),me->state()); |
331 | return event(&returnEvent); | 331 | return event(&returnEvent); |
332 | } else { | 332 | } else { |
333 | return false; | 333 | return false; |
334 | } | 334 | } |
335 | } | 335 | } |
336 | void KOAgendaItem::repaintMe( ) | 336 | void KOAgendaItem::repaintMe( ) |
337 | { | 337 | { |
338 | paintMe ( mSelected ); | 338 | paintMe ( mSelected ); |
339 | } | 339 | } |
340 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | 340 | void KOAgendaItem::paintMe( bool selected, QPainter* paint ) |
341 | { | 341 | { |
342 | if ( globalFlagBlockAgendaItemUpdate && ! selected) | 342 | if ( globalFlagBlockAgendaItemUpdate && ! selected) |
343 | return; | 343 | return; |
344 | QPainter pa; | 344 | QPainter pa; |
345 | 345 | ||
346 | if ( mSelected ) { | 346 | if ( mSelected ) { |
347 | pa.begin( paintPixSel() ); | 347 | pa.begin( this ); |
348 | } else { | 348 | } else { |
349 | if ( mAllDay ) | 349 | if ( mAllDay ) |
350 | pa.begin( paintPixAllday() ); | 350 | pa.begin( paintPixAllday() ); |
351 | else | 351 | else |
352 | pa.begin( paintPix() ); | 352 | pa.begin( paintPix() ); |
353 | } | 353 | } |
354 | int x, yy, w, h; | 354 | int x, yy, w, h; |
355 | float nfh = 7.0; | 355 | float nfh = 7.0; |
356 | x = pos().x(); w = width(); h = height (); | 356 | x = pos().x(); w = width(); h = height (); |
357 | if ( mAllDay ) | 357 | if ( mAllDay ) |
358 | yy = y(); | 358 | yy = y(); |
359 | else | 359 | else |
360 | yy = mCellYTop * ( height() / cellHeight() ); | 360 | yy = mCellYTop * ( height() / cellHeight() ); |
361 | if ( mSelected ) { | ||
362 | pa.translate( -x, -yy ); | ||
363 | } | ||
361 | xPaintCoord= x; | 364 | xPaintCoord= x; |
362 | yPaintCoord = yy; | 365 | yPaintCoord = yy; |
363 | wPaintCoord = width(); | 366 | wPaintCoord = width(); |
364 | hPaintCoord = height(); | 367 | hPaintCoord = height(); |
365 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); | 368 | //qDebug("paintMe %s %d %d %d %d",incidence()->summary().latin1(), x, yy, width(), height()); |
366 | if ( paint == 0 ) | 369 | if ( paint == 0 ) |
367 | paint = &pa; | 370 | paint = &pa; |
368 | bool horLayout = ( w < h ); | 371 | bool horLayout = ( w < h ); |
369 | int maxhei = mFontPixelSize+4; | 372 | int maxhei = mFontPixelSize+4; |
370 | if ( horLayout ) | 373 | if ( horLayout ) |
371 | maxhei += AGENDA_ICON_SIZE -4; | 374 | maxhei += AGENDA_ICON_SIZE -4; |
372 | bool small = ( h < maxhei ); | 375 | bool small = ( h < maxhei ); |
373 | if ( ! small ) | 376 | if ( ! small ) |
374 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); | 377 | paint->setFont(KOPrefs::instance()->mAgendaViewFont); |
375 | else { | 378 | else { |
376 | QFont f = KOPrefs::instance()->mAgendaViewFont; | 379 | QFont f = KOPrefs::instance()->mAgendaViewFont; |
377 | f.setBold( false ); | 380 | f.setBold( false ); |
378 | int fh = f.pointSize(); | 381 | int fh = f.pointSize(); |
379 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; | 382 | nfh = (((float)height())/(float)(mFontPixelSize+4))*fh; |
380 | if ( nfh < 6 ) | 383 | if ( nfh < 6 ) |
381 | nfh = 6; | 384 | nfh = 6; |
382 | f.setPointSize( nfh ); | 385 | f.setPointSize( nfh ); |
383 | paint->setFont(f); | 386 | paint->setFont(f); |
384 | } | 387 | } |
385 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); | 388 | paint->fillRect ( x, yy, w, h, mBackgroundColor ); |
386 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); | 389 | static const QPixmap completedPxmp = SmallIcon("greenhook16"); |
387 | static const QPixmap overduePxmp = SmallIcon("redcross16"); | 390 | static const QPixmap overduePxmp = SmallIcon("redcross16"); |
388 | if ( mIncidence->typeID() == todoID ) { | 391 | if ( mIncidence->typeID() == todoID ) { |
389 | Todo* tempTodo = static_cast<Todo*>(mIncidence); | 392 | Todo* tempTodo = static_cast<Todo*>(mIncidence); |
390 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); | 393 | int xx = pos().x()+(width()-completedPxmp.width()-3 ); |
391 | int yyy = yy+3; | 394 | int yyy = yy+3; |
392 | if ( tempTodo->isCompleted() ) | 395 | if ( tempTodo->isCompleted() ) |
393 | paint->drawPixmap ( xx, yyy, completedPxmp ); | 396 | paint->drawPixmap ( xx, yyy, completedPxmp ); |
394 | else { | 397 | else { |
395 | paint->drawPixmap ( xx, yyy, overduePxmp ); | 398 | paint->drawPixmap ( xx, yyy, overduePxmp ); |
396 | 399 | ||
397 | } | 400 | } |
398 | } | 401 | } |
399 | bool addIcon = false; | 402 | bool addIcon = false; |
400 | if ( ! small || w > 3 * h || h > 3* w ) | 403 | if ( ! small || w > 3 * h || h > 3* w ) |
401 | addIcon = updateIcons( paint, horLayout ); | 404 | addIcon = updateIcons( paint, horLayout ); |
402 | 405 | ||
403 | //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); | 406 | //qDrawShadePanel (paint, x, yy, w, h, mColorGroup, selected , 2, 0); |
404 | qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); | 407 | qDrawWinPanel (paint, x, yy, w, h, mColorGroup, selected ,0); |
405 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); | 408 | //qDebug("draw rect %d %d %d %d ",x, yy, w, h ); |
406 | if ( ! small ) { | 409 | if ( ! small ) { |
407 | x += 3; yy += 3;w -= 6; h-= 5; | 410 | x += 3; yy += 3;w -= 6; h-= 5; |
408 | } else { | 411 | } else { |
@@ -425,164 +428,157 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | |||
425 | if ( ! horLayout ) { | 428 | if ( ! horLayout ) { |
426 | x += AGENDA_ICON_SIZE+3; | 429 | x += AGENDA_ICON_SIZE+3; |
427 | w -= (AGENDA_ICON_SIZE+3); | 430 | w -= (AGENDA_ICON_SIZE+3); |
428 | } | 431 | } |
429 | else { | 432 | else { |
430 | yy+= AGENDA_ICON_SIZE+2; | 433 | yy+= AGENDA_ICON_SIZE+2; |
431 | h -=(AGENDA_ICON_SIZE+3); | 434 | h -=(AGENDA_ICON_SIZE+3); |
432 | } | 435 | } |
433 | } | 436 | } |
434 | if ( mWhiteText ) | 437 | if ( mWhiteText ) |
435 | paint->setPen ( white); | 438 | paint->setPen ( white); |
436 | if ( x < 0 ) { | 439 | if ( x < 0 ) { |
437 | w = w+x-3; | 440 | w = w+x-3; |
438 | x = 3; | 441 | x = 3; |
439 | if ( !horLayout && addIcon ) | 442 | if ( !horLayout && addIcon ) |
440 | x += AGENDA_ICON_SIZE+3; | 443 | x += AGENDA_ICON_SIZE+3; |
441 | if ( w > parentWidget()->width() ){ | 444 | if ( w > parentWidget()->width() ){ |
442 | w = parentWidget()->width() - 6; | 445 | w = parentWidget()->width() - 6; |
443 | #ifndef DESKTOP_VERSION | 446 | #ifndef DESKTOP_VERSION |
444 | align = ( AlignHCenter|WordBreak|AlignTop); | 447 | align = ( AlignHCenter|WordBreak|AlignTop); |
445 | #else | 448 | #else |
446 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); | 449 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); |
447 | #endif | 450 | #endif |
448 | 451 | ||
449 | } | 452 | } |
450 | } | 453 | } |
451 | QRect dr; | 454 | QRect dr; |
452 | if ( w + x > parentWidget()->width() ) | 455 | if ( w + x > parentWidget()->width() ) |
453 | w = parentWidget()->width()-x; | 456 | w = parentWidget()->width()-x; |
454 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 457 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
455 | //qDebug("%d %d %d %d ", x, yy, w, h ); | 458 | //qDebug("%d %d %d %d ", x, yy, w, h ); |
456 | if ( mIncidence->cancelled() ){ | 459 | if ( mIncidence->cancelled() ){ |
457 | 460 | ||
458 | 461 | ||
459 | small = ( height() < 20 ); | 462 | small = ( height() < 20 ); |
460 | 463 | ||
461 | if ( ! small ) { | 464 | if ( ! small ) { |
462 | QFontMetrics fm ( paint->font() ); | 465 | QFontMetrics fm ( paint->font() ); |
463 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); | 466 | paint->drawLine(dr.left(), yy+fm.height()/2, dr.right()-2, yy+fm.height()/2); |
464 | } | 467 | } |
465 | 468 | ||
466 | } | 469 | } |
467 | pa.end(); | 470 | pa.end(); |
468 | 471 | ||
469 | } | 472 | } |
470 | void KOAgendaItem::resizePixmap( int w , int h ) | 473 | void KOAgendaItem::resizePixmap( int w , int h ) |
471 | { | 474 | { |
472 | paintPix()->resize( w, h ); | 475 | paintPix()->resize( w, h ); |
473 | paintPixSel()->resize( w, h ); | ||
474 | 476 | ||
475 | } | 477 | } |
476 | QPixmap * KOAgendaItem::paintPix() | 478 | QPixmap * KOAgendaItem::paintPix() |
477 | { | 479 | { |
478 | static QPixmap* mPaintPix = 0; | 480 | static QPixmap* mPaintPix = 0; |
479 | if ( ! mPaintPix ) { | 481 | if ( ! mPaintPix ) { |
480 | int w = QApplication::desktop()->width(); | 482 | int w = QApplication::desktop()->width(); |
481 | int h = QApplication::desktop()->height(); | 483 | int h = QApplication::desktop()->height(); |
482 | mPaintPix = new QPixmap(w,h); | 484 | mPaintPix = new QPixmap(w,h); |
483 | } | 485 | } |
484 | return mPaintPix ; | 486 | return mPaintPix ; |
485 | } | 487 | } |
486 | QPixmap * KOAgendaItem::paintPixAllday() | 488 | QPixmap * KOAgendaItem::paintPixAllday() |
487 | { | 489 | { |
488 | static QPixmap* mPaintPixA = 0; | 490 | static QPixmap* mPaintPixA = 0; |
489 | if ( ! mPaintPixA ) { | 491 | if ( ! mPaintPixA ) { |
490 | int w = QApplication::desktop()->width(); | 492 | int w = QApplication::desktop()->width(); |
491 | int h = QApplication::desktop()->height()/3; | 493 | int h = QApplication::desktop()->height()/3; |
492 | mPaintPixA = new QPixmap(w,h); | 494 | mPaintPixA = new QPixmap(w,h); |
493 | } | 495 | } |
494 | return mPaintPixA ; | 496 | return mPaintPixA ; |
495 | } | 497 | } |
496 | QPixmap * KOAgendaItem::paintPixSel() | 498 | |
497 | { | ||
498 | static QPixmap* mPaintPixSel = 0; | ||
499 | if ( ! mPaintPixSel ) { | ||
500 | int w = QApplication::desktop()->width(); | ||
501 | int h = QApplication::desktop()->height(); | ||
502 | mPaintPixSel = new QPixmap(w,h); | ||
503 | } | ||
504 | return mPaintPixSel ; | ||
505 | } | ||
506 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) | 499 | void KOAgendaItem::paintEvent ( QPaintEvent *e ) |
507 | { | 500 | { |
508 | 501 | ||
509 | if ( globalFlagBlockAgendaItemPaint ) | 502 | if ( globalFlagBlockAgendaItemPaint ) |
510 | return; | 503 | return; |
511 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) | 504 | if ( globalFlagBlockAgenda > 0 && globalFlagBlockAgenda < 5 ) |
512 | return; | 505 | return; |
513 | int yy; | 506 | int yy; |
514 | if ( mAllDay ) | 507 | if ( mAllDay ) |
515 | yy = y(); | 508 | yy = y(); |
516 | else | 509 | else |
517 | yy = mCellYTop * ( height() / cellHeight() ); | 510 | yy = mCellYTop * ( height() / cellHeight() ); |
518 | int xx = x(); | 511 | int xx = x(); |
519 | 512 | ||
520 | if ( xPaintCoord != xx || yPaintCoord != yy || | 513 | if ( xPaintCoord != xx || yPaintCoord != yy || |
521 | wPaintCoord != width() || hPaintCoord != height()) { | 514 | wPaintCoord != width() || hPaintCoord != height()) { |
522 | xPaintCoord= xx; | 515 | xPaintCoord= xx; |
523 | yPaintCoord = yy; | 516 | yPaintCoord = yy; |
524 | wPaintCoord = width(); | 517 | wPaintCoord = width(); |
525 | hPaintCoord = height(); | 518 | hPaintCoord = height(); |
526 | globalFlagBlockAgendaItemUpdate = 0; | 519 | globalFlagBlockAgendaItemUpdate = 0; |
527 | paintMe( mSelected ); | 520 | paintMe( mSelected ); |
528 | //qDebug("calling paintMe "); | 521 | //qDebug("calling paintMe "); |
529 | globalFlagBlockAgendaItemUpdate = 1; | 522 | globalFlagBlockAgendaItemUpdate = 1; |
523 | if ( mSelected ) | ||
524 | return; | ||
530 | } | 525 | } |
531 | int rx, ry, rw, rh; | 526 | int rx, ry, rw, rh; |
532 | rx = e->rect().x(); | 527 | rx = e->rect().x(); |
533 | ry = e->rect().y(); | 528 | ry = e->rect().y(); |
534 | rw = e->rect().width(); | 529 | rw = e->rect().width(); |
535 | rh = e->rect().height(); | 530 | rh = e->rect().height(); |
536 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); | 531 | //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); |
537 | 532 | ||
538 | QPixmap* paintFrom ; | 533 | QPixmap* paintFrom ; |
539 | if ( mSelected ) { | 534 | if ( mSelected ) { |
540 | paintFrom = paintPixSel(); | 535 | paintMe( mSelected ); |
536 | return; | ||
541 | } else { | 537 | } else { |
542 | if ( mAllDay ) | 538 | if ( mAllDay ) |
543 | paintFrom = paintPixAllday(); | 539 | paintFrom = paintPixAllday(); |
544 | else | 540 | else |
545 | paintFrom = paintPix(); | 541 | paintFrom = paintPix(); |
546 | } | 542 | } |
547 | xx += rx; | 543 | xx += rx; |
548 | 544 | ||
549 | if ( xx < 0 ) { | 545 | if ( xx < 0 ) { |
550 | rw = rw + xx; | 546 | rw = rw + xx; |
551 | rx -= xx; | 547 | rx -= xx; |
552 | xx = 0; | 548 | xx = 0; |
553 | if ( rw <= 1 ) { | 549 | if ( rw <= 1 ) { |
554 | //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); | 550 | //qDebug("KOAgendaItem::Width1 <= 1 (%d). Returning. %s",rw,mDisplayedText.latin1()); |
555 | return; | 551 | return; |
556 | } | 552 | } |
557 | } | 553 | } |
558 | if ( paintFrom->width() < xx+rw ) { | 554 | if ( paintFrom->width() < xx+rw ) { |
559 | rw = paintFrom->width() - xx; | 555 | rw = paintFrom->width() - xx; |
560 | if ( rw <= 1 ) { | 556 | if ( rw <= 1 ) { |
561 | //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); | 557 | //qDebug("KOAgendaItem::Width2 <= 1 (%d). Returning.%s ",rw,mDisplayedText.latin1() ); |
562 | return; | 558 | return; |
563 | } | 559 | } |
564 | } | 560 | } |
565 | //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); | 561 | //qDebug("%d %d %d %d %d %d %d",rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh); |
566 | bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); | 562 | bitBlt (this, rx, ry, paintFrom, xx ,yPaintCoord+ry, rw, rh ,CopyROP); |
567 | } | 563 | } |
568 | void KOAgendaItem::computeText() | 564 | void KOAgendaItem::computeText() |
569 | { | 565 | { |
570 | mDisplayedText = mIncidence->summary(); | 566 | mDisplayedText = mIncidence->summary(); |
571 | if ( (mIncidence->typeID() == todoID ) ) { | 567 | if ( (mIncidence->typeID() == todoID ) ) { |
572 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { | 568 | if ( static_cast<Todo*>(mIncidence)->hasDueDate() ) { |
573 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) | 569 | if ( static_cast<Todo*>(mIncidence)->dtDue().date() < QDate::currentDate() ) |
574 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; | 570 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatDate((static_cast<Todo*>(mIncidence))->dtDue().date(), true)+")"; |
575 | else if ( !(mIncidence->doesFloat())) | 571 | else if ( !(mIncidence->doesFloat())) |
576 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; | 572 | mDisplayedText += i18n(" (") +KGlobal::locale()->formatTime((static_cast<Todo*>(mIncidence))->dtDue().time())+")"; |
577 | } | 573 | } |
578 | } else { | 574 | } else { |
579 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) | 575 | if ( !(mIncidence->doesFloat()) && KOPrefs::instance()->mShowTimeInAgenda) |
580 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; | 576 | mDisplayedText += ": " +KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtStart().time()) + " - " + KGlobal::locale()->formatTime((static_cast<Event*>(mIncidence))->dtEnd().time()) ; |
581 | 577 | ||
582 | if ( mAllDay ) { | 578 | if ( mAllDay ) { |
583 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { | 579 | if ( mIncidence->dtStart().date().addDays(3) < mIncidence->dtEnd().date() ) { |
584 | if ( mIncidence->doesRecur() ) { | 580 | if ( mIncidence->doesRecur() ) { |
585 | mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; | 581 | mDisplayedText += " (" + mIncidence->recurrence()->recurrenceText() + ")"; |
586 | } else { | 582 | } else { |
587 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; | 583 | mDisplayedText += ": " +KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtStart().date(), true) + " - " + KGlobal::locale()->formatDate((static_cast<Event*>(mIncidence))->dtEnd().date(), true) ; |
588 | } | 584 | } |
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index dc2316a..7103abe 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h | |||
@@ -58,97 +58,96 @@ class KOAgendaItem : public QWidget | |||
58 | int subCell() { return mSubCell; } | 58 | int subCell() { return mSubCell; } |
59 | int subCells() { return mSubCells; } | 59 | int subCells() { return mSubCells; } |
60 | 60 | ||
61 | void setCellXY(int X, int YTop, int YBottom); | 61 | void setCellXY(int X, int YTop, int YBottom); |
62 | void setCellY(int YTop, int YBottom); | 62 | void setCellY(int YTop, int YBottom); |
63 | void setCellX(int XLeft, int XRight); | 63 | void setCellX(int XLeft, int XRight); |
64 | void setCellXWidth(int xwidth); | 64 | void setCellXWidth(int xwidth); |
65 | void setSubCell(int subCell); | 65 | void setSubCell(int subCell); |
66 | void setSubCells(int subCells); | 66 | void setSubCells(int subCells); |
67 | 67 | ||
68 | /** Start movement */ | 68 | /** Start movement */ |
69 | void startMove(); | 69 | void startMove(); |
70 | /** Reset to original values */ | 70 | /** Reset to original values */ |
71 | void resetMove(); | 71 | void resetMove(); |
72 | 72 | ||
73 | void moveRelative(int dx,int dy); | 73 | void moveRelative(int dx,int dy); |
74 | void expandTop(int dy); | 74 | void expandTop(int dy); |
75 | void expandBottom(int dy); | 75 | void expandBottom(int dy); |
76 | void expandLeft(int dx); | 76 | void expandLeft(int dx); |
77 | void expandRight(int dx); | 77 | void expandRight(int dx); |
78 | int mLastMoveXPos; | 78 | int mLastMoveXPos; |
79 | 79 | ||
80 | void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, | 80 | void setMultiItem(KOAgendaItem *first,KOAgendaItem *next, |
81 | KOAgendaItem *last); | 81 | KOAgendaItem *last); |
82 | KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } | 82 | KOAgendaItem *firstMultiItem() { return mFirstMultiItem; } |
83 | KOAgendaItem *nextMultiItem() { return mNextMultiItem; } | 83 | KOAgendaItem *nextMultiItem() { return mNextMultiItem; } |
84 | KOAgendaItem *lastMultiItem() { return mLastMultiItem; } | 84 | KOAgendaItem *lastMultiItem() { return mLastMultiItem; } |
85 | 85 | ||
86 | Incidence *incidence() const { return mIncidence; } | 86 | Incidence *incidence() const { return mIncidence; } |
87 | QDate itemDate() { return mDate; } | 87 | QDate itemDate() { return mDate; } |
88 | 88 | ||
89 | /** Update the date of this item's occurence (not in the event) */ | 89 | /** Update the date of this item's occurence (not in the event) */ |
90 | void setItemDate(QDate qd); | 90 | void setItemDate(QDate qd); |
91 | 91 | ||
92 | void setText ( const QString & text ) { mDisplayedText = text; } | 92 | void setText ( const QString & text ) { mDisplayedText = text; } |
93 | QString text () { return mDisplayedText; } | 93 | QString text () { return mDisplayedText; } |
94 | 94 | ||
95 | virtual bool eventFilter ( QObject *, QEvent * ); | 95 | virtual bool eventFilter ( QObject *, QEvent * ); |
96 | 96 | ||
97 | static QToolTipGroup *toolTipGroup(); | 97 | static QToolTipGroup *toolTipGroup(); |
98 | 98 | ||
99 | QPtrList<KOAgendaItem> conflictItems(); | 99 | QPtrList<KOAgendaItem> conflictItems(); |
100 | void setConflictItems(QPtrList<KOAgendaItem>); | 100 | void setConflictItems(QPtrList<KOAgendaItem>); |
101 | void addConflictItem(KOAgendaItem *ci); | 101 | void addConflictItem(KOAgendaItem *ci); |
102 | void paintMe( bool, QPainter* painter = 0 ); | 102 | void paintMe( bool, QPainter* painter = 0 ); |
103 | void repaintMe(); | 103 | void repaintMe(); |
104 | static void resizePixmap( int, int ); | 104 | static void resizePixmap( int, int ); |
105 | static QPixmap * paintPix(); | 105 | static QPixmap * paintPix(); |
106 | static QPixmap * paintPixSel(); | ||
107 | static QPixmap * paintPixAllday(); | 106 | static QPixmap * paintPixAllday(); |
108 | void updateItem(); | 107 | void updateItem(); |
109 | void computeText(); | 108 | void computeText(); |
110 | void recreateIncidence(); | 109 | void recreateIncidence(); |
111 | bool checkLayout(); | 110 | bool checkLayout(); |
112 | void initColor (); | 111 | void initColor (); |
113 | public slots: | 112 | public slots: |
114 | bool updateIcons( QPainter *, bool ); | 113 | bool updateIcons( QPainter *, bool ); |
115 | void select(bool=true); | 114 | void select(bool=true); |
116 | 115 | ||
117 | protected: | 116 | protected: |
118 | void dragEnterEvent(QDragEnterEvent *e); | 117 | void dragEnterEvent(QDragEnterEvent *e); |
119 | void dropEvent(QDropEvent *e); | 118 | void dropEvent(QDropEvent *e); |
120 | void paintEvent ( QPaintEvent * ); | 119 | void paintEvent ( QPaintEvent * ); |
121 | void resizeEvent ( QResizeEvent *ev ); | 120 | void resizeEvent ( QResizeEvent *ev ); |
122 | 121 | ||
123 | private: | 122 | private: |
124 | KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis; | 123 | KOAgendaItemWhatsThis* mKOAgendaItemWhatsThis; |
125 | bool mAllDay; | 124 | bool mAllDay; |
126 | bool mWhiteText; | 125 | bool mWhiteText; |
127 | int mCellX; | 126 | int mCellX; |
128 | int mCellXWidth; | 127 | int mCellXWidth; |
129 | int mCellYTop,mCellYBottom; | 128 | int mCellYTop,mCellYBottom; |
130 | int mSubCell; // subcell number of this item | 129 | int mSubCell; // subcell number of this item |
131 | int mSubCells; // Total number of subcells in cell of this item | 130 | int mSubCells; // Total number of subcells in cell of this item |
132 | int xPaintCoord; | 131 | int xPaintCoord; |
133 | int yPaintCoord; | 132 | int yPaintCoord; |
134 | int wPaintCoord; | 133 | int wPaintCoord; |
135 | int hPaintCoord; | 134 | int hPaintCoord; |
136 | // Variables to remember start position | 135 | // Variables to remember start position |
137 | int mStartCellX; | 136 | int mStartCellX; |
138 | int mStartCellXWidth; | 137 | int mStartCellXWidth; |
139 | int mStartCellYTop,mStartCellYBottom; | 138 | int mStartCellYTop,mStartCellYBottom; |
140 | int mLastMovePos; | 139 | int mLastMovePos; |
141 | 140 | ||
142 | // Multi item pointers | 141 | // Multi item pointers |
143 | KOAgendaItem *mFirstMultiItem; | 142 | KOAgendaItem *mFirstMultiItem; |
144 | KOAgendaItem *mNextMultiItem; | 143 | KOAgendaItem *mNextMultiItem; |
145 | KOAgendaItem *mLastMultiItem; | 144 | KOAgendaItem *mLastMultiItem; |
146 | 145 | ||
147 | int mFontPixelSize; | 146 | int mFontPixelSize; |
148 | Incidence *mIncidence; // corresponding event or todo | 147 | Incidence *mIncidence; // corresponding event or todo |
149 | QDate mDate; //date this events occurs (for recurrence) | 148 | QDate mDate; //date this events occurs (for recurrence) |
150 | //void showIcon( QLabel*, int ); | 149 | //void showIcon( QLabel*, int ); |
151 | //QLabel *mTodoIconLabel; | 150 | //QLabel *mTodoIconLabel; |
152 | //QLabel *mItemLabel; | 151 | //QLabel *mItemLabel; |
153 | //QWidget *mIconBox; | 152 | //QWidget *mIconBox; |
154 | //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; | 153 | //QLabel *mIconAlarm,*mIconRecur,*mIconReadonly; |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 5a63b35..f811fba 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -558,97 +558,97 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
558 | mAllDayAgenda, SLOT( deselectItem() ) ); | 558 | mAllDayAgenda, SLOT( deselectItem() ) ); |
559 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 559 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
560 | mAgenda, SLOT( deselectItem() ) ); | 560 | mAgenda, SLOT( deselectItem() ) ); |
561 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 561 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
562 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 562 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
563 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 563 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
564 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 564 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
565 | connect( mAgenda, SIGNAL( resizedSignal() ), | 565 | connect( mAgenda, SIGNAL( resizedSignal() ), |
566 | SLOT( updateConfig( ) ) ); | 566 | SLOT( updateConfig( ) ) ); |
567 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 567 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
568 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 568 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
569 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 569 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
570 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 570 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
571 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 571 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
572 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 572 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
573 | 573 | ||
574 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); | 574 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); |
575 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); | 575 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); |
576 | 576 | ||
577 | } | 577 | } |
578 | 578 | ||
579 | void KOAgendaView::toggleAllDay() | 579 | void KOAgendaView::toggleAllDay() |
580 | { | 580 | { |
581 | if ( mSplitterAgenda->firstHandle() ) | 581 | if ( mSplitterAgenda->firstHandle() ) |
582 | mSplitterAgenda->firstHandle()->toggle(); | 582 | mSplitterAgenda->firstHandle()->toggle(); |
583 | } | 583 | } |
584 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 584 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
585 | { | 585 | { |
586 | calendar()->addIncidence( inc ); | 586 | calendar()->addIncidence( inc ); |
587 | 587 | ||
588 | if ( incOld ) { | 588 | if ( incOld ) { |
589 | if ( incOld->typeID() == todoID ) | 589 | if ( incOld->typeID() == todoID ) |
590 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 590 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
591 | else | 591 | else |
592 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 592 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
593 | } | 593 | } |
594 | 594 | ||
595 | } | 595 | } |
596 | void KOAgendaView::categoryChanged(Incidence * inc) | 596 | void KOAgendaView::categoryChanged(Incidence * inc) |
597 | { | 597 | { |
598 | mAgenda->categoryChanged( inc ); | 598 | mAgenda->categoryChanged( inc ); |
599 | mAllDayAgenda->categoryChanged( inc ); | 599 | mAllDayAgenda->categoryChanged( inc ); |
600 | } | 600 | } |
601 | KOAgendaView::~KOAgendaView() | 601 | KOAgendaView::~KOAgendaView() |
602 | { | 602 | { |
603 | delete mAllAgendaPopup; | 603 | delete mAllAgendaPopup; |
604 | //delete mAllDayAgendaPopup; | 604 | //delete mAllDayAgendaPopup; |
605 | delete KOAgendaItem::paintPix(); | 605 | delete KOAgendaItem::paintPix(); |
606 | delete KOAgendaItem::paintPixSel(); | 606 | delete KOAgendaItem::paintPixAllday(); |
607 | } | 607 | } |
608 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 608 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
609 | { | 609 | { |
610 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 610 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
611 | bool uc = false; | 611 | bool uc = false; |
612 | int ow = e->oldSize().width(); | 612 | int ow = e->oldSize().width(); |
613 | int oh = e->oldSize().height(); | 613 | int oh = e->oldSize().height(); |
614 | int w = e->size().width(); | 614 | int w = e->size().width(); |
615 | int h = e->size().height(); | 615 | int h = e->size().height(); |
616 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 616 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
617 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 617 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
618 | uc = true; | 618 | uc = true; |
619 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 619 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
620 | } | 620 | } |
621 | mUpcomingWidth = e->size().width() ; | 621 | mUpcomingWidth = e->size().width() ; |
622 | if ( mBlockUpdating || uc ) { | 622 | if ( mBlockUpdating || uc ) { |
623 | mBlockUpdating = false; | 623 | mBlockUpdating = false; |
624 | //mAgenda->setMinimumSize(800 , 600 ); | 624 | //mAgenda->setMinimumSize(800 , 600 ); |
625 | //qDebug("mAgenda->resize+++++++++++++++ "); | 625 | //qDebug("mAgenda->resize+++++++++++++++ "); |
626 | updateConfig(); | 626 | updateConfig(); |
627 | //qDebug("KOAgendaView::Updating now possible "); | 627 | //qDebug("KOAgendaView::Updating now possible "); |
628 | } else | 628 | } else |
629 | createDayLabels(); | 629 | createDayLabels(); |
630 | //qDebug("resizeEvent end "); | 630 | //qDebug("resizeEvent end "); |
631 | 631 | ||
632 | } | 632 | } |
633 | void KOAgendaView::slotDaylabelClicked( int num ) | 633 | void KOAgendaView::slotDaylabelClicked( int num ) |
634 | { | 634 | { |
635 | 635 | ||
636 | QDate firstDate = mSelectedDates.first(); | 636 | QDate firstDate = mSelectedDates.first(); |
637 | if ( num == -1 ) | 637 | if ( num == -1 ) |
638 | emit showDateView( 6, firstDate ); | 638 | emit showDateView( 6, firstDate ); |
639 | else if (num >= 0 ) { | 639 | else if (num >= 0 ) { |
640 | if ( mSelectedDates.count() == 1) | 640 | if ( mSelectedDates.count() == 1) |
641 | emit showDateView( 9, firstDate.addDays( num ) ); | 641 | emit showDateView( 9, firstDate.addDays( num ) ); |
642 | else | 642 | else |
643 | emit showDateView( 3, firstDate.addDays( num ) ); | 643 | emit showDateView( 3, firstDate.addDays( num ) ); |
644 | } | 644 | } |
645 | else | 645 | else |
646 | showDateView( 10, firstDate.addDays(1) ); | 646 | showDateView( 10, firstDate.addDays(1) ); |
647 | } | 647 | } |
648 | 648 | ||
649 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 649 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
650 | { | 650 | { |
651 | 651 | ||
652 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 652 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
653 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 653 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
654 | mDayLabelsList.append( dayLabel ); | 654 | mDayLabelsList.append( dayLabel ); |