-rw-r--r-- | korganizer/koagendaview.cpp | 10 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 7 |
3 files changed, 18 insertions, 0 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 0d36946..13d8398 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -1520,32 +1520,42 @@ void KOAgendaView::keyPressEvent ( QKeyEvent * e ) void KOAgendaView::scrollOneHourUp() { mAgenda->scrollBy ( 0, -mAgenda->contentsHeight () / 24 ); } void KOAgendaView::scrollOneHourDown() { mAgenda->scrollBy ( 0, mAgenda->contentsHeight () / 24 ); } void KOAgendaView::setStartHour( int h ) { mAgenda->setStartHour( h ); } +void KOAgendaView::setInitStartHour() +{ + + if ( KOPrefs::instance()->mCenterOnCurrentTime ) + setStartHour( QTime::currentTime ().hour() ); + else + setStartHour( KOPrefs::instance()->mDayBegins ); + +} + void KOAgendaView::updateTodo( Todo * t, int ) { if ( !isVisible() ) return; bool remove = false; bool removeAD = false; QDate da; if ( t->hasCompletedDate() ) da = t->completed().date(); else da = t->dtDue().date(); if ( ! t->hasDueDate() && !t->hasCompletedDate() ) { remove = true; removeAD = true; } diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 4a058ce..8b8bac0 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -164,32 +164,33 @@ class KOAgendaView : public KOEventView { /** Remove all events from view */ void clearView(); KOAgenda *agenda() { return mAgenda;} virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); /** start-datetime of selection */ QDateTime selectionStart() {return mTimeSpanBegin;} /** end-datetime of selection */ QDateTime selectionEnd() {return mTimeSpanEnd;} /** returns true if selection is for whole day */ bool selectedIsAllDay() {return mTimeSpanInAllDay;} /** make selected start/end invalid */ void deleteSelectedDateTime(); void repaintAgenda(); public slots: + void setInitStartHour(); virtual void updateView(); virtual void updateConfig(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void updateTodo( Todo *, int ); void changeEventDisplay(Event *, int); void clearSelection(); void newTodo(int gx,int gy); void newEvent(int gx,int gy); void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); void newEventAllDay(int gx, int gy); void newTodoAllDay(int gx, int gy); diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index b0f26d1..f8f6c1d 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -81,33 +81,40 @@ KOViewManager::~KOViewManager() KOrg::BaseView *KOViewManager::currentView() { return mCurrentView; } void KOViewManager::readSettings(KConfig *config) { config->setGroup("General"); QString view = config->readEntry("Current View"); if (view == "WhatsNext") showWhatsNextView(); else if (view == "Month") showMonthView(); else if (view == "List") showListView(); else if (view == "Journal") showJournalView(); else if (view == "TimeSpan") showTimeSpanView(); else if (view == "Todo") showTodoView(); else { + config->setGroup( "Views" ); + int dateCount = config->readNumEntry( "ShownDatesCount", 7 ); + mCurrentAgendaView = dateCount; showAgendaView(); + mCurrentAgendaView = dateCount; +#ifdef DESKTOP_VERSION + QTimer::singleShot( 1000, mAgendaView, SLOT ( setInitStartHour() ) ); +#endif } } void KOViewManager::showDateView( int view, QDate date) { static int lastMode = 0; static int lastCount = 0; static bool lastNDMode = false; static QDate lastDate; //qDebug("date %d %s", view, date.toString().latin1()); if (view != 9) lastMode = 0; //qDebug("%d %d ", lastNDMode, mFlagShowNextxDays ); bool savemFlagShowNextxDays = mFlagShowNextxDays; mFlagShowNextxDays = false; |