author | zautrix <zautrix> | 2005-01-31 08:46:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 08:46:08 (UTC) |
commit | 9b13105b4cc0ede4ca2d01a3d998fdb90bf67b58 (patch) (unidiff) | |
tree | db736dd6d3615d46db1bf1d32965a5872d3cc0d4 | |
parent | f7663a4c854d217bcb4f828a3ebb69cc40d0dd7c (diff) | |
download | kdepimpi-9b13105b4cc0ede4ca2d01a3d998fdb90bf67b58.zip kdepimpi-9b13105b4cc0ede4ca2d01a3d998fdb90bf67b58.tar.gz kdepimpi-9b13105b4cc0ede4ca2d01a3d998fdb90bf67b58.tar.bz2 |
fix
-rw-r--r-- | korganizer/kodaymatrix.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index be5a775..9812321 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1,629 +1,630 @@ | |||
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 ode 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 | mPendingUpdateBeforeRepaint = false; |
95 | 95 | ||
96 | // initialize dynamic arrays | 96 | // initialize dynamic arrays |
97 | days = new QDate[NUMDAYS]; | 97 | days = new QDate[NUMDAYS]; |
98 | daylbls = new QString[NUMDAYS]; | 98 | daylbls = new QString[NUMDAYS]; |
99 | events = new int[NUMDAYS]; | 99 | events = new int[NUMDAYS]; |
100 | mToolTip = new DynamicTip(this); | 100 | mToolTip = new DynamicTip(this); |
101 | 101 | ||
102 | // set default values used for drawing the matrix | 102 | // set default values used for drawing the matrix |
103 | mDefaultBackColor = palette().active().base(); | 103 | mDefaultBackColor = palette().active().base(); |
104 | mDefaultTextColor = palette().active().foreground(); | 104 | mDefaultTextColor = palette().active().foreground(); |
105 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 105 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
106 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 106 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
107 | mSelectedDaysColor = QColor("white"); | 107 | mSelectedDaysColor = QColor("white"); |
108 | mTodayMarginWidth = 2; | 108 | mTodayMarginWidth = 2; |
109 | mSelEnd = mSelStart = NOSELECTION; | 109 | mSelEnd = mSelStart = NOSELECTION; |
110 | 110 | ||
111 | setAcceptDrops(true); | 111 | setAcceptDrops(true); |
112 | //setFont( QFont("Arial", 10) ); | 112 | //setFont( QFont("Arial", 10) ); |
113 | 113 | ||
114 | mUpdateTimer = new QTimer( this ); | 114 | mUpdateTimer = new QTimer( this ); |
115 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 115 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
116 | mRepaintTimer = new QTimer( this ); | 116 | mRepaintTimer = new QTimer( this ); |
117 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 117 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
118 | mDayChanged = false; | 118 | mDayChanged = false; |
119 | updateView(); | 119 | updateView(); |
120 | } | 120 | } |
121 | 121 | ||
122 | QColor KODayMatrix::getShadedColor(QColor color) | 122 | QColor KODayMatrix::getShadedColor(QColor color) |
123 | { | 123 | { |
124 | QColor shaded; | 124 | QColor shaded; |
125 | int h=0; | 125 | int h=0; |
126 | int s=0; | 126 | int s=0; |
127 | int v=0; | 127 | int v=0; |
128 | color.hsv(&h,&s,&v); | 128 | color.hsv(&h,&s,&v); |
129 | s = s/4; | 129 | s = s/4; |
130 | v = 192+v/4; | 130 | v = 192+v/4; |
131 | shaded.setHsv(h,s,v); | 131 | shaded.setHsv(h,s,v); |
132 | 132 | ||
133 | return shaded; | 133 | return shaded; |
134 | } | 134 | } |
135 | 135 | ||
136 | KODayMatrix::~KODayMatrix() | 136 | KODayMatrix::~KODayMatrix() |
137 | { | 137 | { |
138 | delete [] days; | 138 | delete [] days; |
139 | delete [] daylbls; | 139 | delete [] daylbls; |
140 | delete [] events; | 140 | delete [] events; |
141 | delete mToolTip; | 141 | delete mToolTip; |
142 | } | 142 | } |
143 | 143 | ||
144 | /* | 144 | /* |
145 | void KODayMatrix::setStartDate(QDate start) | 145 | void KODayMatrix::setStartDate(QDate start) |
146 | { | 146 | { |
147 | updateView(start); | 147 | updateView(start); |
148 | } | 148 | } |
149 | */ | 149 | */ |
150 | 150 | ||
151 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 151 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
152 | { | 152 | { |
153 | 153 | ||
154 | if (mSelStart == NOSELECTION) { | 154 | if (mSelStart == NOSELECTION) { |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | 157 | ||
158 | //cope with selection being out of matrix limits at top (< 0) | 158 | //cope with selection being out of matrix limits at top (< 0) |
159 | int i0 = mSelStart; | 159 | int i0 = mSelStart; |
160 | if (i0 < 0) { | 160 | if (i0 < 0) { |
161 | for (int i = i0; i < 0; i++) { | 161 | for (int i = i0; i < 0; i++) { |
162 | selDays.append(days[0].addDays(i)); | 162 | selDays.append(days[0].addDays(i)); |
163 | } | 163 | } |
164 | i0 = 0; | 164 | i0 = 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | //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) |
168 | if (mSelEnd > NUMDAYS-1) { | 168 | if (mSelEnd > NUMDAYS-1) { |
169 | for (int i = i0; i <= NUMDAYS-1; i++) { | 169 | for (int i = i0; i <= NUMDAYS-1; i++) { |
170 | selDays.append(days[i]); | 170 | selDays.append(days[i]); |
171 | } | 171 | } |
172 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 172 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
173 | selDays.append(days[0].addDays(i)); | 173 | selDays.append(days[0].addDays(i)); |
174 | } | 174 | } |
175 | 175 | ||
176 | // apply normal routine to selection being entirely within matrix limits | 176 | // apply normal routine to selection being entirely within matrix limits |
177 | } else { | 177 | } else { |
178 | for (int i = i0; i <= mSelEnd; i++) { | 178 | for (int i = i0; i <= mSelEnd; i++) { |
179 | selDays.append(days[i]); | 179 | selDays.append(days[i]); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 184 | void KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
185 | { | 185 | { |
186 | mSelStart = startdate.daysTo(start); | 186 | mSelStart = startdate.daysTo(start); |
187 | mSelEnd = startdate.daysTo(end); | 187 | mSelEnd = startdate.daysTo(end); |
188 | } | 188 | } |
189 | 189 | ||
190 | 190 | ||
191 | void KODayMatrix::recalculateToday() | 191 | void KODayMatrix::recalculateToday() |
192 | { | 192 | { |
193 | today = -1; | 193 | today = -1; |
194 | for (int i=0; i<NUMDAYS; i++) { | 194 | for (int i=0; i<NUMDAYS; i++) { |
195 | events[i] = 0; | 195 | events[i] = 0; |
196 | days[i] = startdate.addDays(i); | 196 | days[i] = startdate.addDays(i); |
197 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 197 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
198 | 198 | ||
199 | // if today is in the currently displayed month, hilight today | 199 | // if today is in the currently displayed month, hilight today |
200 | if (days[i].year() == QDate::currentDate().year() && | 200 | if (days[i].year() == QDate::currentDate().year() && |
201 | days[i].month() == QDate::currentDate().month() && | 201 | days[i].month() == QDate::currentDate().month() && |
202 | days[i].day() == QDate::currentDate().day()) { | 202 | days[i].day() == QDate::currentDate().day()) { |
203 | today = i; | 203 | today = i; |
204 | } | 204 | } |
205 | } | 205 | } |
206 | // qDebug(QString("Today is visible at %1.").arg(today)); | 206 | // qDebug(QString("Today is visible at %1.").arg(today)); |
207 | } | 207 | } |
208 | 208 | ||
209 | void KODayMatrix::updateView() | 209 | void KODayMatrix::updateView() |
210 | { | 210 | { |
211 | updateView(startdate); | 211 | updateView(startdate); |
212 | } | 212 | } |
213 | void KODayMatrix::repaintViewTimed() | 213 | void KODayMatrix::repaintViewTimed() |
214 | { | 214 | { |
215 | //qDebug("KODayMatrix::repaintViewTimed "); | 215 | //qDebug("KODayMatrix::repaintViewTimed "); |
216 | mRepaintTimer->stop(); | 216 | mRepaintTimer->stop(); |
217 | repaint(false); | 217 | repaint(false); |
218 | } | 218 | } |
219 | void KODayMatrix::updateViewTimed() | 219 | void KODayMatrix::updateViewTimed() |
220 | { | 220 | { |
221 | 221 | ||
222 | mUpdateTimer->stop(); | 222 | mUpdateTimer->stop(); |
223 | //qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii ); | 223 | //qDebug("KODayMatrix::updateView(QDate actdate) %d", ++iii ); |
224 | for(int i = 0; i < NUMDAYS; i++) { | 224 | for(int i = 0; i < NUMDAYS; i++) { |
225 | 225 | ||
226 | // 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 |
227 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 227 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
228 | Event *event; | 228 | Event *event; |
229 | int numEvents = eventlist.count(); | 229 | int numEvents = eventlist.count(); |
230 | 230 | ||
231 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 231 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
232 | ushort recurType = event->recurrence()->doesRecur(); | 232 | ushort recurType = event->recurrence()->doesRecur(); |
233 | 233 | ||
234 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 234 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
235 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 235 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
236 | numEvents--; | 236 | numEvents--; |
237 | } | 237 | } |
238 | } | 238 | } |
239 | events[i] = numEvents; | 239 | events[i] = numEvents; |
240 | 240 | ||
241 | //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 |
242 | #ifndef KORG_NOPLUGINS | 242 | #ifndef KORG_NOPLUGINS |
243 | QString holiStr = KOCore::self()->holiday(days[i]); | 243 | QString holiStr = KOCore::self()->holiday(days[i]); |
244 | #else | 244 | #else |
245 | QString holiStr = QString::null; | 245 | QString holiStr = QString::null; |
246 | #endif | 246 | #endif |
247 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 247 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
248 | !holiStr.isEmpty()) { | 248 | !holiStr.isEmpty()) { |
249 | if (holiStr.isNull()) holiStr = ""; | 249 | if (holiStr.isNull()) holiStr = ""; |
250 | mHolidays[i] = holiStr; | 250 | mHolidays[i] = holiStr; |
251 | 251 | ||
252 | } else { | 252 | } else { |
253 | mHolidays[i] = QString::null; | 253 | mHolidays[i] = QString::null; |
254 | } | 254 | } |
255 | } | 255 | } |
256 | if ( ! mPendingUpdateBeforeRepaint ) | 256 | if ( ! mPendingUpdateBeforeRepaint ) |
257 | repaint(false); | 257 | repaint(false); |
258 | } | 258 | } |
259 | void KODayMatrix::updateView(QDate actdate) | 259 | void KODayMatrix::updateView(QDate actdate) |
260 | { | 260 | { |
261 | 261 | ||
262 | if ( ! actdate.isValid() ) { | 262 | if ( ! actdate.isValid() ) { |
263 | //qDebug("date not valid "); | 263 | //qDebug("date not valid "); |
264 | return; | 264 | return; |
265 | } | 265 | } |
266 | mDayChanged = false; | 266 | mDayChanged = false; |
267 | //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 |
268 | //mDayChanged = false; | 268 | //mDayChanged = false; |
269 | // 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 |
270 | // of the first day to be shown | 270 | // of the first day to be shown |
271 | if (actdate != startdate) { | 271 | if (actdate != startdate) { |
272 | // 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 |
273 | if (mSelStart != NOSELECTION) { | 273 | if (mSelStart != NOSELECTION) { |
274 | int tmp = actdate.daysTo(startdate); | 274 | int tmp = actdate.daysTo(startdate); |
275 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 275 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
276 | // shift selection if new one would be visible at least partly ! | 276 | // shift selection if new one would be visible at least partly ! |
277 | 277 | ||
278 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 278 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
279 | // 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 |
280 | // otherwise, for month forward and backward, it must be avoided | 280 | // otherwise, for month forward and backward, it must be avoided |
281 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 281 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
282 | mSelStart = mSelStart + tmp; | 282 | mSelStart = mSelStart + tmp; |
283 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 283 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
284 | mSelEnd = mSelEnd + tmp; | 284 | mSelEnd = mSelEnd + tmp; |
285 | } | 285 | } |
286 | } | 286 | } |
287 | startdate = actdate; | 287 | startdate = actdate; |
288 | mDayChanged = true; | 288 | mDayChanged = true; |
289 | recalculateToday(); | 289 | recalculateToday(); |
290 | } | 290 | } |
291 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 291 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
292 | if ( !isVisible() ) { | 292 | if ( !isVisible() ) { |
293 | mPendingUpdateBeforeRepaint = true; | 293 | mPendingUpdateBeforeRepaint = true; |
294 | } else { | 294 | } else { |
295 | mRepaintTimer->start( 250 ); | ||
296 | #ifdef DESKTOP_VERSION | 295 | #ifdef DESKTOP_VERSION |
296 | mRepaintTimer->start( 250 ); | ||
297 | mUpdateTimer->start( 2000 ); | 297 | mUpdateTimer->start( 2000 ); |
298 | #else | 298 | #else |
299 | mRepaintTimer->start( 350 ); | ||
299 | mUpdateTimer->start( 4000 ); | 300 | mUpdateTimer->start( 4000 ); |
300 | #endif | 301 | #endif |
301 | } | 302 | } |
302 | } | 303 | } |
303 | 304 | ||
304 | const QDate& KODayMatrix::getDate(int offset) | 305 | const QDate& KODayMatrix::getDate(int offset) |
305 | { | 306 | { |
306 | if (offset < 0 || offset > NUMDAYS-1) { | 307 | if (offset < 0 || offset > NUMDAYS-1) { |
307 | qDebug("Wrong offset2 "); | 308 | qDebug("Wrong offset2 "); |
308 | return days[0]; | 309 | return days[0]; |
309 | } | 310 | } |
310 | return days[offset]; | 311 | return days[offset]; |
311 | } | 312 | } |
312 | 313 | ||
313 | QString KODayMatrix::getHolidayLabel(int offset) | 314 | QString KODayMatrix::getHolidayLabel(int offset) |
314 | { | 315 | { |
315 | if (offset < 0 || offset > NUMDAYS-1) { | 316 | if (offset < 0 || offset > NUMDAYS-1) { |
316 | qDebug("Wrong offset1 "); | 317 | qDebug("Wrong offset1 "); |
317 | return 0; | 318 | return 0; |
318 | } | 319 | } |
319 | return mHolidays[offset]; | 320 | return mHolidays[offset]; |
320 | } | 321 | } |
321 | 322 | ||
322 | int KODayMatrix::getDayIndexFrom(int x, int y) | 323 | int KODayMatrix::getDayIndexFrom(int x, int y) |
323 | { | 324 | { |
324 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 325 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
325 | 6 - x/daysize.width() : x/daysize.width()); | 326 | 6 - x/daysize.width() : x/daysize.width()); |
326 | } | 327 | } |
327 | 328 | ||
328 | // ---------------------------------------------------------------------------- | 329 | // ---------------------------------------------------------------------------- |
329 | // M O U S E E V E N T H A N D L I N G | 330 | // M O U S E E V E N T H A N D L I N G |
330 | // ---------------------------------------------------------------------------- | 331 | // ---------------------------------------------------------------------------- |
331 | 332 | ||
332 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 333 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
333 | { | 334 | { |
334 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 335 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
335 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 336 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
336 | mSelInit = mSelStart; | 337 | mSelInit = mSelStart; |
337 | } | 338 | } |
338 | 339 | ||
339 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 340 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
340 | { | 341 | { |
341 | 342 | ||
342 | int tmp = getDayIndexFrom(e->x(), e->y()); | 343 | int tmp = getDayIndexFrom(e->x(), e->y()); |
343 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 344 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
344 | 345 | ||
345 | if (mSelInit > tmp) { | 346 | if (mSelInit > tmp) { |
346 | mSelEnd = mSelInit; | 347 | mSelEnd = mSelInit; |
347 | if (tmp != mSelStart) { | 348 | if (tmp != mSelStart) { |
348 | mSelStart = tmp; | 349 | mSelStart = tmp; |
349 | repaint(); | 350 | repaint(); |
350 | } | 351 | } |
351 | } else { | 352 | } else { |
352 | mSelStart = mSelInit; | 353 | mSelStart = mSelInit; |
353 | 354 | ||
354 | //repaint only if selection has changed | 355 | //repaint only if selection has changed |
355 | if (tmp != mSelEnd) { | 356 | if (tmp != mSelEnd) { |
356 | mSelEnd = tmp; | 357 | mSelEnd = tmp; |
357 | repaint(); | 358 | repaint(); |
358 | } | 359 | } |
359 | } | 360 | } |
360 | 361 | ||
361 | DateList daylist; | 362 | DateList daylist; |
362 | if ( mSelStart < 0 ) | 363 | if ( mSelStart < 0 ) |
363 | mSelStart = 0; | 364 | mSelStart = 0; |
364 | for (int i = mSelStart; i <= mSelEnd; i++) { | 365 | for (int i = mSelStart; i <= mSelEnd; i++) { |
365 | daylist.append(days[i]); | 366 | daylist.append(days[i]); |
366 | } | 367 | } |
367 | emit selected((const DateList)daylist); | 368 | emit selected((const DateList)daylist); |
368 | 369 | ||
369 | } | 370 | } |
370 | 371 | ||
371 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) | 372 | void KODayMatrix::mouseMoveEvent (QMouseEvent* e) |
372 | { | 373 | { |
373 | int tmp = getDayIndexFrom(e->x(), e->y()); | 374 | int tmp = getDayIndexFrom(e->x(), e->y()); |
374 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 375 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
375 | 376 | ||
376 | if (mSelInit > tmp) { | 377 | if (mSelInit > tmp) { |
377 | mSelEnd = mSelInit; | 378 | mSelEnd = mSelInit; |
378 | if (tmp != mSelStart) { | 379 | if (tmp != mSelStart) { |
379 | mSelStart = tmp; | 380 | mSelStart = tmp; |
380 | repaint(); | 381 | repaint(); |
381 | } | 382 | } |
382 | } else { | 383 | } else { |
383 | mSelStart = mSelInit; | 384 | mSelStart = mSelInit; |
384 | 385 | ||
385 | //repaint only if selection has changed | 386 | //repaint only if selection has changed |
386 | if (tmp != mSelEnd) { | 387 | if (tmp != mSelEnd) { |
387 | mSelEnd = tmp; | 388 | mSelEnd = tmp; |
388 | repaint(); | 389 | repaint(); |
389 | } | 390 | } |
390 | } | 391 | } |
391 | } | 392 | } |
392 | 393 | ||
393 | // ---------------------------------------------------------------------------- | 394 | // ---------------------------------------------------------------------------- |
394 | // D R A G ' N D R O P H A N D L I N G | 395 | // D R A G ' N D R O P H A N D L I N G |
395 | // ---------------------------------------------------------------------------- | 396 | // ---------------------------------------------------------------------------- |
396 | 397 | ||
397 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) | 398 | void KODayMatrix::dragEnterEvent(QDragEnterEvent *e) |
398 | { | 399 | { |
399 | #ifndef KORG_NODND | 400 | #ifndef KORG_NODND |
400 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 401 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
401 | e->ignore(); | 402 | e->ignore(); |
402 | return; | 403 | return; |
403 | } | 404 | } |
404 | 405 | ||
405 | // some visual feedback | 406 | // some visual feedback |
406 | // oldPalette = palette(); | 407 | // oldPalette = palette(); |
407 | // setPalette(my_HilitePalette); | 408 | // setPalette(my_HilitePalette); |
408 | // update(); | 409 | // update(); |
409 | #endif | 410 | #endif |
410 | } | 411 | } |
411 | 412 | ||
412 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) | 413 | void KODayMatrix::dragMoveEvent(QDragMoveEvent *e) |
413 | { | 414 | { |
414 | #ifndef KORG_NODND | 415 | #ifndef KORG_NODND |
415 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 416 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
416 | e->ignore(); | 417 | e->ignore(); |
417 | return; | 418 | return; |
418 | } | 419 | } |
419 | 420 | ||
420 | e->accept(); | 421 | e->accept(); |
421 | #endif | 422 | #endif |
422 | } | 423 | } |
423 | 424 | ||
424 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) | 425 | void KODayMatrix::dragLeaveEvent(QDragLeaveEvent */*dl*/) |
425 | { | 426 | { |
426 | #ifndef KORG_NODND | 427 | #ifndef KORG_NODND |
427 | // setPalette(oldPalette); | 428 | // setPalette(oldPalette); |
428 | // update(); | 429 | // update(); |
429 | #endif | 430 | #endif |
430 | } | 431 | } |
431 | 432 | ||
432 | void KODayMatrix::dropEvent(QDropEvent *e) | 433 | void KODayMatrix::dropEvent(QDropEvent *e) |
433 | { | 434 | { |
434 | #ifndef KORG_NODND | 435 | #ifndef KORG_NODND |
435 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; | 436 | // kdDebug() << "KODayMatrix::dropEvent(e) begin" << endl; |
436 | 437 | ||
437 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { | 438 | if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) ) { |
438 | e->ignore(); | 439 | e->ignore(); |
439 | return; | 440 | return; |
440 | } | 441 | } |
441 | 442 | ||
442 | DndFactory factory( mCalendar ); | 443 | DndFactory factory( mCalendar ); |
443 | Event *event = factory.createDrop(e); | 444 | Event *event = factory.createDrop(e); |
444 | 445 | ||
445 | if (event) { | 446 | if (event) { |
446 | e->acceptAction(); | 447 | e->acceptAction(); |
447 | 448 | ||
448 | Event *existingEvent = mCalendar->event(event->uid()); | 449 | Event *existingEvent = mCalendar->event(event->uid()); |
449 | 450 | ||
450 | if(existingEvent) { | 451 | if(existingEvent) { |
451 | // uniquify event | 452 | // uniquify event |
452 | event->recreate(); | 453 | event->recreate(); |
453 | /* | 454 | /* |
454 | KMessageBox::sorry(this, | 455 | KMessageBox::sorry(this, |
455 | i18n("Event already exists in this calendar."), | 456 | i18n("Event already exists in this calendar."), |
456 | i18n("Drop Event")); | 457 | i18n("Drop Event")); |
457 | delete event; | 458 | delete event; |
458 | return; | 459 | return; |
459 | */ | 460 | */ |
460 | } | 461 | } |
461 | // kdDebug() << "Drop new Event" << endl; | 462 | // kdDebug() << "Drop new Event" << endl; |
462 | // Adjust date | 463 | // Adjust date |
463 | QDateTime start = event->dtStart(); | 464 | QDateTime start = event->dtStart(); |
464 | QDateTime end = event->dtEnd(); | 465 | QDateTime end = event->dtEnd(); |
465 | int duration = start.daysTo(end); | 466 | int duration = start.daysTo(end); |
466 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); | 467 | int idx = getDayIndexFrom(e->pos().x(), e->pos().y()); |
467 | 468 | ||
468 | start.setDate(days[idx]); | 469 | start.setDate(days[idx]); |
469 | end.setDate(days[idx].addDays(duration)); | 470 | end.setDate(days[idx].addDays(duration)); |
470 | 471 | ||
471 | event->setDtStart(start); | 472 | event->setDtStart(start); |
472 | event->setDtEnd(end); | 473 | event->setDtEnd(end); |
473 | mCalendar->addEvent(event); | 474 | mCalendar->addEvent(event); |
474 | 475 | ||
475 | emit eventDropped(event); | 476 | emit eventDropped(event); |
476 | } else { | 477 | } else { |
477 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; | 478 | // kdDebug() << "KODayMatrix::dropEvent(): Event from drop not decodable" << endl; |
478 | e->ignore(); | 479 | e->ignore(); |
479 | } | 480 | } |
480 | #endif | 481 | #endif |
481 | } | 482 | } |
482 | 483 | ||
483 | // ---------------------------------------------------------------------------- | 484 | // ---------------------------------------------------------------------------- |
484 | // P A I N T E V E N T H A N D L I N G | 485 | // P A I N T E V E N T H A N D L I N G |
485 | // ---------------------------------------------------------------------------- | 486 | // ---------------------------------------------------------------------------- |
486 | 487 | ||
487 | void KODayMatrix::paintEvent(QPaintEvent * pevent) | 488 | void KODayMatrix::paintEvent(QPaintEvent * pevent) |
488 | { | 489 | { |
489 | //kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; | 490 | //kdDebug() << "KODayMatrix::paintEvent() BEGIN" << endl; |
490 | if ( mPendingUpdateBeforeRepaint ) { | 491 | if ( mPendingUpdateBeforeRepaint ) { |
491 | updateViewTimed(); | 492 | updateViewTimed(); |
492 | mPendingUpdateBeforeRepaint = false; | 493 | mPendingUpdateBeforeRepaint = false; |
493 | } | 494 | } |
494 | QPainter p(this); | 495 | QPainter p(this); |
495 | 496 | ||
496 | QRect sz = frameRect(); | 497 | QRect sz = frameRect(); |
497 | int dheight = daysize.height(); | 498 | int dheight = daysize.height(); |
498 | int dwidth = daysize.width(); | 499 | int dwidth = daysize.width(); |
499 | int row,col; | 500 | int row,col; |
500 | int selw, selh; | 501 | int selw, selh; |
501 | bool isRTL = KOGlobals::self()->reverseLayout(); | 502 | bool isRTL = KOGlobals::self()->reverseLayout(); |
502 | 503 | ||
503 | // draw background and topleft frame | 504 | // draw background and topleft frame |
504 | p.fillRect(pevent->rect(), mDefaultBackColor); | 505 | p.fillRect(pevent->rect(), mDefaultBackColor); |
505 | p.setPen(mDefaultTextColor); | 506 | p.setPen(mDefaultTextColor); |
506 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); | 507 | p.drawRect(0, 0, sz.width()+1, sz.height()+1); |
507 | 508 | ||
508 | // draw selected days with highlighted background color | 509 | // draw selected days with highlighted background color |
509 | if (mSelStart != NOSELECTION) { | 510 | if (mSelStart != NOSELECTION) { |
510 | 511 | ||
511 | row = mSelStart/7; | 512 | row = mSelStart/7; |
512 | col = mSelStart -row*7; | 513 | col = mSelStart -row*7; |
513 | QColor selcol = KOPrefs::instance()->mHighlightColor; | 514 | QColor selcol = KOPrefs::instance()->mHighlightColor; |
514 | 515 | ||
515 | if (row == mSelEnd/7) { | 516 | if (row == mSelEnd/7) { |
516 | // Single row selection | 517 | // Single row selection |
517 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, | 518 | p.fillRect(isRTL ? (7 - (mSelEnd-mSelStart+1) - col)*dwidth : col*dwidth, |
518 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); | 519 | row*dheight, (mSelEnd-mSelStart+1)*dwidth, dheight, selcol); |
519 | } else { | 520 | } else { |
520 | // draw first row to the right | 521 | // draw first row to the right |
521 | p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, | 522 | p.fillRect(isRTL ? 0 : col*dwidth, row*dheight, (7-col)*dwidth, |
522 | dheight, selcol); | 523 | dheight, selcol); |
523 | // draw full block till last line | 524 | // draw full block till last line |
524 | selh = mSelEnd/7-row; | 525 | selh = mSelEnd/7-row; |
525 | if (selh > 1) { | 526 | if (selh > 1) { |
526 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); | 527 | p.fillRect(0, (row+1)*dheight, 7*dwidth, (selh-1)*dheight,selcol); |
527 | } | 528 | } |
528 | // draw last block from left to mSelEnd | 529 | // draw last block from left to mSelEnd |
529 | selw = mSelEnd-7*(mSelEnd/7)+1; | 530 | selw = mSelEnd-7*(mSelEnd/7)+1; |
530 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, | 531 | p.fillRect(isRTL ? (7-selw)*dwidth : 0, (row+selh)*dheight, |
531 | selw*dwidth, dheight, selcol); | 532 | selw*dwidth, dheight, selcol); |
532 | } | 533 | } |
533 | } | 534 | } |
534 | 535 | ||
535 | // iterate over all days in the matrix and draw the day label in appropriate colors | 536 | // iterate over all days in the matrix and draw the day label in appropriate colors |
536 | QColor actcol = mDefaultTextColorShaded; | 537 | QColor actcol = mDefaultTextColorShaded; |
537 | p.setPen(actcol); | 538 | p.setPen(actcol); |
538 | QPen tmppen; | 539 | QPen tmppen; |
539 | for(int i = 0; i < NUMDAYS; i++) { | 540 | for(int i = 0; i < NUMDAYS; i++) { |
540 | row = i/7; | 541 | row = i/7; |
541 | col = isRTL ? 6-(i-row*7) : i-row*7; | 542 | col = isRTL ? 6-(i-row*7) : i-row*7; |
542 | 543 | ||
543 | // if it is the first day of a month switch color from normal to shaded and vice versa | 544 | // if it is the first day of a month switch color from normal to shaded and vice versa |
544 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 545 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
545 | if (actcol == mDefaultTextColorShaded) { | 546 | if (actcol == mDefaultTextColorShaded) { |
546 | actcol = mDefaultTextColor; | 547 | actcol = mDefaultTextColor; |
547 | } else { | 548 | } else { |
548 | actcol = mDefaultTextColorShaded; | 549 | actcol = mDefaultTextColorShaded; |
549 | } | 550 | } |
550 | p.setPen(actcol); | 551 | p.setPen(actcol); |
551 | } | 552 | } |
552 | 553 | ||
553 | //Reset pen color after selected days block | 554 | //Reset pen color after selected days block |
554 | if (i == mSelEnd+1) { | 555 | if (i == mSelEnd+1) { |
555 | p.setPen(actcol); | 556 | p.setPen(actcol); |
556 | } | 557 | } |
557 | 558 | ||
558 | // if today then draw rectangle around day | 559 | // if today then draw rectangle around day |
559 | if (today == i) { | 560 | if (today == i) { |
560 | tmppen = p.pen(); | 561 | tmppen = p.pen(); |
561 | QPen mTodayPen(p.pen()); | 562 | QPen mTodayPen(p.pen()); |
562 | 563 | ||
563 | mTodayPen.setWidth(mTodayMarginWidth); | 564 | mTodayPen.setWidth(mTodayMarginWidth); |
564 | //draw red rectangle for holidays | 565 | //draw red rectangle for holidays |
565 | if (!mHolidays[i].isNull()) { | 566 | if (!mHolidays[i].isNull()) { |
566 | if (actcol == mDefaultTextColor) { | 567 | if (actcol == mDefaultTextColor) { |
567 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 568 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
568 | } else { | 569 | } else { |
569 | mTodayPen.setColor(mHolidayColorShaded); | 570 | mTodayPen.setColor(mHolidayColorShaded); |
570 | } | 571 | } |
571 | } | 572 | } |
572 | //draw gray rectangle for today if in selection | 573 | //draw gray rectangle for today if in selection |
573 | if (i >= mSelStart && i <= mSelEnd) { | 574 | if (i >= mSelStart && i <= mSelEnd) { |
574 | QColor grey("grey"); | 575 | QColor grey("grey"); |
575 | mTodayPen.setColor(grey); | 576 | mTodayPen.setColor(grey); |
576 | } | 577 | } |
577 | p.setPen(mTodayPen); | 578 | p.setPen(mTodayPen); |
578 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); | 579 | p.drawRect(col*dwidth, row*dheight, dwidth, dheight); |
579 | p.setPen(tmppen); | 580 | p.setPen(tmppen); |
580 | } | 581 | } |
581 | 582 | ||
582 | // if any events are on that day then draw it using a bold font | 583 | // if any events are on that day then draw it using a bold font |
583 | if (events[i] > 0) { | 584 | if (events[i] > 0) { |
584 | QFont myFont = font(); | 585 | QFont myFont = font(); |
585 | myFont.setBold(true); | 586 | myFont.setBold(true); |
586 | p.setFont(myFont); | 587 | p.setFont(myFont); |
587 | } | 588 | } |
588 | 589 | ||
589 | // if it is a holiday then use the default holiday color | 590 | // if it is a holiday then use the default holiday color |
590 | if (!mHolidays[i].isNull()) { | 591 | if (!mHolidays[i].isNull()) { |
591 | if (actcol == mDefaultTextColor) { | 592 | if (actcol == mDefaultTextColor) { |
592 | p.setPen(KOPrefs::instance()->mHolidayColor); | 593 | p.setPen(KOPrefs::instance()->mHolidayColor); |
593 | } else { | 594 | } else { |
594 | p.setPen(mHolidayColorShaded); | 595 | p.setPen(mHolidayColorShaded); |
595 | } | 596 | } |
596 | } | 597 | } |
597 | 598 | ||
598 | // draw selected days with special color | 599 | // draw selected days with special color |
599 | // DO NOT specially highlight holidays in selection ! | 600 | // DO NOT specially highlight holidays in selection ! |
600 | if (i >= mSelStart && i <= mSelEnd) { | 601 | if (i >= mSelStart && i <= mSelEnd) { |
601 | p.setPen(mSelectedDaysColor); | 602 | p.setPen(mSelectedDaysColor); |
602 | } | 603 | } |
603 | 604 | ||
604 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, | 605 | p.drawText(col*dwidth, row*dheight, dwidth, dheight, |
605 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 606 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
606 | 607 | ||
607 | // reset color to actual color | 608 | // reset color to actual color |
608 | if (!mHolidays[i].isNull()) { | 609 | if (!mHolidays[i].isNull()) { |
609 | p.setPen(actcol); | 610 | p.setPen(actcol); |
610 | } | 611 | } |
611 | // reset bold font to plain font | 612 | // reset bold font to plain font |
612 | if (events[i] > 0) { | 613 | if (events[i] > 0) { |
613 | QFont myFont = font(); | 614 | QFont myFont = font(); |
614 | myFont.setBold(false); | 615 | myFont.setBold(false); |
615 | p.setFont(myFont); | 616 | p.setFont(myFont); |
616 | } | 617 | } |
617 | } | 618 | } |
618 | } | 619 | } |
619 | 620 | ||
620 | // ---------------------------------------------------------------------------- | 621 | // ---------------------------------------------------------------------------- |
621 | // R E SI Z E E V E N T H A N D L I N G | 622 | // R E SI Z E E V E N T H A N D L I N G |
622 | // ---------------------------------------------------------------------------- | 623 | // ---------------------------------------------------------------------------- |
623 | 624 | ||
624 | void KODayMatrix::resizeEvent(QResizeEvent *) | 625 | void KODayMatrix::resizeEvent(QResizeEvent *) |
625 | { | 626 | { |
626 | QRect sz = frameRect(); | 627 | QRect sz = frameRect(); |
627 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 628 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
628 | daysize.setWidth(sz.width() / 7); | 629 | daysize.setWidth(sz.width() / 7); |
629 | } | 630 | } |