summaryrefslogtreecommitdiffabout
path: root/korganizer/kodaymatrix.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kodaymatrix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp87
1 files changed, 62 insertions, 25 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 17a1d13..df606d0 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -363,34 +363,39 @@ void KODayMatrix::computeEvent(Event *event, int i )
if ( !holiStr.isEmpty() )
holiStr += "\n";
holiStr += event->summary();
if ( !event->location().isEmpty() )
holiStr += " (" + event->location() + ")";
mHolidays[i] =holiStr ;
+ eDays.setBit(i);
}
- if ( event->isBirthday()) {
- pDays.setBit(i);
- if ( !holiStr.isEmpty() )
- holiStr += "\n";
- holiStr += i18n("Birthday") + ": "+event->summary();
- if ( !event->location().isEmpty() )
- holiStr += " (" + event->location() + ")";
- bDays.setBit(i);
- mHolidays[i] =holiStr ;
+ if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) {
+ if ( event->isBirthday()) {
+ pDays.setBit(i);
+ if ( !holiStr.isEmpty() )
+ holiStr += "\n";
+ holiStr += i18n("Birthday") + ": "+event->summary();
+ if ( !event->location().isEmpty() )
+ holiStr += " (" + event->location() + ")";
+ bDays.setBit(i);
+ mHolidays[i] =holiStr ;
+ }
}
- eDays.setBit(i);
+ if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW )
+ eDays.setBit(i);
}
void KODayMatrix::updateViewTimed()
{
mUpdateTimer->stop();
if ( !mCalendar ) {
qDebug("NOT CAL ");
return;
}
#if 1
+
int i;
int timeSpan = NUMDAYS-1;
QPtrList<Event> events = mCalendar->events();
Event *event;
QDateTime dt;
bool ok;
@@ -466,28 +471,58 @@ void KODayMatrix::updateViewTimed()
int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday
for(i = 0; i < NUMDAYS; i++) {
if ( ( (i+startDay) % 7 == 0 ) ) {
pDays.setBit(i);
}
}
-
-#if 0
- // insert due todos
- QPtrList<Todo> todos = calendar()->todos( );
- Todo *todo;
- for(todo = todos.first(); todo; todo = todos.next()) {
- //insertTodo( todo );
- if ( todo->hasDueDate() ) {
- int day = mStartDate.daysTo( todo->dtDue().date() );
+ if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) {
+ bDays.fill( false);
+ // insert due todos
+ QPtrList<Todo> todos = mCalendar->todos( );
+ Todo *todo;
+ for(todo = todos.first(); todo; todo = todos.next()) {
+ //insertTodo( todo );
+ if ( todo->hasDueDate() ) {
+ int day = mStartDate.daysTo( todo->dtDue().date() );
+ if ( day >= 0 && day < timeSpan + 1) {
+ int i = day;
+ QString holiStr = mHolidays[i];
+ pDays.setBit(i);
+ if ( !holiStr.isEmpty() )
+ holiStr += "\n";
+ holiStr += i18n("Todo") + ": "+todo->summary();
+ if ( !todo->location().isEmpty() )
+ holiStr += " (" + todo->location() + ")";
+ bDays.setBit(i);
+ mHolidays[i] =holiStr ;
+ eDays.setBit(i);
+ }
+ }
+ }
+ }
+ if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) {
+ bDays.fill( false);
+ // insert due todos
+ QPtrList<Journal> todos = mCalendar->journals( );
+ Journal *todo;
+ for(todo = todos.first(); todo; todo = todos.next()) {
+ int day = mStartDate.daysTo( todo->dtStart().date() );
if ( day >= 0 && day < timeSpan + 1) {
- (*cells)[day]->insertTodo( todo );
+ int i = day;
+ QString holiStr = mHolidays[i];
+ pDays.setBit(i);
+ if ( !holiStr.isEmpty() )
+ holiStr += "\n";
+ holiStr += i18n("Journal");
+ bDays.setBit(i);
+ mHolidays[i] =holiStr ;
+ eDays.setBit(i);
+
}
}
}
-#endif
-
#else
//qDebug("KODayMatrix::updateViewTimed ");
for(int i = 0; i < NUMDAYS; i++) {
// if events are set for the day then remember to draw it bold
QPtrList<Event> eventlist = mCalendar->events(days[i]);
Event *event;
@@ -533,13 +568,15 @@ void KODayMatrix::updateViewTimed()
mRedrawNeeded = true;
if ( ! mPendingUpdateBeforeRepaint )
repaint(false);
}
void KODayMatrix::updateView(QDate actdate)
{
-
+ if ( mLastView != KOPrefs::instance()->mCurrentDisplayedView )
+ mRedrawNeeded = true;
+ mLastView = KOPrefs::instance()->mCurrentDisplayedView;
if ( ! actdate.isValid() ) {
//qDebug("date not valid ");
return;
}
mDayChanged = false;
//flag to indicate if the starting day of the matrix has changed by this call
@@ -1049,15 +1086,15 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
}
// if it is a holiday then use the default holiday color
if ( pDays.testBit(i)) {
if ( bDays.testBit(i) ) {
if ( hDays.testBit(i) )
- p.setPen(QColor(Qt::green));
+ p.setPen(QColor(0,200,0));
else
- p.setPen(QColor(Qt::green).dark());
+ p.setPen(QColor(Qt::blue));
} else {
if (actcol == mDefaultTextColor ) {
p.setPen(KOPrefs::instance()->mHolidayColor);
} else {
p.setPen(mHolidayColorShaded);
}