author | zautrix <zautrix> | 2005-06-15 09:19:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-15 09:19:15 (UTC) |
commit | 37175a31a8fa8772403e9588ff3f8bd7de3979cc (patch) (unidiff) | |
tree | d5e7210eaf5c0700e4957b898e01fb0f6dd73711 /korganizer/koagendaitem.cpp | |
parent | 820a1285559d0bb5859f634ebc6865f3a85a93ab (diff) | |
download | kdepimpi-37175a31a8fa8772403e9588ff3f8bd7de3979cc.zip kdepimpi-37175a31a8fa8772403e9588ff3f8bd7de3979cc.tar.gz kdepimpi-37175a31a8fa8772403e9588ff3f8bd7de3979cc.tar.bz2 |
fix
-rw-r--r-- | korganizer/koagendaitem.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 1be0aca..e660c32 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -114,49 +114,49 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | |||
114 | else | 114 | else |
115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 115 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
116 | } | 116 | } |
117 | else { | 117 | else { |
118 | QStringList categories = mIncidence->categories(); | 118 | QStringList categories = mIncidence->categories(); |
119 | QString cat = categories.first(); | 119 | QString cat = categories.first(); |
120 | if (cat.isEmpty()) { | 120 | if (cat.isEmpty()) { |
121 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 121 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
122 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 122 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
123 | else | 123 | else |
124 | mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); | 124 | mBackgroundColor =KOPrefs::instance()->defaultColor( incidence->calID() ); |
125 | } else { | 125 | } else { |
126 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 126 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
127 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 127 | if ( (incidence->typeID() == todoID ) &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
128 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) | 128 | if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) |
129 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; | 129 | mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | 132 | ||
133 | } | 133 | } |
134 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 134 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
135 | mBackgroundColor.dark(),mBackgroundColor.light(), | 135 | mBackgroundColor.dark(),mBackgroundColor.light(), |
136 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 136 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
137 | setBackgroundColor( mBackgroundColor ); | 137 | setBackgroundColor( mBackgroundColor ); |
138 | 138 | mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); | |
139 | mConflictItems.clear(); | 139 | mConflictItems.clear(); |
140 | setCellXY(0,0,1); | 140 | setCellXY(0,0,1); |
141 | setCellXWidth(0); | 141 | setCellXWidth(0); |
142 | setSubCell(0); | 142 | setSubCell(0); |
143 | setSubCells(1); | 143 | setSubCells(1); |
144 | setMultiItem(0,0,0); | 144 | setMultiItem(0,0,0); |
145 | startMove(); | 145 | startMove(); |
146 | mSelected = true; | 146 | mSelected = true; |
147 | select(false); | 147 | select(false); |
148 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 148 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
149 | mFontPixelSize = fontinf.height();; | 149 | mFontPixelSize = fontinf.height();; |
150 | hide(); | 150 | hide(); |
151 | xPaintCoord = -1; | 151 | xPaintCoord = -1; |
152 | yPaintCoord = -1; | 152 | yPaintCoord = -1; |
153 | } | 153 | } |
154 | 154 | ||
155 | 155 | ||
156 | KOAgendaItem::~KOAgendaItem() | 156 | KOAgendaItem::~KOAgendaItem() |
157 | { | 157 | { |
158 | #if QT_VERSION >= 0x030000 | 158 | #if QT_VERSION >= 0x030000 |
159 | 159 | ||
160 | #else | 160 | #else |
161 | delete mKOAgendaItemWhatsThis; | 161 | delete mKOAgendaItemWhatsThis; |
162 | #endif | 162 | #endif |
@@ -384,50 +384,49 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) | |||
384 | if ( nfh < 6.01 ) { | 384 | if ( nfh < 6.01 ) { |
385 | yy -= 2; | 385 | yy -= 2; |
386 | h += 4; | 386 | h += 4; |
387 | } | 387 | } |
388 | else | 388 | else |
389 | if ( nfh < h -2 ) | 389 | if ( nfh < h -2 ) |
390 | ++yy; | 390 | ++yy; |
391 | } | 391 | } |
392 | int align; | 392 | int align; |
393 | #ifndef DESKTOP_VERSION | 393 | #ifndef DESKTOP_VERSION |
394 | align = ( AlignLeft|WordBreak|AlignTop); | 394 | align = ( AlignLeft|WordBreak|AlignTop); |
395 | #else | 395 | #else |
396 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); | 396 | align = ( AlignLeft|BreakAnywhere|WordBreak|AlignTop); |
397 | #endif | 397 | #endif |
398 | if ( addIcon ) { | 398 | if ( addIcon ) { |
399 | if ( ! horLayout ) { | 399 | if ( ! horLayout ) { |
400 | x += AGENDA_ICON_SIZE+3; | 400 | x += AGENDA_ICON_SIZE+3; |
401 | w -= (AGENDA_ICON_SIZE+3); | 401 | w -= (AGENDA_ICON_SIZE+3); |
402 | } | 402 | } |
403 | else { | 403 | else { |
404 | yy+= AGENDA_ICON_SIZE+2; | 404 | yy+= AGENDA_ICON_SIZE+2; |
405 | h -=(AGENDA_ICON_SIZE+3); | 405 | h -=(AGENDA_ICON_SIZE+3); |
406 | } | 406 | } |
407 | } | 407 | } |
408 | int colsum = mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue(); | 408 | if ( mWhiteText ) |
409 | if ( colsum < 250 ) | ||
410 | paint->setPen ( white); | 409 | paint->setPen ( white); |
411 | if ( x < 0 ) { | 410 | if ( x < 0 ) { |
412 | w = w+x-3; | 411 | w = w+x-3; |
413 | x = 3; | 412 | x = 3; |
414 | if ( w > parentWidget()->width() ){ | 413 | if ( w > parentWidget()->width() ){ |
415 | w = parentWidget()->width() - 6; | 414 | w = parentWidget()->width() - 6; |
416 | #ifndef DESKTOP_VERSION | 415 | #ifndef DESKTOP_VERSION |
417 | align = ( AlignHCenter|WordBreak|AlignTop); | 416 | align = ( AlignHCenter|WordBreak|AlignTop); |
418 | #else | 417 | #else |
419 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); | 418 | align = ( AlignHCenter|BreakAnywhere|WordBreak|AlignTop); |
420 | #endif | 419 | #endif |
421 | 420 | ||
422 | } | 421 | } |
423 | } | 422 | } |
424 | QRect dr; | 423 | QRect dr; |
425 | if ( w + x > parentWidget()->width() ) | 424 | if ( w + x > parentWidget()->width() ) |
426 | w = parentWidget()->width()-x; | 425 | w = parentWidget()->width()-x; |
427 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); | 426 | paint->drawText ( x, yy, w, h, align, mDisplayedText, -1, &dr ); |
428 | //qDebug("%d %d %d %d ", x, yy, w, h ); | 427 | //qDebug("%d %d %d %d ", x, yy, w, h ); |
429 | if ( mIncidence->cancelled() ){ | 428 | if ( mIncidence->cancelled() ){ |
430 | 429 | ||
431 | 430 | ||
432 | small = ( height() < 20 ); | 431 | small = ( height() < 20 ); |
433 | 432 | ||