-rw-r--r-- | korganizer/komonthview.cpp | 91 | ||||
-rw-r--r-- | korganizer/komonthview.h | 2 |
2 files changed, 69 insertions, 24 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 2fe80af..f558084 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -221,8 +221,10 @@ void MonthViewItem::paint(QPainter *p) | |||
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 y = (height( listBox () ) - size -1 ) /2; | ||
228 | |||
227 | if ( KOPrefs::instance()->mMonthShowIcons ) { | 229 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
228 | if ( mInfo ) { | 230 | if ( mInfo ) { |
@@ -243,4 +245,34 @@ void MonthViewItem::paint(QPainter *p) | |||
243 | } | 245 | } |
244 | } | 246 | } |
247 | if ( mMultiday ) { | ||
248 | int yyy = y+(size/2); | ||
249 | int sizeM = size+2; | ||
250 | p->setBrush( QBrush::SolidPattern ); | ||
251 | p->drawLine ( x+sizeM/2, yyy, x +sizeM +sizeM/2-2, yyy ) ; | ||
252 | if ( mMultiday == 2 || mMultiday == 3 ) { | ||
253 | QPointArray pa ( 3 ); | ||
254 | pa.setPoint (0, x, yyy ); | ||
255 | pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); | ||
256 | pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); | ||
257 | p->drawPolygon( pa ); | ||
258 | } | ||
259 | if ( mMultiday == 2 || mMultiday == 1 ) { | ||
260 | QPointArray pa ( 3 ); | ||
261 | pa.setPoint (0, x+sizeM +sizeM/2, yyy ); | ||
262 | pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); | ||
263 | pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); | ||
264 | p->drawPolygon( pa ); | ||
265 | } | ||
266 | if ( mMultiday == 1 ) { | ||
267 | p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | ||
268 | |||
269 | } | ||
270 | if ( mMultiday == 3 ) { | ||
271 | p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); | ||
272 | |||
273 | } | ||
274 | x += sizeM/2 + 1; | ||
275 | x += sizeM + 1; | ||
276 | } | ||
245 | QFontMetrics fm = p->fontMetrics(); | 277 | QFontMetrics fm = p->fontMetrics(); |
246 | int yPos; | 278 | int yPos; |
@@ -262,5 +294,7 @@ void MonthViewItem::paint(QPainter *p) | |||
262 | int MonthViewItem::height(const QListBox *lb) const | 294 | int MonthViewItem::height(const QListBox *lb) const |
263 | { | 295 | { |
264 | return lb->fontMetrics().lineSpacing()+1; | 296 | if ( lb ) |
297 | return lb->fontMetrics().lineSpacing()+1; | ||
298 | return 10; | ||
265 | } | 299 | } |
266 | 300 | ||
@@ -271,15 +305,20 @@ int MonthViewItem::width(const QListBox *lb) const | |||
271 | size = 3; | 305 | size = 3; |
272 | int x = 1; | 306 | int x = 1; |
273 | if ( mInfo ) { | 307 | if ( KOPrefs::instance()->mMonthShowIcons ) { |
274 | x += size + 1; | 308 | if ( mInfo ) { |
275 | } | 309 | x += size + 1; |
276 | if( mRecur ) { | 310 | } |
277 | x += size+1; | 311 | if( mRecur ) { |
278 | } | 312 | x += size+1; |
279 | if( mAlarm ) { | 313 | } |
280 | x += size+1; | 314 | if( mAlarm ) { |
315 | x += size+1; | ||
316 | } | ||
317 | if( mReply ) { | ||
318 | x += size+1; | ||
319 | } | ||
281 | } | 320 | } |
282 | if( mReply ) { | 321 | if( mMultiday ) { |
283 | x += size+1; | 322 | x += size+1+2+size/2; |
284 | } | 323 | } |
285 | 324 | ||
@@ -465,31 +504,34 @@ void MonthViewCell::insertEvent(Event *event) | |||
465 | } | 504 | } |
466 | QString text; | 505 | QString text; |
506 | int multiday = 0;// 1 = start, 2 = midddle, 3 = end day | ||
467 | if (event->isMultiDay()) { | 507 | if (event->isMultiDay()) { |
468 | QString prefix = "<->"; | 508 | QString prefix = "<->";multiday = 2; |
509 | QString time; | ||
469 | if ( event->doesRecur() ) { | 510 | if ( event->doesRecur() ) { |
470 | if ( event->recursOn( mDate) ) | 511 | if ( event->recursOn( mDate) ) { |
471 | prefix ="->" ; | 512 | prefix ="->" ;multiday = 1; |
513 | } | ||
472 | else { | 514 | else { |
473 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 515 | int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
474 | if ( event->recursOn( mDate.addDays( -days)) ) | 516 | if ( event->recursOn( mDate.addDays( -days)) ) |
475 | prefix ="<-" ; | 517 | prefix ="<-" ;multiday = 3; |
476 | } | 518 | } |
477 | 519 | ||
478 | } else { | 520 | } else { |
479 | if (mDate == event->dtStart().date()) { | 521 | if (mDate == event->dtStart().date()) { |
480 | prefix ="->" ; | 522 | prefix ="->" ;multiday = 1; |
481 | } else if (mDate == event->dtEnd().date()) { | 523 | } else if (mDate == event->dtEnd().date()) { |
482 | prefix ="<-" ; | 524 | prefix ="<-" ;multiday = 3; |
483 | } | 525 | } |
484 | } | 526 | } |
485 | if ( !event->doesFloat() ) { | 527 | if ( !event->doesFloat() ) { |
486 | if ( mDate == event->dtStart().date () ) | 528 | if ( mDate == event->dtStart().date () ) |
487 | prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 529 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
488 | else if ( mDate == event->dtEnd().date () ) | 530 | else if ( mDate == event->dtEnd().date () ) |
489 | prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 531 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
490 | 532 | ||
491 | } | 533 | } |
492 | text = prefix + event->summary(); | 534 | text = time + event->summary(); |
493 | mToolTip += text; | 535 | mToolTip += prefix + text; |
494 | } else { | 536 | } else { |
495 | if (event->doesFloat()) { | 537 | if (event->doesFloat()) { |
@@ -530,5 +572,5 @@ void MonthViewCell::insertEvent(Event *event) | |||
530 | item->setPalette( pal ); | 572 | item->setPalette( pal ); |
531 | item->setRecur( event->recurrence()->doesRecur() ); | 573 | item->setRecur( event->recurrence()->doesRecur() ); |
532 | item->setAlarm( event->isAlarmEnabled() ); | 574 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); |
533 | item->setMoreInfo( event->description().length() > 0 ); | 575 | item->setMoreInfo( event->description().length() > 0 ); |
534 | #ifdef DESKTOP_VERSION | 576 | #ifdef DESKTOP_VERSION |
@@ -537,5 +579,5 @@ void MonthViewCell::insertEvent(Event *event) | |||
537 | if ( me != 0 ) { | 579 | if ( me != 0 ) { |
538 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 580 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
539 | item->setReply(true); | 581 | item->setReply(true && multiday < 2); |
540 | else | 582 | else |
541 | item->setReply(false); | 583 | item->setReply(false); |
@@ -543,4 +585,5 @@ void MonthViewCell::insertEvent(Event *event) | |||
543 | item->setReply(false); | 585 | item->setReply(false); |
544 | #endif | 586 | #endif |
587 | item->setMultiDay( multiday ); | ||
545 | mItemList->insertItem( item ); | 588 | mItemList->insertItem( item ); |
546 | mToolTip += "\n"; | 589 | mToolTip += "\n"; |
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index 2f6f5dc..b79a41f 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h | |||
@@ -98,4 +98,5 @@ class MonthViewItem: public QListBoxItem | |||
98 | void setReply(bool on) { mReply = on; } | 98 | void setReply(bool on) { mReply = on; } |
99 | void setMoreInfo(bool on) { mInfo = on; } | 99 | void setMoreInfo(bool on) { mInfo = on; } |
100 | void setMultiDay(int type) { mMultiday = type; } | ||
100 | 101 | ||
101 | 102 | ||
@@ -112,4 +113,5 @@ class MonthViewItem: public QListBoxItem | |||
112 | 113 | ||
113 | private: | 114 | private: |
115 | int mMultiday; | ||
114 | bool mRecur; | 116 | bool mRecur; |
115 | bool mAlarm; | 117 | bool mAlarm; |