author | zautrix <zautrix> | 2005-10-26 09:10:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-26 09:10:50 (UTC) |
commit | 15b9123c6c1f9096a4b1a7729c323433d408c8d7 (patch) (unidiff) | |
tree | 3d9a8a521df355641642172ab1200a0f75529910 /korganizer/calendarview.cpp | |
parent | f696b904526567d45cd01a5b607644f8aa3bfe6b (diff) | |
download | kdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.zip kdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.tar.gz kdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.tar.bz2 |
fix
-rw-r--r-- | korganizer/calendarview.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 28b17a5..31e103d 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -321,96 +321,101 @@ class KOCatPrefs : public QDialog | |||
321 | lay->addWidget( format ); | 321 | lay->addWidget( format ); |
322 | format->setExclusive ( true ) ; | 322 | format->setExclusive ( true ) ; |
323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); | 323 | addCatBut = new QRadioButton(i18n("Add to category list"), format ); |
324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); | 324 | new QRadioButton(i18n("Remove from Events/Todos"), format ); |
325 | addCatBut->setChecked( true ); | 325 | addCatBut->setChecked( true ); |
326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); | 326 | QPushButton * ok = new QPushButton( i18n("Change category list now!"), this ); |
327 | lay->addWidget( ok ); | 327 | lay->addWidget( ok ); |
328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 328 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
329 | lay->addWidget( cancel ); | 329 | lay->addWidget( cancel ); |
330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 330 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 331 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
332 | resize( 200, 200 ); | 332 | resize( 200, 200 ); |
333 | } | 333 | } |
334 | 334 | ||
335 | bool addCat() { return addCatBut->isChecked(); } | 335 | bool addCat() { return addCatBut->isChecked(); } |
336 | private: | 336 | private: |
337 | QRadioButton* addCatBut; | 337 | QRadioButton* addCatBut; |
338 | }; | 338 | }; |
339 | 339 | ||
340 | 340 | ||
341 | 341 | ||
342 | CalendarView::CalendarView( CalendarResources *calendar, | 342 | CalendarView::CalendarView( CalendarResources *calendar, |
343 | QWidget *parent, const char *name ) | 343 | QWidget *parent, const char *name ) |
344 | : CalendarViewBase( parent, name ), | 344 | : CalendarViewBase( parent, name ), |
345 | mCalendar( calendar ), | 345 | mCalendar( calendar ), |
346 | mResourceManager( calendar->resourceManager() ) | 346 | mResourceManager( calendar->resourceManager() ) |
347 | { | 347 | { |
348 | 348 | ||
349 | mEventEditor = 0; | 349 | mEventEditor = 0; |
350 | mTodoEditor = 0; | 350 | mTodoEditor = 0; |
351 | 351 | ||
352 | init(); | 352 | init(); |
353 | } | 353 | } |
354 | 354 | ||
355 | CalendarView::CalendarView( Calendar *calendar, | 355 | CalendarView::CalendarView( Calendar *calendar, |
356 | QWidget *parent, const char *name ) | 356 | QWidget *parent, const char *name ) |
357 | : CalendarViewBase( parent, name ), | 357 | : CalendarViewBase( parent, name ), |
358 | mCalendar( calendar ), | 358 | mCalendar( calendar ), |
359 | mResourceManager( 0 ) | 359 | mResourceManager( 0 ) |
360 | { | 360 | { |
361 | 361 | ||
362 | mEventEditor = 0; | 362 | mEventEditor = 0; |
363 | mTodoEditor = 0; | 363 | mTodoEditor = 0; |
364 | init(); | 364 | init(); |
365 | } | 365 | } |
366 | 366 | ||
367 | void CalendarView::init() | 367 | void CalendarView::init() |
368 | { | 368 | { |
369 | flag_blockConflict = false; | ||
370 | flag_blockScrollBar = false; | ||
371 | flag_checkFileFirsttime = true; | ||
372 | flag_clearallviewsEventDisplay = false; | ||
373 | flag_clearallviewsupdateView = false; | ||
369 | mNextAlarmDateTime = QDateTime::currentDateTime(); | 374 | mNextAlarmDateTime = QDateTime::currentDateTime(); |
370 | setFocusPolicy (NoFocus ); | 375 | setFocusPolicy (NoFocus ); |
371 | mViewerCallerIsSearchDialog = false; | 376 | mViewerCallerIsSearchDialog = false; |
372 | mBlockShowDates = false; | 377 | mBlockShowDates = false; |
373 | mConflictingEvent = 0; | 378 | mConflictingEvent = 0; |
374 | mDatePickerMode = 0; | 379 | mDatePickerMode = 0; |
375 | mCurrentSyncDevice = ""; | 380 | mCurrentSyncDevice = ""; |
376 | mViewManager = new KOViewManager( this ); | 381 | mViewManager = new KOViewManager( this ); |
377 | mDialogManager = new KODialogManager( this ); | 382 | mDialogManager = new KODialogManager( this ); |
378 | mEventViewerDialog = 0; | 383 | mEventViewerDialog = 0; |
379 | mModified = false; | 384 | mModified = false; |
380 | mReadOnly = false; | 385 | mReadOnly = false; |
381 | mSelectedIncidence = 0; | 386 | mSelectedIncidence = 0; |
382 | mCalPrinter = 0; | 387 | mCalPrinter = 0; |
383 | mFilters.setAutoDelete(true); | 388 | mFilters.setAutoDelete(true); |
384 | 389 | ||
385 | mCalendar->registerObserver( this ); | 390 | mCalendar->registerObserver( this ); |
386 | // TODO: Make sure that view is updated, when calendar is changed. | 391 | // TODO: Make sure that view is updated, when calendar is changed. |
387 | 392 | ||
388 | mStorage = new FileStorage( mCalendar ); | 393 | mStorage = new FileStorage( mCalendar ); |
389 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); | 394 | mNavigator = new DateNavigator( this, "datevav", mViewManager ); |
390 | 395 | ||
391 | QBoxLayout *topLayout = (QBoxLayout*)layout(); | 396 | QBoxLayout *topLayout = (QBoxLayout*)layout(); |
392 | #ifndef KORG_NOSPLITTER | 397 | #ifndef KORG_NOSPLITTER |
393 | // create the main layout frames. | 398 | // create the main layout frames. |
394 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); | 399 | mPanner = new QSplitter(QSplitter::Horizontal,this,"CalendarView::Panner"); |
395 | topLayout->addWidget(mPanner); | 400 | topLayout->addWidget(mPanner); |
396 | 401 | ||
397 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, | 402 | mLeftSplitter = new QSplitter(QSplitter::Vertical,mPanner, |
398 | "CalendarView::LeftFrame"); | 403 | "CalendarView::LeftFrame"); |
399 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); | 404 | mPanner->setResizeMode(mLeftSplitter,QSplitter::KeepSize); |
400 | 405 | ||
401 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, | 406 | mDateNavigator = new DateNavigatorContainer( mLeftSplitter, |
402 | "CalendarView::DateNavigator" ); | 407 | "CalendarView::DateNavigator" ); |
403 | 408 | ||
404 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); | 409 | mLeftSplitter->setResizeMode(mDateNavigator,QSplitter::KeepSize); |
405 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); | 410 | mTodoList = new KOTodoView(mCalendar, mLeftSplitter, "todolist_small2"); |
406 | mTodoList->setNavigator( mNavigator ); | 411 | mTodoList->setNavigator( mNavigator ); |
407 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); | 412 | mFilterView = new KOFilterView(&mFilters,mLeftSplitter,"CalendarView::FilterView"); |
408 | 413 | ||
409 | #ifdef KORG_NORESOURCEVIEW | 414 | #ifdef KORG_NORESOURCEVIEW |
410 | mResourceView = 0; | 415 | mResourceView = 0; |
411 | #else | 416 | #else |
412 | if ( mResourceManager ) { | 417 | if ( mResourceManager ) { |
413 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); | 418 | mResourceView = new ResourceView( mResourceManager, mLeftSplitter ); |
414 | mResourceView->updateView(); | 419 | mResourceView->updateView(); |
415 | connect( mResourceView, SIGNAL( resourcesChanged() ), | 420 | connect( mResourceView, SIGNAL( resourcesChanged() ), |
416 | SLOT( updateView() ) ); | 421 | SLOT( updateView() ) ); |
@@ -616,277 +621,274 @@ void CalendarView::init() | |||
616 | mDateFrame->setLineWidth(3); | 621 | mDateFrame->setLineWidth(3); |
617 | mDateFrame->hide(); | 622 | mDateFrame->hide(); |
618 | mDateFrame->setCaption( i18n( "Pick a date to display")); | 623 | mDateFrame->setCaption( i18n( "Pick a date to display")); |
619 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); | 624 | mDatePicker = new KDatePicker ( mDateFrame , QDate::currentDate() ); |
620 | 625 | ||
621 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); | 626 | connect(mDatePicker,SIGNAL(dateSelected(QDate)),SLOT(slotSelectPickerDate(QDate))); |
622 | 627 | ||
623 | mEventEditor = mDialogManager->getEventEditor(); | 628 | mEventEditor = mDialogManager->getEventEditor(); |
624 | mTodoEditor = mDialogManager->getTodoEditor(); | 629 | mTodoEditor = mDialogManager->getTodoEditor(); |
625 | 630 | ||
626 | mFlagEditDescription = false; | 631 | mFlagEditDescription = false; |
627 | 632 | ||
628 | mSuspendTimer = new QTimer( this ); | 633 | mSuspendTimer = new QTimer( this ); |
629 | mAlarmTimer = new QTimer( this ); | 634 | mAlarmTimer = new QTimer( this ); |
630 | mRecheckAlarmTimer = new QTimer( this ); | 635 | mRecheckAlarmTimer = new QTimer( this ); |
631 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); | 636 | connect( mRecheckAlarmTimer, SIGNAL( timeout () ), SLOT( recheckTimerAlarm() ) ); |
632 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); | 637 | connect( mSuspendTimer, SIGNAL( timeout () ), SLOT( suspendAlarm() ) ); |
633 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); | 638 | connect( mAlarmTimer, SIGNAL( timeout () ), SLOT( timerAlarm() ) ); |
634 | mAlarmDialog = new AlarmDialog( this ); | 639 | mAlarmDialog = new AlarmDialog( this ); |
635 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 640 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
636 | mAlarmDialog->setServerNotification( false ); | 641 | mAlarmDialog->setServerNotification( false ); |
637 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 642 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
638 | 643 | ||
639 | 644 | ||
640 | #ifndef DESKTOP_VERSION | 645 | #ifndef DESKTOP_VERSION |
641 | //US listen for arriving address resultsets | 646 | //US listen for arriving address resultsets |
642 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 647 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
643 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 648 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
644 | #endif | 649 | #endif |
645 | mDateNavigator->setCalendar( mCalendar ); | 650 | mDateNavigator->setCalendar( mCalendar ); |
646 | } | 651 | } |
647 | 652 | ||
648 | 653 | ||
649 | CalendarView::~CalendarView() | 654 | CalendarView::~CalendarView() |
650 | { | 655 | { |
651 | // kdDebug() << "~CalendarView()" << endl; | 656 | // kdDebug() << "~CalendarView()" << endl; |
652 | //qDebug("CalendarView::~CalendarView() "); | 657 | //qDebug("CalendarView::~CalendarView() "); |
653 | delete mDialogManager; | 658 | delete mDialogManager; |
654 | delete mViewManager; | 659 | delete mViewManager; |
655 | delete mStorage; | 660 | delete mStorage; |
656 | delete mDateFrame ; | 661 | delete mDateFrame ; |
657 | delete mEventViewerDialog; | 662 | delete mEventViewerDialog; |
658 | //kdDebug() << "~CalendarView() done" << endl; | 663 | //kdDebug() << "~CalendarView() done" << endl; |
659 | } | 664 | } |
660 | 665 | ||
661 | 666 | ||
662 | void CalendarView::nextConflict( bool all, bool allday ) | 667 | void CalendarView::nextConflict( bool all, bool allday ) |
663 | { | 668 | { |
664 | static bool block = false; | 669 | if ( flag_blockConflict ) return; |
665 | if ( block ) return; | 670 | flag_blockConflict = true; |
666 | block = true; | ||
667 | QPtrList<Event> testlist = mCalendar->events(); | 671 | QPtrList<Event> testlist = mCalendar->events(); |
668 | Event * test = testlist.first(); | 672 | Event * test = testlist.first(); |
669 | while ( test ) { | 673 | while ( test ) { |
670 | test->setTagged( false ); | 674 | test->setTagged( false ); |
671 | test = testlist.next(); | 675 | test = testlist.next(); |
672 | } | 676 | } |
673 | QTime st ( 0,0,0); | 677 | QTime st ( 0,0,0); |
674 | if ( mViewManager->currentView() == mViewManager->agendaView() ) | 678 | if ( mViewManager->currentView() == mViewManager->agendaView() ) |
675 | st = mViewManager->agendaView()->agenda()->getEndTime(); | 679 | st = mViewManager->agendaView()->agenda()->getEndTime(); |
676 | //qDebug("time %s ", st.toString().latin1()); | 680 | //qDebug("time %s ", st.toString().latin1()); |
677 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); | 681 | QDateTime startDT = QDateTime (mNavigator->selectedDates().first(),st); |
678 | QDateTime conflict; | 682 | QDateTime conflict; |
679 | QDateTime retVal; | 683 | QDateTime retVal; |
680 | bool found = false; | 684 | bool found = false; |
681 | Event * cE = 0; | 685 | Event * cE = 0; |
682 | Event * cE2 = 0; | 686 | Event * cE2 = 0; |
683 | QPtrList<Event> testlist2 = testlist; | 687 | QPtrList<Event> testlist2 = testlist; |
684 | test = testlist.first(); | 688 | test = testlist.first(); |
685 | bool skip = false; | 689 | bool skip = false; |
686 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); | 690 | topLevelWidget()->setCaption( i18n("Checking conflicts ... please wait") ); |
687 | //QTime tm; | 691 | //QTime tm; |
688 | //tm.start(); | 692 | //tm.start(); |
689 | while ( test ) { | 693 | while ( test ) { |
690 | qApp->processEvents(); | 694 | qApp->processEvents(); |
691 | skip = false; | 695 | skip = false; |
692 | if ( !all ) skip = ( allday != test->doesFloat() ); | 696 | if ( !all ) skip = ( allday != test->doesFloat() ); |
693 | if ( !skip ) { | 697 | if ( !skip ) { |
694 | if ( found ) | 698 | if ( found ) |
695 | skip = !test->matchTime( &startDT, &conflict ); | 699 | skip = !test->matchTime( &startDT, &conflict ); |
696 | else | 700 | else |
697 | skip = !test->matchTime( &startDT, 0 ); | 701 | skip = !test->matchTime( &startDT, 0 ); |
698 | } | 702 | } |
699 | if ( !skip ) { | 703 | if ( !skip ) { |
700 | Event * test2 = testlist2.first(); | 704 | Event * test2 = testlist2.first(); |
701 | while ( test2 ) { | 705 | while ( test2 ) { |
702 | skip = test2->isTagged(); | 706 | skip = test2->isTagged(); |
703 | if ( !skip && !all ) skip = ( allday != test2->doesFloat() ); | 707 | if ( !skip && !all ) skip = ( allday != test2->doesFloat() ); |
704 | if ( !skip ) { | 708 | if ( !skip ) { |
705 | if ( found ) | 709 | if ( found ) |
706 | skip = !test2->matchTime( &startDT, &conflict ); | 710 | skip = !test2->matchTime( &startDT, &conflict ); |
707 | else | 711 | else |
708 | skip = !test2->matchTime( &startDT, 0 ); | 712 | skip = !test2->matchTime( &startDT, 0 ); |
709 | } | 713 | } |
710 | if ( !skip ) { | 714 | if ( !skip ) { |
711 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { | 715 | if ( test->isOverlapping ( test2, &retVal, &startDT ) ) { |
712 | //qDebug("overlap "); | 716 | //qDebug("overlap "); |
713 | if ( ! found ) { | 717 | if ( ! found ) { |
714 | if ( retVal >= startDT ) { | 718 | if ( retVal >= startDT ) { |
715 | conflict = retVal; | 719 | conflict = retVal; |
716 | cE = test; | 720 | cE = test; |
717 | cE2 = test2; | 721 | cE2 = test2; |
718 | found = true; | 722 | found = true; |
719 | } | 723 | } |
720 | } else { | 724 | } else { |
721 | if ( retVal >= startDT && retVal < conflict ) { | 725 | if ( retVal >= startDT && retVal < conflict ) { |
722 | conflict = retVal; | 726 | conflict = retVal; |
723 | cE = test; | 727 | cE = test; |
724 | cE2 = test2; | 728 | cE2 = test2; |
725 | } | 729 | } |
726 | } | 730 | } |
727 | } | 731 | } |
728 | } | 732 | } |
729 | test2 = testlist2.next(); | 733 | test2 = testlist2.next(); |
730 | } | 734 | } |
731 | } | 735 | } |
732 | test->setTagged( true ); | 736 | test->setTagged( true ); |
733 | test = testlist.next(); | 737 | test = testlist.next(); |
734 | } | 738 | } |
735 | //qDebug("Search time : %d", tm.elapsed()); | 739 | //qDebug("Search time : %d", tm.elapsed()); |
736 | if ( found ) { | 740 | if ( found ) { |
737 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 741 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
738 | mViewManager->showDayView(); | 742 | mViewManager->showDayView(); |
739 | mNavigator->slotDaySelect( conflict.date() ); | 743 | mNavigator->slotDaySelect( conflict.date() ); |
740 | int hour = conflict.time().hour(); | 744 | int hour = conflict.time().hour(); |
741 | mViewManager->agendaView()->setStartHour( hour ); | 745 | mViewManager->agendaView()->setStartHour( hour ); |
742 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); | 746 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( cE->summary().left( 20 ) ).arg( cE2->summary().left( 20 ) ) ); |
743 | block = false; | 747 | flag_blockConflict = false; |
744 | return; | 748 | return; |
745 | } | 749 | } |
746 | 750 | ||
747 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 751 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
748 | //qDebug("No conflict found "); | 752 | //qDebug("No conflict found "); |
749 | block = false; | 753 | flag_blockConflict = false; |
750 | return; | 754 | return; |
751 | } | 755 | } |
752 | 756 | ||
753 | void CalendarView::conflictAll() | 757 | void CalendarView::conflictAll() |
754 | { | 758 | { |
755 | nextConflict ( true, true ); | 759 | nextConflict ( true, true ); |
756 | } | 760 | } |
757 | void CalendarView::conflictAllday() | 761 | void CalendarView::conflictAllday() |
758 | { | 762 | { |
759 | nextConflict ( false, true ); | 763 | nextConflict ( false, true ); |
760 | } | 764 | } |
761 | void CalendarView::conflictNotAll() | 765 | void CalendarView::conflictNotAll() |
762 | { | 766 | { |
763 | nextConflict ( false, false ); | 767 | nextConflict ( false, false ); |
764 | } | 768 | } |
765 | 769 | ||
766 | void CalendarView::setCalReadOnly( int id, bool readO ) | 770 | void CalendarView::setCalReadOnly( int id, bool readO ) |
767 | { | 771 | { |
768 | if ( readO ) { | 772 | if ( readO ) { |
769 | emit save(); | 773 | emit save(); |
770 | } | 774 | } |
771 | mCalendar->setReadOnly( id, readO ); | 775 | mCalendar->setReadOnly( id, readO ); |
772 | } | 776 | } |
773 | void CalendarView::setScrollBarStep(int val ) | 777 | void CalendarView::setScrollBarStep(int val ) |
774 | { | 778 | { |
775 | #ifdef DESKTOP_VERSION | 779 | #ifdef DESKTOP_VERSION |
776 | mDateScrollBar->setLineStep ( val ); | 780 | mDateScrollBar->setLineStep ( val ); |
777 | #endif | 781 | #endif |
778 | } | 782 | } |
779 | void CalendarView::scrollBarValue(int val ) | 783 | void CalendarView::scrollBarValue(int val ) |
780 | { | 784 | { |
781 | #ifdef DESKTOP_VERSION | 785 | #ifdef DESKTOP_VERSION |
782 | if ( QApplication::desktop()->width() < 800 ) return; | 786 | if ( QApplication::desktop()->width() < 800 ) return; |
783 | static bool block = false; | 787 | if ( flag_blockScrollBar ) return; |
784 | if ( block ) return; | 788 | flag_blockScrollBar = true; |
785 | block = true; | ||
786 | int count = mNavigator->selectedDates().count(); | 789 | int count = mNavigator->selectedDates().count(); |
787 | int day = mNavigator->selectedDates().first().dayOfYear(); | 790 | int day = mNavigator->selectedDates().first().dayOfYear(); |
788 | int stepdays = val; | 791 | int stepdays = val; |
789 | if ( mDateScrollBar->lineStep () <= count ) { | 792 | if ( mDateScrollBar->lineStep () <= count ) { |
790 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 793 | //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
791 | //qDebug("VAL %d ",val ); | 794 | //qDebug("VAL %d ",val ); |
792 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); | 795 | stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); |
793 | stepdays = day+stepdays; | 796 | stepdays = day+stepdays; |
794 | if ( stepdays < 0 ) stepdays = 0; | 797 | if ( stepdays < 0 ) stepdays = 0; |
795 | } | 798 | } |
796 | if ( stepdays == day ) { | 799 | if ( stepdays == day ) { |
797 | block = false; | 800 | flag_blockScrollBar = false; |
798 | return; | 801 | return; |
799 | } | 802 | } |
800 | int year = mNavigator->selectedDates().first().year(); | 803 | int year = mNavigator->selectedDates().first().year(); |
801 | QDate d ( year,1,1 ); | 804 | QDate d ( year,1,1 ); |
802 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); | 805 | mNavigator->selectDates( d.addDays( stepdays-1) , count ); |
803 | block = false; | 806 | flag_blockScrollBar = false; |
804 | #endif | 807 | #endif |
805 | 808 | ||
806 | } | 809 | } |
807 | void CalendarView::updateView(const QDate &start, const QDate &end) | 810 | void CalendarView::updateView(const QDate &start, const QDate &end) |
808 | { | 811 | { |
809 | #ifdef DESKTOP_VERSION | 812 | #ifdef DESKTOP_VERSION |
810 | if ( ! mDateScrollBar->draggingSlider () ) { | 813 | if ( ! mDateScrollBar->draggingSlider () ) { |
811 | int dof = start.dayOfYear(); | 814 | int dof = start.dayOfYear(); |
812 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); | 815 | //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() ); |
813 | if ( dof != mDateScrollBar->value() ) { | 816 | if ( dof != mDateScrollBar->value() ) { |
814 | mDateScrollBar->blockSignals( true ); | 817 | mDateScrollBar->blockSignals( true ); |
815 | mDateScrollBar->setValue( start.dayOfYear()); | 818 | mDateScrollBar->setValue( start.dayOfYear()); |
816 | mDateScrollBar->blockSignals( false ); | 819 | mDateScrollBar->blockSignals( false ); |
817 | } | 820 | } |
818 | } | 821 | } |
819 | #endif | 822 | #endif |
820 | mTodoList->updateView(); | 823 | mTodoList->updateView(); |
821 | mViewManager->updateView(start, end); | 824 | mViewManager->updateView(start, end); |
822 | //mDateNavigator->updateView(); | 825 | //mDateNavigator->updateView(); |
823 | } | 826 | } |
824 | 827 | ||
825 | 828 | ||
826 | 829 | ||
827 | void CalendarView::checkFiles() | 830 | void CalendarView::checkFiles() |
828 | { | 831 | { |
829 | QString message; | 832 | QString message; |
830 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; | 833 | QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; |
831 | KopiCalendarFile * cal = calendars.first(); | 834 | KopiCalendarFile * cal = calendars.first(); |
832 | while ( cal ) { | 835 | while ( cal ) { |
833 | if ( cal->mErrorOnLoad ) { | 836 | if ( cal->mErrorOnLoad ) { |
834 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; | 837 | message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; |
835 | } | 838 | } |
836 | cal = calendars.next(); | 839 | cal = calendars.next(); |
837 | } | 840 | } |
838 | if ( !message.isEmpty() ) { | 841 | if ( !message.isEmpty() ) { |
839 | 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); | 842 | 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); |
840 | KMessageBox::error(this,message, i18n("Loading of calendar(s) failed")); | 843 | KMessageBox::error(this,message, i18n("Loading of calendar(s) failed")); |
841 | } | 844 | } |
842 | static bool firstTime = true; | 845 | if ( flag_checkFileFirsttime ) { |
843 | if ( firstTime ) { | 846 | flag_checkFileFirsttime = false; |
844 | firstTime = false; | ||
845 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); | 847 | QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); |
846 | } | 848 | } |
847 | } | 849 | } |
848 | void CalendarView::checkAlarms() | 850 | void CalendarView::checkAlarms() |
849 | { | 851 | { |
850 | KConfig *config = KOGlobals::config(); | 852 | KConfig *config = KOGlobals::config(); |
851 | config->setGroup( "AppRun" ); | 853 | config->setGroup( "AppRun" ); |
852 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 854 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
853 | int daysto = dt.daysTo( QDate::currentDate() ); | 855 | int daysto = dt.daysTo( QDate::currentDate() ); |
854 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | 856 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); |
855 | dt = dt.addDays( days ); | 857 | dt = dt.addDays( days ); |
856 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 858 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
857 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; | 859 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
858 | //qDebug("KO: Reading program stop %d ", secs); | 860 | //qDebug("KO: Reading program stop %d ", secs); |
859 | //secs -= ( 3600 * 24*3 ); // debug only | 861 | //secs -= ( 3600 * 24*3 ); // debug only |
860 | QDateTime latest = dt.addSecs ( secs ); | 862 | QDateTime latest = dt.addSecs ( secs ); |
861 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 863 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
862 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 864 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
863 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 865 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
864 | QPtrList<Incidence> al; | 866 | QPtrList<Incidence> al; |
865 | Incidence* inL = el.first(); | 867 | Incidence* inL = el.first(); |
866 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 868 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
867 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 869 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
868 | while ( inL ) { | 870 | while ( inL ) { |
869 | bool ok = false; | 871 | bool ok = false; |
870 | int offset = 0; | 872 | int offset = 0; |
871 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 873 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
872 | if ( ok ) { | 874 | if ( ok ) { |
873 | //qDebug("OK %s",next.toString().latin1()); | 875 | //qDebug("OK %s",next.toString().latin1()); |
874 | if ( next < cur ) { | 876 | if ( next < cur ) { |
875 | al.append( inL ); | 877 | al.append( inL ); |
876 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 878 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
877 | } | 879 | } |
878 | } | 880 | } |
879 | inL = el.next(); | 881 | inL = el.next(); |
880 | } | 882 | } |
881 | if ( al.count() ) { | 883 | if ( al.count() ) { |
882 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 884 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
883 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 885 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
884 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 886 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
885 | lay->setSpacing( 0 ); | 887 | lay->setSpacing( 0 ); |
886 | lay->setMargin( 0 ); | 888 | lay->setMargin( 0 ); |
887 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 889 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
888 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 890 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
889 | lay->addWidget( matb ); | 891 | lay->addWidget( matb ); |
890 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 892 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
891 | int wid = 210; | 893 | int wid = 210; |
892 | int x = QApplication::desktop()->width() - wid - 7; | 894 | int x = QApplication::desktop()->width() - wid - 7; |
@@ -2971,105 +2973,104 @@ void CalendarView::eventChanged(Event *event) | |||
2971 | } | 2973 | } |
2972 | 2974 | ||
2973 | void CalendarView::eventAdded(Event *event) | 2975 | void CalendarView::eventAdded(Event *event) |
2974 | { | 2976 | { |
2975 | changeEventDisplay(event,KOGlobals::EVENTADDED); | 2977 | changeEventDisplay(event,KOGlobals::EVENTADDED); |
2976 | } | 2978 | } |
2977 | 2979 | ||
2978 | void CalendarView::eventToBeDeleted(Event *) | 2980 | void CalendarView::eventToBeDeleted(Event *) |
2979 | { | 2981 | { |
2980 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; | 2982 | kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; |
2981 | } | 2983 | } |
2982 | 2984 | ||
2983 | void CalendarView::eventDeleted() | 2985 | void CalendarView::eventDeleted() |
2984 | { | 2986 | { |
2985 | changeEventDisplay(0,KOGlobals::EVENTDELETED); | 2987 | changeEventDisplay(0,KOGlobals::EVENTDELETED); |
2986 | } | 2988 | } |
2987 | void CalendarView::changeTodoDisplay(Todo *which, int action) | 2989 | void CalendarView::changeTodoDisplay(Todo *which, int action) |
2988 | { | 2990 | { |
2989 | changeIncidenceDisplay((Incidence *)which, action); | 2991 | changeIncidenceDisplay((Incidence *)which, action); |
2990 | mDateNavigator->updateView(); //LR | 2992 | mDateNavigator->updateView(); //LR |
2991 | //mDialogManager->updateSearchDialog(); | 2993 | //mDialogManager->updateSearchDialog(); |
2992 | 2994 | ||
2993 | if (which) { | 2995 | if (which) { |
2994 | mViewManager->updateWNview(); | 2996 | mViewManager->updateWNview(); |
2995 | //mTodoList->updateView(); | 2997 | //mTodoList->updateView(); |
2996 | } | 2998 | } |
2997 | 2999 | ||
2998 | } | 3000 | } |
2999 | 3001 | ||
3000 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) | 3002 | void CalendarView::changeIncidenceDisplay(Incidence *which, int action) |
3001 | { | 3003 | { |
3002 | updateUnmanagedViews(); | 3004 | updateUnmanagedViews(); |
3003 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); | 3005 | //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); |
3004 | if ( action == KOGlobals::EVENTDELETED ) { //delete | 3006 | if ( action == KOGlobals::EVENTDELETED ) { //delete |
3005 | mCalendar->checkAlarmForIncidence( 0, true ); | 3007 | mCalendar->checkAlarmForIncidence( 0, true ); |
3006 | if ( mEventViewerDialog ) | 3008 | if ( mEventViewerDialog ) |
3007 | mEventViewerDialog->hide(); | 3009 | mEventViewerDialog->hide(); |
3008 | } | 3010 | } |
3009 | else | 3011 | else |
3010 | mCalendar->checkAlarmForIncidence( which , false ); | 3012 | mCalendar->checkAlarmForIncidence( which , false ); |
3011 | } | 3013 | } |
3012 | 3014 | ||
3013 | // most of the changeEventDisplays() right now just call the view's | 3015 | // most of the changeEventDisplays() right now just call the view's |
3014 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. | 3016 | // total update mode, but they SHOULD be recoded to be more refresh-efficient. |
3015 | void CalendarView::changeEventDisplay(Event *which, int action) | 3017 | void CalendarView::changeEventDisplay(Event *which, int action) |
3016 | { | 3018 | { |
3017 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; | 3019 | // kdDebug() << "CalendarView::changeEventDisplay" << endl; |
3018 | changeIncidenceDisplay((Incidence *)which, action); | 3020 | changeIncidenceDisplay((Incidence *)which, action); |
3019 | static bool clearallviews = false; | ||
3020 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 3021 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
3021 | if ( clearallviews ) { | 3022 | if ( flag_clearallviewsEventDisplay ) { |
3022 | clearAllViews(); | 3023 | clearAllViews(); |
3023 | clearallviews = false; | 3024 | flag_clearallviewsEventDisplay = false; |
3024 | } | 3025 | } |
3025 | return; | 3026 | return; |
3026 | } | 3027 | } |
3027 | clearallviews = true; | 3028 | flag_clearallviewsEventDisplay = true; |
3028 | mDateNavigator->updateView(); | 3029 | mDateNavigator->updateView(); |
3029 | //mDialogManager->updateSearchDialog(); | 3030 | //mDialogManager->updateSearchDialog(); |
3030 | if (which) { | 3031 | if (which) { |
3031 | // If there is an event view visible update the display | 3032 | // If there is an event view visible update the display |
3032 | mViewManager->currentView()->changeEventDisplay(which,action); | 3033 | mViewManager->currentView()->changeEventDisplay(which,action); |
3033 | // TODO: check, if update needed | 3034 | // TODO: check, if update needed |
3034 | // if (which->getTodoStatus()) { | 3035 | // if (which->getTodoStatus()) { |
3035 | mTodoList->updateView(); | 3036 | mTodoList->updateView(); |
3036 | if ( action != KOGlobals::EVENTDELETED && KOPrefs::instance()->mDetectConflicts ) { | 3037 | if ( action != KOGlobals::EVENTDELETED && KOPrefs::instance()->mDetectConflicts ) { |
3037 | mConflictingEvent = which ; | 3038 | mConflictingEvent = which ; |
3038 | int time = 1000; | 3039 | int time = 1000; |
3039 | #ifdef DESKTOP_VERSION | 3040 | #ifdef DESKTOP_VERSION |
3040 | time = 500; | 3041 | time = 500; |
3041 | #endif | 3042 | #endif |
3042 | bool checkC = false; | 3043 | bool checkC = false; |
3043 | if ( mConflictingEvent->doesFloat() ) { | 3044 | if ( mConflictingEvent->doesFloat() ) { |
3044 | checkC = KOPrefs::instance()->mCheckConflictsAllDayAllDay | 3045 | checkC = KOPrefs::instance()->mCheckConflictsAllDayAllDay |
3045 | || KOPrefs::instance()->mCheckConflictsAllDayNonAD; | 3046 | || KOPrefs::instance()->mCheckConflictsAllDayNonAD; |
3046 | } else { | 3047 | } else { |
3047 | checkC = KOPrefs::instance()->mCheckConflictsNonADAllDay | 3048 | checkC = KOPrefs::instance()->mCheckConflictsNonADAllDay |
3048 | || KOPrefs::instance()->mCheckConflictsNonADNonAD; | 3049 | || KOPrefs::instance()->mCheckConflictsNonADNonAD; |
3049 | } | 3050 | } |
3050 | if ( !KOPrefs::instance()->mIncludeFree && mConflictingEvent->transparency() == KCal::Event::Transparent ) | 3051 | if ( !KOPrefs::instance()->mIncludeFree && mConflictingEvent->transparency() == KCal::Event::Transparent ) |
3051 | checkC = false; | 3052 | checkC = false; |
3052 | if ( checkC ) | 3053 | if ( checkC ) |
3053 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); | 3054 | QTimer::singleShot( time, this, SLOT ( checkConflictForEvent() ) ); |
3054 | } | 3055 | } |
3055 | // } | 3056 | // } |
3056 | } else { | 3057 | } else { |
3057 | mViewManager->currentView()->updateView(); | 3058 | mViewManager->currentView()->updateView(); |
3058 | } | 3059 | } |
3059 | } | 3060 | } |
3060 | void CalendarView::checkConflictForEvent() | 3061 | void CalendarView::checkConflictForEvent() |
3061 | { | 3062 | { |
3062 | 3063 | ||
3063 | if (!KOPrefs::instance()->mConfirm) | 3064 | if (!KOPrefs::instance()->mConfirm) |
3064 | return; | 3065 | return; |
3065 | if ( ! mConflictingEvent ) return; | 3066 | if ( ! mConflictingEvent ) return; |
3066 | Event * conflictingEvent = mConflictingEvent; | 3067 | Event * conflictingEvent = mConflictingEvent; |
3067 | mConflictingEvent = 0; | 3068 | mConflictingEvent = 0; |
3068 | QDateTime current = QDateTime::currentDateTime(); | 3069 | QDateTime current = QDateTime::currentDateTime(); |
3069 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { | 3070 | if ( ! conflictingEvent->matchTime( ¤t, 0 ) ) { |
3070 | return; | 3071 | return; |
3071 | } | 3072 | } |
3072 | CalFilter *filterIN = 0; | 3073 | CalFilter *filterIN = 0; |
3073 | CalFilter *filterALL = 0; | 3074 | CalFilter *filterALL = 0; |
3074 | CalFilter *filter = mFilters.first(); | 3075 | CalFilter *filter = mFilters.first(); |
3075 | while(filter) { | 3076 | while(filter) { |
@@ -3132,105 +3133,104 @@ void CalendarView::checkConflictForEvent() | |||
3132 | } | 3133 | } |
3133 | } | 3134 | } |
3134 | } | 3135 | } |
3135 | test = testlist.next(); | 3136 | test = testlist.next(); |
3136 | } | 3137 | } |
3137 | topLevelWidget()->setCaption( i18n("KO/Pi") ); | 3138 | topLevelWidget()->setCaption( i18n("KO/Pi") ); |
3138 | if ( found ) { | 3139 | if ( found ) { |
3139 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; | 3140 | QString mess = i18n("The event\n%1\nconflicts with event\n%2\nat date\n%3.\n").arg(KGlobal::formatMessage ( conflictingEvent->summary(),0 ) ).arg( KGlobal::formatMessage ( cE->summary(),0 )).arg(KGlobal::locale()->formatDate(conflict.date()) ) ; |
3140 | qApp->processEvents(); | 3141 | qApp->processEvents(); |
3141 | int km = KMessageBox::warningContinueCancel(this,mess, | 3142 | int km = KMessageBox::warningContinueCancel(this,mess, |
3142 | i18n("KO/Pi Conflict detected"),i18n("Show date"),i18n("No problem!")); | 3143 | i18n("KO/Pi Conflict detected"),i18n("Show date"),i18n("No problem!")); |
3143 | if ( km != KMessageBox::Continue ) { | 3144 | if ( km != KMessageBox::Continue ) { |
3144 | return; | 3145 | return; |
3145 | } | 3146 | } |
3146 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) | 3147 | if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) |
3147 | mViewManager->showDayView(); | 3148 | mViewManager->showDayView(); |
3148 | mNavigator->slotDaySelect( conflict.date() ); | 3149 | mNavigator->slotDaySelect( conflict.date() ); |
3149 | int hour = conflict.time().hour(); | 3150 | int hour = conflict.time().hour(); |
3150 | mViewManager->agendaView()->setStartHour( hour ); | 3151 | mViewManager->agendaView()->setStartHour( hour ); |
3151 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); | 3152 | topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( conflictingEvent->summary().left( 20 ) ).arg( cE->summary().left( 20 ) ) ); |
3152 | } else | 3153 | } else |
3153 | topLevelWidget()->setCaption( i18n("No conflict found") ); | 3154 | topLevelWidget()->setCaption( i18n("No conflict found") ); |
3154 | return; | 3155 | return; |
3155 | 3156 | ||
3156 | } | 3157 | } |
3157 | 3158 | ||
3158 | void CalendarView::updateTodoViews() | 3159 | void CalendarView::updateTodoViews() |
3159 | { | 3160 | { |
3160 | mTodoList->updateView(); | 3161 | mTodoList->updateView(); |
3161 | mViewManager->currentView()->updateView(); | 3162 | mViewManager->currentView()->updateView(); |
3162 | 3163 | ||
3163 | } | 3164 | } |
3164 | 3165 | ||
3165 | 3166 | ||
3166 | 3167 | ||
3167 | void CalendarView::clearAllViews() | 3168 | void CalendarView::clearAllViews() |
3168 | { | 3169 | { |
3169 | mTodoList->clearList(); | 3170 | mTodoList->clearList(); |
3170 | mViewManager->clearAllViews(); | 3171 | mViewManager->clearAllViews(); |
3171 | SearchDialog * sd = mDialogManager->getSearchDialog(); | 3172 | SearchDialog * sd = mDialogManager->getSearchDialog(); |
3172 | if ( sd ) { | 3173 | if ( sd ) { |
3173 | KOListView* kol = sd->listview(); | 3174 | KOListView* kol = sd->listview(); |
3174 | if ( kol ) | 3175 | if ( kol ) |
3175 | kol->clearList(); | 3176 | kol->clearList(); |
3176 | } | 3177 | } |
3177 | } | 3178 | } |
3178 | void CalendarView::updateView() | 3179 | void CalendarView::updateView() |
3179 | { | 3180 | { |
3180 | static bool clearallviews = false; | ||
3181 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { | 3181 | if ( KOPrefs::instance()->mGlobalUpdateDisabled ) { |
3182 | if ( clearallviews ) { | 3182 | if ( flag_clearallviewsupdateView ) { |
3183 | clearAllViews(); | 3183 | clearAllViews(); |
3184 | clearallviews = false; | 3184 | flag_clearallviewsupdateView = false; |
3185 | } | 3185 | } |
3186 | return; | 3186 | return; |
3187 | } | 3187 | } |
3188 | clearallviews = true; | 3188 | flag_clearallviewsupdateView = true; |
3189 | DateList tmpList = mNavigator->selectedDates(); | 3189 | DateList tmpList = mNavigator->selectedDates(); |
3190 | 3190 | ||
3191 | if ( KOPrefs::instance()->mHideNonStartedTodos ) | 3191 | if ( KOPrefs::instance()->mHideNonStartedTodos ) |
3192 | mTodoList->updateView(); | 3192 | mTodoList->updateView(); |
3193 | // We assume that the navigator only selects consecutive days. | 3193 | // We assume that the navigator only selects consecutive days. |
3194 | updateView( tmpList.first(), tmpList.last() ); | 3194 | updateView( tmpList.first(), tmpList.last() ); |
3195 | } | 3195 | } |
3196 | 3196 | ||
3197 | void CalendarView::updateUnmanagedViews() | 3197 | void CalendarView::updateUnmanagedViews() |
3198 | { | 3198 | { |
3199 | mDateNavigator->updateDayMatrix(); | 3199 | mDateNavigator->updateDayMatrix(); |
3200 | } | 3200 | } |
3201 | 3201 | ||
3202 | int CalendarView::msgItemDelete(const QString name) | 3202 | int CalendarView::msgItemDelete(const QString name) |
3203 | { | 3203 | { |
3204 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ | 3204 | return KMessageBox::warningContinueCancel(this,name +"\n\n"+ |
3205 | i18n("This item will be\npermanently deleted."), | 3205 | i18n("This item will be\npermanently deleted."), |
3206 | i18n("KO/Pi Confirmation"),i18n("Delete")); | 3206 | i18n("KO/Pi Confirmation"),i18n("Delete")); |
3207 | } | 3207 | } |
3208 | 3208 | ||
3209 | 3209 | ||
3210 | void CalendarView::edit_cut() | 3210 | void CalendarView::edit_cut() |
3211 | { | 3211 | { |
3212 | Event *anEvent=0; | 3212 | Event *anEvent=0; |
3213 | 3213 | ||
3214 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3214 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3215 | 3215 | ||
3216 | if (mViewManager->currentView()->isEventView()) { | 3216 | if (mViewManager->currentView()->isEventView()) { |
3217 | if ( incidence && incidence->typeID() == eventID ) { | 3217 | if ( incidence && incidence->typeID() == eventID ) { |
3218 | anEvent = static_cast<Event *>(incidence); | 3218 | anEvent = static_cast<Event *>(incidence); |
3219 | } | 3219 | } |
3220 | } | 3220 | } |
3221 | 3221 | ||
3222 | if (!anEvent) { | 3222 | if (!anEvent) { |
3223 | KNotifyClient::beep(); | 3223 | KNotifyClient::beep(); |
3224 | return; | 3224 | return; |
3225 | } | 3225 | } |
3226 | DndFactory factory( mCalendar ); | 3226 | DndFactory factory( mCalendar ); |
3227 | factory.cutIncidence(anEvent); | 3227 | factory.cutIncidence(anEvent); |
3228 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3228 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3229 | } | 3229 | } |
3230 | 3230 | ||
3231 | void CalendarView::edit_copy() | 3231 | void CalendarView::edit_copy() |
3232 | { | 3232 | { |
3233 | Event *anEvent=0; | 3233 | Event *anEvent=0; |
3234 | 3234 | ||
3235 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 3235 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
3236 | 3236 | ||