-rw-r--r-- | korganizer/calendarview.cpp | 60 | ||||
-rw-r--r-- | korganizer/calendarview.h | 8 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 10 |
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 @@ -369,8 +369,7 @@ void CalendarView::init() mViewerCallerIsSearchDialog = false; mBlockShowDates = false; - beamDialog = new KOBeamPrefs(); + mDatePickerMode = 0; mCurrentSyncDevice = ""; - writeLocale(); mViewManager = new KOViewManager( this ); mDialogManager = new KODialogManager( this ); @@ -446,5 +445,7 @@ void CalendarView::init() mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); //QBoxLayout * leftFrameLayout; + mDateScrollBar = new QScrollBar ( 0, 364, 1,30, 200,QScrollBar::Horizontal, this ); topLayout->addWidget( mMainFrame ); + topLayout->addWidget( mDateScrollBar ); //mainBoxLayout->addWidget (mLeftFrame); mDateNavigator = new DateNavigatorContainer( mLeftFrame, @@ -469,4 +470,5 @@ void CalendarView::init() connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateView()) ); connect( mCalEditView, SIGNAL( needsUpdate() ),this, SLOT( updateUnmanagedViews()) ); + connect( mDateScrollBar, SIGNAL( valueChanged ( int ) ),this, SLOT( scrollBarValue( int )) ); mTodoList->setNavigator( mNavigator ); #if 0 @@ -643,8 +645,31 @@ CalendarView::~CalendarView() delete mStorage; delete mDateFrame ; - delete beamDialog; delete mEventViewerDialog; //kdDebug() << "~CalendarView() done" << endl; } +void CalendarView::setScrollBarStep(int val ) +{ + mDateScrollBar->setLineStep ( val ); +} +void CalendarView::scrollBarValue(int val ) +{ + static bool block = false; + if ( block ) return; + block = true; + val = val/mDateScrollBar->lineStep ()*mDateScrollBar->lineStep(); + //qDebug("VAL %d ",val ); + int count = mNavigator->selectedDates().count(); + int year = mNavigator->selectedDates().first().year(); + int day = mNavigator->selectedDates().first().dayOfYear(); + if ( val == day -1 ) { + block = false; + return; + } + QDate d ( year,1,1 ); + mNavigator->selectDates( d.addDays( val ), count ); + block = false; + +} + void CalendarView::checkAlarms() { @@ -2468,25 +2493,7 @@ void CalendarView::goPreviousMonth() mNavigator->selectPreviousMonth(); } -void CalendarView::writeLocale() -{ - //KPimGlobalPrefs::instance()->setGlobalConfig(); -#if 0 - KGlobal::locale()->setHore24Format( !KOPrefs::instance()->mPreferredTime ); - KGlobal::locale()->setWeekStartMonday( !KOPrefs::instance()->mWeekStartsOnSunday ); - KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)KOPrefs::instance()->mPreferredDate ); - KGlobal::locale()->setLanguage( KOPrefs::instance()->mPreferredLanguage ); - QString dummy = KOPrefs::instance()->mUserDateFormatLong; - KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); - dummy = KOPrefs::instance()->mUserDateFormatShort; - KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); - KGlobal::locale()->setDaylightSaving( KOPrefs::instance()->mUseDaylightsaving, - KOPrefs::instance()->mDaylightsavingStart, - KOPrefs::instance()->mDaylightsavingEnd ); - KGlobal::locale()->setTimezone( KPimGlobalPrefs::instance()->mTimeZoneId ); -#endif -} + void CalendarView::updateConfig() { - writeLocale(); if ( KOPrefs::instance()->mUseAppColors ) QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); @@ -2578,4 +2585,5 @@ void CalendarView::updateTodoViews() void CalendarView::updateView(const QDate &start, const QDate &end) { + mDateScrollBar->setValue( start.dayOfYear()-1); mTodoList->updateView(); mViewManager->updateView(start, end); @@ -2845,5 +2853,7 @@ void CalendarView::beamFilteredCalendar() void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) { - if ( beamDialog->exec () == QDialog::Rejected ) + + KOBeamPrefs beamDialog; + if ( beamDialog.exec () == QDialog::Rejected ) return; #ifdef DESKTOP_VERSION @@ -2857,5 +2867,5 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) QString description = "\n"; CalendarLocal* cal = new CalendarLocal(); - if ( beamDialog->beamLocal() ) + if ( beamDialog.beamLocal() ) cal->setLocalTime(); else @@ -2881,5 +2891,5 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) incidence = delSel.next(); } - if ( beamDialog->beamVcal() ) { + if ( beamDialog.beamVcal() ) { fn += ".vcs"; FileStorage storage( cal, fn, new VCalFormat ); diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index be18e8f..c89bbf7 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -31,4 +31,5 @@ #include <qvbox.h> #include <qmap.h> +#include <qscrollbar.h> #ifndef DESKTOP_VERSION #include <qtopia/ir.h> @@ -493,4 +494,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser protected slots: void resetFocus(); + void scrollBarValue(int); void slotViewerClosed(); void timerAlarm(); @@ -523,4 +525,6 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser //Attendee* getYourAttendee(Event *event); void setBlockShowDates( bool b ) { mBlockShowDates = b ;} + void setScrollBarStep(int val ); + protected: void schedule(Scheduler::Method, Incidence *incidence = 0); @@ -530,8 +534,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void showEventEditor(); void showTodoEditor(); - void writeLocale(); Todo *selectedTodo(); - private: + QScrollBar * mDateScrollBar; QDateTime mNextAlarmDateTime; bool mViewerCallerIsSearchDialog; @@ -554,5 +557,4 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser QString mCurrentSyncDevice; QString mCurrentSyncName; - KOBeamPrefs* beamDialog; void init(); int mDatePickerMode; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 7b307f7..bd191d8 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -469,4 +469,5 @@ void KOViewManager::showListView() //mFlagShowNextxDays = temp; KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; + mMainView->setScrollBarStep( 7 ); } @@ -536,4 +537,5 @@ void KOViewManager::showAgendaView( bool fullScreen ) showView( mAgendaView, full); KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; + mMainView->setScrollBarStep( 1 ); } @@ -552,4 +554,5 @@ void KOViewManager::showDayView() mMainView->dateNavigator()->selectDates( 1 ); mCurrentAgendaView = 1 ; + mMainView->setScrollBarStep( 1 ); } @@ -569,4 +572,5 @@ void KOViewManager::showWorkWeekView() mMainView->dateNavigator()->selectWorkWeek(); mCurrentAgendaView = 5 ; + mMainView->setScrollBarStep( 1 ); } @@ -587,4 +591,5 @@ void KOViewManager::showWeekView() mMainView->dateNavigator()->selectWeek(); mCurrentAgendaView = 7 ; + mMainView->setScrollBarStep( 1 ); } @@ -603,4 +608,5 @@ void KOViewManager::showNextXView() mCurrentAgendaView = 3 ; KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; + mMainView->setScrollBarStep( KOPrefs::instance()->mNextXDays ); } bool KOViewManager::showsNextDays() @@ -696,4 +702,5 @@ void KOViewManager::showMonthViewWeek() mMonthView->setKeyBFocus(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; + mMainView->setScrollBarStep( 7 ); } @@ -728,4 +735,5 @@ void KOViewManager::showMonthView() mMonthView->setKeyBFocus(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; + mMainView->setScrollBarStep( 7 ); } @@ -785,4 +793,5 @@ void KOViewManager::showTodoView() showView( mTodoView, true ); KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; + mMainView->setScrollBarStep( 7 ); } @@ -804,4 +813,5 @@ void KOViewManager::showJournalView() mMainView->dateNavigator()->selectDates( 1 ); KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; + mMainView->setScrollBarStep( 1 ); } |