author | zautrix <zautrix> | 2005-02-19 23:16:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-19 23:16:04 (UTC) |
commit | e82ab2271ce57a71a0ae3890e9b09a9fcc6043e4 (patch) (unidiff) | |
tree | f4aee70f22fe7807279e0b6c7ee2c6e420694331 | |
parent | 6c152b28df5d22b75b1b0dcef77073f0320c5710 (diff) | |
download | kdepimpi-e82ab2271ce57a71a0ae3890e9b09a9fcc6043e4.zip kdepimpi-e82ab2271ce57a71a0ae3890e9b09a9fcc6043e4.tar.gz kdepimpi-e82ab2271ce57a71a0ae3890e9b09a9fcc6043e4.tar.bz2 |
fix
-rw-r--r-- | korganizer/komonthview.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 3aaa50a..c125ce9 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -102,193 +102,193 @@ QString KNoScrollListBox::getWhatsThisText(QPoint p) | |||
102 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 102 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
103 | { | 103 | { |
104 | 104 | ||
105 | switch(e->key()) { | 105 | switch(e->key()) { |
106 | case Key_Right: | 106 | case Key_Right: |
107 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 107 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
108 | { | 108 | { |
109 | e->ignore(); | 109 | e->ignore(); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | scrollBy(10,0); | 112 | scrollBy(10,0); |
113 | break; | 113 | break; |
114 | case Key_Left: | 114 | case Key_Left: |
115 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 115 | if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
116 | { | 116 | { |
117 | e->ignore(); | 117 | e->ignore(); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | scrollBy(-10,0); | 120 | scrollBy(-10,0); |
121 | break; | 121 | break; |
122 | case Key_Up: | 122 | case Key_Up: |
123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 123 | if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
124 | e->ignore(); | 124 | e->ignore(); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | setCurrentItem((currentItem()+count()-1)%count()); | 127 | setCurrentItem((currentItem()+count()-1)%count()); |
128 | if(!itemVisible(currentItem())) { | 128 | if(!itemVisible(currentItem())) { |
129 | if((unsigned int) currentItem() == (count()-1)) { | 129 | if((unsigned int) currentItem() == (count()-1)) { |
130 | setTopItem(currentItem()-numItemsVisible()+1); | 130 | setTopItem(currentItem()-numItemsVisible()+1); |
131 | } else { | 131 | } else { |
132 | setTopItem(topItem()-1); | 132 | setTopItem(topItem()-1); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | break; | 135 | break; |
136 | case Key_Down: | 136 | case Key_Down: |
137 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { | 137 | if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { |
138 | e->ignore(); | 138 | e->ignore(); |
139 | break; | 139 | break; |
140 | } | 140 | } |
141 | setCurrentItem((currentItem()+1)%count()); | 141 | setCurrentItem((currentItem()+1)%count()); |
142 | if(!itemVisible(currentItem())) { | 142 | if(!itemVisible(currentItem())) { |
143 | if(currentItem() == 0) { | 143 | if(currentItem() == 0) { |
144 | setTopItem(0); | 144 | setTopItem(0); |
145 | } else { | 145 | } else { |
146 | setTopItem(topItem()+1); | 146 | setTopItem(topItem()+1); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | break; | 149 | break; |
150 | case Key_I: | 150 | case Key_I: |
151 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); | 151 | QTimer::singleShot( 11, this, SLOT ( oneDown() ) ); |
152 | e->ignore(); | 152 | e->ignore(); |
153 | break; | 153 | break; |
154 | case Key_Shift: | 154 | case Key_Shift: |
155 | emit shiftDown(); | 155 | emit shiftDown(); |
156 | break; | 156 | break; |
157 | default: | 157 | default: |
158 | e->ignore(); | 158 | e->ignore(); |
159 | break; | 159 | break; |
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | void KNoScrollListBox::oneDown() | 163 | void KNoScrollListBox::oneDown() |
164 | { | 164 | { |
165 | setCurrentItem((currentItem()+1)%count()); | 165 | setCurrentItem((currentItem()+1)%count()); |
166 | if(!itemVisible(currentItem())) { | 166 | if(!itemVisible(currentItem())) { |
167 | if(currentItem() == 0) { | 167 | if(currentItem() == 0) { |
168 | setTopItem(0); | 168 | setTopItem(0); |
169 | } else { | 169 | } else { |
170 | setTopItem(topItem()+1); | 170 | setTopItem(topItem()+1); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | } | 173 | } |
174 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 174 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
175 | { | 175 | { |
176 | switch(e->key()) { | 176 | switch(e->key()) { |
177 | case Key_Shift: | 177 | case Key_Shift: |
178 | emit shiftUp(); | 178 | emit shiftUp(); |
179 | break; | 179 | break; |
180 | default: | 180 | default: |
181 | break; | 181 | break; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 185 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
186 | { | 186 | { |
187 | QListBox::mousePressEvent(e); | 187 | QListBox::mousePressEvent(e); |
188 | 188 | ||
189 | if(e->button() == RightButton) { | 189 | if(e->button() == RightButton) { |
190 | emit rightClick(); | 190 | emit rightClick(); |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 194 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
195 | : QListBoxItem() | 195 | : QListBoxItem() |
196 | { | 196 | { |
197 | setText( s ); | 197 | setText( s ); |
198 | 198 | mMultiday = 0; | |
199 | mIncidence = incidence; | 199 | mIncidence = incidence; |
200 | mDate = qd; | 200 | mDate = qd; |
201 | mRecur = false; | 201 | mRecur = false; |
202 | mAlarm = false; | 202 | mAlarm = false; |
203 | mReply = false; | 203 | mReply = false; |
204 | mInfo = false; | 204 | mInfo = false; |
205 | } | 205 | } |
206 | 206 | ||
207 | void MonthViewItem::paint(QPainter *p) | 207 | void MonthViewItem::paint(QPainter *p) |
208 | { | 208 | { |
209 | #if QT_VERSION >= 0x030000 | 209 | #if QT_VERSION >= 0x030000 |
210 | bool sel = isSelected(); | 210 | bool sel = isSelected(); |
211 | #else | 211 | #else |
212 | bool sel = selected(); | 212 | bool sel = selected(); |
213 | #endif | 213 | #endif |
214 | 214 | ||
215 | 215 | ||
216 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) | 216 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) |
217 | { | 217 | { |
218 | p->setBackgroundColor( palette().color( QPalette::Normal, \ | 218 | p->setBackgroundColor( palette().color( QPalette::Normal, \ |
219 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); | 219 | sel ? QColorGroup::Highlight : QColorGroup::Background ) ); |
220 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); | 220 | p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); |
221 | } | 221 | } |
222 | int x = 1; | 222 | int x = 1; |
223 | //int y = 3;//(height() - mRecurPixmap.height()) /2; | 223 | //int y = 3;//(height() - mRecurPixmap.height()) /2; |
224 | int size = PIXMAP_SIZE; | 224 | int size = PIXMAP_SIZE; |
225 | if ( QApplication::desktop()->width() < 300 ) | 225 | if ( QApplication::desktop()->width() < 300 ) |
226 | size = 3; | 226 | size = 3; |
227 | int heihei = height( listBox () ); | 227 | int heihei = height( listBox () ); |
228 | int y = (heihei - size -1 ) /2; | 228 | int y = (heihei - size -1 ) /2; |
229 | 229 | ||
230 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 230 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
231 | if ( mInfo ) { | 231 | if ( mInfo ) { |
232 | p->fillRect ( x, y,size,size, Qt::darkGreen ); | 232 | p->fillRect ( x, y,size,size, Qt::darkGreen ); |
233 | x += size + 1; | 233 | x += size + 1; |
234 | } | 234 | } |
235 | if ( mRecur ) { | 235 | if ( mRecur ) { |
236 | p->fillRect ( x, y,size,size, Qt::blue ); | 236 | p->fillRect ( x, y,size,size, Qt::blue ); |
237 | x += size + 1; | 237 | x += size + 1; |
238 | } | 238 | } |
239 | if ( mAlarm ) { | 239 | if ( mAlarm ) { |
240 | p->fillRect ( x, y,size,size, Qt::red ); | 240 | p->fillRect ( x, y,size,size, Qt::red ); |
241 | x += size + 1; | 241 | x += size + 1; |
242 | } | 242 | } |
243 | if ( mReply ) { | 243 | if ( mReply ) { |
244 | p->fillRect ( x, y,size,size, Qt::yellow ); | 244 | p->fillRect ( x, y,size,size, Qt::yellow ); |
245 | x += size + 1; | 245 | x += size + 1; |
246 | } | 246 | } |
247 | } | 247 | } |
248 | if ( mMultiday ) { | 248 | if ( mMultiday ) { |
249 | int yyy = y+(size/2); | 249 | int yyy = y+(size/2); |
250 | int sizeM = size+2; | 250 | int sizeM = size+2; |
251 | p->setBrush( QBrush::SolidPattern ); | 251 | p->setBrush( QBrush::SolidPattern ); |
252 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; | 252 | p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; |
253 | if ( mMultiday == 2 || mMultiday == 3 ) { | 253 | if ( mMultiday == 2 || mMultiday == 3 ) { |
254 | QPointArray pa ( 3 ); | 254 | QPointArray pa ( 3 ); |
255 | pa.setPoint (0, x, yyy ); | 255 | pa.setPoint (0, x, yyy ); |
256 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | 256 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); |
257 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | 257 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); |
258 | p->drawPolygon( pa ); | 258 | p->drawPolygon( pa ); |
259 | } | 259 | } |
260 | if ( mMultiday == 2 || mMultiday == 1 ) { | 260 | if ( mMultiday == 2 || mMultiday == 1 ) { |
261 | QPointArray pa ( 3 ); | 261 | QPointArray pa ( 3 ); |
262 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | 262 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); |
263 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | 263 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); |
264 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | 264 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); |
265 | p->drawPolygon( pa ); | 265 | p->drawPolygon( pa ); |
266 | } | 266 | } |
267 | if ( mMultiday == 1 ) { | 267 | if ( mMultiday == 1 ) { |
268 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 268 | // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
269 | 269 | ||
270 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); | 270 | p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); |
271 | } | 271 | } |
272 | if ( mMultiday == 3 ) { | 272 | if ( mMultiday == 3 ) { |
273 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | 273 | // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); |
274 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); | 274 | p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); |
275 | 275 | ||
276 | } | 276 | } |
277 | x += sizeM/2 + 1; | 277 | x += sizeM/2 + 1; |
278 | x += sizeM + 1; | 278 | x += sizeM + 1; |
279 | } | 279 | } |
280 | QFontMetrics fm = p->fontMetrics(); | 280 | QFontMetrics fm = p->fontMetrics(); |
281 | int yPos; | 281 | int yPos; |
282 | int pmheight = size; | 282 | int pmheight = size; |
283 | if( pmheight < fm.height() ) | 283 | if( pmheight < fm.height() ) |
284 | yPos = fm.ascent() + fm.leading()/2; | 284 | yPos = fm.ascent() + fm.leading()/2; |
285 | else | 285 | else |
286 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); | 286 | yPos = pmheight/2 - fm.height()/2 + fm.ascent(); |
287 | p->setPen( palette().color( QPalette::Normal, sel ? \ | 287 | p->setPen( palette().color( QPalette::Normal, sel ? \ |
288 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); | 288 | QColorGroup::HighlightedText : QColorGroup::Foreground ) ); |
289 | p->drawText( x, yPos, text() ); | 289 | p->drawText( x, yPos, text() ); |
290 | if ( mIncidence->cancelled() ) { | 290 | if ( mIncidence->cancelled() ) { |
291 | int wid = fm.width( text() ); | 291 | int wid = fm.width( text() ); |
292 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); | 292 | p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); |
293 | } | 293 | } |
294 | 294 | ||
@@ -423,194 +423,195 @@ QPalette MonthViewCell::getPalette () | |||
423 | if ( mPrimary ) { | 423 | if ( mPrimary ) { |
424 | return mPrimaryPalette ; | 424 | return mPrimaryPalette ; |
425 | } | 425 | } |
426 | } | 426 | } |
427 | return mNonPrimaryPalette; | 427 | return mNonPrimaryPalette; |
428 | } | 428 | } |
429 | bool MonthViewCell::isPrimary() const | 429 | bool MonthViewCell::isPrimary() const |
430 | { | 430 | { |
431 | return mPrimary; | 431 | return mPrimary; |
432 | } | 432 | } |
433 | 433 | ||
434 | void MonthViewCell::setHoliday( bool holiday ) | 434 | void MonthViewCell::setHoliday( bool holiday ) |
435 | { | 435 | { |
436 | mHoliday = holiday; | 436 | mHoliday = holiday; |
437 | //setMyPalette(); | 437 | //setMyPalette(); |
438 | } | 438 | } |
439 | 439 | ||
440 | void MonthViewCell::setHoliday( const QString &holiday ) | 440 | void MonthViewCell::setHoliday( const QString &holiday ) |
441 | { | 441 | { |
442 | mHolidayString = holiday; | 442 | mHolidayString = holiday; |
443 | 443 | ||
444 | if ( !holiday.isEmpty() ) { | 444 | if ( !holiday.isEmpty() ) { |
445 | setHoliday( true ); | 445 | setHoliday( true ); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) | 448 | void MonthViewCell::keyPressEvent ( QKeyEvent * e ) |
449 | { | 449 | { |
450 | 450 | ||
451 | e->ignore(); | 451 | e->ignore(); |
452 | 452 | ||
453 | } | 453 | } |
454 | 454 | ||
455 | void MonthViewCell::startUpdateCell() | 455 | void MonthViewCell::startUpdateCell() |
456 | { | 456 | { |
457 | 457 | ||
458 | mItemList->setFocusPolicy(NoFocus); | 458 | mItemList->setFocusPolicy(NoFocus); |
459 | if ( !mMonthView->isUpdatePossible() ) | 459 | if ( !mMonthView->isUpdatePossible() ) |
460 | return; | 460 | return; |
461 | 461 | ||
462 | /* | 462 | /* |
463 | if ( !isVisible() ){ | 463 | if ( !isVisible() ){ |
464 | return; | 464 | return; |
465 | } | 465 | } |
466 | */ | 466 | */ |
467 | // qDebug("MonthViewCell::updateCell() "); | 467 | // qDebug("MonthViewCell::updateCell() "); |
468 | setPrimary( mDate.month()%2 ); | 468 | setPrimary( mDate.month()%2 ); |
469 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); | 469 | setHoliday( KOGlobals::self()->calendarSystem()->dayOfWeek(mDate) == KOGlobals::self()->calendarSystem()->weekDayOfPray() || ( mDate.dayOfWeek() == 6 ) && KOPrefs::instance()-> mExcludeSaturdays); |
470 | if ( mDate == QDate::currentDate() ) { | 470 | if ( mDate == QDate::currentDate() ) { |
471 | mItemList->setLineWidth( 3 ); | 471 | mItemList->setLineWidth( 3 ); |
472 | } else { | 472 | } else { |
473 | mItemList->setLineWidth( 1 ); | 473 | mItemList->setLineWidth( 1 ); |
474 | } | 474 | } |
475 | mItemList->clear(); | 475 | mItemList->clear(); |
476 | 476 | ||
477 | #ifdef DESKTOP_VERSION | 477 | #ifdef DESKTOP_VERSION |
478 | QToolTip::remove(this); | 478 | QToolTip::remove(this); |
479 | #endif | 479 | #endif |
480 | mToolTip = ""; | 480 | mToolTip = ""; |
481 | //qApp->processEvents(); | 481 | //qApp->processEvents(); |
482 | if ( !mHolidayString.isEmpty() ) { | 482 | if ( !mHolidayString.isEmpty() ) { |
483 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); | 483 | MonthViewItem *item = new MonthViewItem( 0, mDate, mHolidayString ); |
484 | item->setPalette( mHolidayPalette ); | 484 | item->setPalette( mHolidayPalette ); |
485 | mItemList->insertItem( item ); | 485 | mItemList->insertItem( item ); |
486 | mToolTip += mHolidayString+"\n"; | 486 | mToolTip += mHolidayString+"\n"; |
487 | } | 487 | } |
488 | } | 488 | } |
489 | 489 | ||
490 | void MonthViewCell::insertEvent(Event *event) | 490 | void MonthViewCell::insertEvent(Event *event) |
491 | { | 491 | { |
492 | 492 | ||
493 | mItemList->setFocusPolicy(WheelFocus); | 493 | mItemList->setFocusPolicy(WheelFocus); |
494 | if ( !(event->doesRecur() == Recurrence::rNone) ) { | 494 | if ( !(event->doesRecur() == Recurrence::rNone) ) { |
495 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) | 495 | if ( !KOPrefs::instance()->mMonthDailyRecur && event->doesRecur() == Recurrence::rDaily ) |
496 | return; | 496 | return; |
497 | else | 497 | else |
498 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) | 498 | if ( !KOPrefs::instance()->mMonthWeeklyRecur && event->doesRecur() == Recurrence::rWeekly ) |
499 | return; | 499 | return; |
500 | } | 500 | } |
501 | 501 | ||
502 | if ( event->categories().contains("Holiday") || | 502 | if ( event->categories().contains("Holiday") || |
503 | event->categories().contains(i18n("Holiday"))) { | 503 | event->categories().contains(i18n("Holiday"))) { |
504 | setHoliday( true ); | 504 | setHoliday( true ); |
505 | if ( mDate.dayOfWeek() == 7 ) | 505 | if ( mDate.dayOfWeek() == 7 ) |
506 | mItemList->setLineWidth( 3 ); | 506 | mItemList->setLineWidth( 3 ); |
507 | } | 507 | } |
508 | QString text; | 508 | QString text; |
509 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | 509 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day |
510 | if (event->isMultiDay()) { | 510 | if (event->isMultiDay()) { |
511 | QString prefix = "<->";multiday = 2; | 511 | QString prefix = "<->";multiday = 2; |
512 | QString time; | 512 | QString time; |
513 | if ( event->doesRecur() ) { | 513 | if ( event->doesRecur() ) { |
514 | if ( event->recursOn( mDate) ) { | 514 | if ( event->recursOn( mDate) ) { |
515 | prefix ="->" ;multiday = 1; | 515 | prefix ="->" ;multiday = 1; |
516 | } | 516 | } |
517 | else { | 517 | else { |
518 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 518 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
519 | if ( event->recursOn( mDate.addDays( -days)) ) | 519 | if ( event->recursOn( mDate.addDays( -days)) ) { |
520 | prefix ="<-" ;multiday = 3; | 520 | prefix ="<-" ;multiday = 3; |
521 | } | ||
521 | } | 522 | } |
522 | 523 | ||
523 | } else { | 524 | } else { |
524 | if (mDate == event->dtStart().date()) { | 525 | if (mDate == event->dtStart().date()) { |
525 | prefix ="->" ;multiday = 1; | 526 | prefix ="->" ;multiday = 1; |
526 | } else if (mDate == event->dtEnd().date()) { | 527 | } else if (mDate == event->dtEnd().date()) { |
527 | prefix ="<-" ;multiday = 3; | 528 | prefix ="<-" ;multiday = 3; |
528 | } | 529 | } |
529 | } | 530 | } |
530 | if ( !event->doesFloat() ) { | 531 | if ( !event->doesFloat() ) { |
531 | if ( mDate == event->dtStart().date () ) | 532 | if ( mDate == event->dtStart().date () ) |
532 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 533 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
533 | else if ( mDate == event->dtEnd().date () ) | 534 | else if ( mDate == event->dtEnd().date () ) |
534 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 535 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
535 | 536 | ||
536 | } | 537 | } |
537 | text = time + event->summary(); | 538 | text = time + event->summary(); |
538 | mToolTip += prefix + text; | 539 | mToolTip += prefix + text; |
539 | } else { | 540 | } else { |
540 | if (event->doesFloat()) { | 541 | if (event->doesFloat()) { |
541 | text = event->summary(); | 542 | text = event->summary(); |
542 | mToolTip += text; | 543 | mToolTip += text; |
543 | } | 544 | } |
544 | else { | 545 | else { |
545 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 546 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
546 | text += " " + event->summary(); | 547 | text += " " + event->summary(); |
547 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 548 | mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
548 | } | 549 | } |
549 | } | 550 | } |
550 | 551 | ||
551 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); | 552 | MonthViewItem *item = new MonthViewItem( event, mDate, text ); |
552 | QPalette pal; | 553 | QPalette pal; |
553 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 554 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
554 | QStringList categories = event->categories(); | 555 | QStringList categories = event->categories(); |
555 | QString cat = categories.first(); | 556 | QString cat = categories.first(); |
556 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 557 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
557 | pal = getPalette(); | 558 | pal = getPalette(); |
558 | if (cat.isEmpty()) { | 559 | if (cat.isEmpty()) { |
559 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 560 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
560 | } else { | 561 | } else { |
561 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 562 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
562 | } | 563 | } |
563 | 564 | ||
564 | } else { | 565 | } else { |
565 | if (cat.isEmpty()) { | 566 | if (cat.isEmpty()) { |
566 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 567 | pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
567 | } else { | 568 | } else { |
568 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 569 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
569 | } | 570 | } |
570 | } | 571 | } |
571 | 572 | ||
572 | } else { | 573 | } else { |
573 | pal = mStandardPalette ; | 574 | pal = mStandardPalette ; |
574 | } | 575 | } |
575 | item->setPalette( pal ); | 576 | item->setPalette( pal ); |
576 | item->setRecur( event->recurrence()->doesRecur() ); | 577 | item->setRecur( event->recurrence()->doesRecur() ); |
577 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); | 578 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); |
578 | item->setMoreInfo( event->description().length() > 0 ); | 579 | item->setMoreInfo( event->description().length() > 0 ); |
579 | #ifdef DESKTOP_VERSION | 580 | #ifdef DESKTOP_VERSION |
580 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 581 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
581 | KOPrefs::instance()->email()); | 582 | KOPrefs::instance()->email()); |
582 | if ( me != 0 ) { | 583 | if ( me != 0 ) { |
583 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 584 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
584 | item->setReply(true && multiday < 2); | 585 | item->setReply(true && multiday < 2); |
585 | else | 586 | else |
586 | item->setReply(false); | 587 | item->setReply(false); |
587 | } else | 588 | } else |
588 | item->setReply(false); | 589 | item->setReply(false); |
589 | #endif | 590 | #endif |
590 | item->setMultiDay( multiday ); | 591 | item->setMultiDay( multiday ); |
591 | mItemList->insertItem( item ); | 592 | mItemList->insertItem( item ); |
592 | mToolTip += "\n"; | 593 | mToolTip += "\n"; |
593 | } | 594 | } |
594 | void MonthViewCell::insertTodo(Todo *todo) | 595 | void MonthViewCell::insertTodo(Todo *todo) |
595 | { | 596 | { |
596 | mItemList->setFocusPolicy(WheelFocus); | 597 | mItemList->setFocusPolicy(WheelFocus); |
597 | QString text; | 598 | QString text; |
598 | if (todo->hasDueDate()) { | 599 | if (todo->hasDueDate()) { |
599 | if (!todo->doesFloat()) { | 600 | if (!todo->doesFloat()) { |
600 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 601 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
601 | text += " "; | 602 | text += " "; |
602 | } | 603 | } |
603 | } | 604 | } |
604 | text += i18n("T: %1").arg(todo->summary()); | 605 | text += i18n("T: %1").arg(todo->summary()); |
605 | 606 | ||
606 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 607 | MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
607 | //item->setPalette( mStandardPalette ); | 608 | //item->setPalette( mStandardPalette ); |
608 | QPalette pal; | 609 | QPalette pal; |
609 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 610 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
610 | QStringList categories = todo->categories(); | 611 | QStringList categories = todo->categories(); |
611 | QString cat = categories.first(); | 612 | QString cat = categories.first(); |
612 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 613 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
613 | pal = getPalette(); | 614 | pal = getPalette(); |
614 | if (cat.isEmpty()) { | 615 | if (cat.isEmpty()) { |
615 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 616 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
616 | } else { | 617 | } else { |