summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-10-26 09:10:50 (UTC)
committer zautrix <zautrix>2005-10-26 09:10:50 (UTC)
commit15b9123c6c1f9096a4b1a7729c323433d408c8d7 (patch) (unidiff)
tree3d9a8a521df355641642172ab1200a0f75529910
parentf696b904526567d45cd01a5b607644f8aa3bfe6b (diff)
downloadkdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.zip
kdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.tar.gz
kdepimpi-15b9123c6c1f9096a4b1a7729c323433d408c8d7.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp42
-rw-r--r--korganizer/calendarview.h5
-rw-r--r--korganizer/koagendaview.cpp8
-rw-r--r--korganizer/koagendaview.h1
-rw-r--r--korganizer/kotodoview.cpp6
-rw-r--r--korganizer/kotodoview.h1
-rw-r--r--korganizer/koviewmanager.cpp16
-rw-r--r--korganizer/koviewmanager.h7
8 files changed, 52 insertions, 34 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 28b17a5..31e103d 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -345,48 +345,53 @@ CalendarView::CalendarView( CalendarResources *calendar,
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
355CalendarView::CalendarView( Calendar *calendar, 355CalendarView::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
367void CalendarView::init() 367void 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
@@ -640,51 +645,50 @@ void CalendarView::init()
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
649CalendarView::~CalendarView() 654CalendarView::~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
662void CalendarView::nextConflict( bool all, bool allday ) 667void 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();
@@ -719,150 +723,148 @@ void CalendarView::nextConflict( bool all, bool allday )
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
753void CalendarView::conflictAll() 757void CalendarView::conflictAll()
754{ 758{
755 nextConflict ( true, true ); 759 nextConflict ( true, true );
756} 760}
757void CalendarView::conflictAllday() 761void CalendarView::conflictAllday()
758{ 762{
759 nextConflict ( false, true ); 763 nextConflict ( false, true );
760} 764}
761void CalendarView::conflictNotAll() 765void CalendarView::conflictNotAll()
762{ 766{
763 nextConflict ( false, false ); 767 nextConflict ( false, false );
764} 768}
765 769
766void CalendarView::setCalReadOnly( int id, bool readO ) 770void 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}
773void CalendarView::setScrollBarStep(int val ) 777void 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}
779void CalendarView::scrollBarValue(int val ) 783void 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}
807void CalendarView::updateView(const QDate &start, const QDate &end) 810void 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
827void CalendarView::checkFiles() 830void 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}
848void CalendarView::checkAlarms() 850void 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 ) {
@@ -2995,57 +2997,56 @@ void CalendarView::changeTodoDisplay(Todo *which, int action)
2995 //mTodoList->updateView(); 2997 //mTodoList->updateView();
2996 } 2998 }
2997 2999
2998} 3000}
2999 3001
3000void CalendarView::changeIncidenceDisplay(Incidence *which, int action) 3002void 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.
3015void CalendarView::changeEventDisplay(Event *which, int action) 3017void 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;
@@ -3156,57 +3157,56 @@ void CalendarView::checkConflictForEvent()
3156} 3157}
3157 3158
3158void CalendarView::updateTodoViews() 3159void 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
3167void CalendarView::clearAllViews() 3168void 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}
3178void CalendarView::updateView() 3179void 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
3197void CalendarView::updateUnmanagedViews() 3197void CalendarView::updateUnmanagedViews()
3198{ 3198{
3199 mDateNavigator->updateDayMatrix(); 3199 mDateNavigator->updateDayMatrix();
3200} 3200}
3201 3201
3202int CalendarView::msgItemDelete(const QString name) 3202int 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
3210void CalendarView::edit_cut() 3210void CalendarView::edit_cut()
3211{ 3211{
3212 Event *anEvent=0; 3212 Event *anEvent=0;
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 0924f07..80f7ed4 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -530,48 +530,53 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
530 Event* getLastSyncEvent(); 530 Event* getLastSyncEvent();
531 /** Adapt navigation units correpsonding to step size of navigation of the 531 /** Adapt navigation units correpsonding to step size of navigation of the
532 * current view. 532 * current view.
533 */ 533 */
534 void adaptNavigationUnits(); 534 void adaptNavigationUnits();
535 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 535 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
536 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 536 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
537 //Attendee* getYourAttendee(Event *event); 537 //Attendee* getYourAttendee(Event *event);
538 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 538 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
539 void setScrollBarStep(int val ); 539 void setScrollBarStep(int val );
540 540
541 protected: 541 protected:
542 Event *mConflictingEvent; 542 Event *mConflictingEvent;
543 void schedule(Scheduler::Method, Incidence *incidence = 0); 543 void schedule(Scheduler::Method, Incidence *incidence = 0);
544 544
545 // returns KMsgBox::OKCandel() 545 // returns KMsgBox::OKCandel()
546 int msgItemDelete(const QString name); 546 int msgItemDelete(const QString name);
547 void showEventEditor(); 547 void showEventEditor();
548 void showTodoEditor(); 548 void showTodoEditor();
549 Todo *selectedTodo(); 549 Todo *selectedTodo();
550 private: 550 private:
551#ifdef DESKTOP_VERSION 551#ifdef DESKTOP_VERSION
552 QScrollBar * mDateScrollBar; 552 QScrollBar * mDateScrollBar;
553#endif 553#endif
554 bool flag_blockConflict;
555 bool flag_blockScrollBar;
556 bool flag_checkFileFirsttime;
557 bool flag_clearallviewsEventDisplay;
558 bool flag_clearallviewsupdateView;
554 QDateTime mNextAlarmDateTime; 559 QDateTime mNextAlarmDateTime;
555 bool mViewerCallerIsSearchDialog; 560 bool mViewerCallerIsSearchDialog;
556 bool mBlockShowDates; 561 bool mBlockShowDates;
557 KSyncManager* mSyncManager; 562 KSyncManager* mSyncManager;
558 AlarmDialog * mAlarmDialog; 563 AlarmDialog * mAlarmDialog;
559 QString mAlarmNotification; 564 QString mAlarmNotification;
560 QString mSuspendAlarmNotification; 565 QString mSuspendAlarmNotification;
561 QTimer* mSuspendTimer; 566 QTimer* mSuspendTimer;
562 QTimer* mAlarmTimer; 567 QTimer* mAlarmTimer;
563 QTimer* mRecheckAlarmTimer; 568 QTimer* mRecheckAlarmTimer;
564 void computeAlarm( QString ); 569 void computeAlarm( QString );
565 void startAlarm( QString, QString ); 570 void startAlarm( QString, QString );
566 void setSyncEventsReadOnly(); 571 void setSyncEventsReadOnly();
567 572
568 QDateTime loadedFileVersion; 573 QDateTime loadedFileVersion;
569 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 574 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
570 void checkExternalId( Incidence * inc ); 575 void checkExternalId( Incidence * inc );
571 int mGlobalSyncMode; 576 int mGlobalSyncMode;
572 QString mCurrentSyncDevice; 577 QString mCurrentSyncDevice;
573 QString mCurrentSyncName; 578 QString mCurrentSyncName;
574 void init(); 579 void init();
575 int mDatePickerMode; 580 int mDatePickerMode;
576 bool mFlagEditDescription; 581 bool mFlagEditDescription;
577 QDateTime mLastCalendarSync; 582 QDateTime mLastCalendarSync;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index c1b149f..6e65a03 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -356,48 +356,49 @@ void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w )
356 setMaximumHeight(0); 356 setMaximumHeight(0);
357 setMinimumHeight(0); 357 setMinimumHeight(0);
358} 358}
359void EventIndicator::changeColumns(int columns) 359void EventIndicator::changeColumns(int columns)
360{ 360{
361 mColumns = columns; 361 mColumns = columns;
362 mEnabled.resize(mColumns); 362 mEnabled.resize(mColumns);
363 363
364 update(); 364 update();
365} 365}
366 366
367void EventIndicator::enableColumn(int column, bool enable) 367void EventIndicator::enableColumn(int column, bool enable)
368{ 368{
369 mEnabled[column] = enable; 369 mEnabled[column] = enable;
370} 370}
371 371
372 372
373//////////////////////////////////////////////////////////////////////////// 373////////////////////////////////////////////////////////////////////////////
374//////////////////////////////////////////////////////////////////////////// 374////////////////////////////////////////////////////////////////////////////
375//////////////////////////////////////////////////////////////////////////// 375////////////////////////////////////////////////////////////////////////////
376 376
377KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : 377KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
378 KOEventView (cal,parent,name) 378 KOEventView (cal,parent,name)
379{ 379{
380 flag_blockfillAgenda = false;
380 mBlockUpdating = true; 381 mBlockUpdating = true;
381 mStartHour = 8; 382 mStartHour = 8;
382 mSelectedDates.append(QDate::currentDate()); 383 mSelectedDates.append(QDate::currentDate());
383 384
384 mLayoutDayLabels = 0; 385 mLayoutDayLabels = 0;
385 mDayLabelsFrame = 0; 386 mDayLabelsFrame = 0;
386 mDayLabels = 0; 387 mDayLabels = 0;
387 bool isRTL = KOGlobals::self()->reverseLayout(); 388 bool isRTL = KOGlobals::self()->reverseLayout();
388 QPixmap expandPix; 389 QPixmap expandPix;
389 if ( KOPrefs::instance()->mVerticalScreen ) { 390 if ( KOPrefs::instance()->mVerticalScreen ) {
390 expandPix = SmallIcon( "1updownarrow" ); 391 expandPix = SmallIcon( "1updownarrow" );
391 } else { 392 } else {
392 expandPix = SmallIcon("1leftrightarrow" ); 393 expandPix = SmallIcon("1leftrightarrow" );
393 } 394 }
394 395
395 QBoxLayout *topLayout = new QVBoxLayout(this); 396 QBoxLayout *topLayout = new QVBoxLayout(this);
396 397
397 // Create day name labels for agenda columns 398 // Create day name labels for agenda columns
398 // Create agenda splitter 399 // Create agenda splitter
399 400
400 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); 401 mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this);
401 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 402 mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
402 topLayout->addWidget( mSplitterAgenda ); 403 topLayout->addWidget( mSplitterAgenda );
403 mAllDayFrame = new QHBox(mSplitterAgenda); 404 mAllDayFrame = new QHBox(mSplitterAgenda);
@@ -1121,52 +1122,51 @@ void KOAgendaView::showEvents(QPtrList<Event>)
1121 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; 1122 kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl;
1122} 1123}
1123 1124
1124void KOAgendaView::changeEventDisplay(Event *, int) 1125void KOAgendaView::changeEventDisplay(Event *, int)
1125{ 1126{
1126 // qDebug("KOAgendaView::changeEventDisplay "); 1127 // qDebug("KOAgendaView::changeEventDisplay ");
1127 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; 1128 // kdDebug() << "KOAgendaView::changeEventDisplay" << endl;
1128 // this should be re-written to be MUCH smarter. Right now we 1129 // this should be re-written to be MUCH smarter. Right now we
1129 // are just playing dumb. 1130 // are just playing dumb.
1130 fillAgenda(); 1131 fillAgenda();
1131} 1132}
1132 1133
1133void KOAgendaView::fillAgenda(const QDate &) 1134void KOAgendaView::fillAgenda(const QDate &)
1134{ 1135{
1135 // qDebug("KOAgendaView::fillAgenda "); 1136 // qDebug("KOAgendaView::fillAgenda ");
1136 fillAgenda(); 1137 fillAgenda();
1137} 1138}
1138 1139
1139void KOAgendaView::fillAgenda() 1140void KOAgendaView::fillAgenda()
1140{ 1141{
1141 if ( globalFlagBlockStartup ) 1142 if ( globalFlagBlockStartup )
1142 return; 1143 return;
1143 if ( globalFlagBlockAgenda == 1 ) 1144 if ( globalFlagBlockAgenda == 1 )
1144 return; 1145 return;
1145 static bool onlyOne = false; 1146 if ( flag_blockfillAgenda )
1146 if ( onlyOne )
1147 return; 1147 return;
1148 onlyOne = true; 1148 flag_blockfillAgenda = true;
1149 //if ( globalFlagBlockAgenda == 2 ) 1149 //if ( globalFlagBlockAgenda == 2 )
1150 //globalFlagBlockAgenda = 0; 1150 //globalFlagBlockAgenda = 0;
1151 // globalFlagBlockPainting = false; 1151 // globalFlagBlockPainting = false;
1152 if ( globalFlagBlockAgenda == 0 ) 1152 if ( globalFlagBlockAgenda == 0 )
1153 globalFlagBlockAgenda = 1; 1153 globalFlagBlockAgenda = 1;
1154 // clearView(); 1154 // clearView();
1155 //qDebug("fillAgenda()++++ "); 1155 //qDebug("fillAgenda()++++ ");
1156 globalFlagBlockAgendaItemPaint = 1; 1156 globalFlagBlockAgendaItemPaint = 1;
1157 1157
1158 mAllDayAgenda->changeColumns(mSelectedDates.count()); 1158 mAllDayAgenda->changeColumns(mSelectedDates.count());
1159 mAgenda->changeColumns(mSelectedDates.count()); 1159 mAgenda->changeColumns(mSelectedDates.count());
1160 qApp->processEvents(); 1160 qApp->processEvents();
1161 mEventIndicatorTop->changeColumns(mSelectedDates.count()); 1161 mEventIndicatorTop->changeColumns(mSelectedDates.count());
1162 mEventIndicatorBottom->changeColumns(mSelectedDates.count()); 1162 mEventIndicatorBottom->changeColumns(mSelectedDates.count());
1163 setHolidayMasks(); 1163 setHolidayMasks();
1164 1164
1165 mMinY.resize(mSelectedDates.count()); 1165 mMinY.resize(mSelectedDates.count());
1166 mMaxY.resize(mSelectedDates.count()); 1166 mMaxY.resize(mSelectedDates.count());
1167 1167
1168 QPtrList<Event> dayEvents; 1168 QPtrList<Event> dayEvents;
1169 1169
1170 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. 1170 // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue.
1171 // Therefore, gtodoset all of them. 1171 // Therefore, gtodoset all of them.
1172 QPtrList<Todo> todos = calendar()->todos(); 1172 QPtrList<Todo> todos = calendar()->todos();
@@ -1333,49 +1333,49 @@ void KOAgendaView::fillAgenda()
1333 } 1333 }
1334 // ---------- display Todos] -------------- 1334 // ---------- display Todos] --------------
1335 1335
1336 ++curCol; 1336 ++curCol;
1337 } 1337 }
1338 mAgenda->hideUnused(); 1338 mAgenda->hideUnused();
1339 mAllDayAgenda->hideUnused(); 1339 mAllDayAgenda->hideUnused();
1340 mAgenda->checkScrollBoundaries(); 1340 mAgenda->checkScrollBoundaries();
1341 deleteSelectedDateTime(); 1341 deleteSelectedDateTime();
1342 createDayLabels(); 1342 createDayLabels();
1343 emit incidenceSelected( 0 ); 1343 emit incidenceSelected( 0 );
1344 1344
1345 if ( globalFlagBlockAgenda == 2 ) { 1345 if ( globalFlagBlockAgenda == 2 ) {
1346 if ( KOPrefs::instance()->mSetTimeToDayStartAt ) 1346 if ( KOPrefs::instance()->mSetTimeToDayStartAt )
1347 setStartHour( KOPrefs::instance()->mDayBegins ); 1347 setStartHour( KOPrefs::instance()->mDayBegins );
1348 else if ( KOPrefs::instance()->mCenterOnCurrentTime ) 1348 else if ( KOPrefs::instance()->mCenterOnCurrentTime )
1349 setStartHour( QTime::currentTime ().hour() ); 1349 setStartHour( QTime::currentTime ().hour() );
1350 } 1350 }
1351 qApp->processEvents(); 1351 qApp->processEvents();
1352 globalFlagBlockAgenda = 0; 1352 globalFlagBlockAgenda = 0;
1353 mAllDayAgenda->drawContentsToPainter(); 1353 mAllDayAgenda->drawContentsToPainter();
1354 mAgenda->drawContentsToPainter(); 1354 mAgenda->drawContentsToPainter();
1355 repaintAgenda(); 1355 repaintAgenda();
1356 startIdleTimeout(); 1356 startIdleTimeout();
1357 onlyOne = false; 1357 flag_blockfillAgenda = false;
1358} 1358}
1359void KOAgendaView::repaintAgenda() 1359void KOAgendaView::repaintAgenda()
1360{ 1360{
1361 mAgenda->viewport()->repaint( false ); 1361 mAgenda->viewport()->repaint( false );
1362 mAllDayAgenda->viewport()->repaint( false ); 1362 mAllDayAgenda->viewport()->repaint( false );
1363 mAgenda->finishUpdate(); 1363 mAgenda->finishUpdate();
1364 mAllDayAgenda->finishUpdate(); 1364 mAllDayAgenda->finishUpdate();
1365} 1365}
1366 1366
1367 1367
1368void KOAgendaView::clearView() 1368void KOAgendaView::clearView()
1369{ 1369{
1370 mAllDayAgenda->clear(); 1370 mAllDayAgenda->clear();
1371 mAgenda->clear(); 1371 mAgenda->clear();
1372} 1372}
1373void KOAgendaView::clearList() 1373void KOAgendaView::clearList()
1374{ 1374{
1375 clearView(); 1375 clearView();
1376 mAllDayAgenda->hideUnused(); 1376 mAllDayAgenda->hideUnused();
1377 mAgenda->hideUnused(); 1377 mAgenda->hideUnused();
1378} 1378}
1379 1379
1380void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1380void KOAgendaView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1381 const QDate &td) 1381 const QDate &td)
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 4b7ef5b..5e68146 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -235,48 +235,49 @@ class KOAgendaView : public KOEventView {
235 void createDayLabels(); 235 void createDayLabels();
236 236
237 /** 237 /**
238 Set the masks on the agenda widgets indicating, which days are holidays. 238 Set the masks on the agenda widgets indicating, which days are holidays.
239 */ 239 */
240 void setHolidayMasks(); 240 void setHolidayMasks();
241 241
242 protected slots: 242 protected slots:
243 void slotIdleTimeout(); 243 void slotIdleTimeout();
244 void categoryChanged( Incidence * ); 244 void categoryChanged( Incidence * );
245 void slotDaylabelClicked( int ); 245 void slotDaylabelClicked( int );
246 /** Update event belonging to agenda item */ 246 /** Update event belonging to agenda item */
247 void updateEventDates(KOAgendaItem *item, int mode = -1); 247 void updateEventDates(KOAgendaItem *item, int mode = -1);
248 //void updateMovedTodo(); 248 //void updateMovedTodo();
249 249
250 void updateEventIndicatorTop(int newY); 250 void updateEventIndicatorTop(int newY);
251 void updateEventIndicatorBottom(int newY); 251 void updateEventIndicatorBottom(int newY);
252 252
253 /** Updates data for selected timespan */ 253 /** Updates data for selected timespan */
254 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); 254 void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd);
255 /** Updates data for selected timespan for all day event*/ 255 /** Updates data for selected timespan for all day event*/
256 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); 256 void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd);
257 257
258 private: 258 private:
259 bool flag_blockfillAgenda;
259 QTimer* mIdleTimer; 260 QTimer* mIdleTimer;
260 QDateTime mIdleStart; 261 QDateTime mIdleStart;
261 // view widgets 262 // view widgets
262 QFrame *mDayLabels; 263 QFrame *mDayLabels;
263 QHBox *mDayLabelsFrame; 264 QHBox *mDayLabelsFrame;
264 QBoxLayout *mLayoutDayLabels; 265 QBoxLayout *mLayoutDayLabels;
265 QFrame *mAllDayFrame; 266 QFrame *mAllDayFrame;
266 KOAgenda *mAllDayAgenda; 267 KOAgenda *mAllDayAgenda;
267 KOAgenda *mAgenda; 268 KOAgenda *mAgenda;
268 TimeLabels *mTimeLabels; 269 TimeLabels *mTimeLabels;
269 QWidget *mDummyAllDayLeft; 270 QWidget *mDummyAllDayLeft;
270 271
271 KDGanttMinimizeSplitter* mSplitterAgenda; 272 KDGanttMinimizeSplitter* mSplitterAgenda;
272 QPushButton *mExpandButton; 273 QPushButton *mExpandButton;
273 274
274 DateList mSelectedDates; // List of dates to be displayed 275 DateList mSelectedDates; // List of dates to be displayed
275 int mViewType; 276 int mViewType;
276 277
277 bool mWeekStartsMonday; 278 bool mWeekStartsMonday;
278 int mStartHour; 279 int mStartHour;
279 280
280 KOEventPopupMenu *mAllAgendaPopup; 281 KOEventPopupMenu *mAllAgendaPopup;
281 //KOEventPopupMenu *mAllDayAgendaPopup; 282 //KOEventPopupMenu *mAllDayAgendaPopup;
282 283
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index a12c43e..d79a9b9 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -492,49 +492,49 @@ KOQuickTodo::KOQuickTodo(QWidget *parent) :
492 QLineEdit(parent) 492 QLineEdit(parent)
493{ 493{
494 setText(i18n("Click to add new Todo")); 494 setText(i18n("Click to add new Todo"));
495 setFocusPolicy ( QWidget::ClickFocus ); 495 setFocusPolicy ( QWidget::ClickFocus );
496} 496}
497 497
498void KOQuickTodo::focusInEvent(QFocusEvent *ev) 498void KOQuickTodo::focusInEvent(QFocusEvent *ev)
499{ 499{
500 if ( text()==i18n("Click to add new Todo") ) 500 if ( text()==i18n("Click to add new Todo") )
501 setText(""); 501 setText("");
502 QLineEdit::focusInEvent(ev); 502 QLineEdit::focusInEvent(ev);
503} 503}
504 504
505void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 505void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
506{ 506{
507 setText(i18n("Click to add new Todo")); 507 setText(i18n("Click to add new Todo"));
508 QLineEdit::focusOutEvent(ev); 508 QLineEdit::focusOutEvent(ev);
509} 509}
510 510
511///////////////////////////////////////////////////////////////////////////// 511/////////////////////////////////////////////////////////////////////////////
512 512
513KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 513KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
514 KOrg::BaseView(calendar,parent,name) 514 KOrg::BaseView(calendar,parent,name)
515{ 515{
516 516 mIsActiveWindow = false;
517 mCurItem = 0; 517 mCurItem = 0;
518 mCurItemRootParent = 0; 518 mCurItemRootParent = 0;
519 mCurItemParent = 0; 519 mCurItemParent = 0;
520 mCurItemAbove = 0; 520 mCurItemAbove = 0;
521 mActiveItem = 0; 521 mActiveItem = 0;
522 mCategoryPopupMenu = 0; 522 mCategoryPopupMenu = 0;
523 mPendingUpdateBeforeRepaint = false; 523 mPendingUpdateBeforeRepaint = false;
524 isFlatDisplay = false; 524 isFlatDisplay = false;
525 mNavigator = 0; 525 mNavigator = 0;
526 QBoxLayout *topLayout = new QVBoxLayout(this); 526 QBoxLayout *topLayout = new QVBoxLayout(this);
527 mName = QString ( name ); 527 mName = QString ( name );
528 mBlockUpdate = false; 528 mBlockUpdate = false;
529 mQuickBar = new QWidget( this ); 529 mQuickBar = new QWidget( this );
530 topLayout->addWidget(mQuickBar); 530 topLayout->addWidget(mQuickBar);
531 531
532 mQuickAdd = new KOQuickTodo(mQuickBar); 532 mQuickAdd = new KOQuickTodo(mQuickBar);
533 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar); 533 QBoxLayout *quickLayout = new QHBoxLayout(mQuickBar);
534 quickLayout->addWidget( mQuickAdd ); 534 quickLayout->addWidget( mQuickAdd );
535 mNewSubBut = new QPushButton( "sub",mQuickBar ); 535 mNewSubBut = new QPushButton( "sub",mQuickBar );
536 QPushButton * s_done = new QPushButton( "D",mQuickBar ); 536 QPushButton * s_done = new QPushButton( "D",mQuickBar );
537 QPushButton * s_run = new QPushButton( "R",mQuickBar ); 537 QPushButton * s_run = new QPushButton( "R",mQuickBar );
538 QPushButton * allopen = new QPushButton( "O",mQuickBar ); 538 QPushButton * allopen = new QPushButton( "O",mQuickBar );
539 QPushButton * allclose = new QPushButton( "C",mQuickBar ); 539 QPushButton * allclose = new QPushButton( "C",mQuickBar );
540 QPushButton * flat = new QPushButton( "F",mQuickBar ); 540 QPushButton * flat = new QPushButton( "F",mQuickBar );
@@ -929,48 +929,49 @@ void KOTodoView::updateView()
929 } 929 }
930 if ( next ) 930 if ( next )
931 todo = todoList.next(); 931 todo = todoList.next();
932 } 932 }
933 933
934 for(todo = todoList.first(); todo; todo = todoList.next()) { 934 for(todo = todoList.first(); todo; todo = todoList.next()) {
935 if (!mTodoMap.contains(todo) && checkTodo( todo ) ) 935 if (!mTodoMap.contains(todo) && checkTodo( todo ) )
936 { 936 {
937 insertTodoItem(todo); 937 insertTodoItem(todo);
938 } 938 }
939 } 939 }
940 // Restore opened/closed state 940 // Restore opened/closed state
941 mTodoListView->blockSignals( true ); 941 mTodoListView->blockSignals( true );
942 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() ); 942 if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
943 mTodoListView->blockSignals( false ); 943 mTodoListView->blockSignals( false );
944 resetCurrentItem(); 944 resetCurrentItem();
945} 945}
946 946
947void KOTodoView::storeCurrentItem() 947void KOTodoView::storeCurrentItem()
948{ 948{
949 mCurItem = 0; 949 mCurItem = 0;
950 mCurItemRootParent = 0; 950 mCurItemRootParent = 0;
951 mCurItemParent = 0; 951 mCurItemParent = 0;
952 mCurItemAbove = 0; 952 mCurItemAbove = 0;
953 mIsActiveWindow = topLevelWidget()->isActiveWindow();
953 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); 954 mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem();
954 if (mActiveItem) { 955 if (mActiveItem) {
955 mCurItem = mActiveItem->todo(); 956 mCurItem = mActiveItem->todo();
956 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove (); 957 KOTodoViewItem* activeItemAbove = (KOTodoViewItem*)mActiveItem->itemAbove ();
957 if ( activeItemAbove ) 958 if ( activeItemAbove )
958 mCurItemAbove = activeItemAbove->todo(); 959 mCurItemAbove = activeItemAbove->todo();
959 mCurItemRootParent = mCurItem; 960 mCurItemRootParent = mCurItem;
960 mCurItemParent = mCurItemRootParent->relatedTo(); 961 mCurItemParent = mCurItemRootParent->relatedTo();
961 while ( mCurItemRootParent->relatedTo() != 0 ) 962 while ( mCurItemRootParent->relatedTo() != 0 )
962 mCurItemRootParent = mCurItemRootParent->relatedTo(); 963 mCurItemRootParent = mCurItemRootParent->relatedTo();
963 } 964 }
964 mActiveItem = 0; 965 mActiveItem = 0;
965} 966}
966 967
967void KOTodoView::resetCurrentItem() 968void KOTodoView::resetCurrentItem()
968{ 969{
969 //mTodoListView->setFocus(); 970 //mTodoListView->setFocus();
970 KOTodoViewItem* foundItem = 0; 971 KOTodoViewItem* foundItem = 0;
971 KOTodoViewItem* foundItemRoot = 0; 972 KOTodoViewItem* foundItemRoot = 0;
972 KOTodoViewItem* foundItemParent = 0; 973 KOTodoViewItem* foundItemParent = 0;
973 KOTodoViewItem* foundItemAbove = 0; 974 KOTodoViewItem* foundItemAbove = 0;
974 if ( mTodoListView->firstChild () ) { 975 if ( mTodoListView->firstChild () ) {
975 if ( mCurItem ) { 976 if ( mCurItem ) {
976 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); 977 KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild ();
@@ -997,49 +998,50 @@ void KOTodoView::resetCurrentItem()
997 if ( foundItemRoot ) 998 if ( foundItemRoot )
998 foundItem = foundItemRoot; 999 foundItem = foundItemRoot;
999 else 1000 else
1000 foundItem = foundItemAbove; 1001 foundItem = foundItemAbove;
1001 } 1002 }
1002 } 1003 }
1003 } 1004 }
1004 if ( foundItem ) { 1005 if ( foundItem ) {
1005 mTodoListView->setSelected ( foundItem, true ); 1006 mTodoListView->setSelected ( foundItem, true );
1006 mTodoListView->setCurrentItem( foundItem ); 1007 mTodoListView->setCurrentItem( foundItem );
1007 mTodoListView->ensureItemVisible( foundItem ); 1008 mTodoListView->ensureItemVisible( foundItem );
1008 } else { 1009 } else {
1009 if ( mTodoListView->firstChild () ) { 1010 if ( mTodoListView->firstChild () ) {
1010 mTodoListView->setSelected ( mTodoListView->firstChild (), true ); 1011 mTodoListView->setSelected ( mTodoListView->firstChild (), true );
1011 mTodoListView->setCurrentItem( mTodoListView->firstChild () ); 1012 mTodoListView->setCurrentItem( mTodoListView->firstChild () );
1012 } 1013 }
1013 } 1014 }
1014 } 1015 }
1015 processSelectionChange(); 1016 processSelectionChange();
1016 if ( mName != "todolistsmall" ) 1017 if ( mName != "todolistsmall" )
1017 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() )); 1018 QTimer::singleShot( 100, this, SLOT ( resetFocusToList() ));
1018} 1019}
1019void KOTodoView::resetFocusToList() 1020void KOTodoView::resetFocusToList()
1020{ 1021{
1021 topLevelWidget()->setActiveWindow(); 1022 if ( mIsActiveWindow )
1023 topLevelWidget()->setActiveWindow();
1022 mTodoListView->setFocus(); 1024 mTodoListView->setFocus();
1023} 1025}
1024//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove; 1026//Incidence * mCurItem, *mCurItemRootParent,*mCurItemAbove;
1025bool KOTodoView::checkTodo( Todo * todo ) 1027bool KOTodoView::checkTodo( Todo * todo )
1026{ 1028{
1027 1029
1028 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() ) 1030 if ( !KOPrefs::instance()->mShowCompletedTodo && todo->isCompleted() )
1029 return false; 1031 return false;
1030 if ( !todo->isCompleted() ) { 1032 if ( !todo->isCompleted() ) {
1031 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() ) 1033 if ( todo->hasDueDate() && todo->dtDue().date() <= QDate::currentDate() )
1032 return true; 1034 return true;
1033 } 1035 }
1034 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) { 1036 if ( KOPrefs::instance()->mHideNonStartedTodos && mNavigator ) {
1035 if ( todo->hasStartDate() ) 1037 if ( todo->hasStartDate() )
1036 if ( mNavigator->selectedDates().last() < todo->dtStart().date() ) 1038 if ( mNavigator->selectedDates().last() < todo->dtStart().date() )
1037 return false; 1039 return false;
1038 if ( todo->hasDueDate() ) 1040 if ( todo->hasDueDate() )
1039 if ( mNavigator->selectedDates().first() > todo->dtDue().date() ) 1041 if ( mNavigator->selectedDates().first() > todo->dtDue().date() )
1040 return false; 1042 return false;
1041 } 1043 }
1042 return true; 1044 return true;
1043} 1045}
1044 1046
1045void KOTodoView::restoreItemState( QListViewItem *item ) 1047void KOTodoView::restoreItemState( QListViewItem *item )
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index ecd0ad9..161ecb0 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -234,48 +234,49 @@ class KOTodoView : public KOrg::BaseView
234 void unparentTodoSignal(Todo *); 234 void unparentTodoSignal(Todo *);
235 void reparentTodoSignal( Todo *,Todo * ); 235 void reparentTodoSignal( Todo *,Todo * );
236 void showTodoSignal(Todo *); 236 void showTodoSignal(Todo *);
237 237
238 void editTodoSignal(Todo *); 238 void editTodoSignal(Todo *);
239 void deleteTodoSignal(Todo *); 239 void deleteTodoSignal(Todo *);
240 void todoModifiedSignal (Todo *, int); 240 void todoModifiedSignal (Todo *, int);
241 241
242 void isModified(bool); 242 void isModified(bool);
243 void cloneTodoSignal( Incidence * ); 243 void cloneTodoSignal( Incidence * );
244 void cancelTodoSignal( Incidence * ); 244 void cancelTodoSignal( Incidence * );
245 void moveTodoSignal( Incidence * ); 245 void moveTodoSignal( Incidence * );
246 void beamTodoSignal( Incidence * ); 246 void beamTodoSignal( Incidence * );
247 void purgeCompletedSignal(); 247 void purgeCompletedSignal();
248 248
249 protected slots: 249 protected slots:
250 void toggleRunningItem(); 250 void toggleRunningItem();
251 void paintNeeded(); 251 void paintNeeded();
252 void processSelectionChange(); 252 void processSelectionChange();
253 void addQuickTodo(); 253 void addQuickTodo();
254 void setTodoModified( Todo* ); 254 void setTodoModified( Todo* );
255 void todoModified(Todo *, int ); 255 void todoModified(Todo *, int );
256 256
257 private: 257 private:
258 bool mIsActiveWindow;
258 void addQuickTodoPar( Todo * parentTodo); 259 void addQuickTodoPar( Todo * parentTodo);
259 /* 260 /*
260 * the TodoEditor approach is rather unscaling in the long 261 * the TodoEditor approach is rather unscaling in the long
261 * run. 262 * run.
262 * Korganizer keeps it in memory and we need to update 263 * Korganizer keeps it in memory and we need to update
263 * 1. make KOTodoViewItem a QObject again? 264 * 1. make KOTodoViewItem a QObject again?
264 * 2. add a public method for setting one todo modified? 265 * 2. add a public method for setting one todo modified?
265 * 3. add a private method for setting a todo modified + friend here? 266 * 3. add a private method for setting a todo modified + friend here?
266 * -- zecke 2002-07-08 267 * -- zecke 2002-07-08
267 */ 268 */
268 KOTodoViewWhatsThis* mKOTodoViewWhatsThis; 269 KOTodoViewWhatsThis* mKOTodoViewWhatsThis;
269 friend class KOTodoListView; 270 friend class KOTodoListView;
270 void paintEvent(QPaintEvent * pevent); 271 void paintEvent(QPaintEvent * pevent);
271 bool mPendingUpdateBeforeRepaint; 272 bool mPendingUpdateBeforeRepaint;
272 friend class KOTodoViewItem; 273 friend class KOTodoViewItem;
273 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo); 274 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
274 void restoreItemState( QListViewItem * ); 275 void restoreItemState( QListViewItem * );
275 276
276 bool checkTodo( Todo * ); 277 bool checkTodo( Todo * );
277 bool isFlatDisplay; 278 bool isFlatDisplay;
278 void setOpen( QListViewItem*, bool setOpen); 279 void setOpen( QListViewItem*, bool setOpen);
279 KOTodoListView *mTodoListView; 280 KOTodoListView *mTodoListView;
280 QPopupMenu *mItemPopupMenu; 281 QPopupMenu *mItemPopupMenu;
281 QPopupMenu *mPopupMenu; 282 QPopupMenu *mPopupMenu;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index ba3bc05..4057ae0 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -39,48 +39,55 @@
39#include "koagendaview.h" 39#include "koagendaview.h"
40#include "kodialogmanager.h" 40#include "kodialogmanager.h"
41#include "komonthview.h" 41#include "komonthview.h"
42#include "kolistview.h" 42#include "kolistview.h"
43#include "kowhatsnextview.h" 43#include "kowhatsnextview.h"
44#include "kojournalview.h" 44#include "kojournalview.h"
45#include "kotimespanview.h" 45#include "kotimespanview.h"
46#include "koprefs.h" 46#include "koprefs.h"
47#include "navigatorbar.h" 47#include "navigatorbar.h"
48#include "kdatenavigator.h" 48#include "kdatenavigator.h"
49 49
50#include "koviewmanager.h" 50#include "koviewmanager.h"
51//extern bool externFlagMonthviewBlockPainting; 51//extern bool externFlagMonthviewBlockPainting;
52 52
53//bool globalFlagBlockPainting = false; 53//bool globalFlagBlockPainting = false;
54int globalFlagBlockAgenda = 0; 54int globalFlagBlockAgenda = 0;
55int globalFlagBlockLabel = 0; 55int globalFlagBlockLabel = 0;
56int globalFlagBlockAgendaItemPaint = 1; 56int globalFlagBlockAgendaItemPaint = 1;
57int globalFlagBlockAgendaItemUpdate = 1; 57int globalFlagBlockAgendaItemUpdate = 1;
58 58
59 59
60KOViewManager::KOViewManager( CalendarView *mainView ) : 60KOViewManager::KOViewManager( CalendarView *mainView ) :
61 QObject(), mMainView( mainView ) 61 QObject(), mMainView( mainView )
62{ 62{
63
64 lastMode = 0;
65 lastCount = 0;
66 lastNDMode = false;
67 selecteddatescount = 0;
68 selecteddate = QDate ( 2000, 1, 1 );
69 baseCycleDate = QDate ( 2000, 1, 1 );
63 mCurrentView = 0; 70 mCurrentView = 0;
64 flagResetViewChangeDate = 0; 71 flagResetViewChangeDate = 0;
65 mWhatsNextView = 0; 72 mWhatsNextView = 0;
66 mTodoView = 0; 73 mTodoView = 0;
67 mAgendaView = 0; 74 mAgendaView = 0;
68 mMonthView = 0; 75 mMonthView = 0;
69 mListView = 0; 76 mListView = 0;
70 mJournalView = 0; 77 mJournalView = 0;
71 mTimeSpanView = 0; 78 mTimeSpanView = 0;
72 mCurrentAgendaView = 0 ; 79 mCurrentAgendaView = 0 ;
73 mFlagShowNextxDays = false; 80 mFlagShowNextxDays = false;
74} 81}
75 82
76KOViewManager::~KOViewManager() 83KOViewManager::~KOViewManager()
77{ 84{
78} 85}
79 86
80 87
81KOrg::BaseView *KOViewManager::currentView() 88KOrg::BaseView *KOViewManager::currentView()
82{ 89{
83 return mCurrentView; 90 return mCurrentView;
84} 91}
85 92
86void KOViewManager::readSettings(KConfig *config) 93void KOViewManager::readSettings(KConfig *config)
@@ -92,52 +99,49 @@ void KOViewManager::readSettings(KConfig *config)
92 if ( !KOPrefs::instance()->mMonthViewWeek ) 99 if ( !KOPrefs::instance()->mMonthViewWeek )
93 showMonthView(); 100 showMonthView();
94 else 101 else
95 showMonthViewWeek(); 102 showMonthViewWeek();
96 } 103 }
97 else if (view == "List") showListView(); 104 else if (view == "List") showListView();
98 else if (view == "Journal") showJournalView(); 105 else if (view == "Journal") showJournalView();
99 else if (view == "TimeSpan") showTimeSpanView(); 106 else if (view == "TimeSpan") showTimeSpanView();
100 else if (view == "Todo") showTodoView(); 107 else if (view == "Todo") showTodoView();
101 else { 108 else {
102 config->setGroup( "Views" ); 109 config->setGroup( "Views" );
103 int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); 110 int dateCount = config->readNumEntry( "ShownDatesCount", 7 );
104 mCurrentAgendaView = dateCount; 111 mCurrentAgendaView = dateCount;
105 showAgendaView(); 112 showAgendaView();
106 mCurrentAgendaView = dateCount; 113 mCurrentAgendaView = dateCount;
107#ifdef DESKTOP_VERSION 114#ifdef DESKTOP_VERSION
108 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); 115 QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) );
109#endif 116#endif
110 } 117 }
111} 118}
112 119
113 120
114void KOViewManager::showDateView( int view, QDate date) 121void KOViewManager::showDateView( int view, QDate date)
115{ 122{
116 static int lastMode = 0; 123
117 static int lastCount = 0;
118 static bool lastNDMode = false;
119 static QDate lastDate;
120 //qDebug("date %d %s", view, date.toString().latin1()); 124 //qDebug("date %d %s", view, date.toString().latin1());
121 125
122 if (view != 9) 126 if (view != 9)
123 lastMode = 0; 127 lastMode = 0;
124 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); 128 //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays );
125 bool savemFlagShowNextxDays = mFlagShowNextxDays; 129 bool savemFlagShowNextxDays = mFlagShowNextxDays;
126 mFlagShowNextxDays = false; 130 mFlagShowNextxDays = false;
127 if ( view == 3 ) { 131 if ( view == 3 ) {
128 //mCurrentAgendaView = 1 ; 132 //mCurrentAgendaView = 1 ;
129 lastDate = mMainView->dateNavigator()->selectedDates().first(); 133 lastDate = mMainView->dateNavigator()->selectedDates().first();
130 lastCount = mMainView->dateNavigator()->selectedDates().count(); 134 lastCount = mMainView->dateNavigator()->selectedDates().count();
131 lastNDMode = savemFlagShowNextxDays; 135 lastNDMode = savemFlagShowNextxDays;
132 mMainView->dateNavigator()->selectDate( date ); 136 mMainView->dateNavigator()->selectDate( date );
133 lastMode = 1; 137 lastMode = 1;
134 mCurrentAgendaView = 1 ; 138 mCurrentAgendaView = 1 ;
135 } else if (view == 4 ) { 139 } else if (view == 4 ) {
136 mCurrentAgendaView = 7 ; 140 mCurrentAgendaView = 7 ;
137 mMainView->dateNavigator()->selectDates( date, 7 ); 141 mMainView->dateNavigator()->selectDates( date, 7 );
138 } else if (view == 5 ) { 142 } else if (view == 5 ) {
139 mCurrentAgendaView = 14 ; 143 mCurrentAgendaView = 14 ;
140 mMainView->dateNavigator()->selectDates( date, 14); 144 mMainView->dateNavigator()->selectDates( date, 14);
141 } else if (view == 6 ) { 145 } else if (view == 6 ) {
142 resetDateSilent( date,1); 146 resetDateSilent( date,1);
143 showMonthView(); 147 showMonthView();
@@ -180,51 +184,49 @@ void KOViewManager::writeSettings(KConfig *config)
180 else if (mCurrentView == mMonthView) view = "Month"; 184 else if (mCurrentView == mMonthView) view = "Month";
181 else if (mCurrentView == mListView) view = "List"; 185 else if (mCurrentView == mListView) view = "List";
182 else if (mCurrentView == mJournalView) view = "Journal"; 186 else if (mCurrentView == mJournalView) view = "Journal";
183 else if (mCurrentView == mTimeSpanView) view = "TimeSpan"; 187 else if (mCurrentView == mTimeSpanView) view = "TimeSpan";
184 else if (mCurrentView == mTodoView) view = "Todo"; 188 else if (mCurrentView == mTodoView) view = "Todo";
185 else view = "Agenda"; 189 else view = "Agenda";
186 190
187 config->writeEntry("Current View",view); 191 config->writeEntry("Current View",view);
188 192
189 if (mAgendaView) { 193 if (mAgendaView) {
190 mAgendaView->writeSettings(config); 194 mAgendaView->writeSettings(config);
191 } 195 }
192 if (mTimeSpanView) { 196 if (mTimeSpanView) {
193 mTimeSpanView->writeSettings(config); 197 mTimeSpanView->writeSettings(config);
194 } 198 }
195 if (mListView) { 199 if (mListView) {
196 mListView->writeSettings(config); 200 mListView->writeSettings(config);
197 } 201 }
198 if (mTodoView) { 202 if (mTodoView) {
199 mTodoView->saveLayout(config,"Todo View"); 203 mTodoView->saveLayout(config,"Todo View");
200 } 204 }
201} 205}
202void KOViewManager::showNextView() 206void KOViewManager::showNextView()
203{ 207{
204 static int selecteddatescount = 0; 208
205 static QDate selecteddate = QDate ( 2000, 1, 1 );
206 static QDate baseCycleDate = QDate ( 2000, 1, 1 );
207 int newCount = mMainView->dateNavigator()->selectedDates().count(); 209 int newCount = mMainView->dateNavigator()->selectedDates().count();
208 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { 210 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) {
209 flagResetViewChangeDate = 1; 211 flagResetViewChangeDate = 1;
210 } 212 }
211 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) 213 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() )
212 flagResetViewChangeDate = 1; 214 flagResetViewChangeDate = 1;
213 if ( flagResetViewChangeDate > 0 ) { 215 if ( flagResetViewChangeDate > 0 ) {
214 baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); 216 baseCycleDate = mMainView->dateNavigator()->selectedDates().first();
215 //qDebug("newCycle "); 217 //qDebug("newCycle ");
216 } 218 }
217 if (mCurrentView == mWhatsNextView) goto NEXT_X; 219 if (mCurrentView == mWhatsNextView) goto NEXT_X;
218 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; 220 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
219 if (mCurrentView == mJournalView ) goto DAY_1; 221 if (mCurrentView == mJournalView ) goto DAY_1;
220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; 222 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5;
221 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; 223 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7;
222 if (mCurrentView == mAgendaView ) goto DAY_6; 224 if (mCurrentView == mAgendaView ) goto DAY_6;
223 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; 225 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH;
224 if (mCurrentView == mMonthView ) goto LIST; 226 if (mCurrentView == mMonthView ) goto LIST;
225 if (mCurrentView == mListView ) goto TODO; 227 if (mCurrentView == mListView ) goto TODO;
226 // if (mCurrentView == mTodoView ) goto NEXT; 228 // if (mCurrentView == mTodoView ) goto NEXT;
227 NEXT: 229 NEXT:
228 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} 230 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;}
229 NEXT_X: 231 NEXT_X:
230 if ( KOPrefs::instance()->mShowIconNextDays ) { 232 if ( KOPrefs::instance()->mShowIconNextDays ) {
diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h
index 2e6aaed..2aa46d0 100644
--- a/korganizer/koviewmanager.h
+++ b/korganizer/koviewmanager.h
@@ -83,47 +83,54 @@ class KOViewManager : public QObject
83 void printWNV(); 83 void printWNV();
84 void signalFullScreen( bool ); 84 void signalFullScreen( bool );
85 void signalAgendaView( bool ); 85 void signalAgendaView( bool );
86 public slots: 86 public slots:
87 void setDefaultCalendar(int); 87 void setDefaultCalendar(int);
88 void slotprintWNV(); 88 void slotprintWNV();
89 void showNextView(); 89 void showNextView();
90 void showMonth( const QDate & ); 90 void showMonth( const QDate & );
91 void showDateView( int, QDate ); 91 void showDateView( int, QDate );
92 void updateView(); 92 void updateView();
93 void showWhatsNextView(); 93 void showWhatsNextView();
94 void showListView(); 94 void showListView();
95 void showAgendaView( bool fullScreen = false ); 95 void showAgendaView( bool fullScreen = false );
96 void showDayView(); 96 void showDayView();
97 void showWorkWeekView(); 97 void showWorkWeekView();
98 void showWeekView(); 98 void showWeekView();
99 void showNextXView(); 99 void showNextXView();
100 void showMonthView(); 100 void showMonthView();
101 void showMonthViewWeek(); 101 void showMonthViewWeek();
102 void showTodoView(); 102 void showTodoView();
103 void showJournalView(); 103 void showJournalView();
104 void showTimeSpanView(); 104 void showTimeSpanView();
105 105
106 private: 106 private:
107 int lastMode;
108 int lastCount;
109 bool lastNDMode;
110 QDate lastDate;
111 int selecteddatescount;
112 QDate selecteddate;
113 QDate baseCycleDate;
107 void resetDateSilent( QDate date , int days ); 114 void resetDateSilent( QDate date , int days );
108 int flagResetViewChangeDate; 115 int flagResetViewChangeDate;
109 QDate currentViewChangeDate; 116 QDate currentViewChangeDate;
110 void createMonthView(); 117 void createMonthView();
111 CalendarView *mMainView; 118 CalendarView *mMainView;
112 119
113 int mCurrentAgendaView; 120 int mCurrentAgendaView;
114 KOAgendaView *mAgendaView; 121 KOAgendaView *mAgendaView;
115 KOListView *mListView; 122 KOListView *mListView;
116 KOMonthView *mMonthView; 123 KOMonthView *mMonthView;
117 KOTodoView *mTodoView; 124 KOTodoView *mTodoView;
118 KOWhatsNextView *mWhatsNextView; 125 KOWhatsNextView *mWhatsNextView;
119 KOJournalView *mJournalView; 126 KOJournalView *mJournalView;
120 KOTimeSpanView *mTimeSpanView; 127 KOTimeSpanView *mTimeSpanView;
121 128
122 KOrg::BaseView *mCurrentView; // currently active event view 129 KOrg::BaseView *mCurrentView; // currently active event view
123 130
124 int mAgendaViewMode; 131 int mAgendaViewMode;
125 bool mFlagShowNextxDays; 132 bool mFlagShowNextxDays;
126 133
127}; 134};
128 135
129#endif 136#endif