-rw-r--r-- | korganizer/calendarview.cpp | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 697093e..776cdd3 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -363,20 +363,19 @@ CalendarView::CalendarView( Calendar *calendar, } void CalendarView::init() { mNextAlarmDateTime = QDateTime::currentDateTime(); setFocusPolicy ( NoFocus ); mViewerCallerIsSearchDialog = false; mBlockShowDates = false; - beamDialog = new KOBeamPrefs(); + mDatePickerMode = 0; mCurrentSyncDevice = ""; - writeLocale(); mViewManager = new KOViewManager( this ); mDialogManager = new KODialogManager( this ); mEventViewerDialog = 0; mModified = false; mReadOnly = false; mSelectedIncidence = 0; mCalPrinter = 0; mFilters.setAutoDelete(true); @@ -440,17 +439,19 @@ void CalendarView::init() //leftFrameLayout = new QVBoxLayout(leftFrame ); mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); } 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" ); #if 0 // FIXME mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, "CalendarView::DateNavigator", QDate::currentDate()); #endif @@ -463,16 +464,17 @@ void CalendarView::init() connect( mCalEditView, SIGNAL( alarmEnabled(int,bool) ),mCalendar, SLOT( setAlarmEnabled(int,bool)) ); connect( mCalEditView, SIGNAL( calendarReadonly(int,bool) ),mCalendar, SLOT( setReadOnly(int,bool)) ); connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mCalendar, SLOT( setDefaultCalendar(int)) ); connect( mCalEditView, SIGNAL( setCalendarDefault(int) ),mViewManager, SLOT( setDefaultCalendar(int)) ); connect( mCalEditView, SIGNAL( removeCalendar(int) ),mCalendar, SLOT( setCalendarRemove(int)) ); 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 ) { leftFrameLayout->addWidget(mFilterView); leftFrameLayout->addWidget(mTodoList, 2 ); } else { leftFrameLayout->addWidget(mTodoList,2 ); @@ -637,20 +639,43 @@ void CalendarView::init() CalendarView::~CalendarView() { // kdDebug() << "~CalendarView()" << endl; //qDebug("CalendarView::~CalendarView() "); delete mDialogManager; 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(); config->setGroup( "AppRun" ); QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); int daysto = dt.daysTo( QDate::currentDate() ); int days = config->readNumEntry( "LatestProgramStopDays" , daysto); dt = dt.addDays( days ); @@ -2462,37 +2487,19 @@ void CalendarView::goNextMonth() { mNavigator->selectNextMonth(); } 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(); mTodoList->updateConfig(); // mDateNavigator->setFont ( KOPrefs::instance()->mDateNavigatorFont); mCalendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); // To make the "fill window" configurations work //mViewManager->raiseCurrentView(); @@ -2572,16 +2579,17 @@ void CalendarView::updateTodoViews() mTodoList->updateView(); mViewManager->currentView()->updateView(); } void CalendarView::updateView(const QDate &start, const QDate &end) { + mDateScrollBar->setValue( start.dayOfYear()-1); mTodoList->updateView(); mViewManager->updateView(start, end); //mDateNavigator->updateView(); } void CalendarView::clearAllViews() { mTodoList->clearList(); @@ -2839,29 +2847,31 @@ void CalendarView::beamCalendar() void CalendarView::beamFilteredCalendar() { QPtrList<Incidence> delSel = mCalendar->incidences(); //qDebug("beamFilteredCalendar() "); beamIncidenceList( delSel ); } void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) { - if ( beamDialog->exec () == QDialog::Rejected ) + + KOBeamPrefs beamDialog; + if ( beamDialog.exec () == QDialog::Rejected ) return; #ifdef DESKTOP_VERSION QString fn = locateLocal( "tmp", "kopibeamfile" ); #else QString fn = "/tmp/kopibeamfile"; #endif QString mes; bool createbup = true; if ( createbup ) { QString description = "\n"; CalendarLocal* cal = new CalendarLocal(); - if ( beamDialog->beamLocal() ) + if ( beamDialog.beamLocal() ) cal->setLocalTime(); else cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); Incidence *incidence = delSel.first(); bool addText = false; if ( delSel.count() < 10 ) addText = true; else { @@ -2875,17 +2885,17 @@ void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) in->setSummary( in->description().left(20)); in->setDescription(""); } if ( addText ) description += in->summary() + "\n"; cal->addIncidence( in ); incidence = delSel.next(); } - if ( beamDialog->beamVcal() ) { + if ( beamDialog.beamVcal() ) { fn += ".vcs"; FileStorage storage( cal, fn, new VCalFormat ); storage.save(); } else { fn += ".ics"; FileStorage storage( cal, fn, new ICalFormat( ) ); storage.save(); } |