-rw-r--r-- | korganizer/kodaymatrix.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 59618bf..d543aaf 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -54,462 +54,471 @@ | |||
54 | // ============================================================================ | 54 | // ============================================================================ |
55 | 55 | ||
56 | DynamicTip::DynamicTip( QWidget * parent ) | 56 | DynamicTip::DynamicTip( QWidget * parent ) |
57 | : QToolTip( parent ) | 57 | : QToolTip( parent ) |
58 | { | 58 | { |
59 | matrix = (KODayMatrix*)parent; | 59 | matrix = (KODayMatrix*)parent; |
60 | } | 60 | } |
61 | 61 | ||
62 | class KODaymatrixWhatsThis :public QWhatsThis | 62 | class KODaymatrixWhatsThis :public QWhatsThis |
63 | { | 63 | { |
64 | public: | 64 | public: |
65 | KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; | 65 | KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; |
66 | ~KODaymatrixWhatsThis() { ; }; | 66 | ~KODaymatrixWhatsThis() { ; }; |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | virtual QString text( const QPoint& p ) | 69 | virtual QString text( const QPoint& p ) |
70 | { | 70 | { |
71 | return _view->getWhatsThisText( p ) ; | 71 | return _view->getWhatsThisText( p ) ; |
72 | } | 72 | } |
73 | private: | 73 | private: |
74 | KODayMatrix * _view; | 74 | KODayMatrix * _view; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | void DynamicTip::maybeTip( const QPoint &pos ) | 77 | void DynamicTip::maybeTip( const QPoint &pos ) |
78 | { | 78 | { |
79 | //calculate which cell of the matrix the mouse is in | 79 | //calculate which cell of the matrix the mouse is in |
80 | QRect sz = matrix->frameRect(); | 80 | QRect sz = matrix->frameRect(); |
81 | int dheight = sz.height()*7 / 42; | 81 | int dheight = sz.height()*7 / 42; |
82 | int dwidth = sz.width() / 7; | 82 | int dwidth = sz.width() / 7; |
83 | int row = pos.y()/dheight; | 83 | int row = pos.y()/dheight; |
84 | int col = pos.x()/dwidth; | 84 | int col = pos.x()/dwidth; |
85 | 85 | ||
86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 86 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
87 | 87 | ||
88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 88 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
89 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 89 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
90 | 90 | ||
91 | //show holiday names only | 91 | //show holiday names only |
92 | QString str = matrix->getHolidayLabel(col+row*7); | 92 | QString str = matrix->getHolidayLabel(col+row*7); |
93 | if (str.isEmpty()) return; | 93 | if (str.isEmpty()) return; |
94 | tip(rct, str); | 94 | tip(rct, str); |
95 | } | 95 | } |
96 | 96 | ||
97 | 97 | ||
98 | // ============================================================================ | 98 | // ============================================================================ |
99 | // K O D A Y M A T R I X | 99 | // K O D A Y M A T R I X |
100 | // ============================================================================ | 100 | // ============================================================================ |
101 | 101 | ||
102 | const int KODayMatrix::NOSELECTION = -1000; | 102 | const int KODayMatrix::NOSELECTION = -1000; |
103 | const int KODayMatrix::NUMDAYS = 42; | 103 | const int KODayMatrix::NUMDAYS = 42; |
104 | 104 | ||
105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) | 105 | KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) |
106 | : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) | 106 | : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) |
107 | 107 | ||
108 | #if 0 | 108 | #if 0 |
109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 109 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
110 | QFrame(parent, name) | 110 | QFrame(parent, name) |
111 | #endif | 111 | #endif |
112 | { | 112 | { |
113 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); | 113 | mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); |
114 | mPendingUpdateBeforeRepaint = false; | 114 | mPendingUpdateBeforeRepaint = false; |
115 | mouseDown = false; | 115 | mouseDown = false; |
116 | // initialize dynamic arrays | 116 | // initialize dynamic arrays |
117 | bDays.resize ( NUMDAYS ); | 117 | bDays.resize ( NUMDAYS ); |
118 | hDays.resize ( NUMDAYS );; | ||
119 | eDays.resize ( NUMDAYS );; | ||
118 | days = new QDate[NUMDAYS]; | 120 | days = new QDate[NUMDAYS]; |
119 | daylbls = new QString[NUMDAYS]; | 121 | daylbls = new QString[NUMDAYS]; |
120 | events = new int[NUMDAYS]; | 122 | //events = new int[NUMDAYS]; |
121 | mToolTip = new DynamicTip(this); | 123 | mToolTip = new DynamicTip(this); |
122 | 124 | ||
123 | // set default values used for drawing the matrix | 125 | // set default values used for drawing the matrix |
124 | mDefaultBackColor = palette().active().base(); | 126 | mDefaultBackColor = palette().active().base(); |
125 | mDefaultTextColor = palette().active().foreground(); | 127 | mDefaultTextColor = palette().active().foreground(); |
126 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); | 128 | mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); |
127 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); | 129 | mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); |
128 | mSelectedDaysColor = QColor("white"); | 130 | mSelectedDaysColor = QColor("white"); |
129 | mTodayMarginWidth = 2; | 131 | mTodayMarginWidth = 2; |
130 | mSelEnd = mSelStart = NOSELECTION; | 132 | mSelEnd = mSelStart = NOSELECTION; |
131 | 133 | ||
132 | setAcceptDrops(true); | 134 | setAcceptDrops(true); |
133 | //setFont( QFont("Arial", 10) ); | 135 | //setFont( QFont("Arial", 10) ); |
134 | 136 | ||
135 | mUpdateTimer = new QTimer( this ); | 137 | mUpdateTimer = new QTimer( this ); |
136 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); | 138 | connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); |
137 | mRepaintTimer = new QTimer( this ); | 139 | mRepaintTimer = new QTimer( this ); |
138 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); | 140 | connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); |
139 | mDayChanged = false; | 141 | mDayChanged = false; |
140 | updateView(); | 142 | updateView(); |
141 | } | 143 | } |
142 | QString KODayMatrix::getWhatsThisText( QPoint p ) | 144 | QString KODayMatrix::getWhatsThisText( QPoint p ) |
143 | { | 145 | { |
144 | 146 | ||
145 | int tmp = getDayIndexFrom(p.x(), p.y()); | 147 | int tmp = getDayIndexFrom(p.x(), p.y()); |
146 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) | 148 | if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) |
147 | return QString(); | 149 | return QString(); |
148 | QDate mDate = days[tmp]; | 150 | QDate mDate = days[tmp]; |
149 | QPtrList<Event> eventlist = mCalendar->events(mDate); | 151 | QPtrList<Event> eventlist = mCalendar->events(mDate); |
150 | Event *event; | 152 | Event *event; |
151 | QStringList mToolTip; | 153 | QStringList mToolTip; |
152 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 154 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
153 | QString mToolTipText; | 155 | QString mToolTipText; |
154 | QString text; | 156 | QString text; |
155 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 157 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
156 | if (event->isMultiDay()) { | 158 | if (event->isMultiDay()) { |
157 | QString prefix = "<->";multiday = 2; | 159 | QString prefix = "<->";multiday = 2; |
158 | QString time; | 160 | QString time; |
159 | if ( event->doesRecur() ) { | 161 | if ( event->doesRecur() ) { |
160 | if ( event->recursOn( mDate) ) { | 162 | if ( event->recursOn( mDate) ) { |
161 | prefix ="->" ;multiday = 1; | 163 | prefix ="->" ;multiday = 1; |
162 | } | 164 | } |
163 | else { | 165 | else { |
164 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 166 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
165 | if ( event->recursOn( mDate.addDays( -days)) ) { | 167 | if ( event->recursOn( mDate.addDays( -days)) ) { |
166 | prefix ="<-" ;multiday = 3; | 168 | prefix ="<-" ;multiday = 3; |
167 | } | 169 | } |
168 | } | 170 | } |
169 | } else { | 171 | } else { |
170 | if (mDate == event->dtStart().date()) { | 172 | if (mDate == event->dtStart().date()) { |
171 | prefix ="->" ;multiday = 1; | 173 | prefix ="->" ;multiday = 1; |
172 | } else if (mDate == event->dtEnd().date()) { | 174 | } else if (mDate == event->dtEnd().date()) { |
173 | prefix ="<-" ;multiday = 3; | 175 | prefix ="<-" ;multiday = 3; |
174 | } | 176 | } |
175 | } | 177 | } |
176 | if ( !event->doesFloat() ) { | 178 | if ( !event->doesFloat() ) { |
177 | if ( mDate == event->dtStart().date () ) | 179 | if ( mDate == event->dtStart().date () ) |
178 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 180 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
179 | else if ( mDate == event->dtEnd().date () ) | 181 | else if ( mDate == event->dtEnd().date () ) |
180 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 182 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
181 | 183 | ||
182 | } | 184 | } |
183 | text = time + event->summary(); | 185 | text = time + event->summary(); |
184 | mToolTipText += prefix + text; | 186 | mToolTipText += prefix + text; |
185 | } else { | 187 | } else { |
186 | if (event->doesFloat()) { | 188 | if (event->doesFloat()) { |
187 | text = event->summary(); | 189 | text = event->summary(); |
188 | mToolTipText += text; | 190 | mToolTipText += text; |
189 | } | 191 | } |
190 | else { | 192 | else { |
191 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 193 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
192 | text += " " + event->summary(); | 194 | text += " " + event->summary(); |
193 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 195 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
194 | } | 196 | } |
195 | } | 197 | } |
196 | if ( !event->location().isEmpty() ) | 198 | if ( !event->location().isEmpty() ) |
197 | mToolTipText += " (" + event->location() + ")"; | 199 | mToolTipText += " (" + event->location() + ")"; |
198 | #if QT_VERSION >= 0x030000 | 200 | #if QT_VERSION >= 0x030000 |
199 | mToolTipText.replace( '<' , "<" ); | 201 | mToolTipText.replace( '<' , "<" ); |
200 | mToolTipText.replace( '>' , ">" ); | 202 | mToolTipText.replace( '>' , ">" ); |
201 | #else | 203 | #else |
202 | if ( mToolTipText.find ('<') >= 0 ) { | 204 | if ( mToolTipText.find ('<') >= 0 ) { |
203 | mToolTipText.replace( QRegExp("<") , "<" ); | 205 | mToolTipText.replace( QRegExp("<") , "<" ); |
204 | } | 206 | } |
205 | if ( mToolTipText.find ('>') >= 0 ) { | 207 | if ( mToolTipText.find ('>') >= 0 ) { |
206 | mToolTipText.replace( QRegExp(">") , ">" ); | 208 | mToolTipText.replace( QRegExp(">") , ">" ); |
207 | } | 209 | } |
208 | #endif | 210 | #endif |
209 | //qDebug("TTT: %s ", mToolTipText.latin1()); | 211 | //qDebug("TTT: %s ", mToolTipText.latin1()); |
210 | mToolTip.append( mToolTipText ); | 212 | mToolTip.append( mToolTipText ); |
211 | } | 213 | } |
212 | mToolTip.sort(); | 214 | mToolTip.sort(); |
213 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); | 215 | return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); |
214 | } | 216 | } |
215 | void KODayMatrix::setCalendar( Calendar *cal ) | 217 | void KODayMatrix::setCalendar( Calendar *cal ) |
216 | { | 218 | { |
217 | mCalendar = cal; | 219 | mCalendar = cal; |
218 | 220 | ||
219 | setAcceptDrops( mCalendar ); | 221 | setAcceptDrops( mCalendar ); |
220 | 222 | ||
221 | updateEvents(); | 223 | updateEvents(); |
222 | } | 224 | } |
223 | 225 | ||
224 | QColor KODayMatrix::getShadedColor(QColor color) | 226 | QColor KODayMatrix::getShadedColor(QColor color) |
225 | { | 227 | { |
226 | QColor shaded; | 228 | QColor shaded; |
227 | int h=0; | 229 | int h=0; |
228 | int s=0; | 230 | int s=0; |
229 | int v=0; | 231 | int v=0; |
230 | color.hsv(&h,&s,&v); | 232 | color.hsv(&h,&s,&v); |
231 | s = s/4; | 233 | s = s/4; |
232 | v = 192+v/4; | 234 | v = 192+v/4; |
233 | shaded.setHsv(h,s,v); | 235 | shaded.setHsv(h,s,v); |
234 | 236 | ||
235 | return shaded; | 237 | return shaded; |
236 | } | 238 | } |
237 | 239 | ||
238 | KODayMatrix::~KODayMatrix() | 240 | KODayMatrix::~KODayMatrix() |
239 | { | 241 | { |
240 | // delete mKODaymatrixWhatsThis; | 242 | // delete mKODaymatrixWhatsThis; |
241 | delete [] days; | 243 | delete [] days; |
242 | delete [] daylbls; | 244 | delete [] daylbls; |
243 | delete [] events; | 245 | //delete [] events; |
244 | delete mToolTip; | 246 | delete mToolTip; |
245 | } | 247 | } |
246 | 248 | ||
247 | /* | 249 | /* |
248 | void KODayMatrix::setStartDate(QDate start) | 250 | void KODayMatrix::setStartDate(QDate start) |
249 | { | 251 | { |
250 | updateView(start); | 252 | updateView(start); |
251 | } | 253 | } |
252 | */ | 254 | */ |
253 | 255 | ||
254 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) | 256 | void KODayMatrix::addSelectedDaysTo(DateList& selDays) |
255 | { | 257 | { |
256 | 258 | ||
257 | if (mSelStart == NOSELECTION) { | 259 | if (mSelStart == NOSELECTION) { |
258 | return; | 260 | return; |
259 | } | 261 | } |
260 | 262 | ||
261 | //cope with selection being out of matrix limits at top (< 0) | 263 | //cope with selection being out of matrix limits at top (< 0) |
262 | int i0 = mSelStart; | 264 | int i0 = mSelStart; |
263 | if (i0 < 0) { | 265 | if (i0 < 0) { |
264 | for (int i = i0; i < 0; i++) { | 266 | for (int i = i0; i < 0; i++) { |
265 | selDays.append(days[0].addDays(i)); | 267 | selDays.append(days[0].addDays(i)); |
266 | } | 268 | } |
267 | i0 = 0; | 269 | i0 = 0; |
268 | } | 270 | } |
269 | 271 | ||
270 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) | 272 | //cope with selection being out of matrix limits at bottom (> NUMDAYS-1) |
271 | if (mSelEnd > NUMDAYS-1) { | 273 | if (mSelEnd > NUMDAYS-1) { |
272 | for (int i = i0; i <= NUMDAYS-1; i++) { | 274 | for (int i = i0; i <= NUMDAYS-1; i++) { |
273 | selDays.append(days[i]); | 275 | selDays.append(days[i]); |
274 | } | 276 | } |
275 | for (int i = NUMDAYS; i < mSelEnd; i++) { | 277 | for (int i = NUMDAYS; i < mSelEnd; i++) { |
276 | selDays.append(days[0].addDays(i)); | 278 | selDays.append(days[0].addDays(i)); |
277 | } | 279 | } |
278 | 280 | ||
279 | // apply normal routine to selection being entirely within matrix limits | 281 | // apply normal routine to selection being entirely within matrix limits |
280 | } else { | 282 | } else { |
281 | for (int i = i0; i <= mSelEnd; i++) { | 283 | for (int i = i0; i <= mSelEnd; i++) { |
282 | selDays.append(days[i]); | 284 | selDays.append(days[i]); |
283 | } | 285 | } |
284 | } | 286 | } |
285 | } | 287 | } |
286 | 288 | ||
287 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) | 289 | bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end) |
288 | { | 290 | { |
289 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); | 291 | bool noSel = (mSelEnd == NOSELECTION && mSelStart == NOSELECTION ); |
290 | mSelStart = startdate.daysTo(start); | 292 | mSelStart = startdate.daysTo(start); |
291 | if ( mSelStart < 0 ) | 293 | if ( mSelStart < 0 ) |
292 | mSelStart = 0; | 294 | mSelStart = 0; |
293 | mSelEnd = startdate.daysTo(end); | 295 | mSelEnd = startdate.daysTo(end); |
294 | if ( mSelEnd > NUMDAYS-1 ) | 296 | if ( mSelEnd > NUMDAYS-1 ) |
295 | mSelEnd = NUMDAYS-1; | 297 | mSelEnd = NUMDAYS-1; |
296 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { | 298 | if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { |
297 | clearSelection(); | 299 | clearSelection(); |
298 | if ( noSel ) | 300 | if ( noSel ) |
299 | return false; | 301 | return false; |
300 | } | 302 | } |
301 | 303 | ||
302 | return true; | 304 | return true; |
303 | } | 305 | } |
304 | void KODayMatrix::clearSelection() | 306 | void KODayMatrix::clearSelection() |
305 | { | 307 | { |
306 | mSelEnd = mSelStart = NOSELECTION; | 308 | mSelEnd = mSelStart = NOSELECTION; |
307 | } | 309 | } |
308 | 310 | ||
309 | 311 | ||
310 | void KODayMatrix::recalculateToday() | 312 | void KODayMatrix::recalculateToday() |
311 | { | 313 | { |
312 | today = -1; | 314 | today = -1; |
313 | for (int i=0; i<NUMDAYS; i++) { | 315 | for (int i=0; i<NUMDAYS; i++) { |
314 | events[i] = 0; | 316 | //events[i] = 0; |
315 | days[i] = startdate.addDays(i); | 317 | days[i] = startdate.addDays(i); |
316 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); | 318 | daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); |
317 | 319 | ||
318 | // if today is in the currently displayed month, hilight today | 320 | // if today is in the currently displayed month, hilight today |
319 | if (days[i].year() == QDate::currentDate().year() && | 321 | if (days[i].year() == QDate::currentDate().year() && |
320 | days[i].month() == QDate::currentDate().month() && | 322 | days[i].month() == QDate::currentDate().month() && |
321 | days[i].day() == QDate::currentDate().day()) { | 323 | days[i].day() == QDate::currentDate().day()) { |
322 | today = i; | 324 | today = i; |
323 | } | 325 | } |
324 | } | 326 | } |
325 | // qDebug(QString("Today is visible at %1.").arg(today)); | 327 | // qDebug(QString("Today is visible at %1.").arg(today)); |
326 | } | 328 | } |
327 | 329 | ||
328 | void KODayMatrix::updateView() | 330 | void KODayMatrix::updateView() |
329 | { | 331 | { |
330 | updateView(startdate); | 332 | updateView(startdate); |
331 | } | 333 | } |
332 | void KODayMatrix::repaintViewTimed() | 334 | void KODayMatrix::repaintViewTimed() |
333 | { | 335 | { |
334 | mRepaintTimer->stop(); | 336 | mRepaintTimer->stop(); |
335 | repaint(false); | 337 | repaint(false); |
336 | } | 338 | } |
337 | void KODayMatrix::updateViewTimed() | 339 | void KODayMatrix::updateViewTimed() |
338 | { | 340 | { |
339 | mUpdateTimer->stop(); | 341 | mUpdateTimer->stop(); |
340 | if ( !mCalendar ) { | 342 | if ( !mCalendar ) { |
341 | qDebug("NOT CAL "); | 343 | qDebug("NOT CAL "); |
342 | return; | 344 | return; |
343 | } | 345 | } |
344 | //qDebug("KODayMatrix::updateViewTimed "); | 346 | //qDebug("KODayMatrix::updateViewTimed "); |
345 | for(int i = 0; i < NUMDAYS; i++) { | 347 | for(int i = 0; i < NUMDAYS; i++) { |
346 | // if events are set for the day then remember to draw it bold | 348 | // if events are set for the day then remember to draw it bold |
347 | QPtrList<Event> eventlist = mCalendar->events(days[i]); | 349 | QPtrList<Event> eventlist = mCalendar->events(days[i]); |
348 | Event *event; | 350 | Event *event; |
349 | int numEvents = eventlist.count(); | 351 | int numEvents = eventlist.count(); |
350 | QString holiStr = ""; | 352 | QString holiStr = ""; |
351 | bDays.clearBit(i); | 353 | bDays.clearBit(i); |
354 | hDays.clearBit(i); | ||
355 | eDays.clearBit(i); | ||
352 | for(event=eventlist.first();event != 0;event=eventlist.next()) { | 356 | for(event=eventlist.first();event != 0;event=eventlist.next()) { |
353 | ushort recurType = event->recurrence()->doesRecur(); | 357 | ushort recurType = event->recurrence()->doesRecur(); |
354 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 358 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
355 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 359 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
356 | numEvents--; | 360 | numEvents--; |
357 | } | 361 | } |
358 | if ( event->isHoliday()) { | 362 | if ( event->isHoliday()) { |
363 | hDays.setBit(i); | ||
359 | if ( !holiStr.isEmpty() ) | 364 | if ( !holiStr.isEmpty() ) |
360 | holiStr += "\n"; | 365 | holiStr += "\n"; |
361 | holiStr += event->summary(); | 366 | holiStr += event->summary(); |
362 | if ( !event->location().isEmpty() ) | 367 | if ( !event->location().isEmpty() ) |
363 | holiStr += " (" + event->location() + ")"; | 368 | holiStr += " (" + event->location() + ")"; |
364 | } | 369 | } |
365 | if ( event->isBirthday()) { | 370 | if ( event->isBirthday()) { |
366 | if ( !holiStr.isEmpty() ) | 371 | if ( !holiStr.isEmpty() ) |
367 | holiStr += "\n"; | 372 | holiStr += "\n"; |
368 | holiStr += i18n("Birthday") + ": "+event->summary(); | 373 | holiStr += i18n("Birthday") + ": "+event->summary(); |
369 | if ( !event->location().isEmpty() ) | 374 | if ( !event->location().isEmpty() ) |
370 | holiStr += " (" + event->location() + ")"; | 375 | holiStr += " (" + event->location() + ")"; |
371 | bDays.setBit(i); | 376 | bDays.setBit(i); |
372 | } | 377 | } |
373 | } | 378 | } |
374 | events[i] = numEvents; | 379 | if ( numEvents ) |
380 | eDays.setBit(i); | ||
375 | //if it is a holy day then draw it red. Sundays are consider holidays, too | 381 | //if it is a holy day then draw it red. Sundays are consider holidays, too |
376 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || | 382 | if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || |
377 | !holiStr.isEmpty()) { | 383 | !holiStr.isEmpty()) { |
378 | mHolidays[i] = holiStr; | 384 | mHolidays[i] = holiStr; |
379 | } else { | 385 | } else { |
380 | mHolidays[i] = QString::null; | 386 | mHolidays[i] = QString::null; |
381 | } | 387 | } |
382 | } | 388 | } |
383 | if ( ! mPendingUpdateBeforeRepaint ) | 389 | if ( ! mPendingUpdateBeforeRepaint ) |
384 | repaint(false); | 390 | repaint(false); |
385 | } | 391 | } |
386 | void KODayMatrix::updateView(QDate actdate) | 392 | void KODayMatrix::updateView(QDate actdate) |
387 | { | 393 | { |
388 | 394 | ||
389 | if ( ! actdate.isValid() ) { | 395 | if ( ! actdate.isValid() ) { |
390 | //qDebug("date not valid "); | 396 | //qDebug("date not valid "); |
391 | return; | 397 | return; |
392 | } | 398 | } |
393 | mDayChanged = false; | 399 | mDayChanged = false; |
394 | //flag to indicate if the starting day of the matrix has changed by this call | 400 | //flag to indicate if the starting day of the matrix has changed by this call |
395 | //mDayChanged = false; | 401 | //mDayChanged = false; |
396 | // if a new startdate is to be set then apply Cornelius's calculation | 402 | // if a new startdate is to be set then apply Cornelius's calculation |
397 | // of the first day to be shown | 403 | // of the first day to be shown |
398 | if (actdate != startdate) { | 404 | if (actdate != startdate) { |
399 | // reset index of selection according to shift of starting date from startdate to actdate | 405 | // reset index of selection according to shift of starting date from startdate to actdate |
400 | if (mSelStart != NOSELECTION) { | 406 | if (mSelStart != NOSELECTION) { |
401 | int tmp = actdate.daysTo(startdate); | 407 | int tmp = actdate.daysTo(startdate); |
402 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; | 408 | //kdDebug() << "Shift of Selection1: " << mSelStart << " - " << mSelEnd << " -> " << tmp << "(" << offset << ")" << endl; |
403 | // shift selection if new one would be visible at least partly ! | 409 | // shift selection if new one would be visible at least partly ! |
404 | 410 | ||
405 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { | 411 | if (mSelStart+tmp < NUMDAYS && mSelEnd+tmp >= 0) { |
406 | // nested if is required for next X display pushed from a different month - correction required | 412 | // nested if is required for next X display pushed from a different month - correction required |
407 | // otherwise, for month forward and backward, it must be avoided | 413 | // otherwise, for month forward and backward, it must be avoided |
408 | if( mSelStart > NUMDAYS || mSelStart < 0 ) | 414 | if( mSelStart > NUMDAYS || mSelStart < 0 ) |
409 | mSelStart = mSelStart + tmp; | 415 | mSelStart = mSelStart + tmp; |
410 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) | 416 | if( mSelEnd > NUMDAYS || mSelEnd < 0 ) |
411 | mSelEnd = mSelEnd + tmp; | 417 | mSelEnd = mSelEnd + tmp; |
412 | } | 418 | } |
413 | } | 419 | } |
414 | startdate = actdate; | 420 | startdate = actdate; |
415 | mDayChanged = true; | 421 | mDayChanged = true; |
416 | recalculateToday(); | 422 | recalculateToday(); |
417 | } | 423 | } |
418 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); | 424 | //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); |
419 | if ( !isVisible() ) { | 425 | if ( !isVisible() ) { |
420 | mPendingUpdateBeforeRepaint = true; | 426 | mPendingUpdateBeforeRepaint = true; |
421 | } else { | 427 | } else { |
422 | #ifdef DESKTOP_VERSION | 428 | #ifdef DESKTOP_VERSION |
423 | //mRepaintTimer->start( 100 ); | 429 | //mRepaintTimer->start( 100 ); |
424 | //updateViewTimed(); | 430 | //updateViewTimed(); |
425 | mUpdateTimer->start( 20 ); | 431 | mUpdateTimer->start( 20 ); |
426 | #else | 432 | #else |
427 | mRepaintTimer->start( 350 ); | 433 | mRepaintTimer->start( 350 ); |
428 | mUpdateTimer->start( 1200 ); | 434 | mUpdateTimer->start( 1200 ); |
429 | #endif | 435 | #endif |
430 | } | 436 | } |
431 | } | 437 | } |
432 | void KODayMatrix::updateEvents() | 438 | void KODayMatrix::updateEvents() |
433 | { | 439 | { |
434 | if ( !mCalendar ) return; | 440 | if ( !mCalendar ) return; |
435 | 441 | ||
436 | for( int i = 0; i < NUMDAYS; i++ ) { | 442 | for( int i = 0; i < NUMDAYS; i++ ) { |
437 | // if events are set for the day then remember to draw it bold | 443 | // if events are set for the day then remember to draw it bold |
438 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); | 444 | QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); |
439 | int numEvents = eventlist.count(); | 445 | int numEvents = eventlist.count(); |
440 | Event *event; | 446 | Event *event; |
441 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { | 447 | for( event = eventlist.first(); event != 0;event=eventlist.next()) { |
442 | ushort recurType = event->doesRecur(); | 448 | ushort recurType = event->doesRecur(); |
443 | 449 | ||
444 | if ( ( recurType == Recurrence::rDaily && | 450 | if ( ( recurType == Recurrence::rDaily && |
445 | !KOPrefs::instance()->mDailyRecur ) || | 451 | !KOPrefs::instance()->mDailyRecur ) || |
446 | ( recurType == Recurrence::rWeekly && | 452 | ( recurType == Recurrence::rWeekly && |
447 | !KOPrefs::instance()->mWeeklyRecur ) ) { | 453 | !KOPrefs::instance()->mWeeklyRecur ) ) { |
448 | numEvents--; | 454 | numEvents--; |
449 | } | 455 | } |
450 | } | 456 | } |
451 | events[ i ] = numEvents; | 457 | if ( numEvents ) |
458 | eDays.setBit(i); | ||
459 | else | ||
460 | eDays.clearBit(i); | ||
452 | } | 461 | } |
453 | } | 462 | } |
454 | 463 | ||
455 | const QDate& KODayMatrix::getDate(int offset) | 464 | const QDate& KODayMatrix::getDate(int offset) |
456 | { | 465 | { |
457 | if (offset < 0 || offset > NUMDAYS-1) { | 466 | if (offset < 0 || offset > NUMDAYS-1) { |
458 | qDebug("Wrong offset2 %d", offset); | 467 | qDebug("Wrong offset2 %d", offset); |
459 | return days[0]; | 468 | return days[0]; |
460 | } | 469 | } |
461 | return days[offset]; | 470 | return days[offset]; |
462 | } | 471 | } |
463 | 472 | ||
464 | QString KODayMatrix::getHolidayLabel(int offset) | 473 | QString KODayMatrix::getHolidayLabel(int offset) |
465 | { | 474 | { |
466 | if (offset < 0 || offset > NUMDAYS-1) { | 475 | if (offset < 0 || offset > NUMDAYS-1) { |
467 | qDebug("Wrong offset1 %d", offset); | 476 | qDebug("Wrong offset1 %d", offset); |
468 | return QString(); | 477 | return QString(); |
469 | } | 478 | } |
470 | return mHolidays[offset]; | 479 | return mHolidays[offset]; |
471 | } | 480 | } |
472 | 481 | ||
473 | int KODayMatrix::getDayIndexFrom(int x, int y) | 482 | int KODayMatrix::getDayIndexFrom(int x, int y) |
474 | { | 483 | { |
475 | int colModulo = (width()-2) % 7; | 484 | int colModulo = (width()-2) % 7; |
476 | int rowModulo = (height()-2) % 6; | 485 | int rowModulo = (height()-2) % 6; |
477 | #if 0 | 486 | #if 0 |
478 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? | 487 | return 7*(y/daysize.height()) + (KOGlobals::self()->reverseLayout() ? |
479 | 6 - x/daysize.width() : x/daysize.width()); | 488 | 6 - x/daysize.width() : x/daysize.width()); |
480 | #endif | 489 | #endif |
481 | int xVal = (x-colModulo/2-2)/daysize.width(); | 490 | int xVal = (x-colModulo/2-2)/daysize.width(); |
482 | int yVal = (y-rowModulo/2-2)/daysize.height(); | 491 | int yVal = (y-rowModulo/2-2)/daysize.height(); |
483 | 492 | ||
484 | 493 | ||
485 | return 7*(yVal) + xVal; | 494 | return 7*(yVal) + xVal; |
486 | 495 | ||
487 | } | 496 | } |
488 | 497 | ||
489 | // ---------------------------------------------------------------------------- | 498 | // ---------------------------------------------------------------------------- |
490 | // M O U S E E V E N T H A N D L I N G | 499 | // M O U S E E V E N T H A N D L I N G |
491 | // ---------------------------------------------------------------------------- | 500 | // ---------------------------------------------------------------------------- |
492 | 501 | ||
493 | void KODayMatrix::mousePressEvent (QMouseEvent* e) | 502 | void KODayMatrix::mousePressEvent (QMouseEvent* e) |
494 | { | 503 | { |
495 | 504 | ||
496 | if ( e->button() == LeftButton ) | 505 | if ( e->button() == LeftButton ) |
497 | mouseDown = true; | 506 | mouseDown = true; |
498 | mSelStart = getDayIndexFrom(e->x(), e->y()); | 507 | mSelStart = getDayIndexFrom(e->x(), e->y()); |
499 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; | 508 | if (mSelStart > NUMDAYS-1) mSelStart=NUMDAYS-1; |
500 | mSelInit = mSelStart; | 509 | mSelInit = mSelStart; |
501 | mSelEnd = mSelStart; | 510 | mSelEnd = mSelStart; |
502 | repaint(false); | 511 | repaint(false); |
503 | } | 512 | } |
504 | 513 | ||
505 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) | 514 | void KODayMatrix::mouseReleaseEvent (QMouseEvent* e) |
506 | { | 515 | { |
507 | if ( e->button() == LeftButton ) | 516 | if ( e->button() == LeftButton ) |
508 | if ( ! mouseDown ) { | 517 | if ( ! mouseDown ) { |
509 | return; | 518 | return; |
510 | } | 519 | } |
511 | else | 520 | else |
512 | mouseDown = false; | 521 | mouseDown = false; |
513 | int tmp = getDayIndexFrom(e->x(), e->y()); | 522 | int tmp = getDayIndexFrom(e->x(), e->y()); |
514 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; | 523 | if (tmp > NUMDAYS-1) tmp=NUMDAYS-1; |
515 | 524 | ||
@@ -801,143 +810,146 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) | |||
801 | for(int i = 0; i < NUMDAYS; i++) { | 810 | for(int i = 0; i < NUMDAYS; i++) { |
802 | row = i/7; | 811 | row = i/7; |
803 | col = isRTL ? 6-(i-row*7) : i-row*7; | 812 | col = isRTL ? 6-(i-row*7) : i-row*7; |
804 | 813 | ||
805 | // if it is the first day of a month switch color from normal to shaded and vice versa | 814 | // if it is the first day of a month switch color from normal to shaded and vice versa |
806 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { | 815 | if ( KOGlobals::self()->calendarSystem()->day( days[i] ) == 1) { |
807 | if (actcol == mDefaultTextColorShaded) { | 816 | if (actcol == mDefaultTextColorShaded) { |
808 | actcol = mDefaultTextColor; | 817 | actcol = mDefaultTextColor; |
809 | } else { | 818 | } else { |
810 | actcol = mDefaultTextColorShaded; | 819 | actcol = mDefaultTextColorShaded; |
811 | } | 820 | } |
812 | p.setPen(actcol); | 821 | p.setPen(actcol); |
813 | } | 822 | } |
814 | if (actcol == mDefaultTextColorShaded) { | 823 | if (actcol == mDefaultTextColorShaded) { |
815 | if ( ! mouseDown ) { | 824 | if ( ! mouseDown ) { |
816 | continue; | 825 | continue; |
817 | } | 826 | } |
818 | } | 827 | } |
819 | //Reset pen color after selected days block | 828 | //Reset pen color after selected days block |
820 | if (i == mSelEndT+1) { | 829 | if (i == mSelEndT+1) { |
821 | p.setPen(actcol); | 830 | p.setPen(actcol); |
822 | } | 831 | } |
823 | 832 | ||
824 | // if today then draw rectangle around day | 833 | // if today then draw rectangle around day |
825 | if (today == i) { | 834 | if (today == i) { |
826 | tmppen = p.pen(); | 835 | tmppen = p.pen(); |
827 | QPen mTodayPen(p.pen()); | 836 | QPen mTodayPen(p.pen()); |
828 | if ( daysize.width() < 20 ) | 837 | if ( daysize.width() < 20 ) |
829 | mTodayPen.setWidth(1); | 838 | mTodayPen.setWidth(1); |
830 | else | 839 | else |
831 | mTodayPen.setWidth(mTodayMarginWidth); | 840 | mTodayPen.setWidth(mTodayMarginWidth); |
832 | //draw red rectangle for holidays | 841 | //draw red rectangle for holidays |
833 | if (!mHolidays[i].isNull()) { | 842 | if (!mHolidays[i].isNull()) { |
834 | if (actcol == mDefaultTextColor) { | 843 | if (actcol == mDefaultTextColor) { |
835 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); | 844 | mTodayPen.setColor(KOPrefs::instance()->mHolidayColor); |
836 | } else { | 845 | } else { |
837 | mTodayPen.setColor(mHolidayColorShaded); | 846 | mTodayPen.setColor(mHolidayColorShaded); |
838 | } | 847 | } |
839 | } | 848 | } |
840 | //draw gray rectangle for today if in selection | 849 | //draw gray rectangle for today if in selection |
841 | if (i >= mSelStartT && i <= mSelEndT) { | 850 | if (i >= mSelStartT && i <= mSelEndT) { |
842 | QColor grey("grey"); | 851 | QColor grey("grey"); |
843 | mTodayPen.setColor(grey); | 852 | mTodayPen.setColor(grey); |
844 | } | 853 | } |
845 | p.setPen(mTodayPen); | 854 | p.setPen(mTodayPen); |
846 | 855 | ||
847 | 856 | ||
848 | int addCol = 0; | 857 | int addCol = 0; |
849 | int addRow = 0; | 858 | int addRow = 0; |
850 | if (rowModulo) { | 859 | if (rowModulo) { |
851 | if ( row >= 6 - rowModulo ) | 860 | if ( row >= 6 - rowModulo ) |
852 | addRow = row - 5 + rowModulo; | 861 | addRow = row - 5 + rowModulo; |
853 | } | 862 | } |
854 | if ( colModulo ) { | 863 | if ( colModulo ) { |
855 | if ( col >= 7 - colModulo ) | 864 | if ( col >= 7 - colModulo ) |
856 | addCol = col - 6 + colModulo-1; | 865 | addCol = col - 6 + colModulo-1; |
857 | } | 866 | } |
858 | 867 | ||
859 | addCol += 1; | 868 | addCol += 1; |
860 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); | 869 | p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); |
861 | p.setPen(tmppen); | 870 | p.setPen(tmppen); |
862 | } | 871 | } |
863 | 872 | ||
864 | // if any events are on that day then draw it using a bold font | 873 | // if any events are on that day then draw it using a bold font |
865 | if (events[i] > 0) { | 874 | if ( eDays.testBit(i) ) { |
866 | QFont myFont = font(); | 875 | QFont myFont = font(); |
867 | myFont.setBold(true); | 876 | myFont.setBold(true); |
868 | p.setFont(myFont); | 877 | p.setFont(myFont); |
869 | } | 878 | } |
870 | 879 | ||
871 | // if it is a holiday then use the default holiday color | 880 | // if it is a holiday then use the default holiday color |
872 | if (!mHolidays[i].isNull()) { | 881 | if ( !mHolidays[i].isNull()) { |
873 | if ( bDays.testBit(i) ) { | 882 | if ( bDays.testBit(i) ) { |
874 | p.setPen(Qt::green); | 883 | if ( hDays.testBit(i) ) |
884 | p.setPen(QColor(Qt::green)); | ||
885 | else | ||
886 | p.setPen(QColor(Qt::green).dark()); | ||
875 | } else { | 887 | } else { |
876 | if (actcol == mDefaultTextColor) { | 888 | if (actcol == mDefaultTextColor ) { |
877 | p.setPen(KOPrefs::instance()->mHolidayColor); | 889 | p.setPen(KOPrefs::instance()->mHolidayColor); |
878 | } else { | 890 | } else { |
879 | p.setPen(mHolidayColorShaded); | 891 | p.setPen(mHolidayColorShaded); |
880 | } | 892 | } |
881 | } | 893 | } |
882 | } | 894 | } |
883 | 895 | ||
884 | // draw selected days with special color | 896 | // draw selected days with special color |
885 | // DO NOT specially highlight holidays in selection ! | 897 | // DO NOT specially highlight holidays in selection ! |
886 | if (i >= mSelStartT && i <= mSelEndT) { | 898 | if (i >= mSelStartT && i <= mSelEndT) { |
887 | ;//p.setPen(mSelectedDaysColor); | 899 | ;//p.setPen(mSelectedDaysColor); |
888 | } | 900 | } |
889 | 901 | ||
890 | int addCol = 0; | 902 | int addCol = 0; |
891 | int addRow = 0; | 903 | int addRow = 0; |
892 | if ( colModulo ) { | 904 | if ( colModulo ) { |
893 | if ( col >= 7 - colModulo ) | 905 | if ( col >= 7 - colModulo ) |
894 | addCol = col - 7 + colModulo; | 906 | addCol = col - 7 + colModulo; |
895 | } | 907 | } |
896 | if ( rowModulo ) { | 908 | if ( rowModulo ) { |
897 | if ( row >= 6 - rowModulo ) | 909 | if ( row >= 6 - rowModulo ) |
898 | addRow = row - 5 + rowModulo; | 910 | addRow = row - 5 + rowModulo; |
899 | } | 911 | } |
900 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); | 912 | //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); |
901 | ++addCol;//++addCol; | 913 | ++addCol;//++addCol; |
902 | if ( row == 0) | 914 | if ( row == 0) |
903 | addRow = 1; | 915 | addRow = 1; |
904 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, | 916 | p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, |
905 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); | 917 | Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); |
906 | 918 | ||
907 | // reset color to actual color | 919 | // reset color to actual color |
908 | if (!mHolidays[i].isNull()) { | 920 | if (!mHolidays[i].isNull()) { |
909 | p.setPen(actcol); | 921 | p.setPen(actcol); |
910 | } | 922 | } |
911 | // reset bold font to plain font | 923 | // reset bold font to plain font |
912 | if (events[i] > 0) { | 924 | if ( eDays.testBit(i)) { |
913 | QFont myFont = font(); | 925 | QFont myFont = font(); |
914 | myFont.setBold(false); | 926 | myFont.setBold(false); |
915 | p.setFont(myFont); | 927 | p.setFont(myFont); |
916 | } | 928 | } |
917 | } | 929 | } |
918 | int off = 0;//xyOff; | 930 | int off = 0;//xyOff; |
919 | bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); | 931 | bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); |
920 | //qDebug("ffffffffff %d ", off); | 932 | //qDebug("ffffffffff %d ", off); |
921 | } | 933 | } |
922 | 934 | ||
923 | // ---------------------------------------------------------------------------- | 935 | // ---------------------------------------------------------------------------- |
924 | // R E SI Z E E V E N T H A N D L I N G | 936 | // R E SI Z E E V E N T H A N D L I N G |
925 | // ---------------------------------------------------------------------------- | 937 | // ---------------------------------------------------------------------------- |
926 | 938 | ||
927 | void KODayMatrix::resizeEvent(QResizeEvent *) | 939 | void KODayMatrix::resizeEvent(QResizeEvent *) |
928 | { | 940 | { |
929 | QRect sz = frameRect(); | 941 | QRect sz = frameRect(); |
930 | daysize.setHeight(sz.height()*7 / NUMDAYS); | 942 | daysize.setHeight(sz.height()*7 / NUMDAYS); |
931 | daysize.setWidth(sz.width() / 7); | 943 | daysize.setWidth(sz.width() / 7); |
932 | } | 944 | } |
933 | 945 | ||
934 | QSize KODayMatrix::sizeHint() const | 946 | QSize KODayMatrix::sizeHint() const |
935 | { | 947 | { |
936 | 948 | ||
937 | QFontMetrics fm ( font() ); | 949 | QFontMetrics fm ( font() ); |
938 | int wid = fm.width( "30") *7+3; | 950 | int wid = fm.width( "30") *7+3; |
939 | int hei = fm.height() * 6+3; | 951 | int hei = fm.height() * 6+3; |
940 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); | 952 | //qDebug("KODayMatrix::sizeHint()********************* %d %d", wid , hei); |
941 | return QSize ( wid, hei ); | 953 | return QSize ( wid, hei ); |
942 | 954 | ||
943 | } | 955 | } |