-rw-r--r-- | korganizer/kdatenavigator.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index 780ebb8..2cbca76 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h | |||
@@ -1,167 +1,170 @@ | |||
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 <q3frame.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | //Added by qt3to4: | ||
30 | #include <QWheelEvent> | ||
31 | #include <QEvent> | ||
29 | 32 | ||
30 | #include <libkcal/calendar.h> | 33 | #include <libkcal/calendar.h> |
31 | 34 | ||
32 | #include "kodaymatrix.h" | 35 | #include "kodaymatrix.h" |
33 | 36 | ||
34 | class QPushButton; | 37 | class QPushButton; |
35 | class QTimer; | 38 | class QTimer; |
36 | 39 | ||
37 | class KCalendarSystem; | 40 | class KCalendarSystem; |
38 | 41 | ||
39 | class NavigatorBar; | 42 | class NavigatorBar; |
40 | 43 | ||
41 | class KDateNavigator: public QFrame | 44 | class KDateNavigator: public Q3Frame |
42 | { | 45 | { |
43 | Q_OBJECT | 46 | Q_OBJECT |
44 | public: | 47 | public: |
45 | KDateNavigator( QWidget *parent = 0,const char *name = 0 ); | 48 | KDateNavigator( QWidget *parent = 0,const char *name = 0 ); |
46 | ~KDateNavigator(); | 49 | ~KDateNavigator(); |
47 | 50 | ||
48 | /** The DateNavigator automatically checks for | 51 | /** The DateNavigator automatically checks for |
49 | * the passage of midnight. If rollover type is | 52 | * the passage of midnight. If rollover type is |
50 | * set to None, no signals are emitted and no | 53 | * set to None, no signals are emitted and no |
51 | * processing is done. With rollover set to | 54 | * processing is done. With rollover set to |
52 | * FollowDay, the day highlighter changes at | 55 | * FollowDay, the day highlighter changes at |
53 | * midnight and dayPassed() is emitted. | 56 | * midnight and dayPassed() is emitted. |
54 | * With FollowMonth, it has the same effect | 57 | * With FollowMonth, it has the same effect |
55 | * as FollowDay but also adjusts the month that is | 58 | * as FollowDay but also adjusts the month that is |
56 | * visible and emits monthPassed() when the month changes. | 59 | * visible and emits monthPassed() when the month changes. |
57 | */ | 60 | */ |
58 | enum RolloverType { None, FollowDay, FollowMonth } ; | 61 | enum RolloverType { None, FollowDay, FollowMonth } ; |
59 | void enableRollover( RolloverType ); | 62 | void enableRollover( RolloverType ); |
60 | 63 | ||
61 | void setShowWeekNums( bool enabled ); | 64 | void setShowWeekNums( bool enabled ); |
62 | void setCalendar( Calendar * ); | 65 | void setCalendar( Calendar * ); |
63 | void setBaseDate( const QDate & , bool doRepaint = true ); | 66 | void setBaseDate( const QDate & , bool doRepaint = true ); |
64 | 67 | ||
65 | QDate baseDate() const { return m_MthYr;} | 68 | QDate baseDate() const { return m_MthYr;} |
66 | 69 | ||
67 | KCal::DateList selectedDates() const { return mSelectedDates; } | 70 | KCal::DateList selectedDates() const { return mSelectedDates; } |
68 | NavigatorBar *navigatorBar() const { return mNavigatorBar; } | 71 | NavigatorBar *navigatorBar() const { return mNavigatorBar; } |
69 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} | 72 | void setMonthSignalOffset ( int off ) { mMonthSignalOffset = off%12;} |
70 | QSize yourSizeHint()const { return mySizeHint; }; | 73 | QSize yourSizeHint()const { return mySizeHint; }; |
71 | QSize yourFullSizeHint() const { return myFullSizeHint;}; | 74 | QSize yourFullSizeHint() const { return myFullSizeHint;}; |
72 | QFont yourFontHint( QSize , bool * b); | 75 | QFont yourFontHint( QSize , bool * b); |
73 | bool fontChanged() {return mFontChanged; } | 76 | bool fontChanged() {return mFontChanged; } |
74 | void unsetFontChanged() { mFontChanged = false; } | 77 | void unsetFontChanged() { mFontChanged = false; } |
75 | KODayMatrix *dayMatrix() { return daymatrix ;} | 78 | KODayMatrix *dayMatrix() { return daymatrix ;} |
76 | QSize sizeHint() const; | 79 | QSize sizeHint() const; |
77 | QSize sizeHintTwoButtons( int butnum = 2 ) const; | 80 | QSize sizeHintTwoButtons( int butnum = 2 ) const; |
78 | void changeFont ( QFont fo ); | 81 | void changeFont ( QFont fo ); |
79 | public slots: | 82 | public slots: |
80 | void selectDates( const KCal::DateList & ); | 83 | void selectDates( const KCal::DateList & ); |
81 | void updateView(); | 84 | void updateView(); |
82 | void updateConfig(); | 85 | void updateConfig(); |
83 | void updateDayMatrix(); | 86 | void updateDayMatrix(); |
84 | 87 | ||
85 | signals: | 88 | signals: |
86 | void datesSelected( const KCal::DateList & ); | 89 | void datesSelected( const KCal::DateList & ); |
87 | void eventDropped( Event * ); | 90 | void eventDropped( Event * ); |
88 | void weekClicked( const QDate &); | 91 | void weekClicked( const QDate &); |
89 | void showMonth( const QDate & ); | 92 | void showMonth( const QDate & ); |
90 | 93 | ||
91 | void goPrevious(); | 94 | void goPrevious(); |
92 | void goNext(); | 95 | void goNext(); |
93 | 96 | ||
94 | void goNextMonth(); | 97 | void goNextMonth(); |
95 | void goPrevMonth(); | 98 | void goPrevMonth(); |
96 | void goNextYear(); | 99 | void goNextYear(); |
97 | void goPrevYear(); | 100 | void goPrevYear(); |
98 | void monthSelected( int ); | 101 | void monthSelected( int ); |
99 | 102 | ||
100 | // Signals emitted at midnight carrying the new date. | 103 | // Signals emitted at midnight carrying the new date. |
101 | void dayPassed( QDate ); | 104 | void dayPassed( QDate ); |
102 | void monthPassed( QDate ); | 105 | void monthPassed( QDate ); |
103 | 106 | ||
104 | protected slots: | 107 | protected slots: |
105 | 108 | ||
106 | /** | 109 | /** |
107 | * Called regularly to see if we need to update the view | 110 | * Called regularly to see if we need to update the view |
108 | * wrt. the today box and the month box. Only important | 111 | * wrt. the today box and the month box. Only important |
109 | * if you leave KOrganizer idle for long periods of time. | 112 | * if you leave KOrganizer idle for long periods of time. |
110 | * | 113 | * |
111 | * Until we have a reliable way of setting QTimers to go | 114 | * Until we have a reliable way of setting QTimers to go |
112 | * off at a particular wall-clock time, we need this, | 115 | * off at a particular wall-clock time, we need this, |
113 | * which calls passedMidnight() at the right moments. | 116 | * which calls passedMidnight() at the right moments. |
114 | */ | 117 | */ |
115 | void possiblyPastMidnight(); | 118 | void possiblyPastMidnight(); |
116 | 119 | ||
117 | /** handles updating the view when midnight has come by due to idle time. | 120 | /** handles updating the view when midnight has come by due to idle time. |
118 | * | 121 | * |
119 | */ | 122 | */ |
120 | void passedMidnight(); | 123 | void passedMidnight(); |
121 | void slotMonthSelected( int m ); | 124 | void slotMonthSelected( int m ); |
122 | protected: | 125 | protected: |
123 | void updateDates(); | 126 | void updateDates(); |
124 | 127 | ||
125 | void wheelEvent (QWheelEvent *); | 128 | void wheelEvent (QWheelEvent *); |
126 | 129 | ||
127 | bool eventFilter (QObject *,QEvent *); | 130 | bool eventFilter (QObject *,QEvent *); |
128 | 131 | ||
129 | private: | 132 | private: |
130 | QSize mySizeHint; | 133 | QSize mySizeHint; |
131 | QSize myFullSizeHint; | 134 | QSize myFullSizeHint; |
132 | bool mFontChanged; | 135 | bool mFontChanged; |
133 | int mMonthSignalOffset; | 136 | int mMonthSignalOffset; |
134 | NavigatorBar *mNavigatorBar; | 137 | NavigatorBar *mNavigatorBar; |
135 | 138 | ||
136 | QFrame *headingSep; | 139 | Q3Frame *headingSep; |
137 | QFrame *weeknumSep; | 140 | Q3Frame *weeknumSep; |
138 | QLabel *headings[7]; | 141 | QLabel *headings[7]; |
139 | QLabel *weeknos[7]; | 142 | QLabel *weeknos[7]; |
140 | KODayMatrix *daymatrix; | 143 | KODayMatrix *daymatrix; |
141 | 144 | ||
142 | KCal::DateList mSelectedDates; | 145 | KCal::DateList mSelectedDates; |
143 | QDate m_MthYr; | 146 | QDate m_MthYr; |
144 | int m_fstDayOfWk; | 147 | int m_fstDayOfWk; |
145 | bool m_bShowWeekNums; | 148 | bool m_bShowWeekNums; |
146 | 149 | ||
147 | int dayNum(int row, int col); | 150 | int dayNum(int row, int col); |
148 | int dayToIndex(int dayNum); | 151 | int dayToIndex(int dayNum); |
149 | 152 | ||
150 | Calendar *mCalendar; | 153 | Calendar *mCalendar; |
151 | KCalendarSystem *mCalendarSystem; | 154 | KCalendarSystem *mCalendarSystem; |
152 | 155 | ||
153 | const QString *curHeaders; | 156 | const QString *curHeaders; |
154 | 157 | ||
155 | /** used to update the day view periodically, in particular every | 158 | /** used to update the day view periodically, in particular every |
156 | * midnight to move the "today" rectangle. | 159 | * midnight to move the "today" rectangle. |
157 | */ | 160 | */ |
158 | QTimer *updateTimer; | 161 | QTimer *updateTimer; |
159 | QDate lastDayChecked; | 162 | QDate lastDayChecked; |
160 | RolloverType updateRollover; | 163 | RolloverType updateRollover; |
161 | 164 | ||
162 | // Disabling copy constructor and assignment operator | 165 | // Disabling copy constructor and assignment operator |
163 | KDateNavigator(const KDateNavigator & ); | 166 | KDateNavigator(const KDateNavigator & ); |
164 | KDateNavigator &operator=(const KDateNavigator &); | 167 | KDateNavigator &operator=(const KDateNavigator &); |
165 | }; | 168 | }; |
166 | 169 | ||
167 | #endif | 170 | #endif |