summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp60
-rw-r--r--korganizer/calendarview.h8
-rw-r--r--korganizer/koviewmanager.cpp10
3 files changed, 50 insertions, 28 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 697093e..776cdd3 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -355,36 +355,35 @@ CalendarView::CalendarView( Calendar *calendar,
355 : CalendarViewBase( parent, name ), 355 : CalendarViewBase( parent, name ),
356 mCalendar( calendar ), 356 mCalendar( calendar ),
357 mResourceManager( 0 ) 357 mResourceManager( 0 )
358{ 358{
359 359
360 mEventEditor = 0; 360 mEventEditor = 0;
361 mTodoEditor = 0; 361 mTodoEditor = 0;
362 init(); 362 init();
363} 363}
364 364
365void CalendarView::init() 365void CalendarView::init()
366{ 366{
367 mNextAlarmDateTime = QDateTime::currentDateTime(); 367 mNextAlarmDateTime = QDateTime::currentDateTime();
368 setFocusPolicy ( NoFocus ); 368 setFocusPolicy ( NoFocus );
369 mViewerCallerIsSearchDialog = false; 369 mViewerCallerIsSearchDialog = false;
370 mBlockShowDates = false; 370 mBlockShowDates = false;
371 beamDialog = new KOBeamPrefs(); 371
372 mDatePickerMode = 0; 372 mDatePickerMode = 0;
373 mCurrentSyncDevice = ""; 373 mCurrentSyncDevice = "";
374 writeLocale();
375 mViewManager = new KOViewManager( this ); 374 mViewManager = new KOViewManager( this );
376 mDialogManager = new KODialogManager( this ); 375 mDialogManager = new KODialogManager( this );
377 mEventViewerDialog = 0; 376 mEventViewerDialog = 0;
378 mModified = false; 377 mModified = false;
379 mReadOnly = false; 378 mReadOnly = false;
380 mSelectedIncidence = 0; 379 mSelectedIncidence = 0;
381 mCalPrinter = 0; 380 mCalPrinter = 0;
382 mFilters.setAutoDelete(true); 381 mFilters.setAutoDelete(true);
383 382
384 mCalendar->registerObserver( this ); 383 mCalendar->registerObserver( this );
385 // TODO: Make sure that view is updated, when calendar is changed. 384 // TODO: Make sure that view is updated, when calendar is changed.
386 385
387 mStorage = new FileStorage( mCalendar ); 386 mStorage = new FileStorage( mCalendar );
388 mNavigator = new DateNavigator( this, "datevav", mViewManager ); 387 mNavigator = new DateNavigator( this, "datevav", mViewManager );
389 388
390 QBoxLayout *topLayout = (QBoxLayout*)layout(); 389 QBoxLayout *topLayout = (QBoxLayout*)layout();
@@ -432,55 +431,58 @@ void CalendarView::init()
432 //mainBoxLayout = new QVBoxLayout(mainBox); 431 //mainBoxLayout = new QVBoxLayout(mainBox);
433 //leftFrameLayout = new QHBoxLayout(leftFrame ); 432 //leftFrameLayout = new QHBoxLayout(leftFrame );
434 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); 433 mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this );
435 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 434 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
436 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; 435 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);;
437 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 436 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
438 } else { 437 } else {
439 //mainBoxLayout = new QHBoxLayout(mainBox); 438 //mainBoxLayout = new QHBoxLayout(mainBox);
440 //leftFrameLayout = new QVBoxLayout(leftFrame ); 439 //leftFrameLayout = new QVBoxLayout(leftFrame );
441 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); 440 mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this);
442 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); 441 mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left);
443 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); 442 mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame);
444 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); 443 mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up );
445 } 444 }
446 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); 445 mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) );
447 //QBoxLayout * leftFrameLayout; 446 //QBoxLayout * leftFrameLayout;
447 mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this );
448 topLayout->addWidget( mMainFrame ); 448 topLayout->addWidget( mMainFrame );
449 topLayout->addWidget( mDateScrollBar );
449 //mainBoxLayout->addWidget (mLeftFrame); 450 //mainBoxLayout->addWidget (mLeftFrame);
450 mDateNavigator = new DateNavigatorContainer( mLeftFrame, 451 mDateNavigator = new DateNavigatorContainer( mLeftFrame,
451 "CalendarView::DateNavigator" ); 452 "CalendarView::DateNavigator" );
452#if 0 453#if 0
453 // FIXME 454 // FIXME
454 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, 455 mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE,
455 "CalendarView::DateNavigator", QDate::currentDate()); 456 "CalendarView::DateNavigator", QDate::currentDate());
456#endif 457#endif
457 // mDateNavigator->blockSignals( true ); 458 // mDateNavigator->blockSignals( true );
458 //leftFrameLayout->addWidget( mDateNavigator ); 459 //leftFrameLayout->addWidget( mDateNavigator );
459 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); 460 mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall");
460 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); 461 mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView");
461 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); 462 mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView");
462 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) ); 463 connect( mCalEditView, SIGNAL( calendarEnabled (int,bool) ),mCalendar, SLOT( setCalendarEnabled(int,bool)) );
463 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); 464 connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) );
464 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); 465 connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) );
465 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); 466 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) );
466 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); 467 connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) );
467 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 468 connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) );
468 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 469 connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) );
469 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); 470 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) );
470 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); 471 connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) );
472 connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) );
471 mTodoList->setNavigator( mNavigator ); 473 mTodoList->setNavigator( mNavigator );
472#if 0 474#if 0
473 if ( QApplication::desktop()->width() < 480 ) { 475 if ( QApplication::desktop()->width() < 480 ) {
474 leftFrameLayout->addWidget(mFilterView); 476 leftFrameLayout->addWidget(mFilterView);
475 leftFrameLayout->addWidget(mTodoList, 2 ); 477 leftFrameLayout->addWidget(mTodoList, 2 );
476 478
477 } else { 479 } else {
478 leftFrameLayout->addWidget(mTodoList,2 ); 480 leftFrameLayout->addWidget(mTodoList,2 );
479 leftFrameLayout->addWidget(mFilterView ); 481 leftFrameLayout->addWidget(mFilterView );
480 } 482 }
481#endif 483#endif
482 mFilterView->hide(); 484 mFilterView->hide();
483 mCalEditView->hide(); 485 mCalEditView->hide();
484 QWidget *rightBox = new QWidget( mMainFrame ); 486 QWidget *rightBox = new QWidget( mMainFrame );
485 //mainBoxLayout->addWidget ( rightBox, 10 ); 487 //mainBoxLayout->addWidget ( rightBox, 10 );
486 QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); 488 QBoxLayout *rightLayout = new QVBoxLayout( rightBox );
@@ -629,36 +631,59 @@ void CalendarView::init()
629//US listen for arriving address resultsets 631//US listen for arriving address resultsets
630 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), 632 connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
631 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 633 this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
632#endif 634#endif
633 mDateNavigator->setCalendar( mCalendar ); 635 mDateNavigator->setCalendar( mCalendar );
634} 636}
635 637
636 638
637CalendarView::~CalendarView() 639CalendarView::~CalendarView()
638{ 640{
639 // kdDebug() << "~CalendarView()" << endl; 641 // kdDebug() << "~CalendarView()" << endl;
640 //qDebug("CalendarView::~CalendarView() "); 642 //qDebug("CalendarView::~CalendarView() ");
641 delete mDialogManager; 643 delete mDialogManager;
642 delete mViewManager; 644 delete mViewManager;
643 delete mStorage; 645 delete mStorage;
644 delete mDateFrame ; 646 delete mDateFrame ;
645 delete beamDialog;
646 delete mEventViewerDialog; 647 delete mEventViewerDialog;
647 //kdDebug() << "~CalendarView() done" << endl; 648 //kdDebug() << "~CalendarView() done" << endl;
648} 649}
650void CalendarView::setScrollBarStep(int val )
651{
652 mDateScrollBar->setLineStep ( val );
653}
654void CalendarView::scrollBarValue(int val )
655{
656 static bool block = false;
657 if ( block ) return;
658 block = true;
659 val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep();
660 //qDebug("VAL %d ",val );
661 int count = mNavigator->selectedDates().count();
662 int year = mNavigator->selectedDates().first().year();
663 int day = mNavigator->selectedDates().first().dayOfYear();
664 if ( val == day -1 ) {
665 block = false;
666 return;
667 }
668 QDate d ( year,1,1 );
669 mNavigator->selectDates( d.addDays( val ), count );
670 block = false;
671
672}
673
649void CalendarView::checkAlarms() 674void CalendarView::checkAlarms()
650{ 675{
651 KConfig *config = KOGlobals::config(); 676 KConfig *config = KOGlobals::config();
652 config->setGroup( "AppRun" ); 677 config->setGroup( "AppRun" );
653 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); 678 QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
654 int daysto = dt.daysTo( QDate::currentDate() ); 679 int daysto = dt.daysTo( QDate::currentDate() );
655 int days = config->readNumEntry( "LatestProgramStopDays" , daysto); 680 int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
656 dt = dt.addDays( days ); 681 dt = dt.addDays( days );
657 int secto = dt.secsTo( QDateTime::currentDateTime() ); 682 int secto = dt.secsTo( QDateTime::currentDateTime() );
658 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; 683 int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
659 //qDebug("KO: Reading program stop %d ", secs); 684 //qDebug("KO: Reading program stop %d ", secs);
660 //secs -= ( 3600 * 24*3 ); // debug only 685 //secs -= ( 3600 * 24*3 ); // debug only
661 QDateTime latest = dt.addSecs ( secs ); 686 QDateTime latest = dt.addSecs ( secs );
662 qDebug("KO: Last termination on %s ", latest.toString().latin1()); 687 qDebug("KO: Last termination on %s ", latest.toString().latin1());
663 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); 688 //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
664 QPtrList<Incidence> el = mCalendar->rawIncidences(); 689 QPtrList<Incidence> el = mCalendar->rawIncidences();
@@ -2454,53 +2479,35 @@ void CalendarView::goNext()
2454 mNavigator->selectNext(); 2479 mNavigator->selectNext();
2455} 2480}
2456 2481
2457void CalendarView::goPrevious() 2482void CalendarView::goPrevious()
2458{ 2483{
2459 mNavigator->selectPrevious(); 2484 mNavigator->selectPrevious();
2460} 2485}
2461void CalendarView::goNextMonth() 2486void CalendarView::goNextMonth()
2462{ 2487{
2463 mNavigator->selectNextMonth(); 2488 mNavigator->selectNextMonth();
2464} 2489}
2465 2490
2466void CalendarView::goPreviousMonth() 2491void CalendarView::goPreviousMonth()
2467{ 2492{
2468 mNavigator->selectPreviousMonth(); 2493 mNavigator->selectPreviousMonth();
2469} 2494}
2470void CalendarView::writeLocale() 2495
2471{
2472 //KPimGlobalPrefs::instance()->setGlobalConfig();
2473#if 0
2474 KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime );
2475 KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday );
2476 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate );
2477 KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage );
2478 QString dummy = KOPrefs::instance()->mUserDateFormatLong;
2479 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
2480 dummy = KOPrefs::instance()->mUserDateFormatShort;
2481 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
2482 KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving,
2483 KOPrefs::instance()->mDaylightsavingStart,
2484 KOPrefs::instance()->mDaylightsavingEnd );
2485 KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId );
2486#endif
2487}
2488void CalendarView::updateConfig() 2496void CalendarView::updateConfig()
2489{ 2497{
2490 writeLocale();
2491 if ( KOPrefs::instance()->mUseAppColors ) 2498 if ( KOPrefs::instance()->mUseAppColors )
2492 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 2499 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
2493 emit configChanged(); 2500 emit configChanged();
2494 mTodoList->updateConfig(); 2501 mTodoList->updateConfig();
2495 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); 2502 // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont);
2496 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2503 mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2497 // To make the "fill window" configurations work 2504 // To make the "fill window" configurations work
2498 //mViewManager->raiseCurrentView(); 2505 //mViewManager->raiseCurrentView();
2499} 2506}
2500 2507
2501 2508
2502void CalendarView::eventChanged(Event *event) 2509void CalendarView::eventChanged(Event *event)
2503{ 2510{
2504 changeEventDisplay(event,KOGlobals::EVENTEDITED); 2511 changeEventDisplay(event,KOGlobals::EVENTEDITED);
2505 //updateUnmanagedViews(); 2512 //updateUnmanagedViews();
2506} 2513}
@@ -2564,32 +2571,33 @@ void CalendarView::changeEventDisplay(Event *which, int action)
2564 } else { 2571 } else {
2565 mViewManager->currentView()->updateView(); 2572 mViewManager->currentView()->updateView();
2566 } 2573 }
2567} 2574}
2568 2575
2569 2576
2570void CalendarView::updateTodoViews() 2577void CalendarView::updateTodoViews()
2571{ 2578{
2572 mTodoList->updateView(); 2579 mTodoList->updateView();
2573 mViewManager->currentView()->updateView(); 2580 mViewManager->currentView()->updateView();
2574 2581
2575} 2582}
2576 2583
2577 2584
2578void CalendarView::updateView(const QDate &start, const QDate &end) 2585void CalendarView::updateView(const QDate &start, const QDate &end)
2579{ 2586{
2587 mDateScrollBar->setValue( start.dayOfYear()-1);
2580 mTodoList->updateView(); 2588 mTodoList->updateView();
2581 mViewManager->updateView(start, end); 2589 mViewManager->updateView(start, end);
2582 //mDateNavigator->updateView(); 2590 //mDateNavigator->updateView();
2583} 2591}
2584 2592
2585void CalendarView::clearAllViews() 2593void CalendarView::clearAllViews()
2586{ 2594{
2587 mTodoList->clearList(); 2595 mTodoList->clearList();
2588 mViewManager->clearAllViews(); 2596 mViewManager->clearAllViews();
2589 SearchDialog * sd = mDialogManager->getSearchDialog(); 2597 SearchDialog * sd = mDialogManager->getSearchDialog();
2590 if ( sd ) { 2598 if ( sd ) {
2591 KOListView* kol = sd->listview(); 2599 KOListView* kol = sd->listview();
2592 if ( kol ) 2600 if ( kol )
2593 kol->clearList(); 2601 kol->clearList();
2594 } 2602 }
2595} 2603}
@@ -2831,69 +2839,71 @@ void CalendarView::beamIncidence(Incidence * Inc)
2831 beamIncidenceList( delSel ); 2839 beamIncidenceList( delSel );
2832} 2840}
2833void CalendarView::beamCalendar() 2841void CalendarView::beamCalendar()
2834{ 2842{
2835 QPtrList<Incidence> delSel = mCalendar->rawIncidences(); 2843 QPtrList<Incidence> delSel = mCalendar->rawIncidences();
2836 //qDebug("beamCalendar() "); 2844 //qDebug("beamCalendar() ");
2837 beamIncidenceList( delSel ); 2845 beamIncidenceList( delSel );
2838} 2846}
2839void CalendarView::beamFilteredCalendar() 2847void CalendarView::beamFilteredCalendar()
2840{ 2848{
2841 QPtrList<Incidence> delSel = mCalendar->incidences(); 2849 QPtrList<Incidence> delSel = mCalendar->incidences();
2842 //qDebug("beamFilteredCalendar() "); 2850 //qDebug("beamFilteredCalendar() ");
2843 beamIncidenceList( delSel ); 2851 beamIncidenceList( delSel );
2844} 2852}
2845void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) 2853void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
2846{ 2854{
2847 if ( beamDialog->exec () == QDialog::Rejected ) 2855
2856 KOBeamPrefs beamDialog;
2857 if ( beamDialog.exec () == QDialog::Rejected )
2848 return; 2858 return;
2849#ifdef DESKTOP_VERSION 2859#ifdef DESKTOP_VERSION
2850 QString fn = locateLocal( "tmp", "kopibeamfile" ); 2860 QString fn = locateLocal( "tmp", "kopibeamfile" );
2851#else 2861#else
2852 QString fn = "/tmp/kopibeamfile"; 2862 QString fn = "/tmp/kopibeamfile";
2853#endif 2863#endif
2854 QString mes; 2864 QString mes;
2855 bool createbup = true; 2865 bool createbup = true;
2856 if ( createbup ) { 2866 if ( createbup ) {
2857 QString description = "\n"; 2867 QString description = "\n";
2858 CalendarLocal* cal = new CalendarLocal(); 2868 CalendarLocal* cal = new CalendarLocal();
2859 if ( beamDialog->beamLocal() ) 2869 if ( beamDialog.beamLocal() )
2860 cal->setLocalTime(); 2870 cal->setLocalTime();
2861 else 2871 else
2862 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 2872 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
2863 Incidence *incidence = delSel.first(); 2873 Incidence *incidence = delSel.first();
2864 bool addText = false; 2874 bool addText = false;
2865 if ( delSel.count() < 10 ) 2875 if ( delSel.count() < 10 )
2866 addText = true; 2876 addText = true;
2867 else { 2877 else {
2868 description.sprintf(i18n(" %d items?"),delSel.count() ); 2878 description.sprintf(i18n(" %d items?"),delSel.count() );
2869 } 2879 }
2870 while ( incidence ) { 2880 while ( incidence ) {
2871 Incidence *in = incidence->clone(); 2881 Incidence *in = incidence->clone();
2872 if ( ! in->summary().isEmpty() ) { 2882 if ( ! in->summary().isEmpty() ) {
2873 in->setDescription(""); 2883 in->setDescription("");
2874 } else { 2884 } else {
2875 in->setSummary( in->description().left(20)); 2885 in->setSummary( in->description().left(20));
2876 in->setDescription(""); 2886 in->setDescription("");
2877 } 2887 }
2878 if ( addText ) 2888 if ( addText )
2879 description += in->summary() + "\n"; 2889 description += in->summary() + "\n";
2880 cal->addIncidence( in ); 2890 cal->addIncidence( in );
2881 incidence = delSel.next(); 2891 incidence = delSel.next();
2882 } 2892 }
2883 if ( beamDialog->beamVcal() ) { 2893 if ( beamDialog.beamVcal() ) {
2884 fn += ".vcs"; 2894 fn += ".vcs";
2885 FileStorage storage( cal, fn, new VCalFormat ); 2895 FileStorage storage( cal, fn, new VCalFormat );
2886 storage.save(); 2896 storage.save();
2887 } else { 2897 } else {
2888 fn += ".ics"; 2898 fn += ".ics";
2889 FileStorage storage( cal, fn, new ICalFormat( ) ); 2899 FileStorage storage( cal, fn, new ICalFormat( ) );
2890 storage.save(); 2900 storage.save();
2891 } 2901 }
2892 delete cal; 2902 delete cal;
2893 mes = i18n("KO/Pi: Ready for beaming"); 2903 mes = i18n("KO/Pi: Ready for beaming");
2894 topLevelWidget()->setCaption(mes); 2904 topLevelWidget()->setCaption(mes);
2895 KApplication::convert2latin1( fn ); 2905 KApplication::convert2latin1( fn );
2896#ifndef DESKTOP_VERSION 2906#ifndef DESKTOP_VERSION
2897 Ir *ir = new Ir( this ); 2907 Ir *ir = new Ir( this );
2898 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 2908 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
2899 ir->send( fn, description, "text/x-vCalendar" ); 2909 ir->send( fn, description, "text/x-vCalendar" );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index be18e8f..c89bbf7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -17,32 +17,33 @@
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24#ifndef CALENDARVIEW_H 24#ifndef CALENDARVIEW_H
25#define CALENDARVIEW_H 25#define CALENDARVIEW_H
26 26
27#include <qframe.h> 27#include <qframe.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qptrlist.h> 30#include <qptrlist.h>
31#include <qvbox.h> 31#include <qvbox.h>
32#include <qmap.h> 32#include <qmap.h>
33#include <qscrollbar.h>
33#ifndef DESKTOP_VERSION 34#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 35#include <qtopia/ir.h>
35#else 36#else
36#define Ir char 37#define Ir char
37#endif 38#endif
38#include <libkcal/calendar.h> 39#include <libkcal/calendar.h>
39#include <libkcal/scheduler.h> 40#include <libkcal/scheduler.h>
40#include <libkcal/calendarresources.h> 41#include <libkcal/calendarresources.h>
41#include <libkcal/resourcecalendar.h> 42#include <libkcal/resourcecalendar.h>
42#include <KDGanttMinimizeSplitter.h> 43#include <KDGanttMinimizeSplitter.h>
43 44
44#include <korganizer/calendarviewbase.h> 45#include <korganizer/calendarviewbase.h>
45 46
46#include <ksyncmanager.h> 47#include <ksyncmanager.h>
47//#include <koprefs.h> 48//#include <koprefs.h>
48 49
@@ -479,94 +480,95 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
479 void showDatePicker() ; 480 void showDatePicker() ;
480 void showDatePickerPopup() ; 481 void showDatePickerPopup() ;
481 void moveIncidence(Incidence *) ; 482 void moveIncidence(Incidence *) ;
482 void beamIncidence(Incidence *) ; 483 void beamIncidence(Incidence *) ;
483 void beamCalendar() ; 484 void beamCalendar() ;
484 void beamFilteredCalendar() ; 485 void beamFilteredCalendar() ;
485 void beamIncidenceList(QPtrList<Incidence>) ; 486 void beamIncidenceList(QPtrList<Incidence>) ;
486 void manageCategories(); 487 void manageCategories();
487 int addCategories(); 488 int addCategories();
488 void removeCategories(); 489 void removeCategories();
489 void setSyncDevice( QString ); 490 void setSyncDevice( QString );
490 void setSyncName( QString ); 491 void setSyncName( QString );
491 void showDay( QDate ); 492 void showDay( QDate );
492 void undo_delete(); 493 void undo_delete();
493 protected slots: 494 protected slots:
494 void resetFocus(); 495 void resetFocus();
496 void scrollBarValue(int);
495 void slotViewerClosed(); 497 void slotViewerClosed();
496 void timerAlarm(); 498 void timerAlarm();
497 void suspendAlarm(); 499 void suspendAlarm();
498 void beamDone( Ir *ir ); 500 void beamDone( Ir *ir );
499 /** Select a view or adapt the current view to display the specified dates. */ 501 /** Select a view or adapt the current view to display the specified dates. */
500 void showDates( const KCal::DateList & ); 502 void showDates( const KCal::DateList & );
501 void selectWeekNum ( int ); 503 void selectWeekNum ( int );
502 504
503 public: 505 public:
504 // show a standard warning 506 // show a standard warning
505 // returns KMsgBox::yesNoCancel() 507 // returns KMsgBox::yesNoCancel()
506 int msgCalModified(); 508 int msgCalModified();
507 virtual bool sync(KSyncManager* manager, QString filename, int mode); 509 virtual bool sync(KSyncManager* manager, QString filename, int mode);
508 510
509 virtual bool syncExternal(KSyncManager* manager, QString resource); 511 virtual bool syncExternal(KSyncManager* manager, QString resource);
510 virtual void removeSyncInfo( QString syncProfile); 512 virtual void removeSyncInfo( QString syncProfile);
511 void setSyncManager(KSyncManager* manager); 513 void setSyncManager(KSyncManager* manager);
512 void setLoadedFileVersion(QDateTime); 514 void setLoadedFileVersion(QDateTime);
513 bool checkFileVersion(QString fn); 515 bool checkFileVersion(QString fn);
514 bool checkAllFileVersions(); 516 bool checkAllFileVersions();
515 bool checkFileChanged(QString fn); 517 bool checkFileChanged(QString fn);
516 Event* getLastSyncEvent(); 518 Event* getLastSyncEvent();
517 /** Adapt navigation units correpsonding to step size of navigation of the 519 /** Adapt navigation units correpsonding to step size of navigation of the
518 * current view. 520 * current view.
519 */ 521 */
520 void adaptNavigationUnits(); 522 void adaptNavigationUnits();
521 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode ); 523 bool synchronizeCalendar( Calendar* local, Calendar* remote, int mode );
522 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); 524 int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false );
523 //Attendee* getYourAttendee(Event *event); 525 //Attendee* getYourAttendee(Event *event);
524 void setBlockShowDates( bool b ) { mBlockShowDates = b ;} 526 void setBlockShowDates( bool b ) { mBlockShowDates = b ;}
527 void setScrollBarStep(int val );
528
525 protected: 529 protected:
526 void schedule(Scheduler::Method, Incidence *incidence = 0); 530 void schedule(Scheduler::Method, Incidence *incidence = 0);
527 531
528 // returns KMsgBox::OKCandel() 532 // returns KMsgBox::OKCandel()
529 int msgItemDelete(const QString name); 533 int msgItemDelete(const QString name);
530 void showEventEditor(); 534 void showEventEditor();
531 void showTodoEditor(); 535 void showTodoEditor();
532 void writeLocale();
533 Todo *selectedTodo(); 536 Todo *selectedTodo();
534
535 private: 537 private:
538 QScrollBar * mDateScrollBar;
536 QDateTime mNextAlarmDateTime; 539 QDateTime mNextAlarmDateTime;
537 bool mViewerCallerIsSearchDialog; 540 bool mViewerCallerIsSearchDialog;
538 bool mBlockShowDates; 541 bool mBlockShowDates;
539 KSyncManager* mSyncManager; 542 KSyncManager* mSyncManager;
540 AlarmDialog * mAlarmDialog; 543 AlarmDialog * mAlarmDialog;
541 QString mAlarmNotification; 544 QString mAlarmNotification;
542 QString mSuspendAlarmNotification; 545 QString mSuspendAlarmNotification;
543 QTimer* mSuspendTimer; 546 QTimer* mSuspendTimer;
544 QTimer* mAlarmTimer; 547 QTimer* mAlarmTimer;
545 QTimer* mRecheckAlarmTimer; 548 QTimer* mRecheckAlarmTimer;
546 void computeAlarm( QString ); 549 void computeAlarm( QString );
547 void startAlarm( QString, QString ); 550 void startAlarm( QString, QString );
548 void setSyncEventsReadOnly(); 551 void setSyncEventsReadOnly();
549 552
550 QDateTime loadedFileVersion; 553 QDateTime loadedFileVersion;
551 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete ); 554 void checkExternSyncEvent( QPtrList<Event> lastSync , Incidence* toDelete );
552 void checkExternalId( Incidence * inc ); 555 void checkExternalId( Incidence * inc );
553 int mGlobalSyncMode; 556 int mGlobalSyncMode;
554 QString mCurrentSyncDevice; 557 QString mCurrentSyncDevice;
555 QString mCurrentSyncName; 558 QString mCurrentSyncName;
556 KOBeamPrefs* beamDialog;
557 void init(); 559 void init();
558 int mDatePickerMode; 560 int mDatePickerMode;
559 bool mFlagEditDescription; 561 bool mFlagEditDescription;
560 QDateTime mLastCalendarSync; 562 QDateTime mLastCalendarSync;
561 void createPrinter(); 563 void createPrinter();
562 564
563 void calendarModified( bool, Calendar * ); 565 void calendarModified( bool, Calendar * );
564 566
565 CalPrinter *mCalPrinter; 567 CalPrinter *mCalPrinter;
566 568
567 QSplitter *mPanner; 569 QSplitter *mPanner;
568 QSplitter *mLeftSplitter; 570 QSplitter *mLeftSplitter;
569 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame; 571 KDGanttMinimizeSplitter *mLeftFrame, *mMainFrame;
570 QWidgetStack *mRightFrame; 572 QWidgetStack *mRightFrame;
571 573
572 KDatePicker* mDatePicker; 574 KDatePicker* mDatePicker;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 7b307f7..bd191d8 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -455,32 +455,33 @@ void KOViewManager::showListView()
455 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 455 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
456 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 456 connect( mListView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
457 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 457 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
458 } 458 }
459 // bool temp = mFlagShowNextxDays; 459 // bool temp = mFlagShowNextxDays;
460 //globalFlagBlockPainting = true; 460 //globalFlagBlockPainting = true;
461 globalFlagBlockAgenda = 1; 461 globalFlagBlockAgenda = 1;
462 if ( KOPrefs::instance()->mListViewMonthTimespan ) { 462 if ( KOPrefs::instance()->mListViewMonthTimespan ) {
463 mMainView->setBlockShowDates( true ); 463 mMainView->setBlockShowDates( true );
464 mMainView->dateNavigator()->selectMonth(); 464 mMainView->dateNavigator()->selectMonth();
465 mMainView->setBlockShowDates( false ); 465 mMainView->setBlockShowDates( false );
466 } 466 }
467 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 467 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
468 showView(mListView, KOPrefs::instance()->mFullViewTodo); 468 showView(mListView, KOPrefs::instance()->mFullViewTodo);
469 //mFlagShowNextxDays = temp; 469 //mFlagShowNextxDays = temp;
470 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; 470 KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW;
471 mMainView->setScrollBarStep( 7 );
471} 472}
472 473
473void KOViewManager::showAgendaView( bool fullScreen ) 474void KOViewManager::showAgendaView( bool fullScreen )
474{ 475{
475 476
476 mMainView->dialogManager()->hideSearchDialog(); 477 mMainView->dialogManager()->hideSearchDialog();
477 // qDebug("KOViewManager::showAgendaView "); 478 // qDebug("KOViewManager::showAgendaView ");
478 bool full; 479 bool full;
479 full = fullScreen; 480 full = fullScreen;
480 if (!mAgendaView) { 481 if (!mAgendaView) {
481 full = false; 482 full = false;
482 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView"); 483 mAgendaView = new KOAgendaView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::AgendaView");
483 addView(mAgendaView); 484 addView(mAgendaView);
484#ifndef DESKTOP_VERSION 485#ifndef DESKTOP_VERSION
485 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold ); 486 QPEApplication::setStylusOperation( mAgendaView, QPEApplication::RightOnHold );
486#endif 487#endif
@@ -522,99 +523,104 @@ void KOViewManager::showAgendaView( bool fullScreen )
522 SLOT( updateTodo( Todo *, int ) ) ); 523 SLOT( updateTodo( Todo *, int ) ) );
523 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )), 524 connect( mAgendaView,SIGNAL( todoMoved( Todo *, int )),
524 mMainView, SIGNAL( todoModified( Todo *, int ))); 525 mMainView, SIGNAL( todoModified( Todo *, int )));
525 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ), 526 connect( mAgendaView, SIGNAL( moveIncidenceSignal( Incidence * ) ),
526 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 527 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
527 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ), 528 connect( mAgendaView, SIGNAL( beamIncidenceSignal( Incidence * ) ),
528 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 529 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
529 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ), 530 connect( mAgendaView, SIGNAL( selectWeekNum( int ) ),
530 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) ); 531 mMainView->dateNavigator(), SLOT ( selectWeek( int ) ) );
531 mAgendaView->readSettings(); 532 mAgendaView->readSettings();
532 mAgendaView->updateConfig(); 533 mAgendaView->updateConfig();
533 } 534 }
534 535
535 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 536 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
536 showView( mAgendaView, full); 537 showView( mAgendaView, full);
537 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; 538 KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW;
539 mMainView->setScrollBarStep( 1 );
538} 540}
539 541
540void KOViewManager::showDayView() 542void KOViewManager::showDayView()
541{ 543{
542 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 544 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
543 mFlagShowNextxDays = false; 545 mFlagShowNextxDays = false;
544 globalFlagBlockLabel = 1; 546 globalFlagBlockLabel = 1;
545 globalFlagBlockAgenda = 1; 547 globalFlagBlockAgenda = 1;
546 if ( mCurrentAgendaView != 1 ) 548 if ( mCurrentAgendaView != 1 )
547 mCurrentAgendaView = -1; 549 mCurrentAgendaView = -1;
548 showAgendaView(); 550 showAgendaView();
549 qApp->processEvents(); 551 qApp->processEvents();
550 globalFlagBlockAgenda = 2; 552 globalFlagBlockAgenda = 2;
551 globalFlagBlockLabel = 0; 553 globalFlagBlockLabel = 0;
552 mMainView->dateNavigator()->selectDates( 1 ); 554 mMainView->dateNavigator()->selectDates( 1 );
553 mCurrentAgendaView = 1 ; 555 mCurrentAgendaView = 1 ;
556 mMainView->setScrollBarStep( 1 );
554 557
555} 558}
556 559
557void KOViewManager::showWorkWeekView() 560void KOViewManager::showWorkWeekView()
558{ 561{
559 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 562 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
560 mFlagShowNextxDays = false; 563 mFlagShowNextxDays = false;
561 globalFlagBlockAgenda = 1; 564 globalFlagBlockAgenda = 1;
562 globalFlagBlockLabel = 1; 565 globalFlagBlockLabel = 1;
563 if ( mCurrentAgendaView != 5 ) 566 if ( mCurrentAgendaView != 5 )
564 mCurrentAgendaView = -1; 567 mCurrentAgendaView = -1;
565 showAgendaView(); 568 showAgendaView();
566 qApp->processEvents(); 569 qApp->processEvents();
567 globalFlagBlockAgenda = 2; 570 globalFlagBlockAgenda = 2;
568 globalFlagBlockLabel = 0; 571 globalFlagBlockLabel = 0;
569 mMainView->dateNavigator()->selectWorkWeek(); 572 mMainView->dateNavigator()->selectWorkWeek();
570 mCurrentAgendaView = 5 ; 573 mCurrentAgendaView = 5 ;
574 mMainView->setScrollBarStep( 1 );
571 575
572} 576}
573 577
574void KOViewManager::showWeekView() 578void KOViewManager::showWeekView()
575{ 579{
576 580
577 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count(); 581 mCurrentAgendaView = mMainView->dateNavigator()->selectedDates().count();
578 mFlagShowNextxDays = false; 582 mFlagShowNextxDays = false;
579 globalFlagBlockAgenda = 1; 583 globalFlagBlockAgenda = 1;
580 globalFlagBlockLabel = 1; 584 globalFlagBlockLabel = 1;
581 if ( mCurrentAgendaView != 7 ) 585 if ( mCurrentAgendaView != 7 )
582 mCurrentAgendaView = -1; 586 mCurrentAgendaView = -1;
583 showAgendaView(); 587 showAgendaView();
584 qApp->processEvents(); 588 qApp->processEvents();
585 globalFlagBlockAgenda = 2; 589 globalFlagBlockAgenda = 2;
586 globalFlagBlockLabel = 0; 590 globalFlagBlockLabel = 0;
587 mMainView->dateNavigator()->selectWeek(); 591 mMainView->dateNavigator()->selectWeek();
588 mCurrentAgendaView = 7 ; 592 mCurrentAgendaView = 7 ;
593 mMainView->setScrollBarStep( 1 );
589} 594}
590 595
591void KOViewManager::showNextXView() 596void KOViewManager::showNextXView()
592{ 597{
593 598
594 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 599 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
595 globalFlagBlockAgenda = 1; 600 globalFlagBlockAgenda = 1;
596 if ( mCurrentAgendaView != 3 ) 601 if ( mCurrentAgendaView != 3 )
597 mCurrentAgendaView = -1; 602 mCurrentAgendaView = -1;
598 showAgendaView(KOPrefs::instance()->mFullViewMonth); 603 showAgendaView(KOPrefs::instance()->mFullViewMonth);
599 globalFlagBlockAgenda = 2; 604 globalFlagBlockAgenda = 2;
600 mMainView->dateNavigator()->selectDates( QDate::currentDate(), 605 mMainView->dateNavigator()->selectDates( QDate::currentDate(),
601 KOPrefs::instance()->mNextXDays ); 606 KOPrefs::instance()->mNextXDays );
602 mFlagShowNextxDays = true; 607 mFlagShowNextxDays = true;
603 mCurrentAgendaView = 3 ; 608 mCurrentAgendaView = 3 ;
604 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; 609 KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW;
610 mMainView->setScrollBarStep( KOPrefs::instance()->mNextXDays );
605} 611}
606bool KOViewManager::showsNextDays() 612bool KOViewManager::showsNextDays()
607{ 613{
608 return mFlagShowNextxDays; 614 return mFlagShowNextxDays;
609} 615}
610void KOViewManager::createMonthView() 616void KOViewManager::createMonthView()
611{ 617{
612if (!mMonthView) { 618if (!mMonthView) {
613 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 619 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
614 620
615 addView(mMonthView); 621 addView(mMonthView);
616 // mMonthView->show(); 622 // mMonthView->show();
617 // SIGNALS/SLOTS FOR MONTH VIEW 623 // SIGNALS/SLOTS FOR MONTH VIEW
618 624
619 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate ))); 625 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate )));
620 626
@@ -682,64 +688,66 @@ void KOViewManager::showMonthViewWeek()
682 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 688 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
683 globalFlagBlockAgenda = 1; 689 globalFlagBlockAgenda = 1;
684 bool full = true; 690 bool full = true;
685 if ( mCurrentView == mMonthView) 691 if ( mCurrentView == mMonthView)
686 full = mMainView->leftFrame()->isVisible(); 692 full = mMainView->leftFrame()->isVisible();
687 if ( !KOPrefs::instance()->mMonthViewWeek ) { 693 if ( !KOPrefs::instance()->mMonthViewWeek ) {
688 mMonthView->switchView(); 694 mMonthView->switchView();
689 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 695 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
690 full = false; 696 full = false;
691 else 697 else
692 full = true; 698 full = true;
693 } 699 }
694 mMainView->dateNavigator()->selectWeek(); 700 mMainView->dateNavigator()->selectWeek();
695 showView(mMonthView, full ); 701 showView(mMonthView, full );
696 mMonthView->setKeyBFocus(); 702 mMonthView->setKeyBFocus();
697 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; 703 KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ;
704 mMainView->setScrollBarStep( 7 );
698} 705}
699 706
700void KOViewManager::showMonth( const QDate & date ) 707void KOViewManager::showMonth( const QDate & date )
701{ 708{
702 mMainView->dateNavigator()->blockSignals( true ); 709 mMainView->dateNavigator()->blockSignals( true );
703 mMainView->dateNavigator()->selectDate( date ); 710 mMainView->dateNavigator()->selectDate( date );
704 mMainView->dateNavigator()->blockSignals( false ); 711 mMainView->dateNavigator()->blockSignals( false );
705 showMonthView(); 712 showMonthView();
706} 713}
707void KOViewManager::showMonthView() 714void KOViewManager::showMonthView()
708 { 715 {
709 716
710 createMonthView(); 717 createMonthView();
711 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; 718 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
712 globalFlagBlockAgenda = 1; 719 globalFlagBlockAgenda = 1;
713 //mFlagShowNextxDays = false; 720 //mFlagShowNextxDays = false;
714 bool full = true; 721 bool full = true;
715 if ( mCurrentView == mMonthView) 722 if ( mCurrentView == mMonthView)
716 full = mMainView->leftFrame()->isVisible(); 723 full = mMainView->leftFrame()->isVisible();
717 // if(mMonthView == mCurrentView) return; 724 // if(mMonthView == mCurrentView) return;
718 if ( KOPrefs::instance()->mMonthViewWeek ) { 725 if ( KOPrefs::instance()->mMonthViewWeek ) {
719 mMonthView->switchView(); 726 mMonthView->switchView();
720 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() ) 727 if ( KOPrefs::instance()->mViewChangeHoldNonFullscreen && mMainView->leftFrame()->isVisible() )
721 full = false; 728 full = false;
722 else 729 else
723 full = true; 730 full = true;
724 } 731 }
725 mMainView->dateNavigator()->selectMonth(); 732 mMainView->dateNavigator()->selectMonth();
726 733
727 showView(mMonthView, full ); 734 showView(mMonthView, full );
728 mMonthView->setKeyBFocus(); 735 mMonthView->setKeyBFocus();
729 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; 736 KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ;
737 mMainView->setScrollBarStep( 7 );
730 738
731} 739}
732 740
733void KOViewManager::showTodoView() 741void KOViewManager::showTodoView()
734{ 742{
735 //mFlagShowNextxDays = false; 743 //mFlagShowNextxDays = false;
736 if ( !mTodoView ) { 744 if ( !mTodoView ) {
737 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(), 745 mTodoView = new KOTodoView( mMainView->calendar(), mMainView->viewStack(),
738 "KOViewManager::TodoView" ); 746 "KOViewManager::TodoView" );
739 747
740 addView( mTodoView ); 748 addView( mTodoView );
741 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold ); 749 // QPEApplication::setStylusOperation( mTodoView, QPEApplication::RightOnHold );
742 750
743 // SIGNALS/SLOTS FOR TODO VIEW 751 // SIGNALS/SLOTS FOR TODO VIEW
744 connect( mTodoView, SIGNAL( newTodoSignal() ), 752 connect( mTodoView, SIGNAL( newTodoSignal() ),
745 mMainView, SLOT( newTodo() ) ); 753 mMainView, SLOT( newTodo() ) );
@@ -771,51 +779,53 @@ void KOViewManager::showTodoView()
771 mMainView, SLOT ( todo_unsub( Todo * ) ) ); 779 mMainView, SLOT ( todo_unsub( Todo * ) ) );
772 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ), 780 connect( mTodoView, SIGNAL( reparentTodoSignal( Todo *,Todo * ) ),
773 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) ); 781 mMainView, SLOT ( todo_resub( Todo *, Todo *) ) );
774 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ), 782 connect( mTodoView, SIGNAL( moveTodoSignal( Incidence * ) ),
775 mMainView, SLOT ( moveIncidence( Incidence * ) ) ); 783 mMainView, SLOT ( moveIncidence( Incidence * ) ) );
776 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ), 784 connect( mTodoView, SIGNAL( beamTodoSignal( Incidence * ) ),
777 mMainView, SLOT ( beamIncidence( Incidence * ) ) ); 785 mMainView, SLOT ( beamIncidence( Incidence * ) ) );
778 KConfig *config = KOGlobals::config(); 786 KConfig *config = KOGlobals::config();
779 mTodoView->restoreLayout(config,"Todo View"); 787 mTodoView->restoreLayout(config,"Todo View");
780 mTodoView->setNavigator( mMainView->dateNavigator() ); 788 mTodoView->setNavigator( mMainView->dateNavigator() );
781 } 789 }
782 790
783 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; 791 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
784 globalFlagBlockAgenda = 1; 792 globalFlagBlockAgenda = 1;
785 showView( mTodoView, true ); 793 showView( mTodoView, true );
786 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; 794 KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ;
795 mMainView->setScrollBarStep( 7 );
787 796
788} 797}
789 798
790void KOViewManager::showJournalView() 799void KOViewManager::showJournalView()
791{ 800{
792 //mFlagShowNextxDays = false; 801 //mFlagShowNextxDays = false;
793 if (!mJournalView) { 802 if (!mJournalView) {
794 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(), 803 mJournalView = new KOJournalView(mMainView->calendar(),mMainView->viewStack(),
795 "KOViewManager::JournalView"); 804 "KOViewManager::JournalView");
796 connect( mMainView, SIGNAL( configChanged() ), mJournalView, 805 connect( mMainView, SIGNAL( configChanged() ), mJournalView,
797 SLOT( updateConfig() ) ); 806 SLOT( updateConfig() ) );
798 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) ); 807 connect(mJournalView, SIGNAL(deleteJournal(Journal *) ), mMainView,SLOT(deleteJournal(Journal *)) );
799 addView(mJournalView); 808 addView(mJournalView);
800 } 809 }
801 810
802 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; 811 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
803 showView(mJournalView); 812 showView(mJournalView);
804 mMainView->dateNavigator()->selectDates( 1 ); 813 mMainView->dateNavigator()->selectDates( 1 );
805 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; 814 KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ;
815 mMainView->setScrollBarStep( 1 );
806} 816}
807 817
808void KOViewManager::showTimeSpanView() 818void KOViewManager::showTimeSpanView()
809{ 819{
810 //mFlagShowNextxDays = false; 820 //mFlagShowNextxDays = false;
811 if (!mTimeSpanView) { 821 if (!mTimeSpanView) {
812 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(), 822 mTimeSpanView = new KOTimeSpanView(mMainView->calendar(),mMainView->viewStack(),
813 "KOViewManager::TimeSpanView"); 823 "KOViewManager::TimeSpanView");
814 addView(mTimeSpanView); 824 addView(mTimeSpanView);
815 825
816 mTimeSpanView->readSettings(); 826 mTimeSpanView->readSettings();
817 } 827 }
818 828
819 showView(mTimeSpanView); 829 showView(mTimeSpanView);
820} 830}
821 831