-rw-r--r-- | korganizer/koviewmanager.cpp | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index f8f6c1d..e22f096 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp | |||
@@ -85,13 +85,18 @@ KOrg::BaseView *KOViewManager::currentView() | |||
85 | 85 | ||
86 | void KOViewManager::readSettings(KConfig *config) | 86 | void KOViewManager::readSettings(KConfig *config) |
87 | { | 87 | { |
88 | config->setGroup("General"); | 88 | config->setGroup("General"); |
89 | QString view = config->readEntry("Current View"); | 89 | QString view = config->readEntry("Current View"); |
90 | if (view == "WhatsNext") showWhatsNextView(); | 90 | if (view == "WhatsNext") showWhatsNextView(); |
91 | else if (view == "Month") showMonthView(); | 91 | else if (view == "Month") { |
92 | if ( KOPrefs::instance()->mMonthViewWeek ) | ||
93 | showMonthView(); | ||
94 | else | ||
95 | showMonthViewWeek(); | ||
96 | } | ||
92 | else if (view == "List") showListView(); | 97 | else if (view == "List") showListView(); |
93 | else if (view == "Journal") showJournalView(); | 98 | else if (view == "Journal") showJournalView(); |
94 | else if (view == "TimeSpan") showTimeSpanView(); | 99 | else if (view == "TimeSpan") showTimeSpanView(); |
95 | else if (view == "Todo") showTodoView(); | 100 | else if (view == "Todo") showTodoView(); |
96 | else { | 101 | else { |
97 | config->setGroup( "Views" ); | 102 | config->setGroup( "Views" ); |
@@ -204,12 +209,13 @@ void KOViewManager::showView(KOrg::BaseView *view, bool fullScreen ) | |||
204 | return; | 209 | return; |
205 | } | 210 | } |
206 | bool full = fullScreen; | 211 | bool full = fullScreen; |
207 | if(view == mCurrentView && view != mWhatsNextView ) { | 212 | if(view == mCurrentView && view != mWhatsNextView ) { |
208 | if ( mCurrentAgendaView < 0 ) | 213 | if ( mCurrentAgendaView < 0 ) |
209 | return; | 214 | return; |
215 | if ( view != mMonthView ) | ||
210 | full = mMainView->leftFrame()->isVisible(); | 216 | full = mMainView->leftFrame()->isVisible(); |
211 | } else { | 217 | } else { |
212 | if ( view == mMonthView && mMonthView) | 218 | if ( view == mMonthView && mMonthView) |
213 | ;//mMonthView->skipResize = true ; | 219 | ;//mMonthView->skipResize = true ; |
214 | mCurrentView = view; | 220 | mCurrentView = view; |
215 | // bool full = fullScreen; | 221 | // bool full = fullScreen; |
@@ -483,13 +489,13 @@ void KOViewManager::showNextXView() | |||
483 | mCurrentAgendaView = 3 ; | 489 | mCurrentAgendaView = 3 ; |
484 | } | 490 | } |
485 | bool KOViewManager::showsNextDays() | 491 | bool KOViewManager::showsNextDays() |
486 | { | 492 | { |
487 | return mFlagShowNextxDays; | 493 | return mFlagShowNextxDays; |
488 | } | 494 | } |
489 | void KOViewManager::showMonthView() | 495 | void KOViewManager::createMonthView() |
490 | { | 496 | { |
491 | if (!mMonthView) { | 497 | if (!mMonthView) { |
492 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); | 498 | mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); |
493 | 499 | ||
494 | addView(mMonthView); | 500 | addView(mMonthView); |
495 | // mMonthView->show(); | 501 | // mMonthView->show(); |
@@ -514,12 +520,14 @@ void KOViewManager::showMonthView() | |||
514 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), | 520 | connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), |
515 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); | 521 | mMainView, SLOT ( moveIncidence( Incidence * ) ) ); |
516 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), | 522 | connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), |
517 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); | 523 | mMainView, SLOT ( beamIncidence( Incidence * ) ) ); |
518 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), | 524 | connect( mMonthView, SIGNAL( selectWeekNum( int ) ), |
519 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); | 525 | mMainView->dateNavigator(), SLOT ( selectWeekFromMonthView( int ) ) ); |
526 | connect( mMonthView, SIGNAL( selectMonth() ), | ||
527 | mMainView->dateNavigator(), SLOT ( selectMonthFromMonthview() ) ); | ||
520 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), | 528 | connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), |
521 | mMainView, SLOT ( showDay( QDate ) ) ); | 529 | mMainView, SLOT ( showDay( QDate ) ) ); |
522 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); | 530 | connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); |
523 | connect( mMonthView, SIGNAL(nextMonth() ), | 531 | connect( mMonthView, SIGNAL(nextMonth() ), |
524 | mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); | 532 | mMonthView->navigatorBar(), SIGNAL(goNextMonth() ) ); |
525 | connect( mMonthView, SIGNAL(prevMonth() ), | 533 | connect( mMonthView, SIGNAL(prevMonth() ), |
@@ -529,31 +537,63 @@ void KOViewManager::showMonthView() | |||
529 | connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), | 537 | connect( mMonthView->navigatorBar(), SIGNAL( goNextYear() ), |
530 | mMainView->dateNavigator(), SLOT( selectNextYear() ) ); | 538 | mMainView->dateNavigator(), SLOT( selectNextYear() ) ); |
531 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), | 539 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevMonth() ), |
532 | mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); | 540 | mMainView->dateNavigator(), SLOT( selectPreviousMonth() ) ); |
533 | connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), | 541 | connect( mMonthView->navigatorBar(), SIGNAL( goNextMonth() ), |
534 | mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); | 542 | mMainView->dateNavigator(), SLOT( selectNextMonth() ) ); |
543 | connect( mMonthView->navigatorBar(), SIGNAL( goPrevWeek() ), | ||
544 | mMainView->dateNavigator(), SLOT( selectPreviousWeek() ) ); | ||
545 | connect( mMonthView->navigatorBar(), SIGNAL( goNextWeek() ), | ||
546 | mMainView->dateNavigator(), SLOT( selectNextWeek() ) ); | ||
535 | 547 | ||
536 | connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 548 | connect( mMainView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
537 | mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); | 549 | mMonthView->navigatorBar(), SLOT( selectDates( const KCal::DateList & ) ) ); |
538 | 550 | ||
539 | 551 | ||
540 | connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), | 552 | connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), |
541 | mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); | 553 | mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); |
542 | 554 | ||
543 | } | 555 | } |
556 | } | ||
557 | void KOViewManager::showMonthViewWeek() | ||
558 | { | ||
559 | createMonthView(); | ||
560 | bool full = true; | ||
561 | if ( mCurrentView == mMonthView) | ||
562 | full = mMainView->leftFrame()->isVisible(); | ||
563 | if ( !KOPrefs::instance()->mMonthViewWeek ) { | ||
564 | mMonthView->switchView(); | ||
565 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) | ||
566 | full = false; | ||
567 | else | ||
568 | full = true; | ||
569 | } | ||
570 | mMainView->dateNavigator()->selectWeek(); | ||
571 | showView(mMonthView, full ); | ||
572 | } | ||
573 | |||
574 | void KOViewManager::showMonthView() | ||
575 | { | ||
544 | 576 | ||
577 | createMonthView(); | ||
545 | globalFlagBlockAgenda = 1; | 578 | globalFlagBlockAgenda = 1; |
546 | //mFlagShowNextxDays = false; | 579 | //mFlagShowNextxDays = false; |
580 | bool full = true; | ||
581 | if ( mCurrentView == mMonthView) | ||
582 | full = mMainView->leftFrame()->isVisible(); | ||
547 | // if(mMonthView == mCurrentView) return; | 583 | // if(mMonthView == mCurrentView) return; |
548 | if ( KOPrefs::instance()->mMonthViewWeek ) | 584 | if ( KOPrefs::instance()->mMonthViewWeek ) { |
549 | mMainView->dateNavigator()->selectWeek(); | 585 | mMonthView->switchView(); |
586 | if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) | ||
587 | full = false; | ||
550 | else | 588 | else |
589 | full = true; | ||
590 | } | ||
551 | mMainView->dateNavigator()->selectMonth(); | 591 | mMainView->dateNavigator()->selectMonth(); |
552 | 592 | ||
553 | showView(mMonthView, true ); | 593 | showView(mMonthView, full ); |
554 | 594 | ||
555 | } | 595 | } |
556 | 596 | ||
557 | void KOViewManager::showTodoView() | 597 | void KOViewManager::showTodoView() |
558 | { | 598 | { |
559 | //mFlagShowNextxDays = false; | 599 | //mFlagShowNextxDays = false; |