summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-07-03 18:49:19 (UTC)
committer zautrix <zautrix>2005-07-03 18:49:19 (UTC)
commitf9a1b1e8ac52218360731fae67993704c20f17fe (patch) (unidiff)
tree77da06abff6e8b12d2d6170909f77de213f0e172 /korganizer
parent58826b9705ceec6d21034ae166341509ca455481 (diff)
downloadkdepimpi-f9a1b1e8ac52218360731fae67993704c20f17fe.zip
kdepimpi-f9a1b1e8ac52218360731fae67993704c20f17fe.tar.gz
kdepimpi-f9a1b1e8ac52218360731fae67993704c20f17fe.tar.bz2
fixxii
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 1785b8a..7566c6f 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -585,209 +585,229 @@ void CalendarView::init()
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
646CalendarView::~CalendarView() 646CalendarView::~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}
657void CalendarView::setCalReadOnly( int id, bool readO ) 657void CalendarView::setCalReadOnly( int id, bool readO )
658{ 658{
659 if ( readO ) { 659 if ( readO ) {
660 emit save(); 660 emit save();
661 } 661 }
662 mCalendar->setReadOnly( id, readO ); 662 mCalendar->setReadOnly( id, readO );
663} 663}
664void CalendarView::setScrollBarStep(int val ) 664void CalendarView::setScrollBarStep(int val )
665{ 665{
666#ifdef DESKTOP_VERSION 666#ifdef DESKTOP_VERSION
667 mDateScrollBar->setLineStep ( val ); 667 mDateScrollBar->setLineStep ( val );
668#endif 668#endif
669} 669}
670void CalendarView::scrollBarValue(int val ) 670void CalendarView::scrollBarValue(int val )
671{ 671{
672#ifdef DESKTOP_VERSION 672#ifdef DESKTOP_VERSION
673 if ( QApplication::desktop()->width() < 800 ) return; 673 if ( QApplication::desktop()->width() < 800 ) return;
674 static bool block = false; 674 static bool block = false;
675 if ( block ) return; 675 if ( block ) return;
676 block = true; 676 block = true;
677 int count = mNavigator->selectedDates().count(); 677 int count = mNavigator->selectedDates().count();
678 int day = mNavigator->selectedDates().first().dayOfYear(); 678 int day = mNavigator->selectedDates().first().dayOfYear();
679 int stepdays = val; 679 int stepdays = val;
680 if ( mDateScrollBar->lineStep () <= count ) { 680 if ( mDateScrollBar->lineStep () <= count ) {
681 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 681 //val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
682 //qDebug("VAL %d ",val ); 682 //qDebug("VAL %d ",val );
683 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); 683 stepdays = (val-day)/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
684 stepdays = day-1+stepdays; 684 stepdays = day+stepdays;
685 if ( stepdays < 0 ) stepdays = 0; 685 if ( stepdays < 0 ) stepdays = 0;
686 } 686 }
687 if ( stepdays == day -1 ) { 687 if ( stepdays == day ) {
688 block = false; 688 block = false;
689 return; 689 return;
690 } 690 }
691 int year = mNavigator->selectedDates().first().year(); 691 int year = mNavigator->selectedDates().first().year();
692 QDate d ( year,1,1 ); 692 QDate d ( year,1,1 );
693 mNavigator->selectDates( d.addDays( stepdays) , count ); 693 mNavigator->selectDates( d.addDays( stepdays-1) , count );
694 block = false; 694 block = false;
695#endif 695#endif
696 696
697} 697}
698void CalendarView::updateView(const QDate &start, const QDate &end)
699{
700#ifdef DESKTOP_VERSION
701 if ( ! mDateScrollBar->draggingSlider () ) {
702 int dof = start.dayOfYear();
703 //qDebug("dof %d day %d val %d ", dof, start.dayOfYear(),mDateScrollBar->value() );
704 if ( dof != mDateScrollBar->value() ) {
705 mDateScrollBar->blockSignals( true );
706 mDateScrollBar->setValue( start.dayOfYear());
707 mDateScrollBar->blockSignals( false );
708 }
709 }
710#endif
711 mTodoList->updateView();
712 mViewManager->updateView(start, end);
713 //mDateNavigator->updateView();
714}
715
716
717
698void CalendarView::checkFiles() 718void CalendarView::checkFiles()
699{ 719{
700 QString message; 720 QString message;
701 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars; 721 QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
702 KopiCalendarFile * cal = calendars.first(); 722 KopiCalendarFile * cal = calendars.first();
703 while ( cal ) { 723 while ( cal ) {
704 if ( cal->mErrorOnLoad ) { 724 if ( cal->mErrorOnLoad ) {
705 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n"; 725 message += cal->mName +"\n"+KGlobal::formatMessage ( "(" +i18n( "Filepath: ")+ cal->mFileName+")" ,0 )+"\n";
706 } 726 }
707 cal = calendars.next(); 727 cal = calendars.next();
708 } 728 }
709 if ( !message.isEmpty() ) { 729 if ( !message.isEmpty() ) {
710 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); 730 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);
711 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed")); 731 KMessageBox::error(this,message, i18n("Loding of calendar(s) failed"));
712 } 732 }
713 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() )); 733 QTimer::singleShot( 2000, this, SLOT ( checkAlarms() ));
714} 734}
715void CalendarView::checkAlarms() 735void CalendarView::checkAlarms()
716{ 736{
717 737
718 738
719 KConfig *config = KOGlobals::config(); 739 KConfig *config = KOGlobals::config();
720 config->setGroup( "AppRun" ); 740 config->setGroup( "AppRun" );
721 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 741 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
722 int daysto = dt.daysTo( QDate::currentDate() ); 742 int daysto = dt.daysTo( QDate::currentDate() );
723 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 743 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
724 dt = dt.addDays( days ); 744 dt = dt.addDays( days );
725 int secto = dt.secsTo( QDateTime::currentDateTime() ); 745 int secto = dt.secsTo( QDateTime::currentDateTime() );
726 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 746 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
727 //qDebug("KO: Reading program stop %d ", secs); 747 //qDebug("KO: Reading program stop %d ", secs);
728 //secs -= ( 3600 * 24*3 ); // debug only 748 //secs -= ( 3600 * 24*3 ); // debug only
729 QDateTime latest = dt.addSecs ( secs ); 749 QDateTime latest = dt.addSecs ( secs );
730 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 750 qDebug("KO: Last termination on %s ", latest.toString().latin1());
731 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 751 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
732 QPtrList<Incidence> el = mCalendar->rawIncidences(); 752 QPtrList<Incidence> el = mCalendar->rawIncidences();
733 QPtrList<Incidence> al; 753 QPtrList<Incidence> al;
734 Incidence* inL = el.first(); 754 Incidence* inL = el.first();
735 QDateTime cur = QDateTime::currentDateTime().addSecs(-59); 755 QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
736 qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); 756 qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
737 while ( inL ) { 757 while ( inL ) {
738 bool ok = false; 758 bool ok = false;
739 int offset = 0; 759 int offset = 0;
740 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; 760 QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
741 if ( ok ) { 761 if ( ok ) {
742 //qDebug("OK %s",next.toString().latin1()); 762 //qDebug("OK %s",next.toString().latin1());
743 if ( next < cur ) { 763 if ( next < cur ) {
744 al.append( inL ); 764 al.append( inL );
745 //qDebug("found missed alarm: %s ", inL->summary().latin1() ); 765 //qDebug("found missed alarm: %s ", inL->summary().latin1() );
746 } 766 }
747 } 767 }
748 inL = el.next(); 768 inL = el.next();
749 } 769 }
750 if ( al.count() ) { 770 if ( al.count() ) {
751 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); 771 QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
752 dia->setCaption( i18n("KO/Pi: Missing alarms!") ); 772 dia->setCaption( i18n("KO/Pi: Missing alarms!") );
753 QVBoxLayout* lay = new QVBoxLayout( dia ); 773 QVBoxLayout* lay = new QVBoxLayout( dia );
754 lay->setSpacing( 0 ); 774 lay->setSpacing( 0 );
755 lay->setMargin( 0 ); 775 lay->setMargin( 0 );
756 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); 776 MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest );
757 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); 777 connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) ));
758 lay->addWidget( matb ); 778 lay->addWidget( matb );
759 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { 779 if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) {
760 int wid = 210; 780 int wid = 210;
761 int x = QApplication::desktop()->width() - wid - 7; 781 int x = QApplication::desktop()->width() - wid - 7;
762 int y = QApplication::desktop()->height() - wid - 70; 782 int y = QApplication::desktop()->height() - wid - 70;
763 dia->setGeometry ( x,y,wid,wid); 783 dia->setGeometry ( x,y,wid,wid);
764 } else { 784 } else {
765 int si = 220; 785 int si = 220;
766 if ( QApplication::desktop()->width() > 470 ) 786 if ( QApplication::desktop()->width() > 470 )
767 si = 400; 787 si = 400;
768 dia->resize(si,si/2); 788 dia->resize(si,si/2);
769 } 789 }
770 dia->setBackgroundColor( QColor( 255, 255, 255 ) ); 790 dia->setBackgroundColor( QColor( 255, 255, 255 ) );
771 dia->show(); 791 dia->show();
772 792
773 } 793 }
774} 794}
775void CalendarView::showDay( QDate d ) 795void CalendarView::showDay( QDate d )
776{ 796{
777 dateNavigator()->blockSignals( true ); 797 dateNavigator()->blockSignals( true );
778 dateNavigator()->selectDate( d ); 798 dateNavigator()->selectDate( d );
779 dateNavigator()->blockSignals( false ); 799 dateNavigator()->blockSignals( false );
780 mViewManager->showDayView(); 800 mViewManager->showDayView();
781 //dateNavigator()->selectDate( d ); 801 //dateNavigator()->selectDate( d );
782} 802}
783void CalendarView::timerAlarm() 803void CalendarView::timerAlarm()
784{ 804{
785 //qDebug("CalendarView::timerAlarm() "); 805 //qDebug("CalendarView::timerAlarm() ");
786 computeAlarm(mAlarmNotification ); 806 computeAlarm(mAlarmNotification );
787} 807}
788 808
789void CalendarView::suspendAlarm() 809void CalendarView::suspendAlarm()
790{ 810{
791 //qDebug(" CalendarView::suspendAlarm() "); 811 //qDebug(" CalendarView::suspendAlarm() ");
792 computeAlarm(mSuspendAlarmNotification ); 812 computeAlarm(mSuspendAlarmNotification );
793 813
@@ -2540,208 +2560,192 @@ void CalendarView::goNextMonth()
2540} 2560}
2541 2561
2542void CalendarView::goPreviousMonth() 2562void CalendarView::goPreviousMonth()
2543{ 2563{
2544 mNavigator->selectPreviousMonth(); 2564 mNavigator->selectPreviousMonth();
2545} 2565}
2546 2566
2547void CalendarView::updateConfig() 2567void CalendarView::updateConfig()
2548{ 2568{
2549 if ( KOPrefs::instance()->mUseAppColors ) 2569 if ( KOPrefs::instance()->mUseAppColors )
2550 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2570 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2551 emit configChanged(); 2571 emit configChanged();
2552 mTodoList->updateConfig(); 2572 mTodoList->updateConfig();
2553 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2573 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2554 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2574 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2555 // To make the "fill window" configurations work 2575 // To make the "fill window" configurations work
2556 //mViewManager->raiseCurrentView(); 2576 //mViewManager->raiseCurrentView();
2557} 2577}
2558 2578
2559 2579
2560void CalendarView::eventChanged(Event *event) 2580void CalendarView::eventChanged(Event *event)
2561{ 2581{
2562 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2582 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2563 //updateUnmanagedViews(); 2583 //updateUnmanagedViews();
2564} 2584}
2565 2585
2566void CalendarView::eventAdded(Event *event) 2586void CalendarView::eventAdded(Event *event)
2567{ 2587{
2568 changeEventDisplay(event,KOGlobals::EVENTADDED); 2588 changeEventDisplay(event,KOGlobals::EVENTADDED);
2569} 2589}
2570 2590
2571void CalendarView::eventToBeDeleted(Event *) 2591void CalendarView::eventToBeDeleted(Event *)
2572{ 2592{
2573 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl; 2593 kdDebug() << "CalendarView::eventToBeDeleted(): to be implemented" << endl;
2574} 2594}
2575 2595
2576void CalendarView::eventDeleted() 2596void CalendarView::eventDeleted()
2577{ 2597{
2578 changeEventDisplay(0,KOGlobals::EVENTDELETED); 2598 changeEventDisplay(0,KOGlobals::EVENTDELETED);
2579} 2599}
2580void CalendarView::changeTodoDisplay(Todo *which, int action) 2600void CalendarView::changeTodoDisplay(Todo *which, int action)
2581{ 2601{
2582 changeIncidenceDisplay((Incidence *)which, action); 2602 changeIncidenceDisplay((Incidence *)which, action);
2583 mDateNavigator->updateView(); //LR 2603 mDateNavigator->updateView(); //LR
2584 //mDialogManager->updateSearchDialog(); 2604 //mDialogManager->updateSearchDialog();
2585 2605
2586 if (which) { 2606 if (which) {
2587 mViewManager->updateWNview(); 2607 mViewManager->updateWNview();
2588 //mTodoList->updateView(); 2608 //mTodoList->updateView();
2589 } 2609 }
2590 2610
2591} 2611}
2592 2612
2593void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 2613void CalendarView::changeIncidenceDisplay(Incidence *which, int action)
2594{ 2614{
2595 updateUnmanagedViews(); 2615 updateUnmanagedViews();
2596 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action ); 2616 //qDebug(" CalendarView::changeIncidenceDisplay++++++++++++++++++++++++++ %d %d ",which, action );
2597 if ( action == KOGlobals::EVENTDELETED ) { //delete 2617 if ( action == KOGlobals::EVENTDELETED ) { //delete
2598 mCalendar->checkAlarmForIncidence( 0, true ); 2618 mCalendar->checkAlarmForIncidence( 0, true );
2599 if ( mEventViewerDialog ) 2619 if ( mEventViewerDialog )
2600 mEventViewerDialog->hide(); 2620 mEventViewerDialog->hide();
2601 } 2621 }
2602 else 2622 else
2603 mCalendar->checkAlarmForIncidence( which , false ); 2623 mCalendar->checkAlarmForIncidence( which , false );
2604} 2624}
2605 2625
2606// most of the changeEventDisplays() right now just call the view's 2626// most of the changeEventDisplays() right now just call the view's
2607// total update mode, but they SHOULD be recoded to be more refresh-efficient. 2627// total update mode, but they SHOULD be recoded to be more refresh-efficient.
2608void CalendarView::changeEventDisplay(Event *which, int action) 2628void CalendarView::changeEventDisplay(Event *which, int action)
2609{ 2629{
2610 // kdDebug() << "CalendarView::changeEventDisplay" << endl; 2630 // kdDebug() << "CalendarView::changeEventDisplay" << endl;
2611 changeIncidenceDisplay((Incidence *)which, action); 2631 changeIncidenceDisplay((Incidence *)which, action);
2612 mDateNavigator->updateView(); 2632 mDateNavigator->updateView();
2613 //mDialogManager->updateSearchDialog(); 2633 //mDialogManager->updateSearchDialog();
2614 2634
2615 if (which) { 2635 if (which) {
2616 // If there is an event view visible update the display 2636 // If there is an event view visible update the display
2617 mViewManager->currentView()->changeEventDisplay(which,action); 2637 mViewManager->currentView()->changeEventDisplay(which,action);
2618 // TODO: check, if update needed 2638 // TODO: check, if update needed
2619 // if (which->getTodoStatus()) { 2639 // if (which->getTodoStatus()) {
2620 mTodoList->updateView(); 2640 mTodoList->updateView();
2621 // } 2641 // }
2622 } else { 2642 } else {
2623 mViewManager->currentView()->updateView(); 2643 mViewManager->currentView()->updateView();
2624 } 2644 }
2625} 2645}
2626 2646
2627 2647
2628void CalendarView::updateTodoViews() 2648void CalendarView::updateTodoViews()
2629{ 2649{
2630 mTodoList->updateView(); 2650 mTodoList->updateView();
2631 mViewManager->currentView()->updateView(); 2651 mViewManager->currentView()->updateView();
2632 2652
2633} 2653}
2634 2654
2635 2655
2636void CalendarView::updateView(const QDate &start, const QDate &end)
2637{
2638#ifdef DESKTOP_VERSION
2639 if ( ! mDateScrollBar->draggingSlider () ) {
2640 int dof = start.dayOfYear()-1;
2641 if ( dof != mDateScrollBar->value() ) {
2642 mDateScrollBar->blockSignals( true );
2643 mDateScrollBar->setValue( start.dayOfYear()-1);
2644 mDateScrollBar->blockSignals( false );
2645 }
2646 }
2647#endif
2648 mTodoList->updateView();
2649 mViewManager->updateView(start, end);
2650 //mDateNavigator->updateView();
2651}
2652 2656
2653void CalendarView::clearAllViews() 2657void CalendarView::clearAllViews()
2654{ 2658{
2655 mTodoList->clearList(); 2659 mTodoList->clearList();
2656 mViewManager->clearAllViews(); 2660 mViewManager->clearAllViews();
2657 SearchDialog * sd = mDialogManager->getSearchDialog(); 2661 SearchDialog * sd = mDialogManager->getSearchDialog();
2658 if ( sd ) { 2662 if ( sd ) {
2659 KOListView* kol = sd->listview(); 2663 KOListView* kol = sd->listview();
2660 if ( kol ) 2664 if ( kol )
2661 kol->clearList(); 2665 kol->clearList();
2662 } 2666 }
2663} 2667}
2664void CalendarView::updateView() 2668void CalendarView::updateView()
2665{ 2669{
2666 DateList tmpList = mNavigator->selectedDates(); 2670 DateList tmpList = mNavigator->selectedDates();
2667 2671
2668 if ( KOPrefs::instance()->mHideNonStartedTodos ) 2672 if ( KOPrefs::instance()->mHideNonStartedTodos )
2669 mTodoList->updateView(); 2673 mTodoList->updateView();
2670 // We assume that the navigator only selects consecutive days. 2674 // We assume that the navigator only selects consecutive days.
2671 updateView( tmpList.first(), tmpList.last() ); 2675 updateView( tmpList.first(), tmpList.last() );
2672} 2676}
2673 2677
2674void CalendarView::updateUnmanagedViews() 2678void CalendarView::updateUnmanagedViews()
2675{ 2679{
2676 mDateNavigator->updateDayMatrix(); 2680 mDateNavigator->updateDayMatrix();
2677} 2681}
2678 2682
2679int CalendarView::msgItemDelete(const QString name) 2683int CalendarView::msgItemDelete(const QString name)
2680{ 2684{
2681 return KMessageBox::warningContinueCancel(this,name +"\n\n"+ 2685 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2682 i18n("This item will be\npermanently deleted."), 2686 i18n("This item will be\npermanently deleted."),
2683 i18n("KO/Pi Confirmation"),i18n("Delete")); 2687 i18n("KO/Pi Confirmation"),i18n("Delete"));
2684} 2688}
2685 2689
2686 2690
2687void CalendarView::edit_cut() 2691void CalendarView::edit_cut()
2688{ 2692{
2689 Event *anEvent=0; 2693 Event *anEvent=0;
2690 2694
2691 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2695 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2692 2696
2693 if (mViewManager->currentView()->isEventView()) { 2697 if (mViewManager->currentView()->isEventView()) {
2694 if ( incidence && incidence->typeID() == eventID ) { 2698 if ( incidence && incidence->typeID() == eventID ) {
2695 anEvent = static_cast<Event *>(incidence); 2699 anEvent = static_cast<Event *>(incidence);
2696 } 2700 }
2697 } 2701 }
2698 2702
2699 if (!anEvent) { 2703 if (!anEvent) {
2700 KNotifyClient::beep(); 2704 KNotifyClient::beep();
2701 return; 2705 return;
2702 } 2706 }
2703 DndFactory factory( mCalendar ); 2707 DndFactory factory( mCalendar );
2704 factory.cutIncidence(anEvent); 2708 factory.cutIncidence(anEvent);
2705 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); 2709 changeEventDisplay(anEvent, KOGlobals::EVENTDELETED);
2706} 2710}
2707 2711
2708void CalendarView::edit_copy() 2712void CalendarView::edit_copy()
2709{ 2713{
2710 Event *anEvent=0; 2714 Event *anEvent=0;
2711 2715
2712 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); 2716 Incidence *incidence = mViewManager->currentView()->selectedIncidences().first();
2713 2717
2714 if (mViewManager->currentView()->isEventView()) { 2718 if (mViewManager->currentView()->isEventView()) {
2715 if ( incidence && incidence->typeID() == eventID ) { 2719 if ( incidence && incidence->typeID() == eventID ) {
2716 anEvent = static_cast<Event *>(incidence); 2720 anEvent = static_cast<Event *>(incidence);
2717 } 2721 }
2718 } 2722 }
2719 2723
2720 if (!anEvent) { 2724 if (!anEvent) {
2721 KNotifyClient::beep(); 2725 KNotifyClient::beep();
2722 return; 2726 return;
2723 } 2727 }
2724 DndFactory factory( mCalendar ); 2728 DndFactory factory( mCalendar );
2725 factory.copyIncidence(anEvent); 2729 factory.copyIncidence(anEvent);
2726} 2730}
2727 2731
2728void CalendarView::edit_paste() 2732void CalendarView::edit_paste()
2729{ 2733{
2730 QDate date = mNavigator->selectedDates().first(); 2734 QDate date = mNavigator->selectedDates().first();
2731 2735
2732 DndFactory factory( mCalendar ); 2736 DndFactory factory( mCalendar );
2733 Event *pastedEvent = (Event *)factory.pasteIncidence( date ); 2737 Event *pastedEvent = (Event *)factory.pasteIncidence( date );
2734 2738
2735 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED ); 2739 changeEventDisplay( pastedEvent, KOGlobals::EVENTADDED );
2736} 2740}
2737void CalendarView::edit_global_options() 2741void CalendarView::edit_global_options()
2738{ 2742{
2739 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId; 2743 QString tz = KPimGlobalPrefs::instance()->mTimeZoneId;
2740 emit save(); 2744 emit save();
2741 emit saveStopTimer(); 2745 emit saveStopTimer();
2742 mDialogManager->showGlobalOptionsDialog(); 2746 mDialogManager->showGlobalOptionsDialog();
2743 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) { 2747 if ( tz != KPimGlobalPrefs::instance()->mTimeZoneId) {
2744 emit saveStopTimer(); 2748 emit saveStopTimer();
2745 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!"), 2749 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!"),
2746 i18n("Timezone settings"),i18n("Reload"))) { 2750 i18n("Timezone settings"),i18n("Reload"))) {
2747 qDebug("KO: TZ reload cancelled "); 2751 qDebug("KO: TZ reload cancelled ");