-rw-r--r-- | korganizer/kdatenavigator.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index 56822fa..292e71c 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h | |||
@@ -1,151 +1,154 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KDATENAVIGATOR_H | 23 | #ifndef KDATENAVIGATOR_H |
24 | #define KDATENAVIGATOR_H | 24 | #define KDATENAVIGATOR_H |
25 | 25 | ||
26 | #include <qframe.h> | 26 | #include <qframe.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | 29 | ||
30 | #include <libkcal/calendar.h> | 30 | #include <libkcal/calendar.h> |
31 | 31 | ||
32 | #include "kodaymatrix.h" | 32 | #include "kodaymatrix.h" |
33 | 33 | ||
34 | class QPushButton; | 34 | class QPushButton; |
35 | class QTimer; | 35 | class QTimer; |
36 | 36 | ||
37 | class KCalendarSystem; | 37 | class KCalendarSystem; |
38 | 38 | ||
39 | class NavigatorBar; | 39 | class NavigatorBar; |
40 | 40 | ||
41 | class KDateNavigator: public QFrame | 41 | class KDateNavigator: public QFrame |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | KDateNavigator( QWidget *parent = 0,const char *name = 0 ); | 45 | KDateNavigator( QWidget *parent = 0,const char *name = 0 ); |
46 | ~KDateNavigator(); | 46 | ~KDateNavigator(); |
47 | 47 | ||
48 | /** The DateNavigator automatically checks for | 48 | /** The DateNavigator automatically checks for |
49 | * the passage of midnight. If rollover type is | 49 | * the passage of midnight. If rollover type is |
50 | * set to None, no signals are emitted and no | 50 | * set to None, no signals are emitted and no |
51 | * processing is done. With rollover set to | 51 | * processing is done. With rollover set to |
52 | * FollowDay, the day highlighter changes at | 52 | * FollowDay, the day highlighter changes at |
53 | * midnight and dayPassed() is emitted. | 53 | * midnight and dayPassed() is emitted. |
54 | * With FollowMonth, it has the same effect | 54 | * With FollowMonth, it has the same effect |
55 | * as FollowDay but also adjusts the month that is | 55 | * as FollowDay but also adjusts the month that is |
56 | * visible and emits monthPassed() when the month changes. | 56 | * visible and emits monthPassed() when the month changes. |
57 | */ | 57 | */ |
58 | enum RolloverType { None, FollowDay, FollowMonth } ; | 58 | enum RolloverType { None, FollowDay, FollowMonth } ; |
59 | void enableRollover( RolloverType ); | 59 | void enableRollover( RolloverType ); |
60 | 60 | ||
61 | void setShowWeekNums( bool enabled ); | 61 | void setShowWeekNums( bool enabled ); |
62 | void setCalendar( Calendar * ); | 62 | void setCalendar( Calendar * ); |
63 | void setBaseDate( const QDate & ); | 63 | void setBaseDate( const QDate & , bool doRepaint = true ); |
64 | KCal::DateList selectedDates() const { return mSelectedDates; } | 64 | KCal::DateList selectedDates() const { return mSelectedDates; } |
65 | NavigatorBar *navigatorBar() const { return mNavigatorBar; } | 65 | NavigatorBar *navigatorBar() const { return mNavigatorBar; } |
66 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;} | 66 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off;} |
67 | QSize yourSizeHint() { return mySizeHint; } | ||
68 | KODayMatrix *dayMatrix() { return daymatrix ;} | ||
67 | public slots: | 69 | public slots: |
68 | void selectDates( const KCal::DateList & ); | 70 | void selectDates( const KCal::DateList & ); |
69 | void updateView(); | 71 | void updateView(); |
70 | void updateConfig(); | 72 | void updateConfig(); |
71 | void updateDayMatrix(); | 73 | void updateDayMatrix(); |
72 | 74 | ||
73 | signals: | 75 | signals: |
74 | void datesSelected( const KCal::DateList & ); | 76 | void datesSelected( const KCal::DateList & ); |
75 | void eventDropped( Event * ); | 77 | void eventDropped( Event * ); |
76 | void weekClicked( const QDate &); | 78 | void weekClicked( const QDate &); |
77 | 79 | ||
78 | void goPrevious(); | 80 | void goPrevious(); |
79 | void goNext(); | 81 | void goNext(); |
80 | 82 | ||
81 | void goNextMonth(); | 83 | void goNextMonth(); |
82 | void goPrevMonth(); | 84 | void goPrevMonth(); |
83 | void goNextYear(); | 85 | void goNextYear(); |
84 | void goPrevYear(); | 86 | void goPrevYear(); |
85 | void monthSelected( int ); | 87 | void monthSelected( int ); |
86 | 88 | ||
87 | // Signals emitted at midnight carrying the new date. | 89 | // Signals emitted at midnight carrying the new date. |
88 | void dayPassed( QDate ); | 90 | void dayPassed( QDate ); |
89 | void monthPassed( QDate ); | 91 | void monthPassed( QDate ); |
90 | 92 | ||
91 | protected slots: | 93 | protected slots: |
92 | 94 | ||
93 | /** | 95 | /** |
94 | * Called regularly to see if we need to update the view | 96 | * Called regularly to see if we need to update the view |
95 | * wrt. the today box and the month box. Only important | 97 | * wrt. the today box and the month box. Only important |
96 | * if you leave KOrganizer idle for long periods of time. | 98 | * if you leave KOrganizer idle for long periods of time. |
97 | * | 99 | * |
98 | * Until we have a reliable way of setting QTimers to go | 100 | * Until we have a reliable way of setting QTimers to go |
99 | * off at a particular wall-clock time, we need this, | 101 | * off at a particular wall-clock time, we need this, |
100 | * which calls passedMidnight() at the right moments. | 102 | * which calls passedMidnight() at the right moments. |
101 | */ | 103 | */ |
102 | void possiblyPastMidnight(); | 104 | void possiblyPastMidnight(); |
103 | 105 | ||
104 | /** handles updating the view when midnight has come by due to idle time. | 106 | /** handles updating the view when midnight has come by due to idle time. |
105 | * | 107 | * |
106 | */ | 108 | */ |
107 | void passedMidnight(); | 109 | void passedMidnight(); |
108 | void slotMonthSelected( int m ); | 110 | void slotMonthSelected( int m ); |
109 | protected: | 111 | protected: |
110 | void updateDates(); | 112 | void updateDates(); |
111 | 113 | ||
112 | void wheelEvent (QWheelEvent *); | 114 | void wheelEvent (QWheelEvent *); |
113 | 115 | ||
114 | bool eventFilter (QObject *,QEvent *); | 116 | bool eventFilter (QObject *,QEvent *); |
115 | 117 | ||
116 | private: | 118 | private: |
119 | QSize mySizeHint; | ||
117 | int mMonthSignalOffset; | 120 | int mMonthSignalOffset; |
118 | NavigatorBar *mNavigatorBar; | 121 | NavigatorBar *mNavigatorBar; |
119 | 122 | ||
120 | QFrame *headingSep; | 123 | QFrame *headingSep; |
121 | QFrame *weeknumSep; | 124 | QFrame *weeknumSep; |
122 | QLabel *headings[7]; | 125 | QLabel *headings[7]; |
123 | QLabel *weeknos[7]; | 126 | QLabel *weeknos[7]; |
124 | KODayMatrix *daymatrix; | 127 | KODayMatrix *daymatrix; |
125 | 128 | ||
126 | KCal::DateList mSelectedDates; | 129 | KCal::DateList mSelectedDates; |
127 | QDate m_MthYr; | 130 | QDate m_MthYr; |
128 | int m_fstDayOfWk; | 131 | int m_fstDayOfWk; |
129 | bool m_bShowWeekNums; | 132 | bool m_bShowWeekNums; |
130 | 133 | ||
131 | int dayNum(int row, int col); | 134 | int dayNum(int row, int col); |
132 | int dayToIndex(int dayNum); | 135 | int dayToIndex(int dayNum); |
133 | 136 | ||
134 | Calendar *mCalendar; | 137 | Calendar *mCalendar; |
135 | KCalendarSystem *mCalendarSystem; | 138 | KCalendarSystem *mCalendarSystem; |
136 | 139 | ||
137 | const QString *curHeaders; | 140 | const QString *curHeaders; |
138 | 141 | ||
139 | /** used to update the day view periodically, in particular every | 142 | /** used to update the day view periodically, in particular every |
140 | * midnight to move the "today" rectangle. | 143 | * midnight to move the "today" rectangle. |
141 | */ | 144 | */ |
142 | QTimer *updateTimer; | 145 | QTimer *updateTimer; |
143 | QDate lastDayChecked; | 146 | QDate lastDayChecked; |
144 | RolloverType updateRollover; | 147 | RolloverType updateRollover; |
145 | 148 | ||
146 | // Disabling copy constructor and assignment operator | 149 | // Disabling copy constructor and assignment operator |
147 | KDateNavigator(const KDateNavigator & ); | 150 | KDateNavigator(const KDateNavigator & ); |
148 | KDateNavigator &operator=(const KDateNavigator &); | 151 | KDateNavigator &operator=(const KDateNavigator &); |
149 | }; | 152 | }; |
150 | 153 | ||
151 | #endif | 154 | #endif |