-rw-r--r-- | korganizer/kdatenavigator.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/kdatenavigator.h b/korganizer/kdatenavigator.h index 292e71c..3177687 100644 --- a/korganizer/kdatenavigator.h +++ b/korganizer/kdatenavigator.h | |||
@@ -1,154 +1,160 @@ | |||
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 & , bool doRepaint = true ); | 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; } | 67 | QSize yourSizeHint() { return mySizeHint; } |
68 | KODayMatrix *dayMatrix() { return daymatrix ;} | 68 | QFont yourFontHint( QSize , bool * b); |
69 | bool fontChanged() {return mFontChanged; } | ||
70 | void unsetFontChanged() { mFontChanged = false; } | ||
71 | KODayMatrix *dayMatrix() { return daymatrix ;} | ||
72 | QSize sizeHint() const; | ||
73 | void changeFont ( QFont fo ); | ||
69 | public slots: | 74 | public slots: |
70 | void selectDates( const KCal::DateList & ); | 75 | void selectDates( const KCal::DateList & ); |
71 | void updateView(); | 76 | void updateView(); |
72 | void updateConfig(); | 77 | void updateConfig(); |
73 | void updateDayMatrix(); | 78 | void updateDayMatrix(); |
74 | 79 | ||
75 | signals: | 80 | signals: |
76 | void datesSelected( const KCal::DateList & ); | 81 | void datesSelected( const KCal::DateList & ); |
77 | void eventDropped( Event * ); | 82 | void eventDropped( Event * ); |
78 | void weekClicked( const QDate &); | 83 | void weekClicked( const QDate &); |
79 | 84 | ||
80 | void goPrevious(); | 85 | void goPrevious(); |
81 | void goNext(); | 86 | void goNext(); |
82 | 87 | ||
83 | void goNextMonth(); | 88 | void goNextMonth(); |
84 | void goPrevMonth(); | 89 | void goPrevMonth(); |
85 | void goNextYear(); | 90 | void goNextYear(); |
86 | void goPrevYear(); | 91 | void goPrevYear(); |
87 | void monthSelected( int ); | 92 | void monthSelected( int ); |
88 | 93 | ||
89 | // Signals emitted at midnight carrying the new date. | 94 | // Signals emitted at midnight carrying the new date. |
90 | void dayPassed( QDate ); | 95 | void dayPassed( QDate ); |
91 | void monthPassed( QDate ); | 96 | void monthPassed( QDate ); |
92 | 97 | ||
93 | protected slots: | 98 | protected slots: |
94 | 99 | ||
95 | /** | 100 | /** |
96 | * Called regularly to see if we need to update the view | 101 | * Called regularly to see if we need to update the view |
97 | * wrt. the today box and the month box. Only important | 102 | * wrt. the today box and the month box. Only important |
98 | * if you leave KOrganizer idle for long periods of time. | 103 | * if you leave KOrganizer idle for long periods of time. |
99 | * | 104 | * |
100 | * Until we have a reliable way of setting QTimers to go | 105 | * Until we have a reliable way of setting QTimers to go |
101 | * off at a particular wall-clock time, we need this, | 106 | * off at a particular wall-clock time, we need this, |
102 | * which calls passedMidnight() at the right moments. | 107 | * which calls passedMidnight() at the right moments. |
103 | */ | 108 | */ |
104 | void possiblyPastMidnight(); | 109 | void possiblyPastMidnight(); |
105 | 110 | ||
106 | /** handles updating the view when midnight has come by due to idle time. | 111 | /** handles updating the view when midnight has come by due to idle time. |
107 | * | 112 | * |
108 | */ | 113 | */ |
109 | void passedMidnight(); | 114 | void passedMidnight(); |
110 | void slotMonthSelected( int m ); | 115 | void slotMonthSelected( int m ); |
111 | protected: | 116 | protected: |
112 | void updateDates(); | 117 | void updateDates(); |
113 | 118 | ||
114 | void wheelEvent (QWheelEvent *); | 119 | void wheelEvent (QWheelEvent *); |
115 | 120 | ||
116 | bool eventFilter (QObject *,QEvent *); | 121 | bool eventFilter (QObject *,QEvent *); |
117 | 122 | ||
118 | private: | 123 | private: |
119 | QSize mySizeHint; | 124 | QSize mySizeHint; |
125 | bool mFontChanged; | ||
120 | int mMonthSignalOffset; | 126 | int mMonthSignalOffset; |
121 | NavigatorBar *mNavigatorBar; | 127 | NavigatorBar *mNavigatorBar; |
122 | 128 | ||
123 | QFrame *headingSep; | 129 | QFrame *headingSep; |
124 | QFrame *weeknumSep; | 130 | QFrame *weeknumSep; |
125 | QLabel *headings[7]; | 131 | QLabel *headings[7]; |
126 | QLabel *weeknos[7]; | 132 | QLabel *weeknos[7]; |
127 | KODayMatrix *daymatrix; | 133 | KODayMatrix *daymatrix; |
128 | 134 | ||
129 | KCal::DateList mSelectedDates; | 135 | KCal::DateList mSelectedDates; |
130 | QDate m_MthYr; | 136 | QDate m_MthYr; |
131 | int m_fstDayOfWk; | 137 | int m_fstDayOfWk; |
132 | bool m_bShowWeekNums; | 138 | bool m_bShowWeekNums; |
133 | 139 | ||
134 | int dayNum(int row, int col); | 140 | int dayNum(int row, int col); |
135 | int dayToIndex(int dayNum); | 141 | int dayToIndex(int dayNum); |
136 | 142 | ||
137 | Calendar *mCalendar; | 143 | Calendar *mCalendar; |
138 | KCalendarSystem *mCalendarSystem; | 144 | KCalendarSystem *mCalendarSystem; |
139 | 145 | ||
140 | const QString *curHeaders; | 146 | const QString *curHeaders; |
141 | 147 | ||
142 | /** used to update the day view periodically, in particular every | 148 | /** used to update the day view periodically, in particular every |
143 | * midnight to move the "today" rectangle. | 149 | * midnight to move the "today" rectangle. |
144 | */ | 150 | */ |
145 | QTimer *updateTimer; | 151 | QTimer *updateTimer; |
146 | QDate lastDayChecked; | 152 | QDate lastDayChecked; |
147 | RolloverType updateRollover; | 153 | RolloverType updateRollover; |
148 | 154 | ||
149 | // Disabling copy constructor and assignment operator | 155 | // Disabling copy constructor and assignment operator |
150 | KDateNavigator(const KDateNavigator & ); | 156 | KDateNavigator(const KDateNavigator & ); |
151 | KDateNavigator &operator=(const KDateNavigator &); | 157 | KDateNavigator &operator=(const KDateNavigator &); |
152 | }; | 158 | }; |
153 | 159 | ||
154 | #endif | 160 | #endif |