From 8954bae7bb5afc9706e37e808e9c1e237399f214 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 29 Jun 2005 20:23:04 +0000 Subject: fixxx --- 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() setFocusPolicy ( NoFocus ); mViewerCallerIsSearchDialog = false; mBlockShowDates = false; - beamDialog = new KOBeamPrefs(); + mDatePickerMode = 0; mCurrentSyncDevice = ""; - writeLocale(); mViewManager = new KOViewManager( this ); mDialogManager = new KODialogManager( this ); mEventViewerDialog = 0; @@ -445,7 +444,9 @@ 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, "CalendarView::DateNavigator" ); @@ -468,6 +469,7 @@ void CalendarView::init() connect( mCalEditView, SIGNAL( calendarAdded(int) ),this, SLOT( addCalendarId(int)) ); 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 if ( QApplication::desktop()->width() < 480 ) { @@ -642,10 +644,33 @@ CalendarView::~CalendarView() delete mViewManager; 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() { KConfig *config = KOGlobals::config(); @@ -2467,27 +2492,9 @@ 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 ); emit configChanged(); @@ -2577,6 +2584,7 @@ void CalendarView::updateTodoViews() void CalendarView::updateView(const QDate &start, const QDate &end) { + mDateScrollBar->setValue( start.dayOfYear()-1); mTodoList->updateView(); mViewManager->updateView(start, end); //mDateNavigator->updateView(); @@ -2844,7 +2852,9 @@ void CalendarView::beamFilteredCalendar() } void CalendarView::beamIncidenceList(QPtrList delSel ) { - if ( beamDialog->exec () == QDialog::Rejected ) + + KOBeamPrefs beamDialog; + if ( beamDialog.exec () == QDialog::Rejected ) return; #ifdef DESKTOP_VERSION QString fn = locateLocal( "tmp", "kopibeamfile" ); @@ -2856,7 +2866,7 @@ void CalendarView::beamIncidenceList(QPtrList delSel ) if ( createbup ) { QString description = "\n"; CalendarLocal* cal = new CalendarLocal(); - if ( beamDialog->beamLocal() ) + if ( beamDialog.beamLocal() ) cal->setLocalTime(); else cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); @@ -2880,7 +2890,7 @@ void CalendarView::beamIncidenceList(QPtrList delSel ) cal->addIncidence( in ); incidence = delSel.next(); } - if ( beamDialog->beamVcal() ) { + if ( beamDialog.beamVcal() ) { fn += ".vcs"; FileStorage storage( cal, fn, new VCalFormat ); 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 @@ #include #include #include +#include #ifndef DESKTOP_VERSION #include #else @@ -492,6 +493,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void undo_delete(); protected slots: void resetFocus(); + void scrollBarValue(int); void slotViewerClosed(); void timerAlarm(); void suspendAlarm(); @@ -522,6 +524,8 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser int takeEvent( Incidence* local, Incidence* remote, int mode, bool full = false ); //Attendee* getYourAttendee(Event *event); void setBlockShowDates( bool b ) { mBlockShowDates = b ;} + void setScrollBarStep(int val ); + protected: void schedule(Scheduler::Method, Incidence *incidence = 0); @@ -529,10 +533,9 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser int msgItemDelete(const QString name); void showEventEditor(); void showTodoEditor(); - void writeLocale(); Todo *selectedTodo(); - private: + QScrollBar * mDateScrollBar; QDateTime mNextAlarmDateTime; bool mViewerCallerIsSearchDialog; bool mBlockShowDates; @@ -553,7 +556,6 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser int mGlobalSyncMode; QString mCurrentSyncDevice; QString mCurrentSyncName; - KOBeamPrefs* beamDialog; void init(); int mDatePickerMode; 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() showView(mListView, KOPrefs::instance()->mFullViewTodo); //mFlagShowNextxDays = temp; KOPrefs::instance()->mCurrentDisplayedView = VIEW_L_VIEW; + mMainView->setScrollBarStep( 7 ); } void KOViewManager::showAgendaView( bool fullScreen ) @@ -535,6 +536,7 @@ void KOViewManager::showAgendaView( bool fullScreen ) KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; showView( mAgendaView, full); KOPrefs::instance()->mCurrentDisplayedView = VIEW_A_VIEW; + mMainView->setScrollBarStep( 1 ); } void KOViewManager::showDayView() @@ -551,6 +553,7 @@ void KOViewManager::showDayView() globalFlagBlockLabel = 0; mMainView->dateNavigator()->selectDates( 1 ); mCurrentAgendaView = 1 ; + mMainView->setScrollBarStep( 1 ); } @@ -568,6 +571,7 @@ void KOViewManager::showWorkWeekView() globalFlagBlockLabel = 0; mMainView->dateNavigator()->selectWorkWeek(); mCurrentAgendaView = 5 ; + mMainView->setScrollBarStep( 1 ); } @@ -586,6 +590,7 @@ void KOViewManager::showWeekView() globalFlagBlockLabel = 0; mMainView->dateNavigator()->selectWeek(); mCurrentAgendaView = 7 ; + mMainView->setScrollBarStep( 1 ); } void KOViewManager::showNextXView() @@ -602,6 +607,7 @@ void KOViewManager::showNextXView() mFlagShowNextxDays = true; mCurrentAgendaView = 3 ; KOPrefs::instance()->mCurrentDisplayedView = VIEW_NX_VIEW; + mMainView->setScrollBarStep( KOPrefs::instance()->mNextXDays ); } bool KOViewManager::showsNextDays() { @@ -695,6 +701,7 @@ void KOViewManager::showMonthViewWeek() showView(mMonthView, full ); mMonthView->setKeyBFocus(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_ML_VIEW ; + mMainView->setScrollBarStep( 7 ); } void KOViewManager::showMonth( const QDate & date ) @@ -727,6 +734,7 @@ void KOViewManager::showMonthView() showView(mMonthView, full ); mMonthView->setKeyBFocus(); KOPrefs::instance()->mCurrentDisplayedView = VIEW_M_VIEW ; + mMainView->setScrollBarStep( 7 ); } @@ -784,6 +792,7 @@ void KOViewManager::showTodoView() globalFlagBlockAgenda = 1; showView( mTodoView, true ); KOPrefs::instance()->mCurrentDisplayedView = VIEW_T_VIEW ; + mMainView->setScrollBarStep( 7 ); } @@ -803,6 +812,7 @@ void KOViewManager::showJournalView() showView(mJournalView); mMainView->dateNavigator()->selectDates( 1 ); KOPrefs::instance()->mCurrentDisplayedView = VIEW_J_VIEW ; + mMainView->setScrollBarStep( 1 ); } void KOViewManager::showTimeSpanView() -- cgit v0.9.0.2