author | zautrix <zautrix> | 2005-04-05 10:34:37 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-05 10:34:37 (UTC) |
commit | 854e1b46d7895bf4860d914abb5f1e954dfbfe6a (patch) (unidiff) | |
tree | 0636047ee54238f5d2b864bb0b0419e65311c91b /korganizer | |
parent | 141c73d9ee02cff6fc2a56289bd8c85bbf60df02 (diff) | |
download | kdepimpi-854e1b46d7895bf4860d914abb5f1e954dfbfe6a.zip kdepimpi-854e1b46d7895bf4860d914abb5f1e954dfbfe6a.tar.gz kdepimpi-854e1b46d7895bf4860d914abb5f1e954dfbfe6a.tar.bz2 |
fix
-rw-r--r-- | korganizer/komonthview.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 425496a..6d6ae8a 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -300,208 +300,207 @@ void MonthViewItem::paint(QPainter *p) | |||
300 | bool sel = selected(); | 300 | bool sel = selected(); |
301 | #endif | 301 | #endif |
302 | 302 | ||
303 | 303 | ||
304 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 304 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
305 | { | 305 | { |
306 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 306 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
307 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 307 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
308 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 308 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
309 | } | 309 | } |
310 | int x = 1; | 310 | int x = 1; |
311 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 311 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
312 | int size = PIXMAP_SIZE; | 312 | int size = PIXMAP_SIZE; |
313 | if ( QApplication::desktop()->width() < 300 ) | 313 | if ( QApplication::desktop()->width() < 300 ) |
314 | size = 3; | 314 | size = 3; |
315 | int heihei = height( listBox () ); | 315 | int heihei = height( listBox () ); |
316 | int y = (heihei - size -1 ) /2; | 316 | int y = (heihei - size -1 ) /2; |
317 | 317 | ||
318 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 318 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
319 | if ( mInfo ) { | 319 | if ( mInfo ) { |
320 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 320 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
321 | x += size + 1; | 321 | x += size + 1; |
322 | } | 322 | } |
323 | if ( mRecur ) { | 323 | if ( mRecur ) { |
324 | p->fillRect ( x, y,size,size, Qt::blue ); | 324 | p->fillRect ( x, y,size,size, Qt::blue ); |
325 | x += size + 1; | 325 | x += size + 1; |
326 | } | 326 | } |
327 | if ( mAlarm ) { | 327 | if ( mAlarm ) { |
328 | p->fillRect ( x, y,size,size, Qt::red ); | 328 | p->fillRect ( x, y,size,size, Qt::red ); |
329 | x += size + 1; | 329 | x += size + 1; |
330 | } | 330 | } |
331 | if ( mReply ) { | 331 | if ( mReply ) { |
332 | p->fillRect ( x, y,size,size, Qt::yellow ); | 332 | p->fillRect ( x, y,size,size, Qt::yellow ); |
333 | x += size + 1; | 333 | x += size + 1; |
334 | } | 334 | } |
335 | } | 335 | } |
336 | if ( mMultiday ) { | 336 | if ( mMultiday ) { |
337 | int yyy = y+(size/2); | 337 | int yyy = y+(size/2); |
338 | int sizeM = size+2; | 338 | int sizeM = size+2; |
339 | p->setBrush( QBrush::SolidPattern ); | 339 | p->setBrush( QBrush::SolidPattern ); |
340 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 340 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
341 | if ( mMultiday == 2 || mMultiday == 3 ) { | 341 | if ( mMultiday == 2 || mMultiday == 3 ) { |
342 | QPointArray pa ( 3 ); | 342 | QPointArray pa ( 3 ); |
343 | pa.setPoint (0, x, yyy ); | 343 | pa.setPoint (0, x, yyy ); |
344 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 344 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
345 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 345 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
346 | p->drawPolygon( pa ); | 346 | p->drawPolygon( pa ); |
347 | } | 347 | } |
348 | if ( mMultiday == 2 || mMultiday == 1 ) { | 348 | if ( mMultiday == 2 || mMultiday == 1 ) { |
349 | QPointArray pa ( 3 ); | 349 | QPointArray pa ( 3 ); |
350 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 350 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
351 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 351 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
352 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 352 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
353 | p->drawPolygon( pa ); | 353 | p->drawPolygon( pa ); |
354 | } | 354 | } |
355 | if ( mMultiday == 1 ) { | 355 | if ( mMultiday == 1 ) { |
356 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 356 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
357 | 357 | ||
358 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 358 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
359 | } | 359 | } |
360 | if ( mMultiday == 3 ) { | 360 | if ( mMultiday == 3 ) { |
361 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 361 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
362 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 362 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
363 | 363 | ||
364 | } | 364 | } |
365 | x += sizeM/2 + 1; | 365 | x += sizeM/2 + 1; |
366 | x += sizeM + 1; | 366 | x += sizeM + 1; |
367 | } | 367 | } |
368 | 368 | ||
369 | if ( mIncidence->type() == "Todo" ){ | 369 | if ( mIncidence->type() == "Todo" ){ |
370 | Todo* td = ( Todo* ) mIncidence; | 370 | Todo* td = ( Todo* ) mIncidence; |
371 | if ( td->isCompleted() ) { | 371 | if ( td->isCompleted() ) { |
372 | int half = size/2; | 372 | int half = size/2; |
373 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; | 373 | p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ; |
374 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; | 374 | p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ; |
375 | x += half+half + 4; | 375 | x += half+half + 4; |
376 | 376 | ||
377 | } else { | 377 | } else { |
378 | int val = td->percentComplete()/20; | 378 | int val = td->percentComplete()/20; |
379 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); | 379 | p->fillRect ( x+1, y-2, val ,size+4,Qt::black ); |
380 | p->drawRect ( x, y-2,7,size+4); | 380 | p->drawRect ( x, y-2,7,size+4); |
381 | x += size + 3; | 381 | x += size + 3; |
382 | } | 382 | } |
383 | } | 383 | } |
384 | QFontMetrics fm = p->fontMetrics(); | 384 | QFontMetrics fm = p->fontMetrics(); |
385 | int yPos; | 385 | int yPos; |
386 | int pmheight = size; | 386 | int pmheight = size; |
387 | if( pmheight < fm.height() ) | 387 | if( pmheight < fm.height() ) |
388 | yPos = fm.ascent() + fm.leading()/2; | 388 | yPos = fm.ascent() + fm.leading()/2; |
389 | else | 389 | else |
390 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 390 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
391 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 391 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
392 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 392 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
393 | p->drawText( x, yPos, text() ); | 393 | p->drawText( x, yPos, text() ); |
394 | if ( mIncidence->cancelled() ) { | 394 | if ( mIncidence->cancelled() ) { |
395 | int wid = fm.width( text() ); | 395 | int wid = fm.width( text() ); |
396 | p->drawLine( x, heihei/2-1 ,x+wid, heihei/2-1 ); | 396 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
397 | } | 397 | } |
398 | 398 | ||
399 | } | 399 | } |
400 | 400 | ||
401 | int MonthViewItem::height(const QListBox *lb) const | 401 | int MonthViewItem::height(const QListBox *lb) const |
402 | { | 402 | { |
403 | int ret = 10; | 403 | int ret = 10; |
404 | if ( lb ) | 404 | if ( lb ) |
405 | ret = lb->fontMetrics().lineSpacing()+1; | 405 | ret = lb->fontMetrics().lineSpacing()+1; |
406 | return ret; | 406 | return ret; |
407 | } | 407 | } |
408 | 408 | ||
409 | int MonthViewItem::width(const QListBox *lb) const | 409 | int MonthViewItem::width(const QListBox *lb) const |
410 | { | 410 | { |
411 | |||
412 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { | 411 | if( KOPrefs::instance()->mEnableMonthScroll || isWeekItem ) { |
413 | int size = PIXMAP_SIZE; | 412 | int size = PIXMAP_SIZE; |
414 | if ( QApplication::desktop()->width() < 300 ) | 413 | if ( QApplication::desktop()->width() < 300 ) |
415 | size = 3; | 414 | size = 3; |
416 | int x = 1; | 415 | int x = 1; |
417 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 416 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
418 | if ( mInfo ) { | 417 | if ( mInfo ) { |
419 | x += size + 1; | 418 | x += size + 1; |
420 | } | 419 | } |
421 | if( mRecur ) { | 420 | if( mRecur ) { |
422 | x += size+1; | 421 | x += size+1; |
423 | } | 422 | } |
424 | if( mAlarm ) { | 423 | if( mAlarm ) { |
425 | x += size+1; | 424 | x += size+1; |
426 | } | 425 | } |
427 | if( mReply ) { | 426 | if( mReply ) { |
428 | x += size+1; | 427 | x += size+1; |
429 | } | 428 | } |
430 | } | 429 | } |
431 | if( mMultiday ) { | 430 | if( mMultiday ) { |
432 | x += size+1+2+size/2; | 431 | x += size+1+2+size/2; |
433 | } | 432 | } |
434 | return( x + lb->fontMetrics().width( text() ) + 1 ); | 433 | return( x + lb->fontMetrics().width( text() ) + 1 ); |
435 | } | 434 | } |
436 | if ( ! lb ) | 435 | if ( ! lb ) |
437 | return 10; | 436 | return 10; |
438 | //qDebug("ret wid %d ", lb->width()); | 437 | //qDebug("ret wid %d ", lb->width()); |
439 | return lb->width(); | 438 | return lb->width(); |
440 | } | 439 | } |
441 | 440 | ||
442 | 441 | ||
443 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) | 442 | MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) |
444 | : KNoScrollListBox( par ), | 443 | : KNoScrollListBox( par ), |
445 | mMonthView( parent ) | 444 | mMonthView( parent ) |
446 | { | 445 | { |
447 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); | 446 | //QVBoxLayout *topLayout = new QVBoxLayout( this ); |
448 | currentPalette = 0; | 447 | currentPalette = 0; |
449 | // mLabel = new QLabel( this );QPushButton | 448 | // mLabel = new QLabel( this );QPushButton |
450 | mLabel = new QPushButton( this ); | 449 | mLabel = new QPushButton( this ); |
451 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); | 450 | //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); |
452 | //mLabel->setLineWidth( 1 ); | 451 | //mLabel->setLineWidth( 1 ); |
453 | //mLabel->setAlignment( AlignCenter ); | 452 | //mLabel->setAlignment( AlignCenter ); |
454 | mLabel->setFlat( true ); | 453 | mLabel->setFlat( true ); |
455 | mLabel->setFocusPolicy(NoFocus); | 454 | mLabel->setFocusPolicy(NoFocus); |
456 | //mItemList = new KNoScrollListBox( this ); | 455 | //mItemList = new KNoScrollListBox( this ); |
457 | setMinimumSize( 10, 10 ); | 456 | setMinimumSize( 10, 10 ); |
458 | setFrameStyle( QFrame::Panel | QFrame::Plain ); | 457 | setFrameStyle( QFrame::Panel | QFrame::Plain ); |
459 | setLineWidth( 1 ); | 458 | setLineWidth( 1 ); |
460 | //topLayout->addWidget( mItemList ); | 459 | //topLayout->addWidget( mItemList ); |
461 | mLabel->raise(); | 460 | mLabel->raise(); |
462 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) | 461 | // QColor( 0,0,255 ) QColor( 160,1600,255 ) |
463 | mStandardPalette = palette(); | 462 | mStandardPalette = palette(); |
464 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); | 463 | mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); |
465 | 464 | ||
466 | enableScrollBars( false ); | 465 | enableScrollBars( false ); |
467 | updateConfig(); | 466 | updateConfig(); |
468 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); | 467 | //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); |
469 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); | 468 | connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); |
470 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), | 469 | connect( this , SIGNAL( doubleClicked( QListBoxItem *) ), |
471 | SLOT( defaultAction( QListBoxItem * ) ) ); | 470 | SLOT( defaultAction( QListBoxItem * ) ) ); |
472 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, | 471 | connect( this, SIGNAL( rightButtonPressed( QListBoxItem *, |
473 | const QPoint &) ), | 472 | const QPoint &) ), |
474 | SLOT( contextMenu( QListBoxItem * ) ) ); | 473 | SLOT( contextMenu( QListBoxItem * ) ) ); |
475 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), | 474 | connect( this, SIGNAL( highlighted( QListBoxItem *) ), |
476 | SLOT( selection( QListBoxItem * ) ) ); | 475 | SLOT( selection( QListBoxItem * ) ) ); |
477 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 476 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
478 | SLOT( cellClicked( QListBoxItem * ) ) ); | 477 | SLOT( cellClicked( QListBoxItem * ) ) ); |
479 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), | 478 | connect( this, SIGNAL( clicked( QListBoxItem * ) ), |
480 | SLOT( selection( QListBoxItem * ) ) ); | 479 | SLOT( selection( QListBoxItem * ) ) ); |
481 | } | 480 | } |
482 | #ifdef DESKTOP_VERSION | 481 | #ifdef DESKTOP_VERSION |
483 | QToolTipGroup *MonthViewCell::toolTipGroup() | 482 | QToolTipGroup *MonthViewCell::toolTipGroup() |
484 | { | 483 | { |
485 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); | 484 | if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); |
486 | return mToolTipGroup; | 485 | return mToolTipGroup; |
487 | } | 486 | } |
488 | #endif | 487 | #endif |
489 | 488 | ||
490 | void MonthViewCell::setDate( const QDate &date ) | 489 | void MonthViewCell::setDate( const QDate &date ) |
491 | { | 490 | { |
492 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; | 491 | // kdDebug() << "MonthViewCell::setDate(): " << date.toString() << endl; |
493 | mDate = date; | 492 | mDate = date; |
494 | 493 | ||
495 | 494 | ||
496 | 495 | ||
497 | //resizeEvent( 0 ); | 496 | //resizeEvent( 0 ); |
498 | } | 497 | } |
499 | 498 | ||
500 | QDate MonthViewCell::date() const | 499 | QDate MonthViewCell::date() const |
501 | { | 500 | { |
502 | return mDate; | 501 | return mDate; |
503 | } | 502 | } |
504 | 503 | ||
505 | void MonthViewCell::setPrimary( bool primary ) | 504 | void MonthViewCell::setPrimary( bool primary ) |
506 | { | 505 | { |
507 | mPrimary = primary; | 506 | mPrimary = primary; |