summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp91
-rw-r--r--korganizer/komonthview.h2
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
@@ -222,3 +222,3 @@ void MonthViewItem::paint(QPainter *p)
int x = 1;
- int y = 3;//(height() - mRecurPixmap.height()) /2;
+ //int y = 3;//(height() - mRecurPixmap.height()) /2;
int size = PIXMAP_SIZE;
@@ -226,2 +226,4 @@ void MonthViewItem::paint(QPainter *p)
size = 3;
+ int y = (height( listBox () ) - size -1 ) /2;
+
if ( KOPrefs::instance()->mMonthShowIcons ) {
@@ -244,2 +246,32 @@ void MonthViewItem::paint(QPainter *p)
}
+ if ( mMultiday ) {
+ int yyy = y+(size/2);
+ int sizeM = size+2;
+ p->setBrush( QBrush::SolidPattern );
+ p->drawLine ( x+sizeM/2, yyy, x +sizeM +sizeM/2-2, yyy ) ;
+ if ( mMultiday == 2 || mMultiday == 3 ) {
+ QPointArray pa ( 3 );
+ pa.setPoint (0, x, yyy );
+ pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
+ pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
+ p->drawPolygon( pa );
+ }
+ if ( mMultiday == 2 || mMultiday == 1 ) {
+ QPointArray pa ( 3 );
+ pa.setPoint (0, x+sizeM +sizeM/2, yyy );
+ pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
+ pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
+ p->drawPolygon( pa );
+ }
+ if ( mMultiday == 1 ) {
+ p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
+
+ }
+ if ( mMultiday == 3 ) {
+ p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
+
+ }
+ x += sizeM/2 + 1;
+ x += sizeM + 1;
+ }
QFontMetrics fm = p->fontMetrics();
@@ -263,3 +295,5 @@ int MonthViewItem::height(const QListBox *lb) const
{
- return lb->fontMetrics().lineSpacing()+1;
+ if ( lb )
+ return lb->fontMetrics().lineSpacing()+1;
+ return 10;
}
@@ -272,13 +306,18 @@ int MonthViewItem::width(const QListBox *lb) const
int x = 1;
- if ( mInfo ) {
- x += size + 1;
- }
- if( mRecur ) {
- x += size+1;
- }
- if( mAlarm ) {
- x += size+1;
+ if ( KOPrefs::instance()->mMonthShowIcons ) {
+ if ( mInfo ) {
+ x += size + 1;
+ }
+ if( mRecur ) {
+ x += size+1;
+ }
+ if( mAlarm ) {
+ x += size+1;
+ }
+ if( mReply ) {
+ x += size+1;
+ }
}
- if( mReply ) {
- x += size+1;
+ if( mMultiday ) {
+ x += size+1+2+size/2;
}
@@ -466,7 +505,10 @@ void MonthViewCell::insertEvent(Event *event)
QString text;
+ int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
if (event->isMultiDay()) {
- QString prefix = "<->";
+ QString prefix = "<->";multiday = 2;
+ QString time;
if ( event->doesRecur() ) {
- if ( event->recursOn( mDate) )
- prefix ="->" ;
+ if ( event->recursOn( mDate) ) {
+ prefix ="->" ;multiday = 1;
+ }
else {
@@ -474,3 +516,3 @@ void MonthViewCell::insertEvent(Event *event)
if ( event->recursOn( mDate.addDays( -days)) )
- prefix ="<-" ;
+ prefix ="<-" ;multiday = 3;
}
@@ -479,5 +521,5 @@ void MonthViewCell::insertEvent(Event *event)
if (mDate == event->dtStart().date()) {
- prefix ="->" ;
+ prefix ="->" ;multiday = 1;
} else if (mDate == event->dtEnd().date()) {
- prefix ="<-" ;
+ prefix ="<-" ;multiday = 3;
}
@@ -486,9 +528,9 @@ void MonthViewCell::insertEvent(Event *event)
if ( mDate == event->dtStart().date () )
- prefix += KGlobal::locale()->formatTime(event->dtStart().time())+" ";
+ time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
else if ( mDate == event->dtEnd().date () )
- prefix += KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
+ time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
}
- text = prefix + event->summary();
- mToolTip += text;
+ text = time + event->summary();
+ mToolTip += prefix + text;
} else {
@@ -531,3 +573,3 @@ void MonthViewCell::insertEvent(Event *event)
item->setRecur( event->recurrence()->doesRecur() );
- item->setAlarm( event->isAlarmEnabled() );
+ item->setAlarm( event->isAlarmEnabled() && multiday < 2 );
item->setMoreInfo( event->description().length() > 0 );
@@ -538,3 +580,3 @@ void MonthViewCell::insertEvent(Event *event)
if ( me->status() == Attendee::NeedsAction && me->RSVP())
- item->setReply(true);
+ item->setReply(true && multiday < 2);
else
@@ -544,2 +586,3 @@ void MonthViewCell::insertEvent(Event *event)
#endif
+ item->setMultiDay( multiday );
mItemList->insertItem( item );
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 2f6f5dc..b79a41f 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -99,2 +99,3 @@ class MonthViewItem: public QListBoxItem
void setMoreInfo(bool on) { mInfo = on; }
+ void setMultiDay(int type) { mMultiday = type; }
@@ -113,2 +114,3 @@ class MonthViewItem: public QListBoxItem
private:
+ int mMultiday;
bool mRecur;