summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (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
@@ -368,10 +368,9 @@ void CalendarView::init()
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;
@@ -445,7 +444,9 @@ void CalendarView::init()
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" );
@@ -468,6 +469,7 @@ void CalendarView::init()
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 ) {
@@ -642,10 +644,33 @@ CalendarView::~CalendarView()
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();
@@ -2467,27 +2492,9 @@ void 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();
@@ -2577,6 +2584,7 @@ void CalendarView::updateTodoViews()
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();
@@ -2844,7 +2852,9 @@ void CalendarView::beamFilteredCalendar()
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" );
@@ -2856,7 +2866,7 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
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);
@@ -2880,7 +2890,7 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel )
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();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index be18e8f..c89bbf7 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -30,6 +30,7 @@
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
@@ -492,6 +493,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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();
@@ -522,6 +524,8 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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
@@ -529,10 +533,9 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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;
@@ -553,7 +556,6 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
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;
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 7b307f7..bd191d8 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -468,6 +468,7 @@ void KOViewManager::showListView()
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 )
@@ -535,6 +536,7 @@ void KOViewManager::showAgendaView( bool fullScreen )
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()
@@ -551,6 +553,7 @@ void KOViewManager::showDayView()
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
@@ -568,6 +571,7 @@ void KOViewManager::showWorkWeekView()
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
@@ -586,6 +590,7 @@ void KOViewManager::showWeekView()
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()
@@ -602,6 +607,7 @@ void KOViewManager::showNextXView()
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{
@@ -695,6 +701,7 @@ void KOViewManager::showMonthViewWeek()
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 )
@@ -727,6 +734,7 @@ void KOViewManager::showMonthView()
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
@@ -784,6 +792,7 @@ void KOViewManager::showTodoView()
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
@@ -803,6 +812,7 @@ void KOViewManager::showJournalView()
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()