summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Unidiff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp72
1 files changed, 2 insertions, 70 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 36c66ea..0d36946 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -332,368 +332,326 @@ void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
332void EventIndicator::changeColumns(int columns) 332void EventIndicator::changeColumns(int columns)
333{ 333{
334 mColumns = columns; 334 mColumns = columns;
335 mEnabled.resize(mColumns); 335 mEnabled.resize(mColumns);
336 336
337 update(); 337 update();
338} 338}
339 339
340void EventIndicator::enableColumn(int column, bool enable) 340void EventIndicator::enableColumn(int column, bool enable)
341{ 341{
342 mEnabled[column] = enable; 342 mEnabled[column] = enable;
343} 343}
344 344
345 345
346//////////////////////////////////////////////////////////////////////////// 346////////////////////////////////////////////////////////////////////////////
347//////////////////////////////////////////////////////////////////////////// 347////////////////////////////////////////////////////////////////////////////
348//////////////////////////////////////////////////////////////////////////// 348////////////////////////////////////////////////////////////////////////////
349 349
350KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 350KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
351 KOEventView (cal,parent,name) 351 KOEventView (cal,parent,name)
352{ 352{
353 mBlockUpdating = true; 353 mBlockUpdating = true;
354 mStartHour = 8; 354 mStartHour = 8;
355 mSelectedDates.append(QDate::currentDate()); 355 mSelectedDates.append(QDate::currentDate());
356 356
357 mLayoutDayLabels = 0; 357 mLayoutDayLabels = 0;
358 mDayLabelsFrame = 0; 358 mDayLabelsFrame = 0;
359 mDayLabels = 0; 359 mDayLabels = 0;
360 bool isRTL = KOGlobals::self()->reverseLayout(); 360 bool isRTL = KOGlobals::self()->reverseLayout();
361 361
362 if ( KOPrefs::instance()->mVerticalScreen ) { 362 if ( KOPrefs::instance()->mVerticalScreen ) {
363 mExpandedPixmap = SmallIcon( "1downarrow" ); 363 mExpandedPixmap = SmallIcon( "1downarrow" );
364 mNotExpandedPixmap = SmallIcon( "1uparrow" ); 364 mNotExpandedPixmap = SmallIcon( "1uparrow" );
365 } else { 365 } else {
366 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); 366 mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" );
367 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); 367 mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" );
368 } 368 }
369 369
370 QBoxLayout *topLayout = new QVBoxLayout(this); 370 QBoxLayout *topLayout = new QVBoxLayout(this);
371 371
372 // Create day name labels for agenda columns 372 // Create day name labels for agenda columns
373 mDayLabelsFrame = new QHBox(this); 373 mDayLabelsFrame = new QHBox(this);
374 topLayout->addWidget(mDayLabelsFrame); 374 topLayout->addWidget(mDayLabelsFrame);
375 mDayLabels = new QFrame (mDayLabelsFrame); 375 mDayLabels = new QFrame (mDayLabelsFrame);
376 mLayoutDayLabels = new QHBoxLayout(mDayLabels); 376 mLayoutDayLabels = new QHBoxLayout(mDayLabels);
377 // Create agenda splitter 377 // Create agenda splitter
378#ifndef KORG_NOSPLITTER 378#ifndef KORG_NOSPLITTER
379 mSplitterAgenda = new QSplitter(Vertical,this); 379 mSplitterAgenda = new QSplitter(Vertical,this);
380 topLayout->addWidget(mSplitterAgenda); 380 topLayout->addWidget(mSplitterAgenda);
381 mSplitterAgenda->setOpaqueResize(); 381 mSplitterAgenda->setOpaqueResize();
382 382
383 mAllDayFrame = new QHBox(mSplitterAgenda); 383 mAllDayFrame = new QHBox(mSplitterAgenda);
384 384
385 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 385 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
386#else 386#else
387#if 0 387#if 0
388 QWidget *mainBox = new QWidget( this ); 388 QWidget *mainBox = new QWidget( this );
389 topLayout->addWidget( mainBox ); 389 topLayout->addWidget( mainBox );
390 QBoxLayout *mainLayout = new QVBoxLayout(mainBox); 390 QBoxLayout *mainLayout = new QVBoxLayout(mainBox);
391 mAllDayFrame = new QHBox(mainBox); 391 mAllDayFrame = new QHBox(mainBox);
392 mainLayout->addWidget(mAllDayFrame); 392 mainLayout->addWidget(mAllDayFrame);
393 mainLayout->setStretchFactor( mAllDayFrame, 0 ); 393 mainLayout->setStretchFactor( mAllDayFrame, 0 );
394 mAllDayFrame->setFocusPolicy(NoFocus); 394 mAllDayFrame->setFocusPolicy(NoFocus);
395 QWidget *agendaFrame = new QWidget(mainBox); 395 QWidget *agendaFrame = new QWidget(mainBox);
396 mainLayout->addWidget(agendaFrame); 396 mainLayout->addWidget(agendaFrame);
397 mainLayout->setStretchFactor( agendaFrame, 10 ); 397 mainLayout->setStretchFactor( agendaFrame, 10 );
398 398
399 agendaFrame->setFocusPolicy(NoFocus); 399 agendaFrame->setFocusPolicy(NoFocus);
400#endif 400#endif
401 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 401 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
402 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 402 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
403 topLayout->addWidget( mSplitterAgenda ); 403 topLayout->addWidget( mSplitterAgenda );
404 mAllDayFrame = new QHBox(mSplitterAgenda); 404 mAllDayFrame = new QHBox(mSplitterAgenda);
405 mAllDayFrame->setFocusPolicy(NoFocus); 405 mAllDayFrame->setFocusPolicy(NoFocus);
406 QWidget *agendaFrame = new QWidget(mSplitterAgenda); 406 QWidget *agendaFrame = new QWidget(mSplitterAgenda);
407 agendaFrame->setFocusPolicy(NoFocus); 407 agendaFrame->setFocusPolicy(NoFocus);
408 408
409#endif 409#endif
410 410
411 // Create all-day agenda widget 411 // Create all-day agenda widget
412 mDummyAllDayLeft = new QVBox( mAllDayFrame ); 412 mDummyAllDayLeft = new QVBox( mAllDayFrame );
413 413
414 mExpandButton = new QPushButton(mDummyAllDayLeft); 414 mExpandButton = new QPushButton(mDummyAllDayLeft);
415 mExpandButton->setPixmap( mNotExpandedPixmap ); 415 mExpandButton->setPixmap( mNotExpandedPixmap );
416 int widebut = mExpandButton->sizeHint().width(); 416 int widebut = mExpandButton->sizeHint().width();
417 if ( QApplication::desktop()->width() < 480 ) 417 if ( QApplication::desktop()->width() < 480 )
418 widebut = widebut*2; 418 widebut = widebut*2;
419 else 419 else
420 widebut = (widebut*3) / 2; 420 widebut = (widebut*3) / 2;
421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, 421 //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed,
422 // QSizePolicy::Fixed ) ); 422 // QSizePolicy::Fixed ) );
423 mExpandButton->setFixedSize( widebut, widebut); 423 mExpandButton->setFixedSize( widebut, widebut);
424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); 424 connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) );
425 mExpandButton->setFocusPolicy(NoFocus); 425 mExpandButton->setFocusPolicy(NoFocus);
426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame); 426 mAllDayAgenda = new KOAgenda(1,mAllDayFrame);
427 mAllDayAgenda->setFocusPolicy(NoFocus); 427 mAllDayAgenda->setFocusPolicy(NoFocus);
428 QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); 428 QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
429
430 mDummyAllDayRightL = new QLabel ( dummyAllDayRight );
431 QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight);
432 new QLabel ( dummyAllDayRight );
433 mDummyAllDayRightL->setSizePolicy( QSizePolicy( QSizePolicy::Minimum,QSizePolicy::Fixed ) );
434 dummyAllDayRightB->setFlat( true );
435 dummyAllDayRightB->setFocusPolicy(NoFocus);
436 dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 );
437
438 QPopupMenu * wpo = new QPopupMenu (this);
439 QPopupMenu * all = new QPopupMenu (this);
440 //wpo->insertItem( i18n("W#"), 0 );
441 int first = 1;
442 int i;
443 for ( i = 1; i < 50; ++i ) {
444 if ( !(i%10) ) {
445 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
446 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) );
447 first = i;
448 wpo = new QPopupMenu (this);
449 }
450 wpo->insertItem( QString::number(i), i );
451 }
452 for ( i = 50; i < 53; ++i ) {
453 wpo->insertItem( QString::number(i), i);
454 }
455 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
456 dummyAllDayRightB->setPopup( all );
457 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) );
458 429
459 // Create event context menu for all day agenda 430 // Create event context menu for all day agenda
460 mAllDayAgendaPopup = eventPopup(); 431 mAllDayAgendaPopup = eventPopup();
461 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 432 connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
462 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 433 mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
463 434
464 // Create agenda frame 435 // Create agenda frame
465 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); 436 QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3);
466 // QHBox *agendaFrame = new QHBox(splitterAgenda); 437 // QHBox *agendaFrame = new QHBox(splitterAgenda);
467 438
468 // create event indicator bars 439 // create event indicator bars
469 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); 440 mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame);
470 agendaLayout->addWidget(mEventIndicatorTop,0,1); 441 agendaLayout->addWidget(mEventIndicatorTop,0,1);
471 mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); 442 mEventIndicatorTop->setPaintWidget( mSplitterAgenda );
472 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, 443 mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom,
473 agendaFrame); 444 agendaFrame);
474 agendaLayout->addWidget(mEventIndicatorBottom,2,1); 445 agendaLayout->addWidget(mEventIndicatorBottom,2,1);
475 QWidget *dummyAgendaRight = new QWidget(agendaFrame); 446 QWidget *dummyAgendaRight = new QWidget(agendaFrame);
476 agendaLayout->addWidget(dummyAgendaRight,0,2); 447 agendaLayout->addWidget(dummyAgendaRight,0,2);
477 448
478 // Create time labels 449 // Create time labels
479 mTimeLabels = new TimeLabels(24,agendaFrame); 450 mTimeLabels = new TimeLabels(24,agendaFrame);
480 agendaLayout->addWidget(mTimeLabels,1,0); 451 agendaLayout->addWidget(mTimeLabels,1,0);
481 connect(mTimeLabels,SIGNAL( scaleChanged()), 452 connect(mTimeLabels,SIGNAL( scaleChanged()),
482 this,SLOT(updateConfig())); 453 this,SLOT(updateConfig()));
483 454
484 // Create agenda 455 // Create agenda
485 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); 456 mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame);
486 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); 457 agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2);
487 agendaLayout->setColStretch(1,1); 458 agendaLayout->setColStretch(1,1);
488 mAgenda->setFocusPolicy(NoFocus); 459 mAgenda->setFocusPolicy(NoFocus);
489 // Create event context menu for agenda 460 // Create event context menu for agenda
490 mAgendaPopup = eventPopup(); 461 mAgendaPopup = eventPopup();
491 462
492 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), 463 mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
493 i18n("Toggle Alarm"),mAgenda, 464 i18n("Toggle Alarm"),mAgenda,
494 SLOT(popupAlarm()),true); 465 SLOT(popupAlarm()),true);
495 466
496 467
497 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), 468 connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
498 mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); 469 mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
499 470
500 // make connections between dependent widgets 471 // make connections between dependent widgets
501 mTimeLabels->setAgenda(mAgenda); 472 mTimeLabels->setAgenda(mAgenda);
502 473
503 // Update widgets to reflect user preferences 474 // Update widgets to reflect user preferences
504 // updateConfig(); 475 // updateConfig();
505 476
506 // createDayLabels(); 477 // createDayLabels();
507 478
508 // these blank widgets make the All Day Event box line up with the agenda 479 // these blank widgets make the All Day Event box line up with the agenda
509 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 480 dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
510 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); 481 dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width());
511 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); 482 mDummyAllDayLeft->setFixedWidth(mTimeLabels->width());
512 483
513 // Scrolling 484 // Scrolling
514 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), 485 connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)),
515 mTimeLabels, SLOT(positionChanged())); 486 mTimeLabels, SLOT(positionChanged()));
516 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), 487 connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)),
517 SLOT(setContentsPos(int))); 488 SLOT(setContentsPos(int)));
518 489
519 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 490 connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
520 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); 491 connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate )));
521 492
522 // Create/Show/Edit/Delete Event 493 // Create/Show/Edit/Delete Event
523 connect(mAgenda,SIGNAL(newEventSignal(int,int)), 494 connect(mAgenda,SIGNAL(newEventSignal(int,int)),
524 SLOT(newEvent(int,int))); 495 SLOT(newEvent(int,int)));
525 connect(mAgenda,SIGNAL(newTodoSignal(int,int)), 496 connect(mAgenda,SIGNAL(newTodoSignal(int,int)),
526 SLOT(newTodo(int,int))); 497 SLOT(newTodo(int,int)));
527 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), 498 connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)),
528 SLOT(newEvent(int,int,int,int))); 499 SLOT(newEvent(int,int,int,int)));
529 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), 500 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)),
530 SLOT(newEventAllDay(int,int))); 501 SLOT(newEventAllDay(int,int)));
531 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), 502 connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)),
532 SLOT(newTodoAllDay(int,int))); 503 SLOT(newTodoAllDay(int,int)));
533 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), 504 connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)),
534 SLOT(newEventAllDay(int,int))); 505 SLOT(newEventAllDay(int,int)));
535 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 506 connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
536 SLOT(newTimeSpanSelected(int,int,int,int))); 507 SLOT(newTimeSpanSelected(int,int,int,int)));
537 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), 508 connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)),
538 SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); 509 SLOT(newTimeSpanSelectedAllDay(int,int,int,int)));
539 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 510 connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
540 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); 511 connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView()));
541 512
542 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 513 connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
543 SIGNAL(editIncidenceSignal(Incidence *))); 514 SIGNAL(editIncidenceSignal(Incidence *)));
544 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), 515 connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)),
545 SIGNAL(editIncidenceSignal(Incidence *))); 516 SIGNAL(editIncidenceSignal(Incidence *)));
546 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 517 connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
547 SIGNAL(showIncidenceSignal(Incidence *))); 518 SIGNAL(showIncidenceSignal(Incidence *)));
548 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), 519 connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)),
549 SIGNAL(showIncidenceSignal(Incidence *))); 520 SIGNAL(showIncidenceSignal(Incidence *)));
550 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 521 connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
551 SIGNAL(deleteIncidenceSignal(Incidence *))); 522 SIGNAL(deleteIncidenceSignal(Incidence *)));
552 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), 523 connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)),
553 SIGNAL(deleteIncidenceSignal(Incidence *))); 524 SIGNAL(deleteIncidenceSignal(Incidence *)));
554 525
555 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 526 connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
556 SLOT(updateEventDates(KOAgendaItem *, int ))); 527 SLOT(updateEventDates(KOAgendaItem *, int )));
557 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), 528 connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )),
558 SLOT(updateEventDates(KOAgendaItem *, int))); 529 SLOT(updateEventDates(KOAgendaItem *, int)));
559 530
560 // event indicator update 531 // event indicator update
561 connect(mAgenda,SIGNAL(lowerYChanged(int)), 532 connect(mAgenda,SIGNAL(lowerYChanged(int)),
562 SLOT(updateEventIndicatorTop(int))); 533 SLOT(updateEventIndicatorTop(int)));
563 connect(mAgenda,SIGNAL(upperYChanged(int)), 534 connect(mAgenda,SIGNAL(upperYChanged(int)),
564 SLOT(updateEventIndicatorBottom(int))); 535 SLOT(updateEventIndicatorBottom(int)));
565 // drag signals 536 // drag signals
566 /* 537 /*
567 connect(mAgenda,SIGNAL(startDragSignal(Event *)), 538 connect(mAgenda,SIGNAL(startDragSignal(Event *)),
568 SLOT(startDrag(Event *))); 539 SLOT(startDrag(Event *)));
569 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), 540 connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)),
570 SLOT(startDrag(Event *))); 541 SLOT(startDrag(Event *)));
571 */ 542 */
572 // synchronize selections 543 // synchronize selections
573 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 544 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
574 mAllDayAgenda, SLOT( deselectItem() ) ); 545 mAllDayAgenda, SLOT( deselectItem() ) );
575 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 546 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
576 mAgenda, SLOT( deselectItem() ) ); 547 mAgenda, SLOT( deselectItem() ) );
577 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 548 connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
578 SIGNAL( incidenceSelected( Incidence * ) ) ); 549 SIGNAL( incidenceSelected( Incidence * ) ) );
579 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), 550 connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ),
580 SIGNAL( incidenceSelected( Incidence * ) ) ); 551 SIGNAL( incidenceSelected( Incidence * ) ) );
581 connect( mAgenda, SIGNAL( resizedSignal() ), 552 connect( mAgenda, SIGNAL( resizedSignal() ),
582 SLOT( updateConfig( ) ) ); 553 SLOT( updateConfig( ) ) );
583 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), 554 connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ),
584 SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); 555 SLOT( addToCalSlot(Incidence *, Incidence * ) ) );
585 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), 556 connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ),
586 SLOT( addToCalSlot(Incidence * , Incidence *) ) ); 557 SLOT( addToCalSlot(Incidence * , Incidence *) ) );
587 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 558 // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
588 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); 559 //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) );
589 560
590 QFont dlf = KOPrefs::instance()->mTimeLabelsFont; 561
591 QFontMetrics fm ( dlf );
592 QString dayTest = "30";
593 int wid = fm.width( dayTest );
594 int maxWid = dummyAllDayRight->width()-2;
595 int fontPoint = dlf.pointSize();
596 while ( wid > maxWid ) {
597 --fontPoint;
598 dlf.setPointSize( fontPoint );
599 QFontMetrics f( dlf );
600 wid = f.width( dayTest );
601 }
602 mDummyAllDayRightL->setFont( dlf );
603 mDummyAllDayRightL->setAlignment( AlignHCenter );
604} 562}
605 563
606void KOAgendaView::toggleAllDay() 564void KOAgendaView::toggleAllDay()
607{ 565{
608 if ( mSplitterAgenda->firstHandle() ) 566 if ( mSplitterAgenda->firstHandle() )
609 mSplitterAgenda->firstHandle()->toggle(); 567 mSplitterAgenda->firstHandle()->toggle();
610} 568}
611void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) 569void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
612{ 570{
613 calendar()->addIncidence( inc ); 571 calendar()->addIncidence( inc );
614 572
615 if ( incOld ) { 573 if ( incOld ) {
616 if ( incOld->type() == "Todo" ) 574 if ( incOld->type() == "Todo" )
617 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); 575 emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED );
618 else 576 else
619 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); 577 emit incidenceChanged(incOld, KOGlobals::EVENTEDITED);
620 } 578 }
621 579
622} 580}
623 581
624KOAgendaView::~KOAgendaView() 582KOAgendaView::~KOAgendaView()
625{ 583{
626 delete mAgendaPopup; 584 delete mAgendaPopup;
627 delete mAllDayAgendaPopup; 585 delete mAllDayAgendaPopup;
628 delete KOAgendaItem::paintPix(); 586 delete KOAgendaItem::paintPix();
629 delete KOAgendaItem::paintPixSel(); 587 delete KOAgendaItem::paintPixSel();
630} 588}
631void KOAgendaView::resizeEvent( QResizeEvent* e ) 589void KOAgendaView::resizeEvent( QResizeEvent* e )
632{ 590{
633 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); 591 //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width());
634 bool uc = false; 592 bool uc = false;
635 int ow = e->oldSize().width(); 593 int ow = e->oldSize().width();
636 int oh = e->oldSize().height(); 594 int oh = e->oldSize().height();
637 int w = e->size().width(); 595 int w = e->size().width();
638 int h = e->size().height(); 596 int h = e->size().height();
639 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { 597 if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) {
640 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) 598 if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda )
641 uc = true; 599 uc = true;
642 //qDebug("view changed %d %d %d %d ", ow, oh , w , h); 600 //qDebug("view changed %d %d %d %d ", ow, oh , w , h);
643 } 601 }
644 mUpcomingWidth = e->size().width() ; 602 mUpcomingWidth = e->size().width() ;
645 if ( mBlockUpdating || uc ) { 603 if ( mBlockUpdating || uc ) {
646 mBlockUpdating = false; 604 mBlockUpdating = false;
647 //mAgenda->setMinimumSize(800 , 600 ); 605 //mAgenda->setMinimumSize(800 , 600 );
648 //qDebug("mAgenda->resize+++++++++++++++ "); 606 //qDebug("mAgenda->resize+++++++++++++++ ");
649 updateConfig(); 607 updateConfig();
650 //qDebug("KOAgendaView::Updating now possible "); 608 //qDebug("KOAgendaView::Updating now possible ");
651 } else 609 } else
652 createDayLabels(); 610 createDayLabels();
653 //qDebug("resizeEvent end "); 611 //qDebug("resizeEvent end ");
654 612
655} 613}
656void KOAgendaView::slotDaylabelClicked( int num ) 614void KOAgendaView::slotDaylabelClicked( int num )
657{ 615{
658 616
659 QDate firstDate = mSelectedDates.first(); 617 QDate firstDate = mSelectedDates.first();
660 if ( num == -1 ) 618 if ( num == -1 )
661 emit showDateView( 6, firstDate ); 619 emit showDateView( 6, firstDate );
662 else if (num >= 0 ) { 620 else if (num >= 0 ) {
663 if ( mSelectedDates.count() == 1) 621 if ( mSelectedDates.count() == 1)
664 emit showDateView( 9, firstDate.addDays( num ) ); 622 emit showDateView( 9, firstDate.addDays( num ) );
665 else 623 else
666 emit showDateView( 3, firstDate.addDays( num ) ); 624 emit showDateView( 3, firstDate.addDays( num ) );
667 } 625 }
668 else 626 else
669 showDateView( 10, firstDate.addDays(1) ); 627 showDateView( 10, firstDate.addDays(1) );
670} 628}
671 629
672KOAgendaButton* KOAgendaView::getNewDaylabel() 630KOAgendaButton* KOAgendaView::getNewDaylabel()
673{ 631{
674 632
675 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); 633 KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels);
676 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); 634 connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) );
677 mDayLabelsList.append( dayLabel ); 635 mDayLabelsList.append( dayLabel );
678 mLayoutDayLabels->addWidget(dayLabel); 636 mLayoutDayLabels->addWidget(dayLabel);
679 return dayLabel ; 637 return dayLabel ;
680} 638}
681 639
682void KOAgendaView::createDayLabels() 640void KOAgendaView::createDayLabels()
683{ 641{
684 642
685 if ( mBlockUpdating || globalFlagBlockLabel == 1) { 643 if ( mBlockUpdating || globalFlagBlockLabel == 1) {
686 // qDebug(" KOAgendaView::createDayLabels() blocked "); 644 // qDebug(" KOAgendaView::createDayLabels() blocked ");
687 return; 645 return;
688 646
689 } 647 }
690 int newHight; 648 int newHight;
691 649
692 // ### Before deleting and recreating we could check if mSelectedDates changed... 650 // ### Before deleting and recreating we could check if mSelectedDates changed...
693 // It would remove some flickering and gain speed (since this is called by 651 // It would remove some flickering and gain speed (since this is called by
694 // each updateView() call) 652 // each updateView() call)
695 653
696 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; 654 int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2;
697 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); 655 mDayLabelsFrame->setMaximumWidth( mUpcomingWidth );
698 if ( maxWid < 0 ) 656 if ( maxWid < 0 )
699 maxWid = 20; 657 maxWid = 20;
@@ -1015,218 +973,192 @@ void KOAgendaView::updateEventDates(KOAgendaItem *item, int type)
1015 if (item->lastMultiItem()) { 973 if (item->lastMultiItem()) {
1016 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 974 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1017 endDt.setDate(startDate. 975 endDt.setDate(startDate.
1018 addDays(item->lastMultiItem()->cellX() - item->cellX())); 976 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1019 } else { 977 } else {
1020 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 978 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1021 endDt.setDate(startDate); 979 endDt.setDate(startDate);
1022 } 980 }
1023 } 981 }
1024 } else { 982 } else {
1025 // todo 983 // todo
1026 if (item->lastMultiItem()) { 984 if (item->lastMultiItem()) {
1027 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); 985 endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1));
1028 endDt.setDate(startDate. 986 endDt.setDate(startDate.
1029 addDays(item->lastMultiItem()->cellX() - item->cellX())); 987 addDays(item->lastMultiItem()->cellX() - item->cellX()));
1030 } else { 988 } else {
1031 //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); 989 //qDebug("tem->cellYBottom() %d",item->cellYBottom() );
1032 if ( item->cellYBottom() > 0 ) 990 if ( item->cellYBottom() > 0 )
1033 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); 991 endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1));
1034 else 992 else
1035 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); 993 endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time());
1036 endDt.setDate(startDate); 994 endDt.setDate(startDate);
1037 } 995 }
1038 } 996 }
1039 } 997 }
1040 if ( item->incidence()->type() == "Event" ) { 998 if ( item->incidence()->type() == "Event" ) {
1041 item->incidence()->setDtStart(startDt); 999 item->incidence()->setDtStart(startDt);
1042 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); 1000 (static_cast<Event*>(item->incidence()))->setDtEnd(endDt);
1043 } else if ( item->incidence()->type() == "Todo" ) { 1001 } else if ( item->incidence()->type() == "Todo" ) {
1044 (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); 1002 (static_cast<Todo*>(item->incidence()))->setDtDue(endDt);
1045 } 1003 }
1046 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); 1004 //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() );
1047 item->incidence()->setRevision(item->incidence()->revision()+1); 1005 item->incidence()->setRevision(item->incidence()->revision()+1);
1048 item->setItemDate(startDt.date()); 1006 item->setItemDate(startDt.date());
1049 //item->updateItem(); 1007 //item->updateItem();
1050 if ( item->incidence()->type() == "Todo" ) { 1008 if ( item->incidence()->type() == "Todo" ) {
1051 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); 1009 emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED );
1052 1010
1053 } 1011 }
1054 else 1012 else
1055 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); 1013 emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED);
1056 item->updateItem(); 1014 item->updateItem();
1057} 1015}
1058 1016
1059void KOAgendaView::showDates( const QDate &start, const QDate &end ) 1017void KOAgendaView::showDates( const QDate &start, const QDate &end )
1060{ 1018{
1061 // kdDebug() << "KOAgendaView::selectDates" << endl; 1019 // kdDebug() << "KOAgendaView::selectDates" << endl;
1062 1020
1063 mSelectedDates.clear(); 1021 mSelectedDates.clear();
1064 // qDebug("KOAgendaView::showDates "); 1022 // qDebug("KOAgendaView::showDates ");
1065 QDate d = start; 1023 QDate d = start;
1066 while (d <= end) { 1024 while (d <= end) {
1067 mSelectedDates.append(d); 1025 mSelectedDates.append(d);
1068 d = d.addDays( 1 ); 1026 d = d.addDays( 1 );
1069 } 1027 }
1070 1028
1071 // and update the view 1029 // and update the view
1072 fillAgenda(); 1030 fillAgenda();
1073} 1031}
1074 1032
1075 1033
1076void KOAgendaView::showEvents(QPtrList<Event>) 1034void KOAgendaView::showEvents(QPtrList<Event>)
1077{ 1035{
1078 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1036 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1079} 1037}
1080 1038
1081void KOAgendaView::changeEventDisplay(Event *, int) 1039void KOAgendaView::changeEventDisplay(Event *, int)
1082{ 1040{
1083 // qDebug("KOAgendaView::changeEventDisplay "); 1041 // qDebug("KOAgendaView::changeEventDisplay ");
1084 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1042 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1085 // this should be re-written to be MUCH smarter. Right now we 1043 // this should be re-written to be MUCH smarter. Right now we
1086 // are just playing dumb. 1044 // are just playing dumb.
1087 fillAgenda(); 1045 fillAgenda();
1088} 1046}
1089 1047
1090void KOAgendaView::fillAgenda(const QDate &) 1048void KOAgendaView::fillAgenda(const QDate &)
1091{ 1049{
1092 // qDebug("KOAgendaView::fillAgenda "); 1050 // qDebug("KOAgendaView::fillAgenda ");
1093 fillAgenda(); 1051 fillAgenda();
1094} 1052}
1095 1053
1096void KOAgendaView::fillAgenda() 1054void KOAgendaView::fillAgenda()
1097{ 1055{
1098 if ( globalFlagBlockStartup ) 1056 if ( globalFlagBlockStartup )
1099 return; 1057 return;
1100 if ( globalFlagBlockAgenda == 1 ) 1058 if ( globalFlagBlockAgenda == 1 )
1101 return; 1059 return;
1102 //if ( globalFlagBlockAgenda == 2 ) 1060 //if ( globalFlagBlockAgenda == 2 )
1103 //globalFlagBlockAgenda = 0; 1061 //globalFlagBlockAgenda = 0;
1104 // globalFlagBlockPainting = false; 1062 // globalFlagBlockPainting = false;
1105 if ( globalFlagBlockAgenda == 0 ) 1063 if ( globalFlagBlockAgenda == 0 )
1106 globalFlagBlockAgenda = 1; 1064 globalFlagBlockAgenda = 1;
1107 // clearView(); 1065 // clearView();
1108 //qDebug("fillAgenda()++++ "); 1066 //qDebug("fillAgenda()++++ ");
1109 globalFlagBlockAgendaItemPaint = 1; 1067 globalFlagBlockAgendaItemPaint = 1;
1110 1068
1111 int weekNum = 0;
1112 QDate seda = mSelectedDates.first();
1113 QDate d = QDate ( seda.year(), 1,1);
1114 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1115 if ( seda.addDays(6).year() != seda.year() ) {
1116 if ( seda.year() != d.year() ) {
1117 if ( d.dayOfWeek() > 4 )
1118 d = QDate ( seda.year(), 1,1);
1119 else
1120 weekNum = 1;
1121 } else {
1122 QDate dd( seda.year()+1, 1,1);
1123 if ( dd.dayOfWeek() <= 4 )
1124 weekNum = 1;
1125 }
1126 }
1127 if ( weekNum == 0 ){
1128 int dow = d.dayOfWeek();
1129 if ( dow <= 4 )
1130 d = d.addDays( 1-dow );
1131 else // 5,6,7
1132 d = d.addDays( 8-dow );
1133 // we have the first week of the year.we are on monday
1134 weekNum = d.daysTo( seda ) / 7 +1;
1135 }
1136 mDummyAllDayRightL->setText( QString::number( weekNum) );
1137 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1069 mAllDayAgenda->changeColumns(mSelectedDates.count());
1138 mAgenda->changeColumns(mSelectedDates.count()); 1070 mAgenda->changeColumns(mSelectedDates.count());
1139 qApp->processEvents(); 1071 qApp->processEvents();
1140 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1072 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1141 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1073 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1142 setHolidayMasks(); 1074 setHolidayMasks();
1143 1075
1144 //mAgenda->hideUnused(); 1076 //mAgenda->hideUnused();
1145 //mAllDayAgenda->hideUnused(); 1077 //mAllDayAgenda->hideUnused();
1146 1078
1147 // mAgenda->blockNextRepaint( false ); 1079 // mAgenda->blockNextRepaint( false );
1148 // mAgenda->viewport()->repaint(); 1080 // mAgenda->viewport()->repaint();
1149 // mAgenda->blockNextRepaint( true ); 1081 // mAgenda->blockNextRepaint( true );
1150 mMinY.resize(mSelectedDates.count()); 1082 mMinY.resize(mSelectedDates.count());
1151 mMaxY.resize(mSelectedDates.count()); 1083 mMaxY.resize(mSelectedDates.count());
1152 1084
1153 QPtrList<Event> dayEvents; 1085 QPtrList<Event> dayEvents;
1154 1086
1155 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1087 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1156 // Therefore, gtodoset all of them. 1088 // Therefore, gtodoset all of them.
1157 QPtrList<Todo> todos = calendar()->todos(); 1089 QPtrList<Todo> todos = calendar()->todos();
1158 1090
1159 mAgenda->setDateList(mSelectedDates); 1091 mAgenda->setDateList(mSelectedDates);
1160 1092
1161 QDate today = QDate::currentDate(); 1093 QDate today = QDate::currentDate();
1162 1094
1163 DateList::ConstIterator dit; 1095 DateList::ConstIterator dit;
1164 int curCol = 0; 1096 int curCol = 0;
1165 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { 1097 for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
1166 QDate currentDate = *dit; 1098 QDate currentDate = *dit;
1167 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() 1099 // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString()
1168 // << endl; 1100 // << endl;
1169 1101
1170 dayEvents = calendar()->events(currentDate,true); 1102 dayEvents = calendar()->events(currentDate,true);
1171 1103
1172 // Default values, which can never be reached 1104 // Default values, which can never be reached
1173 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; 1105 mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1;
1174 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; 1106 mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1;
1175 1107
1176 unsigned int numEvent; 1108 unsigned int numEvent;
1177 for(numEvent=0;numEvent<dayEvents.count();++numEvent) { 1109 for(numEvent=0;numEvent<dayEvents.count();++numEvent) {
1178 Event *event = dayEvents.at(numEvent); 1110 Event *event = dayEvents.at(numEvent);
1179 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) 1111 if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") )
1180 if ( event->uid().left(15) == QString("last-syncEvent-") ) 1112 if ( event->uid().left(15) == QString("last-syncEvent-") )
1181 continue; 1113 continue;
1182 // kdDebug() << " Event: " << event->summary() << endl; 1114 // kdDebug() << " Event: " << event->summary() << endl;
1183 1115
1184 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; 1116 int beginX = currentDate.daysTo(event->dtStart().date()) + curCol;
1185 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; 1117 int endX = currentDate.daysTo(event->dtEnd().date()) + curCol;
1186 1118
1187 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; 1119 // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl;
1188 1120
1189 if (event->doesFloat()) { 1121 if (event->doesFloat()) {
1190 if (event->recurrence()->doesRecur()) { 1122 if (event->recurrence()->doesRecur()) {
1191 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); 1123 mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol);
1192 } else { 1124 } else {
1193 if (beginX <= 0 && curCol == 0) { 1125 if (beginX <= 0 && curCol == 0) {
1194 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1126 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1195 } else if (beginX == curCol) { 1127 } else if (beginX == curCol) {
1196 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); 1128 mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX);
1197 } 1129 }
1198 } 1130 }
1199 } else if (event->isMultiDay()) { 1131 } else if (event->isMultiDay()) {
1200 if ( event->doesRecur () ) { 1132 if ( event->doesRecur () ) {
1201 QDate dateit = currentDate; 1133 QDate dateit = currentDate;
1202 int count = 0; 1134 int count = 0;
1203 int max = event->dtStart().daysTo( event->dtEnd() ) +2; 1135 int max = event->dtStart().daysTo( event->dtEnd() ) +2;
1204 while (! event->recursOn( dateit ) && count <= max ) { 1136 while (! event->recursOn( dateit ) && count <= max ) {
1205 ++count; 1137 ++count;
1206 dateit = dateit.addDays( -1 ); 1138 dateit = dateit.addDays( -1 );
1207 } 1139 }
1208 bool ok; 1140 bool ok;
1209 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); 1141 QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok );
1210 if ( ok ) 1142 if ( ok )
1211 { 1143 {
1212 int secs = event->dtStart().secsTo( event->dtEnd() ); 1144 int secs = event->dtStart().secsTo( event->dtEnd() );
1213 QDateTime nextOcend =nextOcstart.addSecs( secs ); ; 1145 QDateTime nextOcend =nextOcstart.addSecs( secs ); ;
1214 beginX = currentDate.daysTo(nextOcstart.date()) + curCol; 1146 beginX = currentDate.daysTo(nextOcstart.date()) + curCol;
1215 endX = currentDate.daysTo(nextOcend.date()) + curCol; 1147 endX = currentDate.daysTo(nextOcend.date()) + curCol;
1216 1148
1217 } 1149 }
1218 } 1150 }
1219 int startY = mAgenda->timeToY(event->dtStart().time()); 1151 int startY = mAgenda->timeToY(event->dtStart().time());
1220 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; 1152 int endY = mAgenda->timeToY(event->dtEnd().time()) - 1;
1221 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); 1153 //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol );
1222 if ((beginX <= 0 && curCol == 0) || beginX == curCol) { 1154 if ((beginX <= 0 && curCol == 0) || beginX == curCol) {
1223 //qDebug("insert!!! "); 1155 //qDebug("insert!!! ");
1224 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); 1156 mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY);
1225 } 1157 }
1226 if (beginX == curCol) { 1158 if (beginX == curCol) {
1227 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); 1159 mMaxY[curCol] = mAgenda->timeToY(QTime(23,59));
1228 if (startY < mMinY[curCol]) mMinY[curCol] = startY; 1160 if (startY < mMinY[curCol]) mMinY[curCol] = startY;
1229 } else if (endX == curCol) { 1161 } else if (endX == curCol) {
1230 mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); 1162 mMinY[curCol] = mAgenda->timeToY(QTime(0,0));
1231 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; 1163 if (endY > mMaxY[curCol]) mMaxY[curCol] = endY;
1232 } else { 1164 } else {