summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp3
-rw-r--r--korganizer/datenavigator.cpp6
-rw-r--r--korganizer/datenavigator.h1
-rw-r--r--korganizer/interfaces/korganizer/baseview.h1
-rw-r--r--korganizer/komonthview.h1
5 files changed, 12 insertions, 0 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3908dbb..47cd488 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1970,48 +1970,51 @@ void CalendarView::writeFilterSettings(KConfig *config)
1970 // kdDebug() << "CalendarView::writeFilterSettings()" << endl; 1970 // kdDebug() << "CalendarView::writeFilterSettings()" << endl;
1971 1971
1972 QStringList filterList; 1972 QStringList filterList;
1973 1973
1974 CalFilter *filter = mFilters.first(); 1974 CalFilter *filter = mFilters.first();
1975 while(filter) { 1975 while(filter) {
1976 // kdDebug() << " fn: " << filter->name() << endl; 1976 // kdDebug() << " fn: " << filter->name() << endl;
1977 filterList << filter->name(); 1977 filterList << filter->name();
1978 config->setGroup("Filter_" + filter->name()); 1978 config->setGroup("Filter_" + filter->name());
1979 config->writeEntry("Criteria",filter->criteria()); 1979 config->writeEntry("Criteria",filter->criteria());
1980 config->writeEntry("CategoryList",filter->categoryList()); 1980 config->writeEntry("CategoryList",filter->categoryList());
1981 filter = mFilters.next(); 1981 filter = mFilters.next();
1982 } 1982 }
1983 config->setGroup("General"); 1983 config->setGroup("General");
1984 config->writeEntry("CalendarFilters",filterList); 1984 config->writeEntry("CalendarFilters",filterList);
1985 1985
1986 config->setGroup("FilterView"); 1986 config->setGroup("FilterView");
1987 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled()); 1987 config->writeEntry("FilterEnabled",mFilterView->filtersEnabled());
1988 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name()); 1988 config->writeEntry("Current Filter",mFilterView->selectedFilter()->name());
1989} 1989}
1990 1990
1991 1991
1992void CalendarView::goToday() 1992void CalendarView::goToday()
1993{ 1993{
1994 if ( mViewManager->currentView()->isMonthView() )
1995 mNavigator->selectTodayMonth();
1996 else
1994 mNavigator->selectToday(); 1997 mNavigator->selectToday();
1995} 1998}
1996 1999
1997void CalendarView::goNext() 2000void CalendarView::goNext()
1998{ 2001{
1999 mNavigator->selectNext(); 2002 mNavigator->selectNext();
2000} 2003}
2001 2004
2002void CalendarView::goPrevious() 2005void CalendarView::goPrevious()
2003{ 2006{
2004 mNavigator->selectPrevious(); 2007 mNavigator->selectPrevious();
2005} 2008}
2006void CalendarView::goNextMonth() 2009void CalendarView::goNextMonth()
2007{ 2010{
2008 mNavigator->selectNextMonth(); 2011 mNavigator->selectNextMonth();
2009} 2012}
2010 2013
2011void CalendarView::goPreviousMonth() 2014void CalendarView::goPreviousMonth()
2012{ 2015{
2013 mNavigator->selectPreviousMonth(); 2016 mNavigator->selectPreviousMonth();
2014} 2017}
2015void CalendarView::writeLocale() 2018void CalendarView::writeLocale()
2016{ 2019{
2017 //KPimGlobalPrefs::instance()->setGlobalConfig(); 2020 //KPimGlobalPrefs::instance()->setGlobalConfig();
diff --git a/korganizer/datenavigator.cpp b/korganizer/datenavigator.cpp
index e26e20b..3156b2b 100644
--- a/korganizer/datenavigator.cpp
+++ b/korganizer/datenavigator.cpp
@@ -178,48 +178,54 @@ void DateNavigator::selectWeek( const QDate &d )
178 178
179 selectDates( firstDate, 7 ); 179 selectDates( firstDate, 7 );
180} 180}
181 181
182void DateNavigator::selectWorkWeek() 182void DateNavigator::selectWorkWeek()
183{ 183{
184 QDate d = mSelectedDates.first(); 184 QDate d = mSelectedDates.first();
185 selectWorkWeek( d ); 185 selectWorkWeek( d );
186} 186}
187 187
188void DateNavigator::selectWorkWeek( const QDate &d ) 188void DateNavigator::selectWorkWeek( const QDate &d )
189{ 189{
190 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d ); 190 int dayOfWeek = KOGlobals::self()->calendarSystem()->dayOfWeek( d );
191 191
192 QDate firstDate = d.addDays( 1 - dayOfWeek ); 192 QDate firstDate = d.addDays( 1 - dayOfWeek );
193 193
194 int weekStart = KGlobal::locale()->weekStartDay(); 194 int weekStart = KGlobal::locale()->weekStartDay();
195 if ( weekStart != 1 && dayOfWeek >= weekStart ) { 195 if ( weekStart != 1 && dayOfWeek >= weekStart ) {
196 firstDate = firstDate.addDays( 7 ); 196 firstDate = firstDate.addDays( 7 );
197 } 197 }
198 198
199 selectDates( firstDate, 5 ); 199 selectDates( firstDate, 5 );
200} 200}
201 201
202void DateNavigator::selectTodayMonth()
203{
204 QDate date = QDate::currentDate().addDays( 1-QDate::currentDate().day() );
205 selectDates( date , date.daysInMonth ());
206
207}
202void DateNavigator::selectToday() 208void DateNavigator::selectToday()
203{ 209{
204 QDate d = QDate::currentDate(); 210 QDate d = QDate::currentDate();
205 211
206 int dateCount = mSelectedDates.count(); 212 int dateCount = mSelectedDates.count();
207 213
208 if ( dateCount == 5 ) selectWorkWeek( d ); 214 if ( dateCount == 5 ) selectWorkWeek( d );
209 else if ( dateCount == 7 ) selectWeek( d ); 215 else if ( dateCount == 7 ) selectWeek( d );
210 else selectDates( d, dateCount ); 216 else selectDates( d, dateCount );
211} 217}
212 218
213void DateNavigator::selectPreviousYear() 219void DateNavigator::selectPreviousYear()
214{ 220{
215 QDate firstSelected = mSelectedDates.first(); 221 QDate firstSelected = mSelectedDates.first();
216 int weekDay = firstSelected.dayOfWeek(); 222 int weekDay = firstSelected.dayOfWeek();
217 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 ); 223 firstSelected = KOGlobals::self()->calendarSystem()->addYears( firstSelected, -1 );
218 224
219 selectWeekByDay( weekDay, firstSelected ); 225 selectWeekByDay( weekDay, firstSelected );
220} 226}
221 227
222void DateNavigator::selectPreviousMonth() 228void DateNavigator::selectPreviousMonth()
223{ 229{
224 QDate firstSelected = mSelectedDates.first(); 230 QDate firstSelected = mSelectedDates.first();
225 int weekDay = firstSelected.dayOfWeek(); 231 int weekDay = firstSelected.dayOfWeek();
diff --git a/korganizer/datenavigator.h b/korganizer/datenavigator.h
index 747e3d3..4a19e17 100644
--- a/korganizer/datenavigator.h
+++ b/korganizer/datenavigator.h
@@ -40,48 +40,49 @@ class DateNavigator : public QObject
40 DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0); 40 DateNavigator( QObject *parent = 0, const char *name = 0 , KOViewManager * v = 0);
41 ~DateNavigator(); 41 ~DateNavigator();
42 42
43 KCal::DateList selectedDates(); 43 KCal::DateList selectedDates();
44 44
45 int datesCount() const; 45 int datesCount() const;
46 46
47 public slots: 47 public slots:
48 void selectDates( const KCal::DateList & ); 48 void selectDates( const KCal::DateList & );
49 void selectDate( const QDate & ); 49 void selectDate( const QDate & );
50 50
51 void selectDates( int count ); 51 void selectDates( int count );
52 void selectDates( const QDate &, int count ); 52 void selectDates( const QDate &, int count );
53 53
54 void selectWeek(); 54 void selectWeek();
55 void selectWeek( int weeknum ); 55 void selectWeek( int weeknum );
56 void selectWeek( const QDate & ); 56 void selectWeek( const QDate & );
57 57
58 void selectWorkWeek(); 58 void selectWorkWeek();
59 void selectWorkWeek( const QDate & ); 59 void selectWorkWeek( const QDate & );
60 60
61 void selectWeekByDay( int weekDay, const QDate & ); 61 void selectWeekByDay( int weekDay, const QDate & );
62 62
63 void selectToday(); 63 void selectToday();
64 void selectTodayMonth();
64 65
65 void selectPreviousYear(); 66 void selectPreviousYear();
66 void selectPreviousMonth(); 67 void selectPreviousMonth();
67 void selectNextMonth(); 68 void selectNextMonth();
68 void selectNextYear(); 69 void selectNextYear();
69 70
70 void selectMonth(); 71 void selectMonth();
71 void selectMonthByDate( const QDate & ); 72 void selectMonthByDate( const QDate & );
72 73
73 void selectPrevious(); 74 void selectPrevious();
74 void selectNext(); 75 void selectNext();
75 void slotMonthSelect( int ); 76 void slotMonthSelect( int );
76 void slotDaySelect( QDate d ); 77 void slotDaySelect( QDate d );
77 78
78 signals: 79 signals:
79 void datesSelected( const KCal::DateList & ); 80 void datesSelected( const KCal::DateList & );
80 81
81 protected: 82 protected:
82 void emitSelected(); 83 void emitSelected();
83 84
84 private: 85 private:
85 KOViewManager * mViewManager; 86 KOViewManager * mViewManager;
86 KCal::DateList mSelectedDates; 87 KCal::DateList mSelectedDates;
87}; 88};
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
@@ -113,48 +113,49 @@ class BaseView : public QWidget
113 const QDate &, const QDate &) 113 const QDate &, const QDate &)
114 { 114 {
115 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" 115 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n"
116 "that view yet.\n")); 116 "that view yet.\n"));
117 } 117 }
118 118
119 /** 119 /**
120 Print this view. 120 Print this view.
121 121
122 @param calPrinter Calendar printer object used for printing 122 @param calPrinter Calendar printer object used for printing
123 */ 123 */
124 virtual void print(CalPrinter *) 124 virtual void print(CalPrinter *)
125 { 125 {
126 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n" 126 KMessageBox::sorry(this, i18n("Unfortunately, we don't handle printing for\n"
127 "that view yet.\n")); 127 "that view yet.\n"));
128 } 128 }
129 129
130 /** 130 /**
131 Return number of currently shown dates. A return value of 0 means no idea. 131 Return number of currently shown dates. A return value of 0 means no idea.
132 */ 132 */
133 virtual int currentDateCount() = 0; 133 virtual int currentDateCount() = 0;
134 134
135 /** Return if this view is a view for displaying events. */ 135 /** Return if this view is a view for displaying events. */
136 virtual bool isEventView() { return false; } 136 virtual bool isEventView() { return false; }
137 virtual bool isMonthView() { return false; }
137 138
138 public slots: 139 public slots:
139 /** 140 /**
140 Show incidences for the given date range. The date range actually shown may be 141 Show incidences for the given date range. The date range actually shown may be
141 different from the requested range, depending on the particular requirements 142 different from the requested range, depending on the particular requirements
142 of the view. 143 of the view.
143 144
144 @param start Start of date range. 145 @param start Start of date range.
145 @param end End of date range. 146 @param end End of date range.
146 */ 147 */
147 virtual void showDates( const QDate &start, const QDate &end ) = 0; 148 virtual void showDates( const QDate &start, const QDate &end ) = 0;
148 149
149 /** 150 /**
150 Show given events. Depending on the actual view it might not be possible to 151 Show given events. Depending on the actual view it might not be possible to
151 show all given events. 152 show all given events.
152 153
153 @param eventList a list of events to show. 154 @param eventList a list of events to show.
154 */ 155 */
155 virtual void showEvents(QPtrList<Event> eventList) = 0; 156 virtual void showEvents(QPtrList<Event> eventList) = 0;
156 157
157 /** 158 /**
158 Updates the current display to reflect changes that may have happened 159 Updates the current display to reflect changes that may have happened
159 in the calendar since the last display refresh. 160 in the calendar since the last display refresh.
160 */ 161 */
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index d976246..e94952f 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -179,48 +179,49 @@ class MonthViewCell : public QWidget
179}; 179};
180 180
181 181
182class KOMonthView: public KOEventView 182class KOMonthView: public KOEventView
183{ 183{
184 Q_OBJECT 184 Q_OBJECT
185 public: 185 public:
186 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 186 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
187 ~KOMonthView(); 187 ~KOMonthView();
188 188
189 /** Returns maximum number of days supported by the komonthview */ 189 /** Returns maximum number of days supported by the komonthview */
190 virtual int maxDatesHint(); 190 virtual int maxDatesHint();
191 191
192 /** Returns number of currently shown dates. */ 192 /** Returns number of currently shown dates. */
193 virtual int currentDateCount(); 193 virtual int currentDateCount();
194 194
195 /** returns the currently selected events */ 195 /** returns the currently selected events */
196 virtual QPtrList<Incidence> selectedIncidences(); 196 virtual QPtrList<Incidence> selectedIncidences();
197 197
198 /** returns dates of the currently selected events */ 198 /** returns dates of the currently selected events */
199 virtual DateList selectedDates(); 199 virtual DateList selectedDates();
200 200
201 virtual void printPreview(CalPrinter *calPrinter, 201 virtual void printPreview(CalPrinter *calPrinter,
202 const QDate &, const QDate &); 202 const QDate &, const QDate &);
203 bool isMonthView() { return true; }
203 204
204 MonthViewCell * selectedCell(); 205 MonthViewCell * selectedCell();
205 public slots: 206 public slots:
206 virtual void updateView(); 207 virtual void updateView();
207 virtual void updateConfig(); 208 virtual void updateConfig();
208 virtual void showDates(const QDate &start, const QDate &end); 209 virtual void showDates(const QDate &start, const QDate &end);
209 virtual void showEvents(QPtrList<Event> eventList); 210 virtual void showEvents(QPtrList<Event> eventList);
210 211
211 void changeEventDisplay(Event *, int); 212 void changeEventDisplay(Event *, int);
212 213
213 void clearSelection(); 214 void clearSelection();
214 215
215 void showContextMenu( Incidence * ); 216 void showContextMenu( Incidence * );
216 217
217 void setSelectedCell( MonthViewCell * ); 218 void setSelectedCell( MonthViewCell * );
218 219
219 protected slots: 220 protected slots:
220 void processSelectionChange(); 221 void processSelectionChange();
221 signals: 222 signals:
222 void selectWeekNum ( int ); 223 void selectWeekNum ( int );
223 protected: 224 protected:
224 void resizeEvent(QResizeEvent *); 225 void resizeEvent(QResizeEvent *);
225 void viewChanged(); 226 void viewChanged();
226 void updateDayLabels(); 227 void updateDayLabels();