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 | |||
@@ -242,196 +242,195 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | |||
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(); |