summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp24
-rw-r--r--korganizer/koagendaitem.h1
-rw-r--r--korganizer/koagendaview.cpp2
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
@@ -251,386 +251,382 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
251 if (mIncidence->isReadOnly()) { 251 if (mIncidence->isReadOnly()) {
252 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 252 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
253 if ( horLayout ) 253 if ( horLayout )
254 ++xOff; 254 ++xOff;
255 else 255 else
256 ++yOff; 256 ++yOff;
257 } 257 }
258 258
259 if (mIncidence->attendeeCount()>0) { 259 if (mIncidence->attendeeCount()>0) {
260 260
261 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 261 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 262 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
263 if ( horLayout ) 263 if ( horLayout )
264 ++xOff; 264 ++xOff;
265 else 265 else
266 ++yOff; 266 ++yOff;
267 } else { 267 } else {
268 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 268 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
269 if (me!=0) { 269 if (me!=0) {
270 270
271 271
272 } else { 272 } else {
273 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 273 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
274 if ( horLayout ) 274 if ( horLayout )
275 ++xOff; 275 ++xOff;
276 else 276 else
277 ++yOff; 277 ++yOff;
278 278
279 } 279 }
280 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 280 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
281 if ( horLayout ) 281 if ( horLayout )
282 ++xOff; 282 ++xOff;
283 else 283 else
284 ++yOff; 284 ++yOff;
285 285
286 } 286 }
287 287
288 } 288 }
289 return ( yOff || xOff ); 289 return ( yOff || xOff );
290} 290}
291 291
292 292
293void KOAgendaItem::select(bool selected) 293void KOAgendaItem::select(bool selected)
294{ 294{
295 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); 295 //qDebug("select %d %d",firstMultiItem(), nextMultiItem() );
296 if (mSelected == selected) return; 296 if (mSelected == selected) return;
297 mSelected = selected; 297 mSelected = selected;
298 if ( ! isVisible() ) 298 if ( ! isVisible() )
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*/
321bool KOAgendaItem::eventFilter ( QObject *object, QEvent *e ) 321bool 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}
336void KOAgendaItem::repaintMe( ) 336void KOAgendaItem::repaintMe( )
337{ 337{
338 paintMe ( mSelected ); 338 paintMe ( mSelected );
339} 339}
340void KOAgendaItem::paintMe( bool selected, QPainter* paint ) 340void 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 {
409 x += 2; yy += 1;w -= 4; h-= 4; 412 x += 2; yy += 1;w -= 4; h-= 4;
410 if ( nfh < 6.01 ) { 413 if ( nfh < 6.01 ) {
411 yy -= 2; 414 yy -= 2;
412 h += 4; 415 h += 4;
413 } 416 }
414 else 417 else
415 if ( nfh < h -2 ) 418 if ( nfh < h -2 )
416 ++yy; 419 ++yy;
417 } 420 }
418 int align; 421 int align;
419#ifndef DESKTOP_VERSION 422#ifndef DESKTOP_VERSION
420 align = ( AlignLeft|WordBreak|AlignTop); 423 align = ( AlignLeft|WordBreak|AlignTop);
421#else 424#else
422 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); 425 align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop);
423#endif 426#endif
424 if ( addIcon ) { 427 if ( addIcon ) {
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}
470void KOAgendaItem::resizePixmap( int w , int h ) 473void 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}
476QPixmap * KOAgendaItem::paintPix() 478QPixmap * 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}
486QPixmap * KOAgendaItem::paintPixAllday() 488QPixmap * 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}
496QPixmap * 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}
506void KOAgendaItem::paintEvent ( QPaintEvent *e ) 499void 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}
568void KOAgendaItem::computeText() 564void 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 }
589 } 585 }
590 } 586 }
591 } 587 }
592 588
593 if ( !mIncidence->location().isEmpty() ) { 589 if ( !mIncidence->location().isEmpty() ) {
594 if ( mAllDay ) 590 if ( mAllDay )
595 mDisplayedText += " ("; 591 mDisplayedText += " (";
596 else 592 else
597 mDisplayedText += "\n("; 593 mDisplayedText += "\n(";
598 mDisplayedText += mIncidence->location() +")"; 594 mDisplayedText += mIncidence->location() +")";
599 } 595 }
600#ifdef DESKTOP_VERSION 596#ifdef DESKTOP_VERSION
601 QString tipText = mIncidence->summary(); 597 QString tipText = mIncidence->summary();
602 if ( !mIncidence->doesFloat() ) { 598 if ( !mIncidence->doesFloat() ) {
603 if ( mIncidence->typeID() == eventID ) { 599 if ( mIncidence->typeID() == eventID ) {
604 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { 600 if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) {
605 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); 601 tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr();
606 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); 602 tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr();
607 } 603 }
608 else { 604 else {
609 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); 605 tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr();
610 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); 606 tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr();
611 } 607 }
612 } 608 }
613 else if ( mIncidence->typeID() == todoID ) { 609 else if ( mIncidence->typeID() == todoID ) {
614 if (mIncidence->hasStartDate()) 610 if (mIncidence->hasStartDate())
615 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr(); 611 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartStr();
616 if (((Todo*)mIncidence)->hasDueDate()) 612 if (((Todo*)mIncidence)->hasDueDate())
617 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr(); 613 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueStr();
618 } 614 }
619 } else if ( mIncidence->typeID() == todoID ) { 615 } else if ( mIncidence->typeID() == todoID ) {
620 if (mIncidence->hasStartDate()) 616 if (mIncidence->hasStartDate())
621 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr(); 617 tipText += "\n"+i18n("Start: ")+ (static_cast<Todo*>(mIncidence))->dtStartDateStr();
622 if (((Todo*)mIncidence)->hasDueDate()) 618 if (((Todo*)mIncidence)->hasDueDate())
623 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr(); 619 tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueDateStr();
624 } 620 }
625 621
626 if (!mIncidence->location().isEmpty()) { 622 if (!mIncidence->location().isEmpty()) {
627 tipText += "\n"+i18n("Location: ")+mIncidence->location(); 623 tipText += "\n"+i18n("Location: ")+mIncidence->location();
628 } 624 }
629 QToolTip::add(this,tipText,toolTipGroup(),""); 625 QToolTip::add(this,tipText,toolTipGroup(),"");
630#endif 626#endif
631} 627}
632void KOAgendaItem::updateItem() 628void KOAgendaItem::updateItem()
633{ 629{
634 computeText(); 630 computeText();
635 631
636 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y()); 632 //qDebug("KOAgendaItem:: updateItem() %s %d %d ",incidence()->summary().latin1(), x(), y());
diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h
index dc2316a..7103abe 100644
--- a/korganizer/koagendaitem.h
+++ b/korganizer/koagendaitem.h
@@ -10,157 +10,156 @@
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18*/ 18*/
19#ifndef KOAGENDAITEM_H 19#ifndef KOAGENDAITEM_H
20#define KOAGENDAITEM_H 20#define KOAGENDAITEM_H
21 21
22#include <qframe.h> 22#include <qframe.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qpixmap.h> 24#include <qpixmap.h>
25#include <qdatetime.h> 25#include <qdatetime.h>
26#include <qpalette.h> 26#include <qpalette.h>
27 27
28#include <libkcal/incidence.h> 28#include <libkcal/incidence.h>
29 29
30class KOAgendaItemWhatsThis; 30class KOAgendaItemWhatsThis;
31class QToolTipGroup; 31class QToolTipGroup;
32class QDragEnterEvent; 32class QDragEnterEvent;
33class QDropEvent; 33class QDropEvent;
34 34
35using namespace KCal; 35using namespace KCal;
36 36
37/* 37/*
38 The KOAgendaItem has to make sure that it receives all mouse events, which are 38 The KOAgendaItem has to make sure that it receives all mouse events, which are
39 to be used for dragging and resizing. That means it has to be installed as 39 to be used for dragging and resizing. That means it has to be installed as
40 eventfiler for its children, if it has children, and it has to pass mouse 40 eventfiler for its children, if it has children, and it has to pass mouse
41 events from the cildren to itself. See eventFilter(). 41 events from the cildren to itself. See eventFilter().
42*/ 42*/
43class KOAgendaItem : public QWidget 43class KOAgendaItem : public QWidget
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 public: 46 public:
47 KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0, 47 KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent, bool allday, const char *name=0,
48 WFlags f=0 ); 48 WFlags f=0 );
49 ~KOAgendaItem(); 49 ~KOAgendaItem();
50 QString getWhatsThisText(); 50 QString getWhatsThisText();
51 void init ( Incidence *incidence, QDate qd ); 51 void init ( Incidence *incidence, QDate qd );
52 int cellX() { return mCellX; } 52 int cellX() { return mCellX; }
53 int cellXWidth() { return mCellXWidth; } 53 int cellXWidth() { return mCellXWidth; }
54 int cellYTop() { return mCellYTop; } 54 int cellYTop() { return mCellYTop; }
55 int cellYBottom() { return mCellYBottom; } 55 int cellYBottom() { return mCellYBottom; }
56 int cellHeight(); 56 int cellHeight();
57 int cellWidth(); 57 int cellWidth();
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;
155 //QLabel *mIconReply,*mIconGroup,*mIconOrganizer; 154 //QLabel *mIconReply,*mIconGroup,*mIconOrganizer;
156 //QLabel *mIconMoreInfo; 155 //QLabel *mIconMoreInfo;
157 static QToolTipGroup *mToolTipGroup; 156 static QToolTipGroup *mToolTipGroup;
158 157
159 QColor mBackgroundColor; 158 QColor mBackgroundColor;
160 QColorGroup mColorGroup; 159 QColorGroup mColorGroup;
161 QString mDisplayedText; 160 QString mDisplayedText;
162 bool mSelected; 161 bool mSelected;
163 QPtrList<KOAgendaItem> mConflictItems; 162 QPtrList<KOAgendaItem> mConflictItems;
164}; 163};
165 164
166#endif // KOAGENDAITEM_H 165#endif // KOAGENDAITEM_H
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 5a63b35..f811fba 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -510,193 +510,193 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
510 SLOT(newTodo(int,int))); 510 SLOT(newTodo(int,int)));
511 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 511 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
512 SLOT(newEvent(int,int,int,int))); 512 SLOT(newEvent(int,int,int,int)));
513 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 513 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
514 SLOT(newEventAllDay(int,int))); 514 SLOT(newEventAllDay(int,int)));
515 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), 515 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
516 SLOT(newTodoAllDay(int,int))); 516 SLOT(newTodoAllDay(int,int)));
517 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 517 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
518 SLOT(newEventAllDay(int,int))); 518 SLOT(newEventAllDay(int,int)));
519 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 519 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
520 SLOT(newTimeSpanSelected(int,int,int,int))); 520 SLOT(newTimeSpanSelected(int,int,int,int)));
521 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 521 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
522 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 522 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
523 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 523 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
524 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 524 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
525 525
526 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 526 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
527 SIGNAL(editIncidenceSignal(Incidence *))); 527 SIGNAL(editIncidenceSignal(Incidence *)));
528 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 528 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
529 SIGNAL(editIncidenceSignal(Incidence *))); 529 SIGNAL(editIncidenceSignal(Incidence *)));
530 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 530 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
531 SIGNAL(showIncidenceSignal(Incidence *))); 531 SIGNAL(showIncidenceSignal(Incidence *)));
532 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 532 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
533 SIGNAL(showIncidenceSignal(Incidence *))); 533 SIGNAL(showIncidenceSignal(Incidence *)));
534 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 534 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
535 SIGNAL(deleteIncidenceSignal(Incidence *))); 535 SIGNAL(deleteIncidenceSignal(Incidence *)));
536 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 536 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
537 SIGNAL(deleteIncidenceSignal(Incidence *))); 537 SIGNAL(deleteIncidenceSignal(Incidence *)));
538 538
539 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 539 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
540 SLOT(updateEventDates(KOAgendaItem *, int ))); 540 SLOT(updateEventDates(KOAgendaItem *, int )));
541 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 541 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
542 SLOT(updateEventDates(KOAgendaItem *, int))); 542 SLOT(updateEventDates(KOAgendaItem *, int)));
543 543
544 // event indicator update 544 // event indicator update
545 connect(mAgenda,SIGNAL(lowerYChanged(int)), 545 connect(mAgenda,SIGNAL(lowerYChanged(int)),
546 SLOT(updateEventIndicatorTop(int))); 546 SLOT(updateEventIndicatorTop(int)));
547 connect(mAgenda,SIGNAL(upperYChanged(int)), 547 connect(mAgenda,SIGNAL(upperYChanged(int)),
548 SLOT(updateEventIndicatorBottom(int))); 548 SLOT(updateEventIndicatorBottom(int)));
549 // drag signals 549 // drag signals
550 /* 550 /*
551 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 551 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
552 SLOT(startDrag(Event *))); 552 SLOT(startDrag(Event *)));
553 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 553 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
554 SLOT(startDrag(Event *))); 554 SLOT(startDrag(Event *)));
555 */ 555 */
556 // synchronize selections 556 // synchronize selections
557 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 557 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
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
579void KOAgendaView::toggleAllDay() 579void KOAgendaView::toggleAllDay()
580{ 580{
581 if ( mSplitterAgenda->firstHandle() ) 581 if ( mSplitterAgenda->firstHandle() )
582 mSplitterAgenda->firstHandle()->toggle(); 582 mSplitterAgenda->firstHandle()->toggle();
583} 583}
584void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 584void 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}
596void KOAgendaView::categoryChanged(Incidence * inc) 596void KOAgendaView::categoryChanged(Incidence * inc)
597{ 597{
598 mAgenda->categoryChanged( inc ); 598 mAgenda->categoryChanged( inc );
599 mAllDayAgenda->categoryChanged( inc ); 599 mAllDayAgenda->categoryChanged( inc );
600} 600}
601KOAgendaView::~KOAgendaView() 601KOAgendaView::~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}
608void KOAgendaView::resizeEvent( QResizeEvent* e ) 608void 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}
633void KOAgendaView::slotDaylabelClicked( int num ) 633void 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
649KOAgendaButton* KOAgendaView::getNewDaylabel() 649KOAgendaButton* 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 );
655 mLayoutDayLabels->addWidget(dayLabel); 655 mLayoutDayLabels->addWidget(dayLabel);
656 return dayLabel ; 656 return dayLabel ;
657} 657}
658 658
659void KOAgendaView::createDayLabels() 659void KOAgendaView::createDayLabels()
660{ 660{
661 661
662 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 662 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
663 // qDebug(" KOAgendaView::createDayLabels() blocked "); 663 // qDebug(" KOAgendaView::createDayLabels() blocked ");
664 return; 664 return;
665 665
666 } 666 }
667 int newHight; 667 int newHight;
668 if ( !mSelectedDates.count()) 668 if ( !mSelectedDates.count())
669 return; 669 return;
670 670
671 // ### Before deleting and recreating we could check if mSelectedDates changed... 671 // ### Before deleting and recreating we could check if mSelectedDates changed...
672 // It would remove some flickering and gain speed (since this is called by 672 // It would remove some flickering and gain speed (since this is called by
673 // each updateView() call) 673 // each updateView() call)
674 674
675 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2; 675 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - mAgenda->frameWidth()*2;
676 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); 676 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
677 if ( maxWid < 20 ) 677 if ( maxWid < 20 )
678 maxWid = 20; 678 maxWid = 20;
679 679
680 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 680 QFont dlf = KOPrefs::instance()->mTimeLabelsFont;
681 QFontMetrics fm ( dlf ); 681 QFontMetrics fm ( dlf );
682 dlf.setBold( true ); 682 dlf.setBold( true );
683 int selCount = mSelectedDates.count(); 683 int selCount = mSelectedDates.count();
684 int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1; 684 int widModulo = maxWid - (mAgenda->gridSpacingX() * selCount)+1;
685 QString dayTest = "Mon 20"; 685 QString dayTest = "Mon 20";
686 //QString dayTest = "Mon 20"; 686 //QString dayTest = "Mon 20";
687 int wid = fm.width( dayTest ); 687 int wid = fm.width( dayTest );
688 //maxWid -= ( selCount * 3 ); //working for QLabels 688 //maxWid -= ( selCount * 3 ); //working for QLabels
689 if ( QApplication::desktop()->width() <= 320 ) 689 if ( QApplication::desktop()->width() <= 320 )
690 maxWid -= ( selCount * 3 ); //working for QPushButton 690 maxWid -= ( selCount * 3 ); //working for QPushButton
691 else 691 else
692 maxWid -= ( selCount * 4 ); //working for QPushButton 692 maxWid -= ( selCount * 4 ); //working for QPushButton
693 if ( maxWid < 0 ) 693 if ( maxWid < 0 )
694 maxWid = 20; 694 maxWid = 20;
695 int needWid = wid * selCount; 695 int needWid = wid * selCount;
696 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); 696 //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid );
697 //if ( needWid > maxWid ) 697 //if ( needWid > maxWid )
698 // qDebug("DAYLABELS TOOOOOOO BIG "); 698 // qDebug("DAYLABELS TOOOOOOO BIG ");
699 while ( needWid > maxWid ) { 699 while ( needWid > maxWid ) {
700 dayTest = dayTest.left( dayTest.length() - 1 ); 700 dayTest = dayTest.left( dayTest.length() - 1 );
701 wid = fm.width( dayTest ); 701 wid = fm.width( dayTest );
702 needWid = wid * selCount; 702 needWid = wid * selCount;