summaryrefslogtreecommitdiffabout
path: root/korganizer/koviewmanager.cpp
Unidiff
Diffstat (limited to 'korganizer/koviewmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koviewmanager.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index c442d0b..406e741 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -206,57 +206,49 @@ void KOViewManager::showNextView()
206 int newCount = mMainView->dateNavigator()->selectedDates().count(); 206 int newCount = mMainView->dateNavigator()->selectedDates().count();
207 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) { 207 if ( selecteddatescount != newCount && flagResetViewChangeDate == 0 ) {
208 flagResetViewChangeDate = 1; 208 flagResetViewChangeDate = 1;
209 } 209 }
210 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() ) 210 if ( selecteddate != mMainView->dateNavigator()->selectedDates().first() )
211 flagResetViewChangeDate = 1; 211 flagResetViewChangeDate = 1;
212 if ( flagResetViewChangeDate > 0 ) { 212 if ( flagResetViewChangeDate > 0 ) {
213 baseCycleDate = mMainView->dateNavigator()->selectedDates().first(); 213 baseCycleDate = mMainView->dateNavigator()->selectedDates().first();
214 //qDebug("newCycle "); 214 //qDebug("newCycle ");
215 } 215 }
216 if (mCurrentView == mWhatsNextView) goto NEXT_X; 216 if (mCurrentView == mWhatsNextView) goto NEXT_X;
217 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL; 217 if (mCurrentView == mAgendaView && mFlagShowNextxDays) goto JOURNAL;
218 if (mCurrentView == mJournalView ) goto DAY_1; 218 if (mCurrentView == mJournalView ) goto DAY_1;
219 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5; 219 if (mCurrentView == mAgendaView && mCurrentAgendaView == 1 ) goto DAY_5;
220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7; 220 if (mCurrentView == mAgendaView && mCurrentAgendaView == 5 ) goto DAY_7;
221 if (mCurrentView == mAgendaView ) goto DAY_6; 221 if (mCurrentView == mAgendaView ) goto DAY_6;
222 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH; 222 if (mCurrentView == mMonthView && KOPrefs::instance()->mMonthViewWeek) goto MONTH;
223 if (mCurrentView == mMonthView ) goto LIST; 223 if (mCurrentView == mMonthView ) goto LIST;
224 if (mCurrentView == mListView ) goto TODO; 224 if (mCurrentView == mListView ) goto TODO;
225 // if (mCurrentView == mTodoView ) goto NEXT; 225 // if (mCurrentView == mTodoView ) goto NEXT;
226 NEXT: 226 NEXT:
227 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;} 227 if ( KOPrefs::instance()->mShowIconNext ) { showWhatsNextView();goto ENTE ;}
228 NEXT_X: 228 NEXT_X:
229 if ( KOPrefs::instance()->mShowIconNextDays ) { 229 if ( KOPrefs::instance()->mShowIconNextDays ) {
230 globalFlagBlockAgenda = 1; 230 showNextXView();
231 if ( mCurrentAgendaView != 3 )
232 mCurrentAgendaView = -1;
233 showAgendaView(KOPrefs::instance()->mFullViewMonth);
234 globalFlagBlockAgenda = 2;
235 mMainView->dateNavigator()->selectDates( baseCycleDate ,
236 KOPrefs::instance()->mNextXDays );
237 mFlagShowNextxDays = true;
238 mCurrentAgendaView = 3 ;
239 goto ENTE ; 231 goto ENTE ;
240 } 232 }
241 JOURNAL: 233 JOURNAL:
242 if ( KOPrefs::instance()->mShowIconJournal ) { 234 if ( KOPrefs::instance()->mShowIconJournal ) {
243 resetDateSilent( baseCycleDate , 1 ); 235 resetDateSilent( baseCycleDate , 1 );
244 showJournalView() ;goto ENTE ;} 236 showJournalView() ;goto ENTE ;}
245 DAY_1: 237 DAY_1:
246 if ( KOPrefs::instance()->mShowIconDay1 ) { 238 if ( KOPrefs::instance()->mShowIconDay1 ) {
247 resetDateSilent( baseCycleDate , 2 ); 239 resetDateSilent( baseCycleDate , 2 );
248 showDayView() ;goto ENTE ;} 240 showDayView() ;goto ENTE ;}
249 DAY_5: 241 DAY_5:
250 if ( KOPrefs::instance()->mShowIconDay5 ) { 242 if ( KOPrefs::instance()->mShowIconDay5 ) {
251 resetDateSilent( baseCycleDate , 2 ); 243 resetDateSilent( baseCycleDate , 2 );
252 showWorkWeekView() ;goto ENTE ;} 244 showWorkWeekView() ;goto ENTE ;}
253 DAY_7: 245 DAY_7:
254 if ( KOPrefs::instance()->mShowIconDay7 ) { 246 if ( KOPrefs::instance()->mShowIconDay7 ) {
255 resetDateSilent( baseCycleDate , 2 ); 247 resetDateSilent( baseCycleDate , 2 );
256 showWeekView();goto ENTE ;} 248 showWeekView();goto ENTE ;}
257 DAY_6: 249 DAY_6:
258 if ( KOPrefs::instance()->mShowIconDay6 ) { 250 if ( KOPrefs::instance()->mShowIconDay6 ) {
259 resetDateSilent( baseCycleDate , 2 ); 251 resetDateSilent( baseCycleDate , 2 );
260 showMonthViewWeek();goto ENTE ;} 252 showMonthViewWeek();goto ENTE ;}
261 MONTH: 253 MONTH:
262 if ( KOPrefs::instance()->mShowIconMonth ) { 254 if ( KOPrefs::instance()->mShowIconMonth ) {
@@ -386,94 +378,95 @@ void KOViewManager::updateView(const QDate &start, const QDate &end)
386 378
387 379
388void KOViewManager::updateWNview() 380void KOViewManager::updateWNview()
389{ 381{
390 if ( mCurrentView == mWhatsNextView && mWhatsNextView ) 382 if ( mCurrentView == mWhatsNextView && mWhatsNextView )
391 mWhatsNextView->updateView(); 383 mWhatsNextView->updateView();
392 if ( mCurrentView == mMonthView && mMonthView ) 384 if ( mCurrentView == mMonthView && mMonthView )
393 mMonthView->updateView(); 385 mMonthView->updateView();
394 386
395} 387}
396void KOViewManager::showWhatsNextView() 388void KOViewManager::showWhatsNextView()
397{ 389{
398 if (!mWhatsNextView) { 390 if (!mWhatsNextView) {
399 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(), 391 mWhatsNextView = new KOWhatsNextView(mMainView->calendar(),mMainView->viewStack(),
400 "KOViewManager::WhatsNextView"); 392 "KOViewManager::WhatsNextView");
401 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog()); 393 mWhatsNextView->setEventViewer( mMainView->getEventViewerDialog());
402 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig())); 394 connect(mMainView, SIGNAL(configChanged()), mWhatsNextView, SLOT(updateConfig()));
403 addView(mWhatsNextView); 395 addView(mWhatsNextView);
404 connect(this, SIGNAL( printWNV() ), 396 connect(this, SIGNAL( printWNV() ),
405 mWhatsNextView, SLOT( printMe() ) ); 397 mWhatsNextView, SLOT( printMe() ) );
406 } 398 }
407 globalFlagBlockAgenda = 1; 399 globalFlagBlockAgenda = 1;
408 showView(mWhatsNextView, true ); 400 showView(mWhatsNextView, true );
409 //mWhatsNextView->updateView(); 401 //mWhatsNextView->updateView();
410 402 KOPrefs::instance()->mCurrentDisplayedView = VIEW_WN_VIEW;
411} 403}
412 404
413void KOViewManager::slotprintWNV() 405void KOViewManager::slotprintWNV()
414{ 406{
415 if (!mWhatsNextView) 407 if (!mWhatsNextView)
416 showWhatsNextView(); 408 showWhatsNextView();
417 emit printWNV(); 409 emit printWNV();
418 410
419} 411}
420void KOViewManager::showListView() 412void KOViewManager::showListView()
421{ 413{
422 if (!mListView) { 414 if (!mListView) {
423 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView"); 415 mListView = new KOListView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::ListView");
424 addView(mListView); 416 addView(mListView);
425 417
426 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)), 418 connect(mListView, SIGNAL(showIncidenceSignal(Incidence *)),
427 mMainView, SLOT(showIncidence(Incidence *))); 419 mMainView, SLOT(showIncidence(Incidence *)));
428 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)), 420 connect(mListView, SIGNAL(editIncidenceSignal(Incidence *)),
429 mMainView, SLOT(editIncidence(Incidence *))); 421 mMainView, SLOT(editIncidence(Incidence *)));
430 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)), 422 connect(mListView, SIGNAL(deleteIncidenceSignal(Incidence *)),
431 mMainView, SLOT(deleteIncidence(Incidence *))); 423 mMainView, SLOT(deleteIncidence(Incidence *)));
432 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ), 424 connect( mListView, SIGNAL( incidenceSelected( Incidence * ) ),
433 mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); 425 mMainView, SLOT( processMainViewSelection( Incidence * ) ) );
434 connect( mListView, SIGNAL( signalNewEvent() ), 426 connect( mListView, SIGNAL( signalNewEvent() ),
435 mMainView, SLOT( newEvent() ) ); 427 mMainView, SLOT( newEvent() ) );
436 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig())); 428 connect(mMainView, SIGNAL(configChanged()), mListView, SLOT(updateConfig()));
437 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ), 429 connect( mListView, SIGNAL( cloneIncidenceSignal( Incidence * ) ),
438 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 430 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
439 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ), 431 connect( mListView, SIGNAL( cancelIncidenceSignal( Incidence * ) ),
440 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 432 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
441 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 433 connect( mListView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
442 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 434 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
443 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 435 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
444 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 436 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
445 } 437 }
446 // bool temp = mFlagShowNextxDays; 438 // bool temp = mFlagShowNextxDays;
447 //globalFlagBlockPainting = true; 439 //globalFlagBlockPainting = true;
448 globalFlagBlockAgenda = 1; 440 globalFlagBlockAgenda = 1;
449 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 441 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
450 mMainView->setBlockShowDates( true ); 442 mMainView->setBlockShowDates( true );
451 mMainView->dateNavigator()->selectMonth(); 443 mMainView->dateNavigator()->selectMonth();
452 mMainView->setBlockShowDates( false ); 444 mMainView->setBlockShowDates( false );
453 } 445 }
454 showView(mListView, KOPrefs::instance()->mFullViewTodo); 446 showView(mListView, KOPrefs::instance()->mFullViewTodo);
455 //mFlagShowNextxDays = temp; 447 //mFlagShowNextxDays = temp;
448 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
456} 449}
457 450
458void KOViewManager::showAgendaView( bool fullScreen ) 451void KOViewManager::showAgendaView( bool fullScreen )
459{ 452{
460 453
461 mMainView->dialogManager()->hideSearchDialog(); 454 mMainView->dialogManager()->hideSearchDialog();
462 // qDebug("KOViewManager::showAgendaView "); 455 // qDebug("KOViewManager::showAgendaView ");
463 bool full; 456 bool full;
464 full = fullScreen; 457 full = fullScreen;
465 if (!mAgendaView) { 458 if (!mAgendaView) {
466 full = false; 459 full = false;
467 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 460 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
468 addView(mAgendaView); 461 addView(mAgendaView);
469#ifndef DESKTOP_VERSION 462#ifndef DESKTOP_VERSION
470 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 463 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
471#endif 464#endif
472 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )), 465 connect( mAgendaView, SIGNAL( incidenceChanged(Incidence *, int )),
473 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) )); 466 mMainView, SLOT( changeIncidenceDisplay( Incidence *, int ) ));
474 467
475 // SIGNALS/SLOTS FOR DAY/WEEK VIEW 468 // SIGNALS/SLOTS FOR DAY/WEEK VIEW
476 469
477 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate ))); 470 connect(mAgendaView,SIGNAL(showDateView( int, QDate )),SLOT(showDateView( int, QDate )));
478 471
479 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)), 472 connect(mAgendaView,SIGNAL(newTodoSignal(QDateTime,bool)),
@@ -497,49 +490,49 @@ void KOViewManager::showAgendaView( bool fullScreen )
497 490
498 connect(mAgendaView, SIGNAL( toggleExpand() ), 491 connect(mAgendaView, SIGNAL( toggleExpand() ),
499 mMainView, SLOT( toggleExpand() ) ); 492 mMainView, SLOT( toggleExpand() ) );
500 493
501 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ), 494 connect( mAgendaView, SIGNAL( cloneIncidenceSignal(Incidence *) ),
502 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ; 495 mMainView, SLOT(cloneIncidence(Incidence *) ) ) ;
503 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ), 496 connect( mAgendaView, SIGNAL( cancelIncidenceSignal(Incidence *) ),
504 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ; 497 mMainView, SLOT(cancelIncidence(Incidence *) ) ) ;
505 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig())); 498 connect(mMainView, SIGNAL(configChanged()), mAgendaView, SLOT(updateConfig()));
506 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView, 499 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mAgendaView,
507 SLOT( updateTodo( Todo *, int ) ) ); 500 SLOT( updateTodo( Todo *, int ) ) );
508 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 501 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
509 mMainView, SIGNAL( todoModified( Todo *, int ))); 502 mMainView, SIGNAL( todoModified( Todo *, int )));
510 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 503 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
511 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 504 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
512 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 505 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
513 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 506 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
514 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 507 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
515 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 508 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
516 mAgendaView->readSettings(); 509 mAgendaView->readSettings();
517 mAgendaView->updateConfig(); 510 mAgendaView->updateConfig();
518 } 511 }
519 512
520 showView( mAgendaView, full); 513 showView( mAgendaView, full);
521 514 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
522} 515}
523 516
524void KOViewManager::showDayView() 517void KOViewManager::showDayView()
525{ 518{
526 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 519 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
527 mFlagShowNextxDays = false; 520 mFlagShowNextxDays = false;
528 globalFlagBlockLabel = 1; 521 globalFlagBlockLabel = 1;
529 globalFlagBlockAgenda = 1; 522 globalFlagBlockAgenda = 1;
530 if ( mCurrentAgendaView != 1 ) 523 if ( mCurrentAgendaView != 1 )
531 mCurrentAgendaView = -1; 524 mCurrentAgendaView = -1;
532 showAgendaView(); 525 showAgendaView();
533 qApp->processEvents(); 526 qApp->processEvents();
534 globalFlagBlockAgenda = 2; 527 globalFlagBlockAgenda = 2;
535 globalFlagBlockLabel = 0; 528 globalFlagBlockLabel = 0;
536 mMainView->dateNavigator()->selectDates( 1 ); 529 mMainView->dateNavigator()->selectDates( 1 );
537 mCurrentAgendaView = 1 ; 530 mCurrentAgendaView = 1 ;
538 531
539} 532}
540 533
541void KOViewManager::showWorkWeekView() 534void KOViewManager::showWorkWeekView()
542{ 535{
543 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 536 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
544 mFlagShowNextxDays = false; 537 mFlagShowNextxDays = false;
545 globalFlagBlockAgenda = 1; 538 globalFlagBlockAgenda = 1;
@@ -571,48 +564,49 @@ void KOViewManager::showWeekView()
571 globalFlagBlockAgenda = 1; 564 globalFlagBlockAgenda = 1;
572 globalFlagBlockLabel = 1; 565 globalFlagBlockLabel = 1;
573 if ( mCurrentAgendaView != 7 ) 566 if ( mCurrentAgendaView != 7 )
574 mCurrentAgendaView = -1; 567 mCurrentAgendaView = -1;
575 showAgendaView(); 568 showAgendaView();
576 qApp->processEvents(); 569 qApp->processEvents();
577 globalFlagBlockAgenda = 2; 570 globalFlagBlockAgenda = 2;
578 globalFlagBlockLabel = 0; 571 globalFlagBlockLabel = 0;
579 mMainView->dateNavigator()->selectWeek(); 572 mMainView->dateNavigator()->selectWeek();
580 mCurrentAgendaView = 7 ; 573 mCurrentAgendaView = 7 ;
581} 574}
582 575
583void KOViewManager::showNextXView() 576void KOViewManager::showNextXView()
584{ 577{
585 578
586 globalFlagBlockAgenda = 1; 579 globalFlagBlockAgenda = 1;
587 if ( mCurrentAgendaView != 3 ) 580 if ( mCurrentAgendaView != 3 )
588 mCurrentAgendaView = -1; 581 mCurrentAgendaView = -1;
589 showAgendaView(KOPrefs::instance()->mFullViewMonth); 582 showAgendaView(KOPrefs::instance()->mFullViewMonth);
590 globalFlagBlockAgenda = 2; 583 globalFlagBlockAgenda = 2;
591 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 584 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
592 KOPrefs::instance()->mNextXDays ); 585 KOPrefs::instance()->mNextXDays );
593 mFlagShowNextxDays = true; 586 mFlagShowNextxDays = true;
594 mCurrentAgendaView = 3 ; 587 mCurrentAgendaView = 3 ;
588 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
595} 589}
596bool KOViewManager::showsNextDays() 590bool KOViewManager::showsNextDays()
597{ 591{
598 return mFlagShowNextxDays; 592 return mFlagShowNextxDays;
599} 593}
600void KOViewManager::createMonthView() 594void KOViewManager::createMonthView()
601{ 595{
602if (!mMonthView) { 596if (!mMonthView) {
603 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 597 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
604 598
605 addView(mMonthView); 599 addView(mMonthView);
606 // mMonthView->show(); 600 // mMonthView->show();
607 // SIGNALS/SLOTS FOR MONTH VIEW 601 // SIGNALS/SLOTS FOR MONTH VIEW
608 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 602 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
609 mMainView, SLOT(newEvent(QDateTime))); 603 mMainView, SLOT(newEvent(QDateTime)));
610 604
611 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 605 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
612 mMainView, SLOT(showIncidence(Incidence *))); 606 mMainView, SLOT(showIncidence(Incidence *)));
613 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 607 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),
614 mMainView, SLOT(editIncidence(Incidence *))); 608 mMainView, SLOT(editIncidence(Incidence *)));
615 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)), 609 connect(mMonthView, SIGNAL(deleteIncidenceSignal(Incidence *)),
616 mMainView, SLOT(deleteIncidence(Incidence *))); 610 mMainView, SLOT(deleteIncidence(Incidence *)));
617 611
618 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ), 612 connect( mMonthView, SIGNAL( incidenceSelected( Incidence * ) ),
@@ -655,78 +649,80 @@ if (!mMonthView) {
655 649
656 650
657 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ), 651 connect( mMonthView->navigatorBar(), SIGNAL( monthSelected ( int ) ),
658 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) ); 652 mMainView->dateNavigator(), SLOT( slotMonthSelect( int ) ) );
659 653
660 } 654 }
661} 655}
662void KOViewManager::showMonthViewWeek() 656void KOViewManager::showMonthViewWeek()
663{ 657{
664 createMonthView(); 658 createMonthView();
665 globalFlagBlockAgenda = 1; 659 globalFlagBlockAgenda = 1;
666 bool full = true; 660 bool full = true;
667 if ( mCurrentView == mMonthView) 661 if ( mCurrentView == mMonthView)
668 full = mMainView->leftFrame()->isVisible(); 662 full = mMainView->leftFrame()->isVisible();
669 if ( !KOPrefs::instance()->mMonthViewWeek ) { 663 if ( !KOPrefs::instance()->mMonthViewWeek ) {
670 mMonthView->switchView(); 664 mMonthView->switchView();
671 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 665 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
672 full = false; 666 full = false;
673 else 667 else
674 full = true; 668 full = true;
675 } 669 }
676 mMainView->dateNavigator()->selectWeek(); 670 mMainView->dateNavigator()->selectWeek();
677 showView(mMonthView, full ); 671 showView(mMonthView, full );
678 mMonthView->setKeyBFocus(); 672 mMonthView->setKeyBFocus();
673 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
679} 674}
680 675
681void KOViewManager::showMonth( const QDate & date ) 676void KOViewManager::showMonth( const QDate & date )
682{ 677{
683 mMainView->dateNavigator()->blockSignals( true ); 678 mMainView->dateNavigator()->blockSignals( true );
684 mMainView->dateNavigator()->selectDate( date ); 679 mMainView->dateNavigator()->selectDate( date );
685 mMainView->dateNavigator()->blockSignals( false ); 680 mMainView->dateNavigator()->blockSignals( false );
686 showMonthView(); 681 showMonthView();
687} 682}
688void KOViewManager::showMonthView() 683void KOViewManager::showMonthView()
689 { 684 {
690 685
691 createMonthView(); 686 createMonthView();
692 globalFlagBlockAgenda = 1; 687 globalFlagBlockAgenda = 1;
693 //mFlagShowNextxDays = false; 688 //mFlagShowNextxDays = false;
694 bool full = true; 689 bool full = true;
695 if ( mCurrentView == mMonthView) 690 if ( mCurrentView == mMonthView)
696 full = mMainView->leftFrame()->isVisible(); 691 full = mMainView->leftFrame()->isVisible();
697 // if(mMonthView == mCurrentView) return; 692 // if(mMonthView == mCurrentView) return;
698 if ( KOPrefs::instance()->mMonthViewWeek ) { 693 if ( KOPrefs::instance()->mMonthViewWeek ) {
699 mMonthView->switchView(); 694 mMonthView->switchView();
700 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 695 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
701 full = false; 696 full = false;
702 else 697 else
703 full = true; 698 full = true;
704 } 699 }
705 mMainView->dateNavigator()->selectMonth(); 700 mMainView->dateNavigator()->selectMonth();
706 701
707 showView(mMonthView, full ); 702 showView(mMonthView, full );
708 mMonthView->setKeyBFocus(); 703 mMonthView->setKeyBFocus();
704 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
709 705
710} 706}
711 707
712void KOViewManager::showTodoView() 708void KOViewManager::showTodoView()
713{ 709{
714 //mFlagShowNextxDays = false; 710 //mFlagShowNextxDays = false;
715 if ( !mTodoView ) { 711 if ( !mTodoView ) {
716 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 712 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
717 "KOViewManager::TodoView" ); 713 "KOViewManager::TodoView" );
718 714
719 addView( mTodoView ); 715 addView( mTodoView );
720 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 716 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
721 717
722 // SIGNALS/SLOTS FOR TODO VIEW 718 // SIGNALS/SLOTS FOR TODO VIEW
723 connect( mTodoView, SIGNAL( newTodoSignal() ), 719 connect( mTodoView, SIGNAL( newTodoSignal() ),
724 mMainView, SLOT( newTodo() ) ); 720 mMainView, SLOT( newTodo() ) );
725 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ), 721 connect( mTodoView, SIGNAL( newSubTodoSignal( Todo * ) ),
726 mMainView, SLOT( newSubTodo( Todo *) ) ); 722 mMainView, SLOT( newSubTodo( Todo *) ) );
727 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ), 723 connect( mTodoView, SIGNAL( showTodoSignal( Todo *) ),
728 mMainView, SLOT( showTodo( Todo * ) ) ); 724 mMainView, SLOT( showTodo( Todo * ) ) );
729 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ), 725 connect( mTodoView, SIGNAL( editTodoSignal( Todo * ) ),
730 mMainView, SLOT( editTodo( Todo * ) ) ); 726 mMainView, SLOT( editTodo( Todo * ) ) );
731 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ), 727 connect( mTodoView, SIGNAL( deleteTodoSignal( Todo * ) ),
732 mMainView, SLOT( deleteTodo( Todo * ) ) ); 728 mMainView, SLOT( deleteTodo( Todo * ) ) );
@@ -740,65 +736,67 @@ void KOViewManager::showTodoView()
740 SLOT( updateConfig() ) ); 736 SLOT( updateConfig() ) );
741 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView, 737 connect( mMainView, SIGNAL( todoModified( Todo *, int )), mTodoView,
742 SLOT( updateTodo( Todo *, int ) ) ); 738 SLOT( updateTodo( Todo *, int ) ) );
743 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ), 739 connect( mTodoView, SIGNAL( todoModifiedSignal( Todo *, int ) ),
744 mMainView, SIGNAL ( todoModified( Todo *, int ) ) ); 740 mMainView, SIGNAL ( todoModified( Todo *, int ) ) );
745 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ), 741 connect( mTodoView, SIGNAL( cloneTodoSignal( Incidence * ) ),
746 mMainView, SLOT ( cloneIncidence( Incidence * ) ) ); 742 mMainView, SLOT ( cloneIncidence( Incidence * ) ) );
747 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ), 743 connect( mTodoView, SIGNAL( cancelTodoSignal( Incidence * ) ),
748 mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); 744 mMainView, SLOT ( cancelIncidence( Incidence * ) ) );
749 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ), 745 connect( mTodoView, SIGNAL( unparentTodoSignal( Todo * ) ),
750 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 746 mMainView, SLOT ( todo_unsub( Todo * ) ) );
751 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 747 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
752 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 748 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
753 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 749 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
754 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 750 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
755 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 751 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
756 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 752 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
757 KConfig *config = KOGlobals::config(); 753 KConfig *config = KOGlobals::config();
758 mTodoView->restoreLayout(config,"Todo View"); 754 mTodoView->restoreLayout(config,"Todo View");
759 mTodoView->setNavigator( mMainView->dateNavigator() ); 755 mTodoView->setNavigator( mMainView->dateNavigator() );
760 } 756 }
761 757
762 globalFlagBlockAgenda = 1; 758 globalFlagBlockAgenda = 1;
763 showView( mTodoView, true ); 759 showView( mTodoView, true );
760 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
764 761
765} 762}
766 763
767void KOViewManager::showJournalView() 764void KOViewManager::showJournalView()
768{ 765{
769 //mFlagShowNextxDays = false; 766 //mFlagShowNextxDays = false;
770 if (!mJournalView) { 767 if (!mJournalView) {
771 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 768 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
772 "KOViewManager::JournalView"); 769 "KOViewManager::JournalView");
773 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 770 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
774 SLOT( updateConfig() ) ); 771 SLOT( updateConfig() ) );
775 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 772 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
776 addView(mJournalView); 773 addView(mJournalView);
777 } 774 }
778 775
779 showView(mJournalView); 776 showView(mJournalView);
780 mMainView->dateNavigator()->selectDates( 1 ); 777 mMainView->dateNavigator()->selectDates( 1 );
778 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
781} 779}
782 780
783void KOViewManager::showTimeSpanView() 781void KOViewManager::showTimeSpanView()
784{ 782{
785 //mFlagShowNextxDays = false; 783 //mFlagShowNextxDays = false;
786 if (!mTimeSpanView) { 784 if (!mTimeSpanView) {
787 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 785 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
788 "KOViewManager::TimeSpanView"); 786 "KOViewManager::TimeSpanView");
789 addView(mTimeSpanView); 787 addView(mTimeSpanView);
790 788
791 mTimeSpanView->readSettings(); 789 mTimeSpanView->readSettings();
792 } 790 }
793 791
794 showView(mTimeSpanView); 792 showView(mTimeSpanView);
795} 793}
796 794
797Incidence *KOViewManager::currentSelection() 795Incidence *KOViewManager::currentSelection()
798{ 796{
799 if (!mCurrentView) return 0; 797 if (!mCurrentView) return 0;
800 if ( mCurrentView == mListView ) { 798 if ( mCurrentView == mListView ) {
801 if ( mListView->currentItem() ) 799 if ( mListView->currentItem() )
802 return mListView->currentItem(); 800 return mListView->currentItem();
803 } 801 }
804 return mCurrentView->selectedIncidences().first(); 802 return mCurrentView->selectedIncidences().first();