author | zautrix <zautrix> | 2005-06-27 21:06:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-27 21:06:01 (UTC) |
commit | 386f48c2011e49c7c145bad7754a725cabc25dd5 (patch) (unidiff) | |
tree | 104009f871e81468f2b4b5ba779b12c25a409c32 | |
parent | bf664c505e66f54dd03c3518386fdeab43108e56 (diff) | |
download | kdepimpi-386f48c2011e49c7c145bad7754a725cabc25dd5.zip kdepimpi-386f48c2011e49c7c145bad7754a725cabc25dd5.tar.gz kdepimpi-386f48c2011e49c7c145bad7754a725cabc25dd5.tar.bz2 |
mont fix
-rw-r--r-- | korganizer/komonthview.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index aeb3974..64b0e95 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -146,388 +146,387 @@ void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 148 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
149 | { | 149 | { |
150 | QListBoxItem* item = itemAt ( p ); | 150 | QListBoxItem* item = itemAt ( p ); |
151 | if ( ! item ) { | 151 | if ( ! item ) { |
152 | return i18n("Click in the cell\nto add an event!"); | 152 | return i18n("Click in the cell\nto add an event!"); |
153 | } | 153 | } |
154 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), | 154 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), |
155 | KOPrefs::instance()->mWTshowDetails, | 155 | KOPrefs::instance()->mWTshowDetails, |
156 | KOPrefs::instance()->mWTshowCreated, | 156 | KOPrefs::instance()->mWTshowCreated, |
157 | KOPrefs::instance()->mWTshowChanged); | 157 | KOPrefs::instance()->mWTshowChanged); |
158 | } | 158 | } |
159 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 159 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
160 | { | 160 | { |
161 | //qDebug("KNoScrollListBox::keyPressEvent "); | 161 | //qDebug("KNoScrollListBox::keyPressEvent "); |
162 | switch(e->key()) { | 162 | switch(e->key()) { |
163 | case Key_Right: | 163 | case Key_Right: |
164 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 164 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
165 | { | 165 | { |
166 | e->ignore(); | 166 | e->ignore(); |
167 | return; | 167 | return; |
168 | } | 168 | } |
169 | scrollBy(10,0); | 169 | scrollBy(10,0); |
170 | break; | 170 | break; |
171 | case Key_Left: | 171 | case Key_Left: |
172 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 172 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
173 | { | 173 | { |
174 | e->ignore(); | 174 | e->ignore(); |
175 | return; | 175 | return; |
176 | } | 176 | } |
177 | scrollBy(-10,0); | 177 | scrollBy(-10,0); |
178 | break; | 178 | break; |
179 | case Key_Up: | 179 | case Key_Up: |
180 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 180 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
181 | e->ignore(); | 181 | e->ignore(); |
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | if ( count() ) { | 184 | if ( count() ) { |
185 | if ( currentItem() == 0 ) { | 185 | if ( currentItem() == 0 ) { |
186 | emit prevCell(); | 186 | emit prevCell(); |
187 | } else { | 187 | } else { |
188 | setCurrentItem((currentItem()+count()-1)%count()); | 188 | setCurrentItem((currentItem()+count()-1)%count()); |
189 | if(!itemVisible(currentItem())) { | 189 | if(!itemVisible(currentItem())) { |
190 | if((unsigned int) currentItem() == (count()-1)) { | 190 | if((unsigned int) currentItem() == (count()-1)) { |
191 | setTopItem(currentItem()-numItemsVisible()+1); | 191 | setTopItem(currentItem()-numItemsVisible()+1); |
192 | } else { | 192 | } else { |
193 | setTopItem(topItem()-1); | 193 | setTopItem(topItem()-1); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } | 197 | } |
198 | break; | 198 | break; |
199 | case Key_Down: | 199 | case Key_Down: |
200 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 200 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
201 | e->ignore(); | 201 | e->ignore(); |
202 | break; | 202 | break; |
203 | } | 203 | } |
204 | if ( count () ) { | 204 | if ( count () ) { |
205 | if ( currentItem()+1 == count () ) { | 205 | if ( currentItem()+1 == count () ) { |
206 | emit nextCell(); | 206 | emit nextCell(); |
207 | } else { | 207 | } else { |
208 | setCurrentItem((currentItem()+1)%count()); | 208 | setCurrentItem((currentItem()+1)%count()); |
209 | if(!itemVisible(currentItem())) { | 209 | if(!itemVisible(currentItem())) { |
210 | if(currentItem() == 0) { | 210 | if(currentItem() == 0) { |
211 | setTopItem(0); | 211 | setTopItem(0); |
212 | } else { | 212 | } else { |
213 | setTopItem(topItem()+1); | 213 | setTopItem(topItem()+1); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
218 | break; | 218 | break; |
219 | case Key_I: | 219 | case Key_I: |
220 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); | 220 | QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); |
221 | e->ignore(); | 221 | e->ignore(); |
222 | break; | 222 | break; |
223 | case Key_Return: | 223 | case Key_Return: |
224 | case Key_Enter: | 224 | case Key_Enter: |
225 | { | 225 | { |
226 | if ( currentItem() >= 0 ) { | 226 | if ( currentItem() >= 0 ) { |
227 | emit doubleClicked( item( currentItem() ) ); | 227 | emit doubleClicked( item( currentItem() ) ); |
228 | e->accept(); | 228 | e->accept(); |
229 | } else { | 229 | } else { |
230 | e->ignore(); | 230 | e->ignore(); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | break; | 233 | break; |
234 | case Key_Shift: | 234 | case Key_Shift: |
235 | emit shiftDown(); | 235 | emit shiftDown(); |
236 | break; | 236 | break; |
237 | default: | 237 | default: |
238 | e->ignore(); | 238 | e->ignore(); |
239 | break; | 239 | break; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | void KNoScrollListBox::oneDown() | 243 | void KNoScrollListBox::oneDown() |
244 | { | 244 | { |
245 | if ( count () ) { | 245 | if ( count () ) { |
246 | if ( currentItem()+1 == count () ) { | 246 | if ( currentItem()+1 == count () ) { |
247 | emit nextCell(); | 247 | emit nextCell(); |
248 | } else { | 248 | } else { |
249 | resetOnFocusIn = false; | 249 | resetOnFocusIn = false; |
250 | setCurrentItem((currentItem()+1)%count()); | 250 | setCurrentItem((currentItem()+1)%count()); |
251 | if(!itemVisible(currentItem())) { | 251 | if(!itemVisible(currentItem())) { |
252 | if(currentItem() == 0) { | 252 | if(currentItem() == 0) { |
253 | setTopItem(0); | 253 | setTopItem(0); |
254 | } else { | 254 | } else { |
255 | setTopItem(topItem()+1); | 255 | setTopItem(topItem()+1); |
256 | } | 256 | } |
257 | } | 257 | } |
258 | } | 258 | } |
259 | } | 259 | } |
260 | } | 260 | } |
261 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 261 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
262 | { | 262 | { |
263 | switch(e->key()) { | 263 | switch(e->key()) { |
264 | case Key_Shift: | 264 | case Key_Shift: |
265 | emit shiftUp(); | 265 | emit shiftUp(); |
266 | break; | 266 | break; |
267 | default: | 267 | default: |
268 | break; | 268 | break; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | 271 | ||
272 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 272 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
273 | { | 273 | { |
274 | QListBox::mousePressEvent(e); | 274 | QListBox::mousePressEvent(e); |
275 | 275 | ||
276 | if(e->button() == RightButton) { | 276 | if(e->button() == RightButton) { |
277 | emit rightClick(); | 277 | emit rightClick(); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) | 281 | MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s) |
282 | : QListBoxItem() | 282 | : QListBoxItem() |
283 | { | 283 | { |
284 | mblockRepaint = true; | 284 | mblockRepaint = true; |
285 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; | 285 | isWeekItem = KOPrefs::instance()->mMonthViewWeek; |
286 | recycle( incidence, s ); | 286 | recycle( incidence, s ); |
287 | } | 287 | } |
288 | void MonthViewItem::recycle( Incidence *incidence, const QString & s) | 288 | void MonthViewItem::recycle( Incidence *incidence, const QString & s) |
289 | { | 289 | { |
290 | mDisplayHightlighted = false; | 290 | mDisplayHightlighted = false; |
291 | setText( s ); | 291 | setText( s ); |
292 | mMultiday = 0; | 292 | mMultiday = 0; |
293 | mIncidence = incidence; | 293 | mIncidence = incidence; |
294 | mRecur = false; | 294 | mRecur = false; |
295 | mAlarm = false; | 295 | mAlarm = false; |
296 | mReply = false; | 296 | mReply = false; |
297 | mInfo = false; | 297 | mInfo = false; |
298 | mdayPos = 0; | 298 | mdayPos = 0; |
299 | } | 299 | } |
300 | 300 | ||
301 | bool MonthViewItem::setHighlightedFalse() | 301 | bool MonthViewItem::setHighlightedFalse() |
302 | { | 302 | { |
303 | if ( !mDisplayHightlighted ) | 303 | if ( !mDisplayHightlighted ) |
304 | return false; | 304 | return false; |
305 | mDisplayHightlighted = false; | 305 | mDisplayHightlighted = false; |
306 | return true; | 306 | return true; |
307 | } | 307 | } |
308 | 308 | ||
309 | bool MonthViewItem::setHighlighted( Incidence * inc ) | 309 | bool MonthViewItem::setHighlighted( Incidence * inc ) |
310 | { | 310 | { |
311 | if ( inc == mIncidence ) { | 311 | if ( inc == mIncidence ) { |
312 | if ( mDisplayHightlighted ) | 312 | if ( mDisplayHightlighted ) |
313 | return false; | 313 | return false; |
314 | mDisplayHightlighted = true; | 314 | mDisplayHightlighted = true; |
315 | return true; | 315 | return true; |
316 | } else { | 316 | } else { |
317 | if ( !mDisplayHightlighted ) | 317 | if ( !mDisplayHightlighted ) |
318 | return false; | 318 | return false; |
319 | mDisplayHightlighted = false; | 319 | mDisplayHightlighted = false; |
320 | return true; | 320 | return true; |
321 | } | 321 | } |
322 | return false; | 322 | return false; |
323 | } | 323 | } |
324 | void MonthViewItem::paint(QPainter *p) | 324 | void MonthViewItem::paint(QPainter *p) |
325 | { | 325 | { |
326 | if ( mblockRepaint || !mIncidence ) { | 326 | if ( mblockRepaint || !mIncidence ) { |
327 | return; | 327 | return; |
328 | } | 328 | } |
329 | #if QT_VERSION >= 0x030000 | 329 | #if QT_VERSION >= 0x030000 |
330 | bool sel = isSelected(); | 330 | bool sel = isSelected(); |
331 | #else | 331 | #else |
332 | bool sel = selected(); | 332 | bool sel = selected(); |
333 | #endif | 333 | #endif |
334 | int heihei = height( listBox () ); | 334 | int heihei = height( listBox () ); |
335 | int x = 1; | 335 | int x = 1; |
336 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted || sel ) | 336 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted || sel ) |
337 | { | 337 | { |
338 | if ( mDisplayHightlighted ) | 338 | |
339 | sel = true; | ||
340 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 339 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
341 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 340 | sel ||mDisplayHightlighted ? QColorGroup::Highlight : QColorGroup::Background ) ); |
342 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); | 341 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei ); |
343 | } | 342 | } |
344 | 343 | ||
345 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 344 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
346 | int size = PIXMAP_SIZE; | 345 | int size = PIXMAP_SIZE; |
347 | if ( QApplication::desktop()->width() < 300 ) | 346 | if ( QApplication::desktop()->width() < 300 ) |
348 | size = 3; | 347 | size = 3; |
349 | int y = (heihei - size -1 ) /2; | 348 | int y = (heihei - size -1 ) /2; |
350 | 349 | ||
351 | if ( mIncidence->calID() > 1 ) { | 350 | if ( mIncidence->calID() > 1 ) { |
352 | p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); | 351 | p->fillRect ( x, y-2,size,size+4, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); |
353 | p->drawRect ( x, y-2,size,size+4); | 352 | p->drawRect ( x, y-2,size,size+4); |
354 | x += size + 1; | 353 | x += size + 1; |
355 | } | 354 | } |
356 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 355 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
357 | if ( mInfo ) { | 356 | if ( mInfo ) { |
358 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 357 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
359 | x += size + 1; | 358 | x += size + 1; |
360 | } | 359 | } |
361 | if ( mRecur ) { | 360 | if ( mRecur ) { |
362 | p->fillRect ( x, y,size,size, Qt::blue ); | 361 | p->fillRect ( x, y,size,size, Qt::blue ); |
363 | x += size + 1; | 362 | x += size + 1; |
364 | } | 363 | } |
365 | if ( mAlarm ) { | 364 | if ( mAlarm ) { |
366 | p->fillRect ( x, y,size,size, Qt::red ); | 365 | p->fillRect ( x, y,size,size, Qt::red ); |
367 | x += size + 1; | 366 | x += size + 1; |
368 | } | 367 | } |
369 | if ( mReply ) { | 368 | if ( mReply ) { |
370 | p->fillRect ( x, y,size,size, Qt::yellow ); | 369 | p->fillRect ( x, y,size,size, Qt::yellow ); |
371 | x += size + 1; | 370 | x += size + 1; |
372 | } | 371 | } |
373 | } | 372 | } |
374 | if ( mMultiday ) { | 373 | if ( mMultiday ) { |
375 | int yyy = y+(size/2); | 374 | int yyy = y+(size/2); |
376 | int sizeM = size+2; | 375 | int sizeM = size+2; |
377 | p->setBrush( QBrush( p->pen().color() ) ); | 376 | p->setBrush( QBrush( p->pen().color() ) ); |
378 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 377 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
379 | if ( mMultiday == 2 || mMultiday == 3 ) { | 378 | if ( mMultiday == 2 || mMultiday == 3 ) { |
380 | QPointArray pa ( 3 ); | 379 | QPointArray pa ( 3 ); |
381 | pa.setPoint (0, x, yyy ); | 380 | pa.setPoint (0, x, yyy ); |
382 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 381 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
383 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 382 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
384 | p->drawPolygon( pa ); | 383 | p->drawPolygon( pa ); |
385 | } | 384 | } |
386 | if ( mMultiday == 2 || mMultiday == 1 ) { | 385 | if ( mMultiday == 2 || mMultiday == 1 ) { |
387 | QPointArray pa ( 3 ); | 386 | QPointArray pa ( 3 ); |
388 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 387 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
389 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 388 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
390 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 389 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
391 | p->drawPolygon( pa ); | 390 | p->drawPolygon( pa ); |
392 | } | 391 | } |
393 | if ( mMultiday == 1 ) { | 392 | if ( mMultiday == 1 ) { |
394 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 393 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
395 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 394 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
396 | } | 395 | } |
397 | if ( mMultiday == 3 ) { | 396 | if ( mMultiday == 3 ) { |
398 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 397 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
399 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 398 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
400 | 399 | ||
401 | } | 400 | } |
402 | x += sizeM/2 + 1; | 401 | x += sizeM/2 + 1; |
403 | x += sizeM + 1; | 402 | x += sizeM + 1; |
404 | } | 403 | } |
405 | 404 | ||
406 | if ( mIncidence->typeID() == todoID ){ | 405 | if ( mIncidence->typeID() == todoID ){ |
407 | Todo* td = ( Todo* ) mIncidence; | 406 | Todo* td = ( Todo* ) mIncidence; |
408 | if ( td->isCompleted() ) { | 407 | if ( td->isCompleted() ) { |
409 | int half = size/2; | 408 | int half = size/2; |
410 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 409 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
411 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 410 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
412 | x += half+half + 4; | 411 | x += half+half + 4; |
413 | 412 | ||
414 | } else { | 413 | } else { |
415 | int val = td->percentComplete()/20; | 414 | int val = td->percentComplete()/20; |
416 | p->fillRect ( x+1, y-2, val ,size+4,p->pen().color() ); | 415 | p->fillRect ( x+1, y-2, val ,size+4,p->pen().color() ); |
417 | p->drawRect ( x, y-2,7,size+4); | 416 | p->drawRect ( x, y-2,7,size+4); |
418 | x += size + 3; | 417 | x += size + 3; |
419 | } | 418 | } |
420 | } | 419 | } |
421 | QFontMetrics fm = p->fontMetrics(); | 420 | QFontMetrics fm = p->fontMetrics(); |
422 | int yPos; | 421 | int yPos; |
423 | int pmheight = size; | 422 | int pmheight = size; |
424 | if( pmheight < fm.height() ) | 423 | if( pmheight < fm.height() ) |
425 | yPos = fm.ascent() + fm.leading()/2; | 424 | yPos = fm.ascent() + fm.leading()/2; |
426 | else | 425 | else |
427 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 426 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
428 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 427 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
429 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 428 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
430 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { | 429 | if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) { |
431 | p->drawText( x, yPos, text() ); | 430 | p->drawText( x, yPos, text() ); |
432 | if ( mIncidence->cancelled() ) { | 431 | if ( mIncidence->cancelled() ) { |
433 | int wid = fm.width( text() ); | 432 | int wid = fm.width( text() ); |
434 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 433 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
435 | } | 434 | } |
436 | } else { | 435 | } else { |
437 | QString pText = text(); | 436 | QString pText = text(); |
438 | if( pText.mid(2,1) == ":" ) | 437 | if( pText.mid(2,1) == ":" ) |
439 | pText = pText.mid( 6 ); | 438 | pText = pText.mid( 6 ); |
440 | p->drawText( x, yPos, pText ); | 439 | p->drawText( x, yPos, pText ); |
441 | if ( mIncidence->cancelled() ) { | 440 | if ( mIncidence->cancelled() ) { |
442 | int wid = fm.width( pText ); | 441 | int wid = fm.width( pText ); |
443 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 442 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
444 | } | 443 | } |
445 | } | 444 | } |
446 | } | 445 | } |
447 | 446 | ||
448 | int MonthViewItem::height(const QListBox *lb) const | 447 | int MonthViewItem::height(const QListBox *lb) const |
449 | { | 448 | { |
450 | int ret = 10; | 449 | int ret = 10; |
451 | if ( lb ) | 450 | if ( lb ) |
452 | ret = lb->fontMetrics().lineSpacing()+1; | 451 | ret = lb->fontMetrics().lineSpacing()+1; |
453 | return ret; | 452 | return ret; |
454 | } | 453 | } |
455 | 454 | ||
456 | int MonthViewItem::width(const QListBox *lb) const | 455 | int MonthViewItem::width(const QListBox *lb) const |
457 | { | 456 | { |
458 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { | 457 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { |
459 | int size = PIXMAP_SIZE; | 458 | int size = PIXMAP_SIZE; |
460 | if ( QApplication::desktop()->width() < 300 ) | 459 | if ( QApplication::desktop()->width() < 300 ) |
461 | size = 3; | 460 | size = 3; |
462 | int x = 1; | 461 | int x = 1; |
463 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 462 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
464 | if ( mInfo ) { | 463 | if ( mInfo ) { |
465 | x += size + 1; | 464 | x += size + 1; |
466 | } | 465 | } |
467 | if( mRecur ) { | 466 | if( mRecur ) { |
468 | x += size+1; | 467 | x += size+1; |
469 | } | 468 | } |
470 | if( mAlarm ) { | 469 | if( mAlarm ) { |
471 | x += size+1; | 470 | x += size+1; |
472 | } | 471 | } |
473 | if( mReply ) { | 472 | if( mReply ) { |
474 | x += size+1; | 473 | x += size+1; |
475 | } | 474 | } |
476 | } | 475 | } |
477 | if( mMultiday ) { | 476 | if( mMultiday ) { |
478 | x += size+1+2+size/2; | 477 | x += size+1+2+size/2; |
479 | } | 478 | } |
480 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 479 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
481 | } | 480 | } |
482 | if ( ! lb ) | 481 | if ( ! lb ) |
483 | return 10; | 482 | return 10; |
484 | return lb->width(); | 483 | return lb->width(); |
485 | } | 484 | } |
486 | 485 | ||
487 | 486 | ||
488 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 487 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
489 | : KNoScrollListBox( par ), | 488 | : KNoScrollListBox( par ), |
490 | mMonthView( parent ) | 489 | mMonthView( parent ) |
491 | { | 490 | { |
492 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); | 491 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); |
493 | currentPalette = 0; | 492 | currentPalette = 0; |
494 | // mLabel = new QLabel( this );QPushButton | 493 | // mLabel = new QLabel( this );QPushButton |
495 | mLabel = new QPushButton( this ); | 494 | mLabel = new QPushButton( this ); |
496 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 495 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
497 | //mLabel->setLineWidth( 1 ); | 496 | //mLabel->setLineWidth( 1 ); |
498 | //mLabel->setAlignment( AlignCenter ); | 497 | //mLabel->setAlignment( AlignCenter ); |
499 | mLabel->setFlat( true ); | 498 | mLabel->setFlat( true ); |
500 | mLabel->setFocusPolicy(NoFocus); | 499 | mLabel->setFocusPolicy(NoFocus); |
501 | //mItemList = new KNoScrollListBox( this ); | 500 | //mItemList = new KNoScrollListBox( this ); |
502 | setMinimumSize( 10, 10 ); | 501 | setMinimumSize( 10, 10 ); |
503 | setFrameStyle( QFrame::Panel | QFrame::Plain ); | 502 | setFrameStyle( QFrame::Panel | QFrame::Plain ); |
504 | setLineWidth( 1 ); | 503 | setLineWidth( 1 ); |
505 | //topLayout->addWidget( mItemList ); | 504 | //topLayout->addWidget( mItemList ); |
506 | mLabel->raise(); | 505 | mLabel->raise(); |
507 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 506 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
508 | mStandardPalette = palette(); | 507 | mStandardPalette = palette(); |
509 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 508 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
510 | 509 | ||
511 | enableScrollBars( false ); | 510 | enableScrollBars( false ); |
512 | updateConfig(); | 511 | updateConfig(); |
513 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 512 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
514 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 513 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
515 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), | 514 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), |
516 | SLOT( defaultAction( QListBoxItem * ) ) ); | 515 | SLOT( defaultAction( QListBoxItem * ) ) ); |
517 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, | 516 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, |
518 | const QPoint &) ), | 517 | const QPoint &) ), |
519 | SLOT( contextMenu( QListBoxItem * ) ) ); | 518 | SLOT( contextMenu( QListBoxItem * ) ) ); |
520 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), | 519 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), |
521 | SLOT( selection( QListBoxItem * ) ) ); | 520 | SLOT( selection( QListBoxItem * ) ) ); |
522 | 521 | ||
523 | /* | 522 | /* |
524 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 523 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
525 | SLOT( selection( QListBoxItem * ) ) ); | 524 | SLOT( selection( QListBoxItem * ) ) ); |
526 | */ | 525 | */ |
527 | } | 526 | } |
528 | #ifdef DESKTOP_VERSION | 527 | #ifdef DESKTOP_VERSION |
529 | QToolTipGroup *MonthViewCell::toolTipGroup() | 528 | QToolTipGroup *MonthViewCell::toolTipGroup() |
530 | { | 529 | { |
531 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 530 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
532 | return mToolTipGroup; | 531 | return mToolTipGroup; |
533 | } | 532 | } |