-rw-r--r-- | korganizer/calendarview.cpp | 5 | ||||
-rw-r--r-- | korganizer/datenavigator.cpp | 6 | ||||
-rw-r--r-- | korganizer/datenavigator.h | 1 | ||||
-rw-r--r-- | korganizer/interfaces/korganizer/baseview.h | 1 | ||||
-rw-r--r-- | korganizer/komonthview.h | 1 |
5 files changed, 13 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3908dbb..47cd488 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1978,33 +1978,36 @@ void CalendarView::writeFilterSettings(KConfig *config) config->setGroup("Filter_" + filter->name()); config->writeEntry("Criteria",filter->criteria()); config->writeEntry("CategoryList",filter->categoryList()); filter = mFilters.next(); } config->setGroup("General"); config->writeEntry("CalendarFilters",filterList); config->setGroup("FilterView"); config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); } void CalendarView::goToday() { - mNavigator->selectToday(); + if ( mViewManager->currentView()->isMonthView() ) + mNavigator->selectTodayMonth(); + else + mNavigator->selectToday(); } void CalendarView::goNext() { mNavigator->selectNext(); } void CalendarView::goPrevious() { mNavigator->selectPrevious(); } void CalendarView::goNextMonth() { mNavigator->selectNextMonth(); } diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp index e26e20b..3156b2b 100644 --- a/korganizer/datenavigator.cpp +++ b/korganizer/datenavigator.cpp @@ -186,32 +186,38 @@ void DateNavigator::selectWorkWeek() } void DateNavigator::selectWorkWeek( const QDate &d ) { int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); QDate firstDate = d.addDays( 1 - dayOfWeek ); int weekStart = KGlobal::locale()->weekStartDay(); if ( weekStart != 1 && dayOfWeek >= weekStart ) { firstDate = firstDate.addDays( 7 ); } selectDates( firstDate, 5 ); } +void DateNavigator::selectTodayMonth() +{ + QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() ); + selectDates( date , date.daysInMonth ()); + +} void DateNavigator::selectToday() { QDate d = QDate::currentDate(); int dateCount = mSelectedDates.count(); if ( dateCount == 5 ) selectWorkWeek( d ); else if ( dateCount == 7 ) selectWeek( d ); else selectDates( d, dateCount ); } void DateNavigator::selectPreviousYear() { QDate firstSelected = mSelectedDates.first(); int weekDay = firstSelected.dayOfWeek(); firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h index 747e3d3..4a19e17 100644 --- a/korganizer/datenavigator.h +++ b/korganizer/datenavigator.h @@ -48,32 +48,33 @@ class DateNavigator : public QObject void selectDates( const KCal::DateList & ); void selectDate( const QDate & ); void selectDates( int count ); void selectDates( const QDate &, int count ); void selectWeek(); void selectWeek( int weeknum ); void selectWeek( const QDate & ); void selectWorkWeek(); void selectWorkWeek( const QDate & ); void selectWeekByDay( int weekDay, const QDate & ); void selectToday(); + void selectTodayMonth(); void selectPreviousYear(); void selectPreviousMonth(); void selectNextMonth(); void selectNextYear(); void selectMonth(); void selectMonthByDate( const QDate & ); void selectPrevious(); void selectNext(); void slotMonthSelect( int ); void slotDaySelect( QDate d ); signals: void datesSelected( const KCal::DateList & ); diff --git a/korganizer/interfaces/korganizer/baseview.h b/korganizer/interfaces/korganizer/baseview.h index 09f8ba3..2ac9de1 100644 --- a/korganizer/interfaces/korganizer/baseview.h +++ b/korganizer/interfaces/korganizer/baseview.h @@ -121,32 +121,33 @@ class BaseView : public QWidget @param calPrinter Calendar printer object used for printing */ virtual void print(CalPrinter *) { KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" "that view yet.\n")); } /** Return number of currently shown dates. A return value of 0 means no idea. */ virtual int currentDateCount() = 0; /** Return if this view is a view for displaying events. */ virtual bool isEventView() { return false; } + virtual bool isMonthView() { return false; } public slots: /** Show incidences for the given date range. The date range actually shown may be different from the requested range, depending on the particular requirements of the view. @param start Start of date range. @param end End of date range. */ virtual void showDates( const QDate &start, const QDate &end ) = 0; /** Show given events. Depending on the actual view it might not be possible to show all given events. diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index d976246..e94952f 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -187,32 +187,33 @@ class KOMonthView: public KOEventView ~KOMonthView(); /** Returns maximum number of days supported by the komonthview */ virtual int maxDatesHint(); /** Returns number of currently shown dates. */ virtual int currentDateCount(); /** returns the currently selected events */ virtual QPtrList<Incidence> selectedIncidences(); /** returns dates of the currently selected events */ virtual DateList selectedDates(); virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); + bool isMonthView() { return true; } MonthViewCell * selectedCell(); public slots: virtual void updateView(); virtual void updateConfig(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void changeEventDisplay(Event *, int); void clearSelection(); void showContextMenu( Incidence * ); void setSelectedCell( MonthViewCell * ); |