-rw-r--r-- | korganizer/kodaymatrix.cpp | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 9c3621e..be5a775 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1,634 +1,629 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> | 3 | Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> |
4 | Parts of the source code have been copied from kdpdatebutton.cpp | 4 | Parts of the source code have been copied from kdpdatebutton.cpp |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source ode for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | #include <qtimer.h> | 28 | #include <qtimer.h> |
29 | 29 | ||
30 | #include <kglobal.h> | 30 | #include <kglobal.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | 33 | ||
34 | #include <libkcal/vcaldrag.h> | 34 | #include <libkcal/vcaldrag.h> |
35 | #include <libkcal/icaldrag.h> | 35 | #include <libkcal/icaldrag.h> |
36 | #include <libkcal/dndfactory.h> | 36 | #include <libkcal/dndfactory.h> |
37 | #include <libkcal/calendarresources.h> | 37 | #include <libkcal/calendarresources.h> |
38 | #include <libkcal/resourcecalendar.h> | 38 | #include <libkcal/resourcecalendar.h> |
39 | #include <kresources/resourceselectdialog.h> | 39 | #include <kresources/resourceselectdialog.h> |
40 | 40 | ||
41 | #include <kcalendarsystem.h> | 41 | #include <kcalendarsystem.h> |
42 | 42 | ||
43 | #ifndef KORG_NOPLUGINS | 43 | #ifndef KORG_NOPLUGINS |
44 | #include "kocore.h" | 44 | #include "kocore.h" |
45 | #endif | 45 | #endif |
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "koglobals.h" | 47 | #include "koglobals.h" |
48 | 48 | ||
49 | #include "kodaymatrix.h" | 49 | #include "kodaymatrix.h" |
50 | 50 | ||
51 | // ============================================================================ | 51 | // ============================================================================ |
52 | // D Y N A M I C T I P | 52 | // D Y N A M I C T I P |
53 | // ============================================================================ | 53 | // ============================================================================ |
54 | 54 | ||
55 | DynamicTip::DynamicTip( QWidget * parent ) | 55 | DynamicTip::DynamicTip( QWidget * parent ) |
56 | : QToolTip( parent ) | 56 | : QToolTip( parent ) |
57 | { | 57 | { |
58 | matrix = (KODayMatrix*)parent; | 58 | matrix = (KODayMatrix*)parent; |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | void DynamicTip::maybeTip( const QPoint &pos ) | 62 | void DynamicTip::maybeTip( const QPoint &pos ) |
63 | { | 63 | { |
64 | //calculate which cell of the matrix the mouse is in | 64 | //calculate which cell of the matrix the mouse is in |
65 | QRect sz = matrix->frameRect(); | 65 | QRect sz = matrix->frameRect(); |
66 | int dheight = sz.height()*7 / 42; | 66 | int dheight = sz.height()*7 / 42; |
67 | int dwidth = sz.width() / 7; | 67 | int dwidth = sz.width() / 7; |
68 | int row = pos.y()/dheight; | 68 | int row = pos.y()/dheight; |
69 | int col = pos.x()/dwidth; | 69 | int col = pos.x()/dwidth; |
70 | 70 | ||
71 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 71 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
72 | 72 | ||
73 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 73 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
74 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 74 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
75 | 75 | ||
76 | //show holiday names only | 76 | //show holiday names only |
77 | QString str = matrix->getHolidayLabel(col+row*7); | 77 | QString str = matrix->getHolidayLabel(col+row*7); |
78 | if (str.isEmpty()) return; | 78 | if (str.isEmpty()) return; |
79 | tip(rct, str); | 79 | tip(rct, str); |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | // ============================================================================ | 83 | // ============================================================================ |
84 | // K O D A Y M A T R I X | 84 | // K O D A Y M A T R I X |
85 | // ============================================================================ | 85 | // ============================================================================ |
86 | 86 | ||
87 | const int KODayMatrix::NOSELECTION = -1000; | 87 | const int KODayMatrix::NOSELECTION = -1000; |
88 | const int KODayMatrix::NUMDAYS = 42; | 88 | const int KODayMatrix::NUMDAYS = 42; |
89 | 89 | ||
90 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 90 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
91 | QFrame(parent, name) | 91 | QFrame(parent, name) |
92 | { | 92 | { |
93 | mCalendar = calendar; | 93 | mCalendar = calendar; |
94 | mPendingUpdateBeforeRepaint = false; | ||
94 | 95 | ||
95 | // initialize dynamic arrays | 96 | // initialize dynamic arrays |
96 | days = new QDate[NUMDAYS]; | 97 | days = new QDate[NUMDAYS]; |
97 | daylbls = new QString[NUMDAYS]; | 98 | daylbls = new QString[NUMDAYS]; |
98 | events = new int[NUMDAYS]; | 99 | events = new int[NUMDAYS]; |
99 | mToolTip = new DynamicTip(this); | 100 | mToolTip = new DynamicTip(this); |
100 | 101 | ||
101 | // set default values used for drawing the matrix | 102 | // set default values used for drawing the matrix |
102 | mDefaultBackColor = palette().active().base(); | 103 | mDefaultBackColor = palette().active().base(); |
103 | mDefaultTextColor = palette().active().foreground(); | 104 | mDefaultTextColor = palette().active().foreground(); |
104 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 105 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
105 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 106 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
106 | mSelectedDaysColor = QColor("white"); | 107 | mSelectedDaysColor = QColor("white"); |
107 | mTodayMarginWidth = 2; | 108 | mTodayMarginWidth = 2; |
108 | mSelEnd = mSelStart = NOSELECTION; | 109 | mSelEnd = mSelStart = NOSELECTION; |
109 | 110 | ||
110 | setAcceptDrops(true); | 111 | setAcceptDrops(true); |
111 | //setFont( QFont("Arial", 10) ); | 112 | //setFont( QFont("Arial", 10) ); |
112 | 113 | ||
113 | mUpdateTimer = new QTimer( this ); | 114 | mUpdateTimer = new QTimer( this ); |
114 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 115 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
115 | mRepaintTimer = new QTimer( this ); | 116 | mRepaintTimer = new QTimer( this ); |
116 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 117 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
117 | mDayChanged = false; | 118 | mDayChanged = false; |
118 | updateView(); | 119 | updateView(); |
119 | } | 120 | } |
120 | 121 | ||
121 | QColor KODayMatrix::getShadedColor(QColor color) | 122 | QColor KODayMatrix::getShadedColor(QColor color) |
122 | { | 123 | { |
123 | QColor shaded; | 124 | QColor shaded; |
124 | int h=0; | 125 | int h=0; |
125 | int s=0; | 126 | int s=0; |
126 | int v=0; | 127 | int v=0; |
127 | color.hsv(&h,&s,&v); | 128 | color.hsv(&h,&s,&v); |
128 | s = s/4; | 129 | s = s/4; |
129 | v = 192+v/4; | 130 | v = 192+v/4; |
130 | shaded.setHsv(h,s,v); | 131 | shaded.setHsv(h,s,v); |
131 | 132 | ||
132 | return shaded; | 133 | return shaded; |
133 | } | 134 | } |
134 | 135 | ||
135 | KODayMatrix::~KODayMatrix() | 136 | KODayMatrix::~KODayMatrix() |
136 | { | 137 | { |
137 | delete [] days; | 138 | delete [] days; |
138 | delete [] daylbls; | 139 | delete [] daylbls; |
139 | delete [] events; | 140 | delete [] events; |
140 | delete mToolTip; | 141 | delete mToolTip; |
141 | } | 142 | } |
142 | 143 | ||
143 | /* | 144 | /* |
144 | void KODayMatrix::setStartDate(QDate start) | 145 | void KODayMatrix::setStartDate(QDate start) |
145 | { | 146 | { |
146 | updateView(start); | 147 | updateView(start); |
147 | } | 148 | } |
148 | */ | 149 | */ |
149 | 150 | ||
150 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 151 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
151 | { | 152 | { |
152 | 153 | ||
153 | if (mSelStart == NOSELECTION) { | 154 | if (mSelStart == NOSELECTION) { |
154 | return; | 155 | return; |
155 | } | 156 | } |
156 | 157 | ||
157 | //cope with selection being out of matrix limits at top (< 0) | 158 | //cope with selection being out of matrix limits at top (< 0) |
158 | int i0 = mSelStart; | 159 | int i0 = mSelStart; |
159 | if (i0 < 0) { | 160 | if (i0 < 0) { |
160 | for (int i = i0; i < 0; i++) { | 161 | for (int i = i0; i < 0; i++) { |
161 | selDays.append(days[0].addDays(i)); | 162 | selDays.append(days[0].addDays(i)); |
162 | } | 163 | } |
163 | i0 = 0; | 164 | i0 = 0; |
164 | } | 165 | } |
165 | 166 | ||
166 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 167 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
167 | if (mSelEnd > NUMDAYS-1) { | 168 | if (mSelEnd > NUMDAYS-1) { |
168 | for (int i = i0; i <= NUMDAYS-1; i++) { | 169 | for (int i = i0; i <= NUMDAYS-1; i++) { |
169 | selDays.append(days[i]); | 170 | selDays.append(days[i]); |
170 | } | 171 | } |
171 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 172 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
172 | selDays.append(days[0].addDays(i)); | 173 | selDays.append(days[0].addDays(i)); |
173 | } | 174 | } |
174 | 175 | ||
175 | // apply normal routine to selection being entirely within matrix limits | 176 | // apply normal routine to selection being entirely within matrix limits |
176 | } else { | 177 | } else { |
177 | for (int i = i0; i <= mSelEnd; i++) { | 178 | for (int i = i0; i <= mSelEnd; i++) { |
178 | selDays.append(days[i]); | 179 | selDays.append(days[i]); |
179 | } | 180 | } |
180 | } | 181 | } |
181 | } | 182 | } |
182 | 183 | ||
183 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 184 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
184 | { | 185 | { |
185 | mSelStart = startdate.daysTo(start); | 186 | mSelStart = startdate.daysTo(start); |
186 | mSelEnd = startdate.daysTo(end); | 187 | mSelEnd = startdate.daysTo(end); |
187 | } | 188 | } |
188 | 189 | ||
189 | 190 | ||
190 | void KODayMatrix::recalculateToday() | 191 | void KODayMatrix::recalculateToday() |
191 | { | 192 | { |
192 | today = -1; | 193 | today = -1; |
193 | for (int i=0; i<NUMDAYS; i++) { | 194 | for (int i=0; i<NUMDAYS; i++) { |
195 | events[i] = 0; | ||
194 | days[i] = startdate.addDays(i); | 196 | days[i] = startdate.addDays(i); |
195 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 197 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
196 | 198 | ||
197 | // if today is in the currently displayed month, hilight today | 199 | // if today is in the currently displayed month, hilight today |
198 | if (days[i].year() == QDate::currentDate().year() && | 200 | if (days[i].year() == QDate::currentDate().year() && |
199 | days[i].month() == QDate::currentDate().month() && | 201 | days[i].month() == QDate::currentDate().month() && |
200 | days[i].day() == QDate::currentDate().day()) { | 202 | days[i].day() == QDate::currentDate().day()) { |
201 | today = i; | 203 | today = i; |
202 | } | 204 | } |
203 | } | 205 | } |
204 | // qDebug(QString("Today is visible at %1.").arg(today)); | 206 | // qDebug(QString("Today is visible at %1.").arg(today)); |
205 | } | 207 | } |
206 | 208 | ||
207 | void KODayMatrix::updateView() | 209 | void KODayMatrix::updateView() |
208 | { | 210 | { |
209 | updateView(startdate); | 211 | updateView(startdate); |
210 | } | 212 | } |
211 | void KODayMatrix::repaintViewTimed() | 213 | void KODayMatrix::repaintViewTimed() |
212 | { | 214 | { |
213 | qDebug("KODayMatrix::repaintViewTimed "); | 215 | //qDebug("KODayMatrix::repaintViewTimed "); |
214 | mRepaintTimer->stop(); | 216 | mRepaintTimer->stop(); |
215 | repaint(false); | 217 | repaint(false); |
216 | } | 218 | } |
217 | void KODayMatrix::updateViewTimed() | 219 | void KODayMatrix::updateViewTimed() |
218 | { | 220 | { |
219 | 221 | ||
220 | mUpdateTimer->stop(); | 222 | mUpdateTimer->stop(); |
221 | //QDate actdate = mPendingNewDate; | 223 | //qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii ); |
222 | |||
223 | static int iii = 0; | ||
224 | qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii ); | ||
225 | |||
226 | if (mDayChanged) { | ||
227 | recalculateToday(); | ||
228 | mDayChanged = false; | ||
229 | } | ||
230 | |||
231 | for(int i = 0; i < NUMDAYS; i++) { | 224 | for(int i = 0; i < NUMDAYS; i++) { |
232 | 225 | ||
233 | // if events are set for the day then remember to draw it bold | 226 | // if events are set for the day then remember to draw it bold |
234 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 227 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
235 | Event *event; | 228 | Event *event; |
236 | int numEvents = eventlist.count(); | 229 | int numEvents = eventlist.count(); |
237 | 230 | ||
238 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 231 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
239 | ushort recurType = event->recurrence()->doesRecur(); | 232 | ushort recurType = event->recurrence()->doesRecur(); |
240 | 233 | ||
241 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 234 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
242 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 235 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
243 | numEvents--; | 236 | numEvents--; |
244 | } | 237 | } |
245 | } | 238 | } |
246 | events[i] = numEvents; | 239 | events[i] = numEvents; |
247 | 240 | ||
248 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 241 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
249 | #ifndef KORG_NOPLUGINS | 242 | #ifndef KORG_NOPLUGINS |
250 | QString holiStr = KOCore::self()->holiday(days[i]); | 243 | QString holiStr = KOCore::self()->holiday(days[i]); |
251 | #else | 244 | #else |
252 | QString holiStr = QString::null; | 245 | QString holiStr = QString::null; |
253 | #endif | 246 | #endif |
254 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 247 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
255 | !holiStr.isEmpty()) { | 248 | !holiStr.isEmpty()) { |
256 | if (holiStr.isNull()) holiStr = ""; | 249 | if (holiStr.isNull()) holiStr = ""; |
257 | mHolidays[i] = holiStr; | 250 | mHolidays[i] = holiStr; |
258 | 251 | ||
259 | } else { | 252 | } else { |
260 | mHolidays[i] = QString::null; | 253 | mHolidays[i] = QString::null; |
261 | } | 254 | } |
262 | } | 255 | } |
263 | repaint(false); | 256 | if ( ! mPendingUpdateBeforeRepaint ) |
257 | repaint(false); | ||
264 | } | 258 | } |
265 | void KODayMatrix::updateView(QDate actdate) | 259 | void KODayMatrix::updateView(QDate actdate) |
266 | { | 260 | { |
267 | 261 | ||
262 | if ( ! actdate.isValid() ) { | ||
263 | //qDebug("date not valid "); | ||
264 | return; | ||
265 | } | ||
266 | mDayChanged = false; | ||
268 | //flag to indicate if the starting day of the matrix has changed by this call | 267 | //flag to indicate if the starting day of the matrix has changed by this call |
269 | //mDayChanged = false; | 268 | //mDayChanged = false; |
270 | // if a new startdate is to be set then apply Cornelius's calculation | 269 | // if a new startdate is to be set then apply Cornelius's calculation |
271 | // of the first day to be shown | 270 | // of the first day to be shown |
272 | if (actdate != startdate) { | 271 | if (actdate != startdate) { |
273 | // reset index of selection according to shift of starting date from startdate to actdate | 272 | // reset index of selection according to shift of starting date from startdate to actdate |
274 | if (mSelStart != NOSELECTION) { | 273 | if (mSelStart != NOSELECTION) { |
275 | int tmp = actdate.daysTo(startdate); | 274 | int tmp = actdate.daysTo(startdate); |
276 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 275 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
277 | // shift selection if new one would be visible at least partly ! | 276 | // shift selection if new one would be visible at least partly ! |
278 | 277 | ||
279 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 278 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
280 | // nested if is required for next X display pushed from a different month - correction required | 279 | // nested if is required for next X display pushed from a different month - correction required |
281 | // otherwise, for month forward and backward, it must be avoided | 280 | // otherwise, for month forward and backward, it must be avoided |
282 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 281 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
283 | mSelStart = mSelStart + tmp; | 282 | mSelStart = mSelStart + tmp; |
284 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 283 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
285 | mSelEnd = mSelEnd + tmp; | 284 | mSelEnd = mSelEnd + tmp; |
286 | } | 285 | } |
287 | } | 286 | } |
288 | |||
289 | startdate = actdate; | 287 | startdate = actdate; |
290 | mDayChanged = true; | 288 | mDayChanged = true; |
289 | recalculateToday(); | ||
291 | } | 290 | } |
292 | qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 291 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
293 | static int iii = 0; | 292 | if ( !isVisible() ) { |
294 | if ( iii < 2 ) { | 293 | mPendingUpdateBeforeRepaint = true; |
295 | ++iii; | ||
296 | updateViewTimed(); | ||
297 | } else { | 294 | } else { |
298 | if ( !isVisible() ) { | 295 | mRepaintTimer->start( 250 ); |
299 | mUpdateTimer->start( 2000 ); | 296 | #ifdef DESKTOP_VERSION |
300 | } else { | 297 | mUpdateTimer->start( 2000 ); |
301 | if ( mDayChanged ) { | 298 | #else |
302 | mUpdateTimer->start( 250 ); | 299 | mUpdateTimer->start( 4000 ); |
303 | } else { | 300 | #endif |
304 | mRepaintTimer->start( 250 ); | ||
305 | mUpdateTimer->start( 2000 ); | ||
306 | } | ||
307 | } | ||
308 | } | 301 | } |
309 | |||
310 | } | 302 | } |
311 | 303 | ||
312 | const QDate& KODayMatrix::getDate(int offset) | 304 | const QDate& KODayMatrix::getDate(int offset) |
313 | { | 305 | { |
314 | if (offset < 0 || offset > NUMDAYS-1) { | 306 | if (offset < 0 || offset > NUMDAYS-1) { |
315 | qDebug("Wrong offset2 "); | 307 | qDebug("Wrong offset2 "); |
316 | return days[0]; | 308 | return days[0]; |
317 | } | 309 | } |
318 | return days[offset]; | 310 | return days[offset]; |
319 | } | 311 | } |
320 | 312 | ||
321 | QString KODayMatrix::getHolidayLabel(int offset) | 313 | QString KODayMatrix::getHolidayLabel(int offset) |
322 | { | 314 | { |
323 | if (offset < 0 || offset > NUMDAYS-1) { | 315 | if (offset < 0 || offset > NUMDAYS-1) { |
324 | qDebug("Wrong offset1 "); | 316 | qDebug("Wrong offset1 "); |
325 | return 0; | 317 | return 0; |
326 | } | 318 | } |
327 | return mHolidays[offset]; | 319 | return mHolidays[offset]; |
328 | } | 320 | } |
329 | 321 | ||
330 | int KODayMatrix::getDayIndexFrom(int x, int y) | 322 | int KODayMatrix::getDayIndexFrom(int x, int y) |
331 | { | 323 | { |
332 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 324 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
333 | 6 - x/daysize.width() : x/daysize.width()); | 325 | 6 - x/daysize.width() : x/daysize.width()); |
334 | } | 326 | } |
335 | 327 | ||
336 | // ---------------------------------------------------------------------------- | 328 | // ---------------------------------------------------------------------------- |
337 | // M O U S E E V E N T H A N D L I N G | 329 | // M O U S E E V E N T H A N D L I N G |
338 | // ---------------------------------------------------------------------------- | 330 | // ---------------------------------------------------------------------------- |
339 | 331 | ||
340 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 332 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
341 | { | 333 | { |
342 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 334 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
343 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 335 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
344 | mSelInit = mSelStart; | 336 | mSelInit = mSelStart; |
345 | } | 337 | } |
346 | 338 | ||
347 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 339 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
348 | { | 340 | { |
349 | 341 | ||
350 | int tmp = getDayIndexFrom(e->x(), e->y()); | 342 | int tmp = getDayIndexFrom(e->x(), e->y()); |
351 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 343 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
352 | 344 | ||
353 | if (mSelInit > tmp) { | 345 | if (mSelInit > tmp) { |
354 | mSelEnd = mSelInit; | 346 | mSelEnd = mSelInit; |
355 | if (tmp != mSelStart) { | 347 | if (tmp != mSelStart) { |
356 | mSelStart = tmp; | 348 | mSelStart = tmp; |
357 | repaint(); | 349 | repaint(); |
358 | } | 350 | } |
359 | } else { | 351 | } else { |
360 | mSelStart = mSelInit; | 352 | mSelStart = mSelInit; |
361 | 353 | ||
362 | //repaint only if selection has changed | 354 | //repaint only if selection has changed |
363 | if (tmp != mSelEnd) { | 355 | if (tmp != mSelEnd) { |
364 | mSelEnd = tmp; | 356 | mSelEnd = tmp; |
365 | repaint(); | 357 | repaint(); |
366 | } | 358 | } |
367 | } | 359 | } |
368 | 360 | ||
369 | DateList daylist; | 361 | DateList daylist; |
370 | if ( mSelStart < 0 ) | 362 | if ( mSelStart < 0 ) |
371 | mSelStart = 0; | 363 | mSelStart = 0; |
372 | for (int i = mSelStart; i <= mSelEnd; i++) { | 364 | for (int i = mSelStart; i <= mSelEnd; i++) { |
373 | daylist.append(days[i]); | 365 | daylist.append(days[i]); |
374 | } | 366 | } |
375 | emit selected((const DateList)daylist); | 367 | emit selected((const DateList)daylist); |
376 | 368 | ||
377 | } | 369 | } |
378 | 370 | ||
379 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 371 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
380 | { | 372 | { |
381 | int tmp = getDayIndexFrom(e->x(), e->y()); | 373 | int tmp = getDayIndexFrom(e->x(), e->y()); |
382 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 374 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
383 | 375 | ||
384 | if (mSelInit > tmp) { | 376 | if (mSelInit > tmp) { |
385 | mSelEnd = mSelInit; | 377 | mSelEnd = mSelInit; |
386 | if (tmp != mSelStart) { | 378 | if (tmp != mSelStart) { |
387 | mSelStart = tmp; | 379 | mSelStart = tmp; |
388 | repaint(); | 380 | repaint(); |
389 | } | 381 | } |
390 | } else { | 382 | } else { |
391 | mSelStart = mSelInit; | 383 | mSelStart = mSelInit; |
392 | 384 | ||
393 | //repaint only if selection has changed | 385 | //repaint only if selection has changed |
394 | if (tmp != mSelEnd) { | 386 | if (tmp != mSelEnd) { |
395 | mSelEnd = tmp; | 387 | mSelEnd = tmp; |
396 | repaint(); | 388 | repaint(); |
397 | } | 389 | } |
398 | } | 390 | } |
399 | } | 391 | } |
400 | 392 | ||
401 | // ---------------------------------------------------------------------------- | 393 | // ---------------------------------------------------------------------------- |
402 | // D R A G ' N D R O P H A N D L I N G | 394 | // D R A G ' N D R O P H A N D L I N G |
403 | // ---------------------------------------------------------------------------- | 395 | // ---------------------------------------------------------------------------- |
404 | 396 | ||
405 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) | 397 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) |
406 | { | 398 | { |
407 | #ifndef KORG_NODND | 399 | #ifndef KORG_NODND |
408 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 400 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
409 | e->ignore(); | 401 | e->ignore(); |
410 | return; | 402 | return; |
411 | } | 403 | } |
412 | 404 | ||
413 | // some visual feedback | 405 | // some visual feedback |
414 | // oldPalette = palette(); | 406 | // oldPalette = palette(); |
415 | // setPalette(my_HilitePalette); | 407 | // setPalette(my_HilitePalette); |
416 | // update(); | 408 | // update(); |
417 | #endif | 409 | #endif |
418 | } | 410 | } |
419 | 411 | ||
420 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) | 412 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) |
421 | { | 413 | { |
422 | #ifndef KORG_NODND | 414 | #ifndef KORG_NODND |
423 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 415 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
424 | e->ignore(); | 416 | e->ignore(); |
425 | return; | 417 | return; |
426 | } | 418 | } |
427 | 419 | ||
428 | e->accept(); | 420 | e->accept(); |
429 | #endif | 421 | #endif |
430 | } | 422 | } |
431 | 423 | ||
432 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) | 424 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) |
433 | { | 425 | { |
434 | #ifndef KORG_NODND | 426 | #ifndef KORG_NODND |
435 | // setPalette(oldPalette); | 427 | // setPalette(oldPalette); |
436 | // update(); | 428 | // update(); |
437 | #endif | 429 | #endif |
438 | } | 430 | } |
439 | 431 | ||
440 | void KODayMatrix::dropEvent(QDropEvent *e) | 432 | void KODayMatrix::dropEvent(QDropEvent *e) |
441 | { | 433 | { |
442 | #ifndef KORG_NODND | 434 | #ifndef KORG_NODND |
443 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; | 435 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; |
444 | 436 | ||
445 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 437 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
446 | e->ignore(); | 438 | e->ignore(); |
447 | return; | 439 | return; |
448 | } | 440 | } |
449 | 441 | ||
450 | DndFactory factory( mCalendar ); | 442 | DndFactory factory( mCalendar ); |
451 | Event *event = factory.createDrop(e); | 443 | Event *event = factory.createDrop(e); |
452 | 444 | ||
453 | if (event) { | 445 | if (event) { |
454 | e->acceptAction(); | 446 | e->acceptAction(); |
455 | 447 | ||
456 | Event *existingEvent = mCalendar->event(event->uid()); | 448 | Event *existingEvent = mCalendar->event(event->uid()); |
457 | 449 | ||
458 | if(existingEvent) { | 450 | if(existingEvent) { |
459 | // uniquify event | 451 | // uniquify event |
460 | event->recreate(); | 452 | event->recreate(); |
461 | /* | 453 | /* |
462 | KMessageBox::sorry(this, | 454 | KMessageBox::sorry(this, |
463 | i18n("Event already exists in this calendar."), | 455 | i18n("Event already exists in this calendar."), |
464 | i18n("Drop Event")); | 456 | i18n("Drop Event")); |
465 | delete event; | 457 | delete event; |
466 | return; | 458 | return; |
467 | */ | 459 | */ |
468 | } | 460 | } |
469 | // kdDebug() << "Drop new Event" << endl; | 461 | // kdDebug() << "Drop new Event" << endl; |
470 | // Adjust date | 462 | // Adjust date |
471 | QDateTime start = event->dtStart(); | 463 | QDateTime start = event->dtStart(); |
472 | QDateTime end = event->dtEnd(); | 464 | QDateTime end = event->dtEnd(); |
473 | int duration = start.daysTo(end); | 465 | int duration = start.daysTo(end); |
474 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); | 466 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); |
475 | 467 | ||
476 | start.setDate(days[idx]); | 468 | start.setDate(days[idx]); |
477 | end.setDate(days[idx].addDays(duration)); | 469 | end.setDate(days[idx].addDays(duration)); |
478 | 470 | ||
479 | event->setDtStart(start); | 471 | event->setDtStart(start); |
480 | event->setDtEnd(end); | 472 | event->setDtEnd(end); |
481 | mCalendar->addEvent(event); | 473 | mCalendar->addEvent(event); |
482 | 474 | ||
483 | emit eventDropped(event); | 475 | emit eventDropped(event); |
484 | } else { | 476 | } else { |
485 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; | 477 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; |
486 | e->ignore(); | 478 | e->ignore(); |
487 | } | 479 | } |
488 | #endif | 480 | #endif |
489 | } | 481 | } |
490 | 482 | ||
491 | // ---------------------------------------------------------------------------- | 483 | // ---------------------------------------------------------------------------- |
492 | // P A I N T E V E N T H A N D L I N G | 484 | // P A I N T E V E N T H A N D L I N G |
493 | // ---------------------------------------------------------------------------- | 485 | // ---------------------------------------------------------------------------- |
494 | 486 | ||
495 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 487 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
496 | { | 488 | { |
497 | //kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; | 489 | //kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; |
498 | 490 | if ( mPendingUpdateBeforeRepaint ) { | |
491 | updateViewTimed(); | ||
492 | mPendingUpdateBeforeRepaint = false; | ||
493 | } | ||
499 | QPainter p(this); | 494 | QPainter p(this); |
500 | 495 | ||
501 | QRect sz = frameRect(); | 496 | QRect sz = frameRect(); |
502 | int dheight = daysize.height(); | 497 | int dheight = daysize.height(); |
503 | int dwidth = daysize.width(); | 498 | int dwidth = daysize.width(); |
504 | int row,col; | 499 | int row,col; |
505 | int selw, selh; | 500 | int selw, selh; |
506 | bool isRTL = KOGlobals::self()->reverseLayout(); | 501 | bool isRTL = KOGlobals::self()->reverseLayout(); |
507 | 502 | ||
508 | // draw background and topleft frame | 503 | // draw background and topleft frame |
509 | p.fillRect(pevent->rect(), mDefaultBackColor); | 504 | p.fillRect(pevent->rect(), mDefaultBackColor); |
510 | p.setPen(mDefaultTextColor); | 505 | p.setPen(mDefaultTextColor); |
511 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); | 506 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); |
512 | 507 | ||
513 | // draw selected days with highlighted background color | 508 | // draw selected days with highlighted background color |
514 | if (mSelStart != NOSELECTION) { | 509 | if (mSelStart != NOSELECTION) { |
515 | 510 | ||
516 | row = mSelStart/7; | 511 | row = mSelStart/7; |
517 | col = mSelStart -row*7; | 512 | col = mSelStart -row*7; |
518 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 513 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
519 | 514 | ||
520 | if (row == mSelEnd/7) { | 515 | if (row == mSelEnd/7) { |
521 | // Single row selection | 516 | // Single row selection |
522 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, | 517 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, |
523 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); | 518 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); |
524 | } else { | 519 | } else { |
525 | // draw first row to the right | 520 | // draw first row to the right |
526 | p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, | 521 | p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, |
527 | dheight, selcol); | 522 | dheight, selcol); |
528 | // draw full block till last line | 523 | // draw full block till last line |
529 | selh = mSelEnd/7-row; | 524 | selh = mSelEnd/7-row; |
530 | if (selh > 1) { | 525 | if (selh > 1) { |
531 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); | 526 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); |
532 | } | 527 | } |
533 | // draw last block from left to mSelEnd | 528 | // draw last block from left to mSelEnd |
534 | selw = mSelEnd-7*(mSelEnd/7)+1; | 529 | selw = mSelEnd-7*(mSelEnd/7)+1; |
535 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, | 530 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, |
536 | selw*dwidth, dheight, selcol); | 531 | selw*dwidth, dheight, selcol); |
537 | } | 532 | } |
538 | } | 533 | } |
539 | 534 | ||
540 | // iterate over all days in the matrix and draw the day label in appropriate colors | 535 | // iterate over all days in the matrix and draw the day label in appropriate colors |
541 | QColor actcol = mDefaultTextColorShaded; | 536 | QColor actcol = mDefaultTextColorShaded; |
542 | p.setPen(actcol); | 537 | p.setPen(actcol); |
543 | QPen tmppen; | 538 | QPen tmppen; |
544 | for(int i = 0; i < NUMDAYS; i++) { | 539 | for(int i = 0; i < NUMDAYS; i++) { |
545 | row = i/7; | 540 | row = i/7; |
546 | col = isRTL ? 6-(i-row*7) : i-row*7; | 541 | col = isRTL ? 6-(i-row*7) : i-row*7; |
547 | 542 | ||
548 | // if it is the first day of a month switch color from normal to shaded and vice versa | 543 | // if it is the first day of a month switch color from normal to shaded and vice versa |
549 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 544 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
550 | if (actcol == mDefaultTextColorShaded) { | 545 | if (actcol == mDefaultTextColorShaded) { |
551 | actcol = mDefaultTextColor; | 546 | actcol = mDefaultTextColor; |
552 | } else { | 547 | } else { |
553 | actcol = mDefaultTextColorShaded; | 548 | actcol = mDefaultTextColorShaded; |
554 | } | 549 | } |
555 | p.setPen(actcol); | 550 | p.setPen(actcol); |
556 | } | 551 | } |
557 | 552 | ||
558 | //Reset pen color after selected days block | 553 | //Reset pen color after selected days block |
559 | if (i == mSelEnd+1) { | 554 | if (i == mSelEnd+1) { |
560 | p.setPen(actcol); | 555 | p.setPen(actcol); |
561 | } | 556 | } |
562 | 557 | ||
563 | // if today then draw rectangle around day | 558 | // if today then draw rectangle around day |
564 | if (today == i) { | 559 | if (today == i) { |
565 | tmppen = p.pen(); | 560 | tmppen = p.pen(); |
566 | QPen mTodayPen(p.pen()); | 561 | QPen mTodayPen(p.pen()); |
567 | 562 | ||
568 | mTodayPen.setWidth(mTodayMarginWidth); | 563 | mTodayPen.setWidth(mTodayMarginWidth); |
569 | //draw red rectangle for holidays | 564 | //draw red rectangle for holidays |
570 | if (!mHolidays[i].isNull()) { | 565 | if (!mHolidays[i].isNull()) { |
571 | if (actcol == mDefaultTextColor) { | 566 | if (actcol == mDefaultTextColor) { |
572 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 567 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
573 | } else { | 568 | } else { |
574 | mTodayPen.setColor(mHolidayColorShaded); | 569 | mTodayPen.setColor(mHolidayColorShaded); |
575 | } | 570 | } |
576 | } | 571 | } |
577 | //draw gray rectangle for today if in selection | 572 | //draw gray rectangle for today if in selection |
578 | if (i >= mSelStart && i <= mSelEnd) { | 573 | if (i >= mSelStart && i <= mSelEnd) { |
579 | QColor grey("grey"); | 574 | QColor grey("grey"); |
580 | mTodayPen.setColor(grey); | 575 | mTodayPen.setColor(grey); |
581 | } | 576 | } |
582 | p.setPen(mTodayPen); | 577 | p.setPen(mTodayPen); |
583 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); | 578 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); |
584 | p.setPen(tmppen); | 579 | p.setPen(tmppen); |
585 | } | 580 | } |
586 | 581 | ||
587 | // if any events are on that day then draw it using a bold font | 582 | // if any events are on that day then draw it using a bold font |
588 | if (events[i] > 0) { | 583 | if (events[i] > 0) { |
589 | QFont myFont = font(); | 584 | QFont myFont = font(); |
590 | myFont.setBold(true); | 585 | myFont.setBold(true); |
591 | p.setFont(myFont); | 586 | p.setFont(myFont); |
592 | } | 587 | } |
593 | 588 | ||
594 | // if it is a holiday then use the default holiday color | 589 | // if it is a holiday then use the default holiday color |
595 | if (!mHolidays[i].isNull()) { | 590 | if (!mHolidays[i].isNull()) { |
596 | if (actcol == mDefaultTextColor) { | 591 | if (actcol == mDefaultTextColor) { |
597 | p.setPen(KOPrefs::instance()->mHolidayColor); | 592 | p.setPen(KOPrefs::instance()->mHolidayColor); |
598 | } else { | 593 | } else { |
599 | p.setPen(mHolidayColorShaded); | 594 | p.setPen(mHolidayColorShaded); |
600 | } | 595 | } |
601 | } | 596 | } |
602 | 597 | ||
603 | // draw selected days with special color | 598 | // draw selected days with special color |
604 | // DO NOT specially highlight holidays in selection ! | 599 | // DO NOT specially highlight holidays in selection ! |
605 | if (i >= mSelStart && i <= mSelEnd) { | 600 | if (i >= mSelStart && i <= mSelEnd) { |
606 | p.setPen(mSelectedDaysColor); | 601 | p.setPen(mSelectedDaysColor); |
607 | } | 602 | } |
608 | 603 | ||
609 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, | 604 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, |
610 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 605 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
611 | 606 | ||
612 | // reset color to actual color | 607 | // reset color to actual color |
613 | if (!mHolidays[i].isNull()) { | 608 | if (!mHolidays[i].isNull()) { |
614 | p.setPen(actcol); | 609 | p.setPen(actcol); |
615 | } | 610 | } |
616 | // reset bold font to plain font | 611 | // reset bold font to plain font |
617 | if (events[i] > 0) { | 612 | if (events[i] > 0) { |
618 | QFont myFont = font(); | 613 | QFont myFont = font(); |
619 | myFont.setBold(false); | 614 | myFont.setBold(false); |
620 | p.setFont(myFont); | 615 | p.setFont(myFont); |
621 | } | 616 | } |
622 | } | 617 | } |
623 | } | 618 | } |
624 | 619 | ||
625 | // ---------------------------------------------------------------------------- | 620 | // ---------------------------------------------------------------------------- |
626 | // R E SI Z E E V E N T H A N D L I N G | 621 | // R E SI Z E E V E N T H A N D L I N G |
627 | // ---------------------------------------------------------------------------- | 622 | // ---------------------------------------------------------------------------- |
628 | 623 | ||
629 | void KODayMatrix::resizeEvent(QResizeEvent *) | 624 | void KODayMatrix::resizeEvent(QResizeEvent *) |
630 | { | 625 | { |
631 | QRect sz = frameRect(); | 626 | QRect sz = frameRect(); |
632 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 627 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
633 | daysize.setWidth(sz.width() / 7); | 628 | daysize.setWidth(sz.width() / 7); |
634 | } | 629 | } |