-rw-r--r-- | korganizer/calendarview.cpp | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 65750af..426e8f9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -408,554 +408,569 @@ void CalendarView::init() | |||
408 | #ifdef KORG_NORESOURCEVIEW | 408 | #ifdef KORG_NORESOURCEVIEW |
409 | mResourceView = 0; | 409 | mResourceView = 0; |
410 | #else | 410 | #else |
411 | if ( mResourceManager ) { | 411 | if ( mResourceManager ) { |
412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 412 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
413 | mResourceView->updateView(); | 413 | mResourceView->updateView(); |
414 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 414 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
415 | SLOT( updateView() ) ); | 415 | SLOT( updateView() ) ); |
416 | } else { | 416 | } else { |
417 | mResourceView = 0; | 417 | mResourceView = 0; |
418 | } | 418 | } |
419 | #endif | 419 | #endif |
420 | QWidget *rightBox = new QWidget( mPanner ); | 420 | QWidget *rightBox = new QWidget( mPanner ); |
421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 421 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
422 | 422 | ||
423 | mRightFrame = new QWidgetStack( rightBox ); | 423 | mRightFrame = new QWidgetStack( rightBox ); |
424 | rightLayout->addWidget( mRightFrame, 1 ); | 424 | rightLayout->addWidget( mRightFrame, 1 ); |
425 | 425 | ||
426 | mLeftFrame = mLeftSplitter; | 426 | mLeftFrame = mLeftSplitter; |
427 | #else | 427 | #else |
428 | //QWidget *mainBox = new QWidget( this ); | 428 | //QWidget *mainBox = new QWidget( this ); |
429 | //QWidget *leftFrame = new QWidget( mainBox ); | 429 | //QWidget *leftFrame = new QWidget( mainBox ); |
430 | //QBoxLayout * mainBoxLayout; | 430 | //QBoxLayout * mainBoxLayout; |
431 | if ( KOPrefs::instance()->mVerticalScreen ) { | 431 | if ( KOPrefs::instance()->mVerticalScreen ) { |
432 | //mainBoxLayout = new QVBoxLayout(mainBox); | 432 | //mainBoxLayout = new QVBoxLayout(mainBox); |
433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); | 433 | //leftFrameLayout = new QHBoxLayout(leftFrame ); |
434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); | 434 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); |
435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 435 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; | 436 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; |
437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 437 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
438 | } else { | 438 | } else { |
439 | //mainBoxLayout = new QHBoxLayout(mainBox); | 439 | //mainBoxLayout = new QHBoxLayout(mainBox); |
440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); | 440 | //leftFrameLayout = new QVBoxLayout(leftFrame ); |
441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 441 | mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); | 442 | mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); |
443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); | 443 | mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); |
444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 444 | mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
445 | } | 445 | } |
446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); | 446 | mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); |
447 | //QBoxLayout * leftFrameLayout; | 447 | //QBoxLayout * leftFrameLayout; |
448 | topLayout->addWidget( mMainFrame ); | 448 | topLayout->addWidget( mMainFrame ); |
449 | #ifdef DESKTOP_VERSION | 449 | #ifdef DESKTOP_VERSION |
450 | mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); | 450 | mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); |
451 | topLayout->addWidget( mDateScrollBar ); | 451 | topLayout->addWidget( mDateScrollBar ); |
452 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); | 452 | connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); |
453 | if ( QApplication::desktop()->width() < 800 ) | 453 | if ( QApplication::desktop()->width() < 800 ) |
454 | mDateScrollBar->hide(); | 454 | mDateScrollBar->hide(); |
455 | #endif | 455 | #endif |
456 | //mainBoxLayout->addWidget (mLeftFrame); | 456 | //mainBoxLayout->addWidget (mLeftFrame); |
457 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, | 457 | mDateNavigator = new DateNavigatorContainer( mLeftFrame, |
458 | "CalendarView::DateNavigator" ); | 458 | "CalendarView::DateNavigator" ); |
459 | #if 0 | 459 | #if 0 |
460 | // FIXME | 460 | // FIXME |
461 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, | 461 | mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, |
462 | "CalendarView::DateNavigator", QDate::currentDate()); | 462 | "CalendarView::DateNavigator", QDate::currentDate()); |
463 | #endif | 463 | #endif |
464 | // mDateNavigator->blockSignals( true ); | 464 | // mDateNavigator->blockSignals( true ); |
465 | //leftFrameLayout->addWidget( mDateNavigator ); | 465 | //leftFrameLayout->addWidget( mDateNavigator ); |
466 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); | 466 | mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); |
467 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); | 467 | mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); |
468 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); | 468 | mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); |
469 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); | 469 | connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); |
470 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); | 470 | connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); |
471 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); | 471 | connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),this, SLOT( setCalReadOnly(int,bool)) ); |
472 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); | 472 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); |
473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); | 473 | connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); |
474 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); | 474 | connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); |
475 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); | 475 | connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); |
476 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); | 476 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); |
477 | connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); | 477 | connect( mCalEditView, SIGNAL( checkCalendar() ),this, SLOT( checkFiles() )); |
478 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); | 478 | connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); |
479 | 479 | ||
480 | mTodoList->setNavigator( mNavigator ); | 480 | mTodoList->setNavigator( mNavigator ); |
481 | #if 0 | 481 | #if 0 |
482 | if ( QApplication::desktop()->width() < 480 ) { | 482 | if ( QApplication::desktop()->width() < 480 ) { |
483 | leftFrameLayout->addWidget(mFilterView); | 483 | leftFrameLayout->addWidget(mFilterView); |
484 | leftFrameLayout->addWidget(mTodoList, 2 ); | 484 | leftFrameLayout->addWidget(mTodoList, 2 ); |
485 | 485 | ||
486 | } else { | 486 | } else { |
487 | leftFrameLayout->addWidget(mTodoList,2 ); | 487 | leftFrameLayout->addWidget(mTodoList,2 ); |
488 | leftFrameLayout->addWidget(mFilterView ); | 488 | leftFrameLayout->addWidget(mFilterView ); |
489 | } | 489 | } |
490 | #endif | 490 | #endif |
491 | mFilterView->hide(); | 491 | mFilterView->hide(); |
492 | mCalEditView->hide(); | 492 | mCalEditView->hide(); |
493 | QWidget *rightBox = new QWidget( mMainFrame ); | 493 | QWidget *rightBox = new QWidget( mMainFrame ); |
494 | //mainBoxLayout->addWidget ( rightBox, 10 ); | 494 | //mainBoxLayout->addWidget ( rightBox, 10 ); |
495 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); | 495 | QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); |
496 | mRightFrame = new QWidgetStack( rightBox ); | 496 | mRightFrame = new QWidgetStack( rightBox ); |
497 | rightLayout->addWidget( mRightFrame, 10 ); | 497 | rightLayout->addWidget( mRightFrame, 10 ); |
498 | 498 | ||
499 | //mLeftFrame = (QWidget *)leftFrame; | 499 | //mLeftFrame = (QWidget *)leftFrame; |
500 | if ( KOPrefs::instance()->mVerticalScreen ) { | 500 | if ( KOPrefs::instance()->mVerticalScreen ) { |
501 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); | 501 | //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); |
502 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); | 502 | //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); |
503 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); | 503 | //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); |
504 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); | 504 | //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); |
505 | } else { | 505 | } else { |
506 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); | 506 | //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); |
507 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); | 507 | //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); |
508 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); | 508 | //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); |
509 | } | 509 | } |
510 | if ( !KOPrefs::instance()->mShowDateNavigator) | 510 | if ( !KOPrefs::instance()->mShowDateNavigator) |
511 | mDateNavigator->hide(); | 511 | mDateNavigator->hide(); |
512 | //qDebug("Calendarview Size %d %d ", width(), height()); | 512 | //qDebug("Calendarview Size %d %d ", width(), height()); |
513 | #endif | 513 | #endif |
514 | 514 | ||
515 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 515 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
516 | SLOT( showDates( const KCal::DateList & ) ) ); | 516 | SLOT( showDates( const KCal::DateList & ) ) ); |
517 | 517 | ||
518 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 518 | connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
519 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 519 | mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
520 | 520 | ||
521 | 521 | ||
522 | 522 | ||
523 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), | 523 | connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), |
524 | mViewManager, SLOT( showMonth( const QDate & ) ) ); | 524 | mViewManager, SLOT( showMonth( const QDate & ) ) ); |
525 | 525 | ||
526 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), | 526 | connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), |
527 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); | 527 | mNavigator, SLOT( selectWeek( const QDate & ) ) ); |
528 | 528 | ||
529 | connect( mDateNavigator, SIGNAL( goPrevYear() ), | 529 | connect( mDateNavigator, SIGNAL( goPrevYear() ), |
530 | mNavigator, SLOT( selectPreviousYear() ) ); | 530 | mNavigator, SLOT( selectPreviousYear() ) ); |
531 | connect( mDateNavigator, SIGNAL( goNextYear() ), | 531 | connect( mDateNavigator, SIGNAL( goNextYear() ), |
532 | mNavigator, SLOT( selectNextYear() ) ); | 532 | mNavigator, SLOT( selectNextYear() ) ); |
533 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), | 533 | connect( mDateNavigator, SIGNAL( goPrevMonth() ), |
534 | mNavigator, SLOT( selectPreviousMonth() ) ); | 534 | mNavigator, SLOT( selectPreviousMonth() ) ); |
535 | connect( mDateNavigator, SIGNAL( goNextMonth() ), | 535 | connect( mDateNavigator, SIGNAL( goNextMonth() ), |
536 | mNavigator, SLOT( selectNextMonth() ) ); | 536 | mNavigator, SLOT( selectNextMonth() ) ); |
537 | 537 | ||
538 | connect( mDateNavigator, SIGNAL( goPrevious() ), | 538 | connect( mDateNavigator, SIGNAL( goPrevious() ), |
539 | mNavigator, SLOT( selectPrevious() ) ); | 539 | mNavigator, SLOT( selectPrevious() ) ); |
540 | connect( mDateNavigator, SIGNAL( goNext() ), | 540 | connect( mDateNavigator, SIGNAL( goNext() ), |
541 | mNavigator, SLOT( selectNext() ) ); | 541 | mNavigator, SLOT( selectNext() ) ); |
542 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), | 542 | connect( mDateNavigator, SIGNAL( monthSelected ( int ) ), |
543 | mNavigator, SLOT( slotMonthSelect( int ) ) ); | 543 | mNavigator, SLOT( slotMonthSelect( int ) ) ); |
544 | 544 | ||
545 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), | 545 | connect( mDateNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), |
546 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); | 546 | mNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); |
547 | #if 0 | 547 | #if 0 |
548 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), | 548 | connect( mDateNavigator, SIGNAL( incidenceDropped( Incidence * ) ), |
549 | SLOT( incidenceAdded( Incidence *) ) ); | 549 | SLOT( incidenceAdded( Incidence *) ) ); |
550 | #endif | 550 | #endif |
551 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); | 551 | // connect(mDateNavigator,SIGNAL(dayPassed(QDate)),SLOT(updateView())); |
552 | 552 | ||
553 | connect( this, SIGNAL( configChanged() ), | 553 | connect( this, SIGNAL( configChanged() ), |
554 | mDateNavigator, SLOT( updateConfig() ) ); | 554 | mDateNavigator, SLOT( updateConfig() ) ); |
555 | 555 | ||
556 | connect( mTodoList, SIGNAL( newTodoSignal() ), | 556 | connect( mTodoList, SIGNAL( newTodoSignal() ), |
557 | SLOT( newTodo() ) ); | 557 | SLOT( newTodo() ) ); |
558 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), | 558 | connect( mTodoList, SIGNAL( newSubTodoSignal( Todo *) ), |
559 | SLOT( newSubTodo( Todo * ) ) ); | 559 | SLOT( newSubTodo( Todo * ) ) ); |
560 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), | 560 | connect( mTodoList, SIGNAL( editTodoSignal( Todo * ) ), |
561 | SLOT( editTodo( Todo * ) ) ); | 561 | SLOT( editTodo( Todo * ) ) ); |
562 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), | 562 | connect( mTodoList, SIGNAL( showTodoSignal( Todo * ) ), |
563 | SLOT( showTodo( Todo *) ) ); | 563 | SLOT( showTodo( Todo *) ) ); |
564 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), | 564 | connect( mTodoList, SIGNAL( deleteTodoSignal( Todo *) ), |
565 | SLOT( deleteTodo( Todo *) ) ); | 565 | SLOT( deleteTodo( Todo *) ) ); |
566 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); | 566 | connect( this, SIGNAL( configChanged()), mTodoList, SLOT( updateConfig() ) ); |
567 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), | 567 | connect( mTodoList, SIGNAL( purgeCompletedSignal() ), |
568 | SLOT( purgeCompleted() ) ); | 568 | SLOT( purgeCompleted() ) ); |
569 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), | 569 | connect( mTodoList, SIGNAL( todoModifiedSignal( Todo *, int ) ), |
570 | SIGNAL( todoModified( Todo *, int ) ) ); | 570 | SIGNAL( todoModified( Todo *, int ) ) ); |
571 | 571 | ||
572 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), | 572 | connect( mTodoList, SIGNAL( cloneTodoSignal( Incidence * ) ), |
573 | this, SLOT ( cloneIncidence( Incidence * ) ) ); | 573 | this, SLOT ( cloneIncidence( Incidence * ) ) ); |
574 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), | 574 | connect( mTodoList, SIGNAL( cancelTodoSignal( Incidence * ) ), |
575 | this, SLOT (cancelIncidence( Incidence * ) ) ); | 575 | this, SLOT (cancelIncidence( Incidence * ) ) ); |
576 | 576 | ||
577 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), | 577 | connect( mTodoList, SIGNAL( moveTodoSignal( Incidence * ) ), |
578 | this, SLOT ( moveIncidence( Incidence * ) ) ); | 578 | this, SLOT ( moveIncidence( Incidence * ) ) ); |
579 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), | 579 | connect( mTodoList, SIGNAL( beamTodoSignal( Incidence * ) ), |
580 | this, SLOT ( beamIncidence( Incidence * ) ) ); | 580 | this, SLOT ( beamIncidence( Incidence * ) ) ); |
581 | 581 | ||
582 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), | 582 | connect( mTodoList, SIGNAL( unparentTodoSignal( Todo * ) ), |
583 | this, SLOT ( todo_unsub( Todo * ) ) ); | 583 | this, SLOT ( todo_unsub( Todo * ) ) ); |
584 | 584 | ||
585 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), | 585 | connect( mTodoList, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), |
586 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); | 586 | this, SLOT ( todo_resub( Todo *,Todo * ) ) ); |
587 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, | 587 | connect( this, SIGNAL( todoModified( Todo *, int )), mTodoList, |
588 | SLOT( updateTodo( Todo *, int ) ) ); | 588 | SLOT( updateTodo( Todo *, int ) ) ); |
589 | connect( this, SIGNAL( todoModified( Todo *, int )), this, | 589 | connect( this, SIGNAL( todoModified( Todo *, int )), this, |
590 | SLOT( changeTodoDisplay( Todo *, int ) ) ); | 590 | SLOT( changeTodoDisplay( Todo *, int ) ) ); |
591 | 591 | ||
592 | 592 | ||
593 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); | 593 | connect( mFilterView, SIGNAL( filterChanged() ), SLOT( updateFilter() ) ); |
594 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); | 594 | connect( mFilterView, SIGNAL( editFilters() ), SLOT( editFilters() ) ); |
595 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); | 595 | connect( mCalendar, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addAlarm(const QDateTime &, const QString & ) ) ); |
596 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); | 596 | connect( mCalendar, SIGNAL( removeAlarm(const QDateTime &, const QString & ) ), SLOT( removeAlarm(const QDateTime &, const QString & ) ) ); |
597 | 597 | ||
598 | 598 | ||
599 | 599 | ||
600 | 600 | ||
601 | 601 | ||
602 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), | 602 | connect(QApplication::clipboard(),SIGNAL(dataChanged()), |
603 | SLOT(checkClipboard())); | 603 | SLOT(checkClipboard())); |
604 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), | 604 | connect( mTodoList,SIGNAL( incidenceSelected( Incidence * ) ), |
605 | SLOT( processTodoListSelection( Incidence * ) ) ); | 605 | SLOT( processTodoListSelection( Incidence * ) ) ); |
606 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); | 606 | connect(mTodoList,SIGNAL(isModified(bool)),SLOT(setModified(bool))); |
607 | 607 | ||
608 | // kdDebug() << "CalendarView::CalendarView() done" << endl; | 608 | // kdDebug() << "CalendarView::CalendarView() done" << endl; |
609 | 609 | ||
610 | mDateFrame = new QVBox(0,0,WType_Popup); | 610 | mDateFrame = new QVBox(0,0,WType_Popup); |
611 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); | 611 | //mDateFrame->setFrameStyle(QFrame::PopupPanel | QFrame::Raised); |
612 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); | 612 | mDateFrame->setFrameStyle( QFrame::WinPanel |QFrame::Raised ); |
613 | mDateFrame->setLineWidth(3); | 613 | mDateFrame->setLineWidth(3); |
614 | mDateFrame->hide(); | 614 | mDateFrame->hide(); |
615 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 615 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
616 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 616 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
617 | 617 | ||
618 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 618 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
619 | 619 | ||
620 | mEventEditor = mDialogManager->getEventEditor(); | 620 | mEventEditor = mDialogManager->getEventEditor(); |
621 | mTodoEditor = mDialogManager->getTodoEditor(); | 621 | mTodoEditor = mDialogManager->getTodoEditor(); |
622 | 622 | ||
623 | mFlagEditDescription = false; | 623 | mFlagEditDescription = false; |
624 | 624 | ||
625 | mSuspendTimer = new QTimer( this ); | 625 | mSuspendTimer = new QTimer( this ); |
626 | mAlarmTimer = new QTimer( this ); | 626 | mAlarmTimer = new QTimer( this ); |
627 | mRecheckAlarmTimer = new QTimer( this ); | 627 | mRecheckAlarmTimer = new QTimer( this ); |
628 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 628 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
629 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 629 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
630 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 630 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
631 | mAlarmDialog = new AlarmDialog( this ); | 631 | mAlarmDialog = new AlarmDialog( this ); |
632 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 632 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
633 | mAlarmDialog->setServerNotification( false ); | 633 | mAlarmDialog->setServerNotification( false ); |
634 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 634 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
635 | 635 | ||
636 | 636 | ||
637 | #ifndef DESKTOP_VERSION | 637 | #ifndef DESKTOP_VERSION |
638 | //US listen for arriving address resultsets | 638 | //US listen for arriving address resultsets |
639 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 639 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
640 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 640 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
641 | #endif | 641 | #endif |
642 | mDateNavigator->setCalendar( mCalendar ); | 642 | mDateNavigator->setCalendar( mCalendar ); |
643 | } | 643 | } |
644 | 644 | ||
645 | 645 | ||
646 | CalendarView::~CalendarView() | 646 | CalendarView::~CalendarView() |
647 | { | 647 | { |
648 | // kdDebug() << "~CalendarView()" << endl; | 648 | // kdDebug() << "~CalendarView()" << endl; |
649 | //qDebug("CalendarView::~CalendarView() "); | 649 | //qDebug("CalendarView::~CalendarView() "); |
650 | delete mDialogManager; | 650 | delete mDialogManager; |
651 | delete mViewManager; | 651 | delete mViewManager; |
652 | delete mStorage; | 652 | delete mStorage; |
653 | delete mDateFrame ; | 653 | delete mDateFrame ; |
654 | delete mEventViewerDialog; | 654 | delete mEventViewerDialog; |
655 | //kdDebug() << "~CalendarView() done" << endl; | 655 | //kdDebug() << "~CalendarView() done" << endl; |
656 | } | 656 | } |
657 | void CalendarView::nextConflict( bool all, bool allday ) | 657 | void CalendarView::nextConflict( bool all, bool allday ) |
658 | { | 658 | { |
659 | 659 | ||
660 | QPtrList<Event> testlist = mCalendar->events(); | 660 | QPtrList<Event> testlist = mCalendar->events(); |
661 | Event * test = testlist.first(); | 661 | Event * test = testlist.first(); |
662 | while ( test ) { | 662 | while ( test ) { |
663 | test->setTagged( false ); | 663 | test->setTagged( false ); |
664 | test = testlist.next(); | ||
664 | } | 665 | } |
665 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0)); | 666 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first().addDays(1), QTime ( 0,0,0)); |
666 | QDateTime conflict; | 667 | QDateTime conflict; |
667 | QDateTime retVal; | 668 | QDateTime retVal; |
668 | bool found = false; | 669 | bool found = false; |
669 | Event * cE = 0; | 670 | Event * cE = 0; |
671 | Event * cE2 = 0; | ||
670 | QPtrList<Event> testlist2 = testlist; | 672 | QPtrList<Event> testlist2 = testlist; |
673 | test = testlist.first(); | ||
674 | bool skip = false; | ||
671 | while ( test ) { | 675 | while ( test ) { |
672 | Event * test2 = testlist2.first(); | 676 | skip = false; |
673 | while ( test2 ) { | 677 | if ( !all ) skip = ( allday != test->doesFloat() ); |
674 | if ( !test2->isTagged() ) { | 678 | if ( !skip ) { |
675 | if ( test->isOverlapping ( test2, &retVal, true ) ) { | 679 | Event * test2 = testlist2.first(); |
676 | if ( ! found ) { | 680 | while ( test2 ) { |
677 | if ( retVal >= startDT ) { | 681 | skip = false; |
678 | conflict = retVal; | 682 | if ( !all ) skip = ( allday != test2->doesFloat() ); |
679 | cE = test; | 683 | if ( !skip ) { |
680 | found = true; | 684 | if ( !test2->isTagged() ) { |
681 | } | 685 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { |
682 | } else { | 686 | //qDebug("overlap "); |
683 | if ( retVal >= startDT && retVal < conflict ) { | 687 | if ( ! found ) { |
684 | conflict = retVal; | 688 | if ( retVal >= startDT ) { |
685 | cE = test; | 689 | conflict = retVal; |
690 | cE = test; | ||
691 | cE2 = test2; | ||
692 | found = true; | ||
693 | } | ||
694 | } else { | ||
695 | if ( retVal >= startDT && retVal < conflict ) { | ||
696 | conflict = retVal; | ||
697 | cE = test; | ||
698 | cE2 = test2; | ||
699 | } | ||
700 | } | ||
686 | } | 701 | } |
687 | } | 702 | } |
688 | } | 703 | } |
704 | test2 = testlist2.next(); | ||
689 | } | 705 | } |
690 | test2 = testlist2.next(); | ||
691 | } | 706 | } |
692 | test->setTagged( true ); | 707 | test->setTagged( true ); |
693 | test = testlist.next(); | 708 | test = testlist.next(); |
694 | } | 709 | } |
695 | if ( found ) { | 710 | if ( found ) { |
696 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 711 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
697 | mViewManager->showDayView(); | 712 | mViewManager->showDayView(); |
698 | mNavigator->slotDaySelect( conflict.date() ); | 713 | mNavigator->slotDaySelect( conflict.date() ); |
699 | int hour = conflict.time().hour(); | 714 | int hour = conflict.time().hour(); |
700 | mViewManager->agendaView()->setStartHour( hour ); | 715 | mViewManager->agendaView()->setStartHour( hour ); |
701 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 716 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); |
702 | return; | 717 | return; |
703 | } | 718 | } |
704 | 719 | ||
705 | topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); | 720 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
706 | qDebug("No conflict found "); | 721 | qDebug("No conflict found "); |
707 | return; | 722 | return; |
708 | 723 | ||
709 | 724 | ||
710 | 725 | ||
711 | 726 | ||
712 | 727 | ||
713 | #if 0 | 728 | #if 0 |
714 | 729 | ||
715 | 730 | ||
716 | QDate end = start.addDays( 365*2); | 731 | QDate end = start.addDays( 365*2); |
717 | while ( start < end ) { | 732 | while ( start < end ) { |
718 | QPtrList<Event> eventList = calendar()->events( start ); | 733 | QPtrList<Event> eventList = calendar()->events( start ); |
719 | Event * ev = eventList.first(); | 734 | Event * ev = eventList.first(); |
720 | QPtrList<Event> test = eventList; | 735 | QPtrList<Event> test = eventList; |
721 | while ( ev ) { | 736 | while ( ev ) { |
722 | //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); | 737 | //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); |
723 | Event * t_ev = test.first(); | 738 | Event * t_ev = test.first(); |
724 | QDateTime es = ev->dtStart(); | 739 | QDateTime es = ev->dtStart(); |
725 | QDateTime ee = ev->dtEnd(); | 740 | QDateTime ee = ev->dtEnd(); |
726 | if ( ev->doesFloat() ) | 741 | if ( ev->doesFloat() ) |
727 | ee = ee.addDays( 1 ); | 742 | ee = ee.addDays( 1 ); |
728 | if ( ! all ) { | 743 | if ( ! all ) { |
729 | if ( ev->doesFloat() != allday ) | 744 | if ( ev->doesFloat() != allday ) |
730 | t_ev = 0; | 745 | t_ev = 0; |
731 | } | 746 | } |
732 | while ( t_ev ) { | 747 | while ( t_ev ) { |
733 | bool skip = false; | 748 | bool skip = false; |
734 | if ( ! all ) { | 749 | if ( ! all ) { |
735 | if ( t_ev->doesFloat() != allday ) | 750 | if ( t_ev->doesFloat() != allday ) |
736 | skip = true; | 751 | skip = true; |
737 | } | 752 | } |
738 | if ( !skip && ev != t_ev ) { | 753 | if ( !skip && ev != t_ev ) { |
739 | QDateTime ets = t_ev->dtStart(); | 754 | QDateTime ets = t_ev->dtStart(); |
740 | QDateTime ete = t_ev->dtEnd(); | 755 | QDateTime ete = t_ev->dtEnd(); |
741 | if ( t_ev->doesFloat() ) | 756 | if ( t_ev->doesFloat() ) |
742 | ete = ete.addDays( 1 ); | 757 | ete = ete.addDays( 1 ); |
743 | //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); | 758 | //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); |
744 | if ( es < ete && ets < ee ) { | 759 | if ( es < ete && ets < ee ) { |
745 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 760 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
746 | mViewManager->showDayView(); | 761 | mViewManager->showDayView(); |
747 | mNavigator->slotDaySelect( start ); | 762 | mNavigator->slotDaySelect( start ); |
748 | int hour = es.time().hour(); | 763 | int hour = es.time().hour(); |
749 | if ( ets > es ) | 764 | if ( ets > es ) |
750 | hour = ets.time().hour(); | 765 | hour = ets.time().hour(); |
751 | mViewManager->agendaView()->setStartHour( hour ); | 766 | mViewManager->agendaView()->setStartHour( hour ); |
752 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); | 767 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); |
753 | return; | 768 | return; |
754 | } | 769 | } |
755 | } | 770 | } |
756 | t_ev = test.next(); | 771 | t_ev = test.next(); |
757 | } | 772 | } |
758 | ev = eventList.next(); | 773 | ev = eventList.next(); |
759 | } | 774 | } |
760 | start = start.addDays( 1 ); | 775 | start = start.addDays( 1 ); |
761 | } | 776 | } |
762 | topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); | 777 | topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); |
763 | qDebug("No conflict found "); | 778 | qDebug("No conflict found "); |
764 | #endif | 779 | #endif |
765 | } | 780 | } |
766 | 781 | ||
767 | void CalendarView::conflictAll() | 782 | void CalendarView::conflictAll() |
768 | { | 783 | { |
769 | nextConflict ( true, true ); | 784 | nextConflict ( true, true ); |
770 | } | 785 | } |
771 | void CalendarView::conflictAllday() | 786 | void CalendarView::conflictAllday() |
772 | { | 787 | { |
773 | nextConflict ( false, true ); | 788 | nextConflict ( false, true ); |
774 | } | 789 | } |
775 | void CalendarView::conflictNotAll() | 790 | void CalendarView::conflictNotAll() |
776 | { | 791 | { |
777 | nextConflict ( false, false ); | 792 | nextConflict ( false, false ); |
778 | } | 793 | } |
779 | 794 | ||
780 | void CalendarView::setCalReadOnly( int id, bool readO ) | 795 | void CalendarView::setCalReadOnly( int id, bool readO ) |
781 | { | 796 | { |
782 | if ( readO ) { | 797 | if ( readO ) { |
783 | emit save(); | 798 | emit save(); |
784 | } | 799 | } |
785 | mCalendar->setReadOnly( id, readO ); | 800 | mCalendar->setReadOnly( id, readO ); |
786 | } | 801 | } |
787 | void CalendarView::setScrollBarStep(int val ) | 802 | void CalendarView::setScrollBarStep(int val ) |
788 | { | 803 | { |
789 | #ifdef DESKTOP_VERSION | 804 | #ifdef DESKTOP_VERSION |
790 | mDateScrollBar->setLineStep ( val ); | 805 | mDateScrollBar->setLineStep ( val ); |
791 | #endif | 806 | #endif |
792 | } | 807 | } |
793 | void CalendarView::scrollBarValue(int val ) | 808 | void CalendarView::scrollBarValue(int val ) |
794 | { | 809 | { |
795 | #ifdef DESKTOP_VERSION | 810 | #ifdef DESKTOP_VERSION |
796 | if ( QApplication::desktop()->width() < 800 ) return; | 811 | if ( QApplication::desktop()->width() < 800 ) return; |
797 | static bool block = false; | 812 | static bool block = false; |
798 | if ( block ) return; | 813 | if ( block ) return; |
799 | block = true; | 814 | block = true; |
800 | int count = mNavigator->selectedDates().count(); | 815 | int count = mNavigator->selectedDates().count(); |
801 | int day = mNavigator->selectedDates().first().dayOfYear(); | 816 | int day = mNavigator->selectedDates().first().dayOfYear(); |
802 | int stepdays = val; | 817 | int stepdays = val; |
803 | if ( mDateScrollBar->lineStep () <= count ) { | 818 | if ( mDateScrollBar->lineStep () <= count ) { |
804 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 819 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
805 | //qDebug("VAL %d ",val ); | 820 | //qDebug("VAL %d ",val ); |
806 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 821 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
807 | stepdays = day+stepdays; | 822 | stepdays = day+stepdays; |
808 | if ( stepdays < 0 ) stepdays = 0; | 823 | if ( stepdays < 0 ) stepdays = 0; |
809 | } | 824 | } |
810 | if ( stepdays == day ) { | 825 | if ( stepdays == day ) { |
811 | block = false; | 826 | block = false; |
812 | return; | 827 | return; |
813 | } | 828 | } |
814 | int year = mNavigator->selectedDates().first().year(); | 829 | int year = mNavigator->selectedDates().first().year(); |
815 | QDate d ( year,1,1 ); | 830 | QDate d ( year,1,1 ); |
816 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); | 831 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); |
817 | block = false; | 832 | block = false; |
818 | #endif | 833 | #endif |
819 | 834 | ||
820 | } | 835 | } |
821 | void CalendarView::updateView(const QDate &start, const QDate &end) | 836 | void CalendarView::updateView(const QDate &start, const QDate &end) |
822 | { | 837 | { |
823 | #ifdef DESKTOP_VERSION | 838 | #ifdef DESKTOP_VERSION |
824 | if ( ! mDateScrollBar->draggingSlider () ) { | 839 | if ( ! mDateScrollBar->draggingSlider () ) { |
825 | int dof = start.dayOfYear(); | 840 | int dof = start.dayOfYear(); |
826 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); | 841 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); |
827 | if ( dof != mDateScrollBar->value() ) { | 842 | if ( dof != mDateScrollBar->value() ) { |
828 | mDateScrollBar->blockSignals( true ); | 843 | mDateScrollBar->blockSignals( true ); |
829 | mDateScrollBar->setValue( start.dayOfYear()); | 844 | mDateScrollBar->setValue( start.dayOfYear()); |
830 | mDateScrollBar->blockSignals( false ); | 845 | mDateScrollBar->blockSignals( false ); |
831 | } | 846 | } |
832 | } | 847 | } |
833 | #endif | 848 | #endif |
834 | mTodoList->updateView(); | 849 | mTodoList->updateView(); |
835 | mViewManager->updateView(start, end); | 850 | mViewManager->updateView(start, end); |
836 | //mDateNavigator->updateView(); | 851 | //mDateNavigator->updateView(); |
837 | } | 852 | } |
838 | 853 | ||
839 | 854 | ||
840 | 855 | ||
841 | void CalendarView::checkFiles() | 856 | void CalendarView::checkFiles() |
842 | { | 857 | { |
843 | QString message; | 858 | QString message; |
844 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 859 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
845 | KopiCalendarFile * cal = calendars.first(); | 860 | KopiCalendarFile * cal = calendars.first(); |
846 | while ( cal ) { | 861 | while ( cal ) { |
847 | if ( cal->mErrorOnLoad ) { | 862 | if ( cal->mErrorOnLoad ) { |
848 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; | 863 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; |
849 | } | 864 | } |
850 | cal = calendars.next(); | 865 | cal = calendars.next(); |
851 | } | 866 | } |
852 | if ( !message.isEmpty() ) { | 867 | if ( !message.isEmpty() ) { |
853 | message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); | 868 | message = KGlobal::formatMessage( i18n("Calendar(s) not loaded:"),0 )+"\n" + message +KGlobal::formatMessage(i18n("You can try to reload the calendar in the Resource View!"),0); |
854 | KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); | 869 | KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); |
855 | } | 870 | } |
856 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); | 871 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); |
857 | } | 872 | } |
858 | void CalendarView::checkAlarms() | 873 | void CalendarView::checkAlarms() |
859 | { | 874 | { |
860 | 875 | ||
861 | 876 | ||
862 | KConfig *config = KOGlobals::config(); | 877 | KConfig *config = KOGlobals::config(); |
863 | config->setGroup( "AppRun" ); | 878 | config->setGroup( "AppRun" ); |
864 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 879 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
865 | int daysto = dt.daysTo( QDate::currentDate() ); | 880 | int daysto = dt.daysTo( QDate::currentDate() ); |
866 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 881 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
867 | dt = dt.addDays( days ); | 882 | dt = dt.addDays( days ); |
868 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 883 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
869 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 884 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
870 | //qDebug("KO: Reading program stop %d ", secs); | 885 | //qDebug("KO: Reading program stop %d ", secs); |
871 | //secs -= ( 3600 * 24*3 ); // debug only | 886 | //secs -= ( 3600 * 24*3 ); // debug only |
872 | QDateTime latest = dt.addSecs ( secs ); | 887 | QDateTime latest = dt.addSecs ( secs ); |
873 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 888 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
874 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 889 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
875 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 890 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
876 | QPtrList<Incidence> al; | 891 | QPtrList<Incidence> al; |
877 | Incidence* inL = el.first(); | 892 | Incidence* inL = el.first(); |
878 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 893 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
879 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 894 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
880 | while ( inL ) { | 895 | while ( inL ) { |
881 | bool ok = false; | 896 | bool ok = false; |
882 | int offset = 0; | 897 | int offset = 0; |
883 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 898 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
884 | if ( ok ) { | 899 | if ( ok ) { |
885 | //qDebug("OK %s",next.toString().latin1()); | 900 | //qDebug("OK %s",next.toString().latin1()); |
886 | if ( next < cur ) { | 901 | if ( next < cur ) { |
887 | al.append( inL ); | 902 | al.append( inL ); |
888 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 903 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
889 | } | 904 | } |
890 | } | 905 | } |
891 | inL = el.next(); | 906 | inL = el.next(); |
892 | } | 907 | } |
893 | if ( al.count() ) { | 908 | if ( al.count() ) { |
894 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 909 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
895 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 910 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
896 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 911 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
897 | lay->setSpacing( 0 ); | 912 | lay->setSpacing( 0 ); |
898 | lay->setMargin( 0 ); | 913 | lay->setMargin( 0 ); |
899 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 914 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
900 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 915 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
901 | lay->addWidget( matb ); | 916 | lay->addWidget( matb ); |
902 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 917 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
903 | int wid = 210; | 918 | int wid = 210; |
904 | int x = QApplication::desktop()->width() - wid - 7; | 919 | int x = QApplication::desktop()->width() - wid - 7; |
905 | int y = QApplication::desktop()->height() - wid - 70; | 920 | int y = QApplication::desktop()->height() - wid - 70; |
906 | dia->setGeometry ( x,y,wid,wid); | 921 | dia->setGeometry ( x,y,wid,wid); |
907 | } else { | 922 | } else { |
908 | int si = 220; | 923 | int si = 220; |
909 | if ( QApplication::desktop()->width() > 470 ) | 924 | if ( QApplication::desktop()->width() > 470 ) |
910 | si = 400; | 925 | si = 400; |
911 | dia->resize(si,si/2); | 926 | dia->resize(si,si/2); |
912 | } | 927 | } |
913 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); | 928 | dia->setBackgroundColor( QColor( 255, 255, 255 ) ); |
914 | dia->show(); | 929 | dia->show(); |
915 | 930 | ||
916 | } | 931 | } |
917 | } | 932 | } |
918 | void CalendarView::showDay( QDate d ) | 933 | void CalendarView::showDay( QDate d ) |
919 | { | 934 | { |
920 | dateNavigator()->blockSignals( true ); | 935 | dateNavigator()->blockSignals( true ); |
921 | dateNavigator()->selectDate( d ); | 936 | dateNavigator()->selectDate( d ); |
922 | dateNavigator()->blockSignals( false ); | 937 | dateNavigator()->blockSignals( false ); |
923 | mViewManager->showDayView(); | 938 | mViewManager->showDayView(); |
924 | //dateNavigator()->selectDate( d ); | 939 | //dateNavigator()->selectDate( d ); |
925 | } | 940 | } |
926 | void CalendarView::timerAlarm() | 941 | void CalendarView::timerAlarm() |
927 | { | 942 | { |
928 | //qDebug("CalendarView::timerAlarm() "); | 943 | //qDebug("CalendarView::timerAlarm() "); |
929 | computeAlarm(mAlarmNotification ); | 944 | computeAlarm(mAlarmNotification ); |
930 | } | 945 | } |
931 | 946 | ||
932 | void CalendarView::suspendAlarm() | 947 | void CalendarView::suspendAlarm() |
933 | { | 948 | { |
934 | //qDebug(" CalendarView::suspendAlarm() "); | 949 | //qDebug(" CalendarView::suspendAlarm() "); |
935 | computeAlarm(mSuspendAlarmNotification ); | 950 | computeAlarm(mSuspendAlarmNotification ); |
936 | 951 | ||
937 | } | 952 | } |
938 | 953 | ||
939 | void CalendarView::startAlarm( QString mess , QString filename) | 954 | void CalendarView::startAlarm( QString mess , QString filename) |
940 | { | 955 | { |
941 | 956 | ||
942 | topLevelWidget()->showNormal(); | 957 | topLevelWidget()->showNormal(); |
943 | topLevelWidget()->setActiveWindow(); | 958 | topLevelWidget()->setActiveWindow(); |
944 | topLevelWidget()->raise(); | 959 | topLevelWidget()->raise(); |
945 | 960 | ||
946 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); | 961 | mAlarmDialog->eventNotification( mess, KOPrefs::instance()->mAlarmPlayBeeps, filename, true,KOPrefs::instance()->mAlarmBeepInterval ,KOPrefs::instance()->mAlarmSuspendCount ); |
947 | QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); | 962 | QTimer::singleShot( 2000, this, SLOT( checkNextTimerAlarm() ) ); |
948 | 963 | ||
949 | } | 964 | } |
950 | 965 | ||
951 | void CalendarView::checkNextTimerAlarm() | 966 | void CalendarView::checkNextTimerAlarm() |
952 | { | 967 | { |
953 | mCalendar->checkAlarmForIncidence( 0, true ); | 968 | mCalendar->checkAlarmForIncidence( 0, true ); |
954 | } | 969 | } |
955 | 970 | ||
956 | void CalendarView::computeAlarm( QString msg ) | 971 | void CalendarView::computeAlarm( QString msg ) |
957 | { | 972 | { |
958 | 973 | ||
959 | QString mess = msg; | 974 | QString mess = msg; |
960 | QString mAlarmMessage = mess.mid( 9 ); | 975 | QString mAlarmMessage = mess.mid( 9 ); |
961 | QString filename = MainWindow::resourcePath(); | 976 | QString filename = MainWindow::resourcePath(); |
@@ -2541,515 +2556,516 @@ void CalendarView::writeSettings() | |||
2541 | list << QString::number( y ); | 2556 | list << QString::number( y ); |
2542 | list << QString::number( w ); | 2557 | list << QString::number( w ); |
2543 | list << QString::number( h ); | 2558 | list << QString::number( h ); |
2544 | config->writeEntry("MainLayout",list ); | 2559 | config->writeEntry("MainLayout",list ); |
2545 | 2560 | ||
2546 | wid = mEventEditor; | 2561 | wid = mEventEditor; |
2547 | x = wid->geometry().x(); | 2562 | x = wid->geometry().x(); |
2548 | y = wid->geometry().y(); | 2563 | y = wid->geometry().y(); |
2549 | w = wid->width(); | 2564 | w = wid->width(); |
2550 | h = wid->height(); | 2565 | h = wid->height(); |
2551 | list.clear(); | 2566 | list.clear(); |
2552 | list << QString::number( x ); | 2567 | list << QString::number( x ); |
2553 | list << QString::number( y ); | 2568 | list << QString::number( y ); |
2554 | list << QString::number( w ); | 2569 | list << QString::number( w ); |
2555 | list << QString::number( h ); | 2570 | list << QString::number( h ); |
2556 | config->writeEntry("EditEventLayout",list ); | 2571 | config->writeEntry("EditEventLayout",list ); |
2557 | 2572 | ||
2558 | wid = mTodoEditor; | 2573 | wid = mTodoEditor; |
2559 | x = wid->geometry().x(); | 2574 | x = wid->geometry().x(); |
2560 | y = wid->geometry().y(); | 2575 | y = wid->geometry().y(); |
2561 | w = wid->width(); | 2576 | w = wid->width(); |
2562 | h = wid->height(); | 2577 | h = wid->height(); |
2563 | list.clear(); | 2578 | list.clear(); |
2564 | list << QString::number( x ); | 2579 | list << QString::number( x ); |
2565 | list << QString::number( y ); | 2580 | list << QString::number( y ); |
2566 | list << QString::number( w ); | 2581 | list << QString::number( w ); |
2567 | list << QString::number( h ); | 2582 | list << QString::number( h ); |
2568 | config->writeEntry("EditTodoLayout",list ); | 2583 | config->writeEntry("EditTodoLayout",list ); |
2569 | wid = getEventViewerDialog(); | 2584 | wid = getEventViewerDialog(); |
2570 | x = wid->geometry().x(); | 2585 | x = wid->geometry().x(); |
2571 | y = wid->geometry().y(); | 2586 | y = wid->geometry().y(); |
2572 | w = wid->width(); | 2587 | w = wid->width(); |
2573 | h = wid->height(); | 2588 | h = wid->height(); |
2574 | list.clear(); | 2589 | list.clear(); |
2575 | list << QString::number( x ); | 2590 | list << QString::number( x ); |
2576 | list << QString::number( y ); | 2591 | list << QString::number( y ); |
2577 | list << QString::number( w ); | 2592 | list << QString::number( w ); |
2578 | list << QString::number( h ); | 2593 | list << QString::number( h ); |
2579 | config->writeEntry("ViewerLayout",list ); | 2594 | config->writeEntry("ViewerLayout",list ); |
2580 | wid = mDialogManager->getSearchDialog(); | 2595 | wid = mDialogManager->getSearchDialog(); |
2581 | if ( wid ) { | 2596 | if ( wid ) { |
2582 | x = wid->geometry().x(); | 2597 | x = wid->geometry().x(); |
2583 | y = wid->geometry().y(); | 2598 | y = wid->geometry().y(); |
2584 | w = wid->width(); | 2599 | w = wid->width(); |
2585 | h = wid->height(); | 2600 | h = wid->height(); |
2586 | list.clear(); | 2601 | list.clear(); |
2587 | list << QString::number( x ); | 2602 | list << QString::number( x ); |
2588 | list << QString::number( y ); | 2603 | list << QString::number( y ); |
2589 | list << QString::number( w ); | 2604 | list << QString::number( w ); |
2590 | list << QString::number( h ); | 2605 | list << QString::number( h ); |
2591 | config->writeEntry("SearchLayout",list ); | 2606 | config->writeEntry("SearchLayout",list ); |
2592 | } | 2607 | } |
2593 | #endif | 2608 | #endif |
2594 | 2609 | ||
2595 | 2610 | ||
2596 | config->sync(); | 2611 | config->sync(); |
2597 | } | 2612 | } |
2598 | 2613 | ||
2599 | void CalendarView::readFilterSettings(KConfig *config) | 2614 | void CalendarView::readFilterSettings(KConfig *config) |
2600 | { | 2615 | { |
2601 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; | 2616 | // kdDebug() << "CalendarView::readFilterSettings()" << endl; |
2602 | 2617 | ||
2603 | mFilters.clear(); | 2618 | mFilters.clear(); |
2604 | 2619 | ||
2605 | config->setGroup("General"); | 2620 | config->setGroup("General"); |
2606 | QStringList filterList = config->readListEntry("CalendarFilters"); | 2621 | QStringList filterList = config->readListEntry("CalendarFilters"); |
2607 | 2622 | ||
2608 | QStringList::ConstIterator it = filterList.begin(); | 2623 | QStringList::ConstIterator it = filterList.begin(); |
2609 | QStringList::ConstIterator end = filterList.end(); | 2624 | QStringList::ConstIterator end = filterList.end(); |
2610 | while(it != end) { | 2625 | while(it != end) { |
2611 | // kdDebug() << " filter: " << (*it) << endl; | 2626 | // kdDebug() << " filter: " << (*it) << endl; |
2612 | 2627 | ||
2613 | CalFilter *filter; | 2628 | CalFilter *filter; |
2614 | filter = new CalFilter(*it); | 2629 | filter = new CalFilter(*it); |
2615 | config->setGroup("Filter_" + (*it).utf8()); | 2630 | config->setGroup("Filter_" + (*it).utf8()); |
2616 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); | 2631 | //qDebug("readFilterSettings %d ",config->readNumEntry("Criteria",0) ); |
2617 | filter->setCriteria(config->readNumEntry("Criteria",0)); | 2632 | filter->setCriteria(config->readNumEntry("Criteria",0)); |
2618 | filter->setCategoryList(config->readListEntry("CategoryList")); | 2633 | filter->setCategoryList(config->readListEntry("CategoryList")); |
2619 | mFilters.append(filter); | 2634 | mFilters.append(filter); |
2620 | 2635 | ||
2621 | ++it; | 2636 | ++it; |
2622 | } | 2637 | } |
2623 | 2638 | ||
2624 | if (mFilters.count() == 0) { | 2639 | if (mFilters.count() == 0) { |
2625 | CalFilter *filter = new CalFilter(i18n("Default")); | 2640 | CalFilter *filter = new CalFilter(i18n("Default")); |
2626 | mFilters.append(filter); | 2641 | mFilters.append(filter); |
2627 | } | 2642 | } |
2628 | mFilterView->updateFilters(); | 2643 | mFilterView->updateFilters(); |
2629 | config->setGroup("FilterView"); | 2644 | config->setGroup("FilterView"); |
2630 | 2645 | ||
2631 | mFilterView->blockSignals(true); | 2646 | mFilterView->blockSignals(true); |
2632 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); | 2647 | mFilterView->setFiltersEnabled(config->readBoolEntry("FilterEnabled")); |
2633 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); | 2648 | mFilterView->setSelectedFilter(config->readEntry("Current Filter")); |
2634 | mFilterView->blockSignals(false); | 2649 | mFilterView->blockSignals(false); |
2635 | // We do it manually to avoid it being done twice by the above calls | 2650 | // We do it manually to avoid it being done twice by the above calls |
2636 | updateFilter(); | 2651 | updateFilter(); |
2637 | } | 2652 | } |
2638 | 2653 | ||
2639 | void CalendarView::writeFilterSettings(KConfig *config) | 2654 | void CalendarView::writeFilterSettings(KConfig *config) |
2640 | { | 2655 | { |
2641 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; | 2656 | // kdDebug() << "CalendarView::writeFilterSettings()" << endl; |
2642 | 2657 | ||
2643 | QStringList filterList; | 2658 | QStringList filterList; |
2644 | 2659 | ||
2645 | CalFilter *filter = mFilters.first(); | 2660 | CalFilter *filter = mFilters.first(); |
2646 | while(filter) { | 2661 | while(filter) { |
2647 | // kdDebug() << " fn: " << filter->name() << endl; | 2662 | // kdDebug() << " fn: " << filter->name() << endl; |
2648 | filterList << filter->name(); | 2663 | filterList << filter->name(); |
2649 | config->setGroup("Filter_" + filter->name().utf8()); | 2664 | config->setGroup("Filter_" + filter->name().utf8()); |
2650 | config->writeEntry("Criteria",filter->criteria()); | 2665 | config->writeEntry("Criteria",filter->criteria()); |
2651 | config->writeEntry("CategoryList",filter->categoryList()); | 2666 | config->writeEntry("CategoryList",filter->categoryList()); |
2652 | filter = mFilters.next(); | 2667 | filter = mFilters.next(); |
2653 | } | 2668 | } |
2654 | config->setGroup("General"); | 2669 | config->setGroup("General"); |
2655 | config->writeEntry("CalendarFilters",filterList); | 2670 | config->writeEntry("CalendarFilters",filterList); |
2656 | 2671 | ||
2657 | config->setGroup("FilterView"); | 2672 | config->setGroup("FilterView"); |
2658 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); | 2673 | config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); |
2659 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); | 2674 | config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); |
2660 | } | 2675 | } |
2661 | 2676 | ||
2662 | 2677 | ||
2663 | void CalendarView::goToday() | 2678 | void CalendarView::goToday() |
2664 | { | 2679 | { |
2665 | if ( mViewManager->currentView()->isMonthView() ) | 2680 | if ( mViewManager->currentView()->isMonthView() ) |
2666 | mNavigator->selectTodayMonth(); | 2681 | mNavigator->selectTodayMonth(); |
2667 | else | 2682 | else |
2668 | mNavigator->selectToday(); | 2683 | mNavigator->selectToday(); |
2669 | } | 2684 | } |
2670 | 2685 | ||
2671 | void CalendarView::goNext() | 2686 | void CalendarView::goNext() |
2672 | { | 2687 | { |
2673 | mNavigator->selectNext(); | 2688 | mNavigator->selectNext(); |
2674 | } | 2689 | } |
2675 | 2690 | ||
2676 | void CalendarView::goPrevious() | 2691 | void CalendarView::goPrevious() |
2677 | { | 2692 | { |
2678 | mNavigator->selectPrevious(); | 2693 | mNavigator->selectPrevious(); |
2679 | } | 2694 | } |
2680 | void CalendarView::goNextMonth() | 2695 | void CalendarView::goNextMonth() |
2681 | { | 2696 | { |
2682 | mNavigator->selectNextMonth(); | 2697 | mNavigator->selectNextMonth(); |
2683 | } | 2698 | } |
2684 | 2699 | ||
2685 | void CalendarView::goPreviousMonth() | 2700 | void CalendarView::goPreviousMonth() |
2686 | { | 2701 | { |
2687 | mNavigator->selectPreviousMonth(); | 2702 | mNavigator->selectPreviousMonth(); |
2688 | } | 2703 | } |
2689 | 2704 | ||
2690 | void CalendarView::updateConfig() | 2705 | void CalendarView::updateConfig() |
2691 | { | 2706 | { |
2692 | if ( KOPrefs::instance()->mUseAppColors ) | 2707 | if ( KOPrefs::instance()->mUseAppColors ) |
2693 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 2708 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
2694 | emit configChanged(); | 2709 | emit configChanged(); |
2695 | mTodoList->updateConfig(); | 2710 | mTodoList->updateConfig(); |
2696 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); | 2711 | // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); |
2697 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2712 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2698 | // To make the "fill window" configurations work | 2713 | // To make the "fill window" configurations work |
2699 | //mViewManager->raiseCurrentView(); | 2714 | //mViewManager->raiseCurrentView(); |
2700 | } | 2715 | } |
2701 | 2716 | ||
2702 | 2717 | ||
2703 | void CalendarView::eventChanged(Event *event) | 2718 | void CalendarView::eventChanged(Event *event) |
2704 | { | 2719 | { |
2705 | changeEventDisplay(event,KOGlobals::EVENTEDITED); | 2720 | changeEventDisplay(event,KOGlobals::EVENTEDITED); |
2706 | //updateUnmanagedViews(); | 2721 | //updateUnmanagedViews(); |
2707 | } | 2722 | } |
2708 | 2723 | ||
2709 | void CalendarView::eventAdded(Event *event) | 2724 | void CalendarView::eventAdded(Event *event) |
2710 | { | 2725 | { |
2711 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2726 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2712 | } | 2727 | } |
2713 | 2728 | ||
2714 | void CalendarView::eventToBeDeleted(Event *) | 2729 | void CalendarView::eventToBeDeleted(Event *) |
2715 | { | 2730 | { |
2716 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2731 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2717 | } | 2732 | } |
2718 | 2733 | ||
2719 | void CalendarView::eventDeleted() | 2734 | void CalendarView::eventDeleted() |
2720 | { | 2735 | { |
2721 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2736 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2722 | } | 2737 | } |
2723 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2738 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2724 | { | 2739 | { |
2725 | changeIncidenceDisplay((Incidence *)which, action); | 2740 | changeIncidenceDisplay((Incidence *)which, action); |
2726 | mDateNavigator->updateView(); //LR | 2741 | mDateNavigator->updateView(); //LR |
2727 | //mDialogManager->updateSearchDialog(); | 2742 | //mDialogManager->updateSearchDialog(); |
2728 | 2743 | ||
2729 | if (which) { | 2744 | if (which) { |
2730 | mViewManager->updateWNview(); | 2745 | mViewManager->updateWNview(); |
2731 | //mTodoList->updateView(); | 2746 | //mTodoList->updateView(); |
2732 | } | 2747 | } |
2733 | 2748 | ||
2734 | } | 2749 | } |
2735 | 2750 | ||
2736 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 2751 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
2737 | { | 2752 | { |
2738 | updateUnmanagedViews(); | 2753 | updateUnmanagedViews(); |
2739 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 2754 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
2740 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 2755 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
2741 | mCalendar->checkAlarmForIncidence( 0, true ); | 2756 | mCalendar->checkAlarmForIncidence( 0, true ); |
2742 | if ( mEventViewerDialog ) | 2757 | if ( mEventViewerDialog ) |
2743 | mEventViewerDialog->hide(); | 2758 | mEventViewerDialog->hide(); |
2744 | } | 2759 | } |
2745 | else | 2760 | else |
2746 | mCalendar->checkAlarmForIncidence( which , false ); | 2761 | mCalendar->checkAlarmForIncidence( which , false ); |
2747 | } | 2762 | } |
2748 | 2763 | ||
2749 | // most of the changeEventDisplays() right now just call the view's | 2764 | // most of the changeEventDisplays() right now just call the view's |
2750 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 2765 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
2751 | void CalendarView::changeEventDisplay(Event *which, int action) | 2766 | void CalendarView::changeEventDisplay(Event *which, int action) |
2752 | { | 2767 | { |
2753 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 2768 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
2754 | changeIncidenceDisplay((Incidence *)which, action); | 2769 | changeIncidenceDisplay((Incidence *)which, action); |
2755 | static bool clearallviews = false; | 2770 | static bool clearallviews = false; |
2756 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2771 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2757 | if ( clearallviews ) { | 2772 | if ( clearallviews ) { |
2758 | clearAllViews(); | 2773 | clearAllViews(); |
2759 | clearallviews = false; | 2774 | clearallviews = false; |
2760 | } | 2775 | } |
2761 | return; | 2776 | return; |
2762 | } | 2777 | } |
2763 | clearallviews = true; | 2778 | clearallviews = true; |
2764 | mDateNavigator->updateView(); | 2779 | mDateNavigator->updateView(); |
2765 | //mDialogManager->updateSearchDialog(); | 2780 | //mDialogManager->updateSearchDialog(); |
2766 | if (which) { | 2781 | if (which) { |
2767 | // If there is an event view visible update the display | 2782 | // If there is an event view visible update the display |
2768 | mViewManager->currentView()->changeEventDisplay(which,action); | 2783 | mViewManager->currentView()->changeEventDisplay(which,action); |
2769 | // TODO: check, if update needed | 2784 | // TODO: check, if update needed |
2770 | // if (which->getTodoStatus()) { | 2785 | // if (which->getTodoStatus()) { |
2771 | mTodoList->updateView(); | 2786 | mTodoList->updateView(); |
2772 | if ( action != KOGlobals::EVENTDELETED ) { | 2787 | if ( action != KOGlobals::EVENTDELETED ) { |
2773 | mConflictingEvent = which ; | 2788 | mConflictingEvent = which ; |
2774 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); | 2789 | QTimer::singleShot( 1000, this, SLOT ( checkConflictForEvent() ) ); |
2775 | } | 2790 | } |
2776 | // } | 2791 | // } |
2777 | } else { | 2792 | } else { |
2778 | mViewManager->currentView()->updateView(); | 2793 | mViewManager->currentView()->updateView(); |
2779 | } | 2794 | } |
2780 | } | 2795 | } |
2781 | void CalendarView::checkConflictForEvent() | 2796 | void CalendarView::checkConflictForEvent() |
2782 | { | 2797 | { |
2783 | 2798 | ||
2784 | if (!KOPrefs::instance()->mConfirm) | 2799 | if (!KOPrefs::instance()->mConfirm) |
2785 | return; | 2800 | return; |
2786 | if ( ! mConflictingEvent ) return; | 2801 | if ( ! mConflictingEvent ) return; |
2787 | if ( mConflictingEvent->doesFloat() ) { | 2802 | if ( mConflictingEvent->doesFloat() ) { |
2788 | mConflictingEvent = 0; | 2803 | mConflictingEvent = 0; |
2789 | return; | 2804 | return; |
2790 | } | 2805 | } |
2791 | QPtrList<Event> testlist = mCalendar->events(); | 2806 | QPtrList<Event> testlist = mCalendar->events(); |
2792 | Event * test = testlist.first(); | 2807 | Event * test = testlist.first(); |
2793 | QDateTime conflict; | 2808 | QDateTime conflict; |
2794 | QDateTime retVal; | 2809 | QDateTime retVal; |
2795 | bool found = false; | 2810 | bool found = false; |
2796 | Event * cE = 0; | 2811 | Event * cE = 0; |
2812 | QDateTime current = QDateTime::currentDateTime(); | ||
2797 | while ( test ) { | 2813 | while ( test ) { |
2798 | if ( !test->doesFloat() ) { | 2814 | if ( !test->doesFloat() ) { |
2799 | if ( mConflictingEvent->isOverlapping ( test, &retVal, true ) ) { | 2815 | if ( mConflictingEvent->isOverlapping ( test, &retVal, ¤t ) ) { |
2800 | if ( ! found ) { | 2816 | if ( ! found ) { |
2801 | conflict = retVal; | 2817 | conflict = retVal; |
2802 | cE = test; | 2818 | cE = test; |
2803 | } else { | 2819 | } else { |
2804 | if ( retVal < conflict ) { | 2820 | if ( retVal < conflict ) { |
2805 | conflict = retVal; | 2821 | conflict = retVal; |
2806 | cE = test; | 2822 | cE = test; |
2807 | } | 2823 | } |
2808 | } | 2824 | } |
2809 | found = true; | 2825 | found = true; |
2810 | } | 2826 | } |
2811 | } | 2827 | } |
2812 | test = testlist.next(); | 2828 | test = testlist.next(); |
2813 | } | 2829 | } |
2814 | if ( found ) { | 2830 | if ( found ) { |
2815 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 2831 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( mConflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
2816 | qApp->processEvents(); | 2832 | qApp->processEvents(); |
2817 | int km = KMessageBox::warningContinueCancel(this,mess, | 2833 | int km = KMessageBox::warningContinueCancel(this,mess, |
2818 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); | 2834 | i18n("KO/Pi Conflict delected"),i18n("Show date"),i18n("No problem!")); |
2819 | if ( km != KMessageBox::Continue ) | 2835 | if ( km != KMessageBox::Continue ) |
2820 | return; | 2836 | return; |
2821 | 2837 | ||
2822 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 2838 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
2823 | mViewManager->showDayView(); | 2839 | mViewManager->showDayView(); |
2824 | mNavigator->slotDaySelect( conflict.date() ); | 2840 | mNavigator->slotDaySelect( conflict.date() ); |
2825 | int hour = conflict.time().hour(); | 2841 | int hour = conflict.time().hour(); |
2826 | mViewManager->agendaView()->setStartHour( hour ); | 2842 | mViewManager->agendaView()->setStartHour( hour ); |
2827 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 2843 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( mConflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
2828 | return; | 2844 | return; |
2829 | } | 2845 | } |
2830 | 2846 | ||
2831 | return; | 2847 | return; |
2832 | 2848 | ||
2833 | } | 2849 | } |
2834 | 2850 | ||
2835 | void CalendarView::updateTodoViews() | 2851 | void CalendarView::updateTodoViews() |
2836 | { | 2852 | { |
2837 | mTodoList->updateView(); | 2853 | mTodoList->updateView(); |
2838 | mViewManager->currentView()->updateView(); | 2854 | mViewManager->currentView()->updateView(); |
2839 | 2855 | ||
2840 | } | 2856 | } |
2841 | 2857 | ||
2842 | 2858 | ||
2843 | 2859 | ||
2844 | void CalendarView::clearAllViews() | 2860 | void CalendarView::clearAllViews() |
2845 | { | 2861 | { |
2846 | mTodoList->clearList(); | 2862 | mTodoList->clearList(); |
2847 | mViewManager->clearAllViews(); | 2863 | mViewManager->clearAllViews(); |
2848 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 2864 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
2849 | if ( sd ) { | 2865 | if ( sd ) { |
2850 | KOListView* kol = sd->listview(); | 2866 | KOListView* kol = sd->listview(); |
2851 | if ( kol ) | 2867 | if ( kol ) |
2852 | kol->clearList(); | 2868 | kol->clearList(); |
2853 | } | 2869 | } |
2854 | } | 2870 | } |
2855 | void CalendarView::updateView() | 2871 | void CalendarView::updateView() |
2856 | { | 2872 | { |
2857 | static bool clearallviews = false; | 2873 | static bool clearallviews = false; |
2858 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 2874 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
2859 | if ( clearallviews ) { | 2875 | if ( clearallviews ) { |
2860 | clearAllViews(); | 2876 | clearAllViews(); |
2861 | clearallviews = false; | 2877 | clearallviews = false; |
2862 | } | 2878 | } |
2863 | return; | 2879 | return; |
2864 | } | 2880 | } |
2865 | clearallviews = true; | 2881 | clearallviews = true; |
2866 | DateList tmpList = mNavigator->selectedDates(); | 2882 | DateList tmpList = mNavigator->selectedDates(); |
2867 | 2883 | ||
2868 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 2884 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
2869 | mTodoList->updateView(); | 2885 | mTodoList->updateView(); |
2870 | // We assume that the navigator only selects consecutive days. | 2886 | // We assume that the navigator only selects consecutive days. |
2871 | updateView( tmpList.first(), tmpList.last() ); | 2887 | updateView( tmpList.first(), tmpList.last() ); |
2872 | } | 2888 | } |
2873 | 2889 | ||
2874 | void CalendarView::updateUnmanagedViews() | 2890 | void CalendarView::updateUnmanagedViews() |
2875 | { | 2891 | { |
2876 | mDateNavigator->updateDayMatrix(); | 2892 | mDateNavigator->updateDayMatrix(); |
2877 | } | 2893 | } |
2878 | 2894 | ||
2879 | int CalendarView::msgItemDelete(const QString name) | 2895 | int CalendarView::msgItemDelete(const QString name) |
2880 | { | 2896 | { |
2881 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 2897 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
2882 | i18n("This item will be\npermanently deleted."), | 2898 | i18n("This item will be\npermanently deleted."), |
2883 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 2899 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
2884 | } | 2900 | } |
2885 | 2901 | ||
2886 | 2902 | ||
2887 | void CalendarView::edit_cut() | 2903 | void CalendarView::edit_cut() |
2888 | { | 2904 | { |
2889 | Event *anEvent=0; | 2905 | Event *anEvent=0; |
2890 | 2906 | ||
2891 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2907 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2892 | 2908 | ||
2893 | if (mViewManager->currentView()->isEventView()) { | 2909 | if (mViewManager->currentView()->isEventView()) { |
2894 | if ( incidence && incidence->typeID() == eventID ) { | 2910 | if ( incidence && incidence->typeID() == eventID ) { |
2895 | anEvent = static_cast<Event *>(incidence); | 2911 | anEvent = static_cast<Event *>(incidence); |
2896 | } | 2912 | } |
2897 | } | 2913 | } |
2898 | 2914 | ||
2899 | if (!anEvent) { | 2915 | if (!anEvent) { |
2900 | KNotifyClient::beep(); | 2916 | KNotifyClient::beep(); |
2901 | return; | 2917 | return; |
2902 | } | 2918 | } |
2903 | DndFactory factory( mCalendar ); | 2919 | DndFactory factory( mCalendar ); |
2904 | factory.cutIncidence(anEvent); | 2920 | factory.cutIncidence(anEvent); |
2905 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 2921 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
2906 | } | 2922 | } |
2907 | 2923 | ||
2908 | void CalendarView::edit_copy() | 2924 | void CalendarView::edit_copy() |
2909 | { | 2925 | { |
2910 | Event *anEvent=0; | 2926 | Event *anEvent=0; |
2911 | 2927 | ||
2912 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2928 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2913 | 2929 | ||
2914 | if (mViewManager->currentView()->isEventView()) { | 2930 | if (mViewManager->currentView()->isEventView()) { |
2915 | if ( incidence && incidence->typeID() == eventID ) { | 2931 | if ( incidence && incidence->typeID() == eventID ) { |
2916 | anEvent = static_cast<Event *>(incidence); | 2932 | anEvent = static_cast<Event *>(incidence); |
2917 | } | 2933 | } |
2918 | } | 2934 | } |
2919 | 2935 | ||
2920 | if (!anEvent) { | 2936 | if (!anEvent) { |
2921 | KNotifyClient::beep(); | 2937 | KNotifyClient::beep(); |
2922 | return; | 2938 | return; |
2923 | } | 2939 | } |
2924 | DndFactory factory( mCalendar ); | 2940 | DndFactory factory( mCalendar ); |
2925 | factory.copyIncidence(anEvent); | 2941 | factory.copyIncidence(anEvent); |
2926 | } | 2942 | } |
2927 | 2943 | ||
2928 | void CalendarView::edit_paste() | 2944 | void CalendarView::edit_paste() |
2929 | { | 2945 | { |
2930 | QDate date = mNavigator->selectedDates().first(); | 2946 | QDate date = mNavigator->selectedDates().first(); |
2931 | 2947 | ||
2932 | DndFactory factory( mCalendar ); | 2948 | DndFactory factory( mCalendar ); |
2933 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); | 2949 | Event *pastedEvent = (Event *)factory.pasteIncidence( date ); |
2934 | 2950 | ||
2935 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); | 2951 | changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); |
2936 | } | 2952 | } |
2937 | void CalendarView::edit_global_options() | 2953 | void CalendarView::edit_global_options() |
2938 | { | 2954 | { |
2939 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; | 2955 | QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; |
2940 | emit save(); | 2956 | emit save(); |
2941 | emit saveStopTimer(); | 2957 | emit saveStopTimer(); |
2942 | mDialogManager->showGlobalOptionsDialog(); | 2958 | mDialogManager->showGlobalOptionsDialog(); |
2943 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { | 2959 | if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { |
2944 | emit saveStopTimer(); | 2960 | emit saveStopTimer(); |
2945 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), | 2961 | if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, i18n("The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n\"How do I change the timezone?\"\nas well!"), |
2946 | i18n("Timezone settings"),i18n("Reload"))) { | 2962 | i18n("Timezone settings"),i18n("Reload"))) { |
2947 | qDebug("KO: TZ reload cancelled "); | 2963 | qDebug("KO: TZ reload cancelled "); |
2948 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2964 | mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2949 | return; | 2965 | return; |
2950 | } | 2966 | } |
2951 | qDebug("KO: Timezone change "); | 2967 | qDebug("KO: Timezone change "); |
2952 | loadCalendars(); | 2968 | loadCalendars(); |
2953 | setModified(true); | 2969 | setModified(true); |
2954 | } | 2970 | } |
2955 | else | 2971 | else |
2956 | qDebug("KO: No tz change "); | 2972 | qDebug("KO: No tz change "); |
2957 | } | 2973 | } |
2958 | void CalendarView::edit_options() | 2974 | void CalendarView::edit_options() |
2959 | { | 2975 | { |
2960 | mDialogManager->showOptionsDialog(); | 2976 | mDialogManager->showOptionsDialog(); |
2961 | } | 2977 | } |
2962 | 2978 | ||
2963 | 2979 | ||
2964 | void CalendarView::slotSelectPickerDate( QDate d) | 2980 | void CalendarView::slotSelectPickerDate( QDate d) |
2965 | { | 2981 | { |
2966 | mDateFrame->hide(); | 2982 | mDateFrame->hide(); |
2967 | if ( mDatePickerMode == 1 ) { | 2983 | if ( mDatePickerMode == 1 ) { |
2968 | mNavigator->slotDaySelect( d ); | 2984 | mNavigator->slotDaySelect( d ); |
2969 | } else if ( mDatePickerMode == 2 ) { | 2985 | } else if ( mDatePickerMode == 2 ) { |
2970 | if ( mMoveIncidence->typeID() == todoID ) { | 2986 | if ( mMoveIncidence->typeID() == todoID ) { |
2971 | Todo * to = (Todo *) mMoveIncidence; | 2987 | Todo * to = (Todo *) mMoveIncidence; |
2972 | QTime tim; | 2988 | QTime tim; |
2973 | int len = 0; | 2989 | int len = 0; |
2974 | if ( to->hasStartDate() && to->hasDueDate() ) | 2990 | if ( to->hasStartDate() && to->hasDueDate() ) |
2975 | len = to->dtStart().secsTo( to->dtDue()); | 2991 | len = to->dtStart().secsTo( to->dtDue()); |
2976 | if ( to->hasDueDate() ) | 2992 | if ( to->hasDueDate() ) |
2977 | tim = to->dtDue().time(); | 2993 | tim = to->dtDue().time(); |
2978 | else { | 2994 | else { |
2979 | tim = QTime ( 0,0,0 ); | 2995 | tim = QTime ( 0,0,0 ); |
2980 | to->setFloats( true ); | 2996 | to->setFloats( true ); |
2981 | to->setHasDueDate( true ); | 2997 | to->setHasDueDate( true ); |
2982 | } | 2998 | } |
2983 | QDateTime dt ( d,tim ); | 2999 | QDateTime dt ( d,tim ); |
2984 | to->setDtDue( dt ); | 3000 | to->setDtDue( dt ); |
2985 | 3001 | ||
2986 | if ( to->hasStartDate() ) { | 3002 | if ( to->hasStartDate() ) { |
2987 | if ( len>0 ) | 3003 | if ( len>0 ) |
2988 | to->setDtStart(to->dtDue().addSecs( -len )); | 3004 | to->setDtStart(to->dtDue().addSecs( -len )); |
2989 | else | 3005 | else |
2990 | if (to->dtStart() > to->dtDue() ) | 3006 | if (to->dtStart() > to->dtDue() ) |
2991 | to->setDtStart(to->dtDue().addDays( -3 )); | 3007 | to->setDtStart(to->dtDue().addDays( -3 )); |
2992 | } | 3008 | } |
2993 | 3009 | ||
2994 | todoChanged( to ); | 3010 | todoChanged( to ); |
2995 | } else if ( mMoveIncidence->typeID() == eventID ) { | 3011 | } else if ( mMoveIncidence->typeID() == eventID ) { |
2996 | if ( mMoveIncidence->doesRecur() ) { | 3012 | if ( mMoveIncidence->doesRecur() ) { |
2997 | #if 0 | 3013 | #if 0 |
2998 | // PENDING implement this | 3014 | // PENDING implement this |
2999 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); | 3015 | Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); |
3000 | mCalendar()->addIncidence( newInc ); | 3016 | mCalendar()->addIncidence( newInc ); |
3001 | if ( mMoveIncidence->typeID() == todoID ) | 3017 | if ( mMoveIncidence->typeID() == todoID ) |
3002 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); | 3018 | emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); |
3003 | else | 3019 | else |
3004 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); | 3020 | emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); |
3005 | mMoveIncidence = newInc; | 3021 | mMoveIncidence = newInc; |
3006 | 3022 | ||
3007 | #endif | 3023 | #endif |
3008 | } | 3024 | } |
3009 | QTime tim = mMoveIncidence->dtStart().time(); | 3025 | QTime tim = mMoveIncidence->dtStart().time(); |
3010 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); | 3026 | int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); |
3011 | QDateTime dt ( d,tim ); | 3027 | QDateTime dt ( d,tim ); |
3012 | mMoveIncidence->setDtStart( dt ); | 3028 | mMoveIncidence->setDtStart( dt ); |
3013 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); | 3029 | ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); |
3014 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); | 3030 | changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); |
3015 | } else if ( mMoveIncidence->typeID() == journalID ) { | 3031 | } else if ( mMoveIncidence->typeID() == journalID ) { |
3016 | QTime tim = mMoveIncidence->dtStart().time(); | 3032 | QTime tim = mMoveIncidence->dtStart().time(); |
3017 | QDateTime dt ( d,tim ); | 3033 | QDateTime dt ( d,tim ); |
3018 | mMoveIncidence->setDtStart( dt ); | 3034 | mMoveIncidence->setDtStart( dt ); |
3019 | updateView(); | 3035 | updateView(); |
3020 | } | 3036 | } |
3021 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); | 3037 | mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); |
3022 | } | 3038 | } |
3023 | } | 3039 | } |
3024 | 3040 | ||
3025 | void CalendarView::removeCategories() | 3041 | void CalendarView::removeCategories() |
3026 | { | 3042 | { |
3027 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3043 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3028 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3044 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3029 | QStringList catIncList; | 3045 | QStringList catIncList; |
3030 | QStringList newCatList; | 3046 | QStringList newCatList; |
3031 | Incidence* inc = incList.first(); | 3047 | Incidence* inc = incList.first(); |
3032 | uint i; | 3048 | uint i; |
3033 | while ( inc ) { | 3049 | while ( inc ) { |
3034 | newCatList.clear(); | 3050 | newCatList.clear(); |
3035 | catIncList = inc->categories() ; | 3051 | catIncList = inc->categories() ; |
3036 | for( i = 0; i< catIncList.count(); ++i ) { | 3052 | for( i = 0; i< catIncList.count(); ++i ) { |
3037 | if ( catList.contains (catIncList[i])) | 3053 | if ( catList.contains (catIncList[i])) |
3038 | newCatList.append( catIncList[i] ); | 3054 | newCatList.append( catIncList[i] ); |
3039 | } | 3055 | } |
3040 | newCatList.sort(); | 3056 | newCatList.sort(); |
3041 | inc->setCategories( newCatList.join(",") ); | 3057 | inc->setCategories( newCatList.join(",") ); |
3042 | inc = incList.next(); | 3058 | inc = incList.next(); |
3043 | } | 3059 | } |
3044 | } | 3060 | } |
3045 | 3061 | ||
3046 | int CalendarView::addCategories() | 3062 | int CalendarView::addCategories() |
3047 | { | 3063 | { |
3048 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); | 3064 | QPtrList<Incidence> incList = mCalendar->rawIncidences(); |
3049 | QStringList catList = KOPrefs::instance()->mCustomCategories; | 3065 | QStringList catList = KOPrefs::instance()->mCustomCategories; |
3050 | QStringList catIncList; | 3066 | QStringList catIncList; |
3051 | Incidence* inc = incList.first(); | 3067 | Incidence* inc = incList.first(); |
3052 | uint i; | 3068 | uint i; |
3053 | int count = 0; | 3069 | int count = 0; |
3054 | while ( inc ) { | 3070 | while ( inc ) { |
3055 | catIncList = inc->categories() ; | 3071 | catIncList = inc->categories() ; |