summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kodaymatrix.cpp34
-rw-r--r--korganizer/kodaymatrix.h4
2 files changed, 26 insertions, 12 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 59618bf..d543aaf 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -116,7 +116,9 @@ KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const
// initialize dynamic arrays
bDays.resize ( NUMDAYS );
+ hDays.resize ( NUMDAYS );;
+ eDays.resize ( NUMDAYS );;
days = new QDate[NUMDAYS];
daylbls = new QString[NUMDAYS];
- events = new int[NUMDAYS];
+ //events = new int[NUMDAYS];
mToolTip = new DynamicTip(this);
@@ -241,5 +243,5 @@ KODayMatrix::~KODayMatrix()
delete [] days;
delete [] daylbls;
- delete [] events;
+ //delete [] events;
delete mToolTip;
}
@@ -312,5 +314,5 @@ void KODayMatrix::recalculateToday()
today = -1;
for (int i=0; i<NUMDAYS; i++) {
- events[i] = 0;
+ //events[i] = 0;
days[i] = startdate.addDays(i);
daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
@@ -350,4 +352,6 @@ void KODayMatrix::updateViewTimed()
QString holiStr = "";
bDays.clearBit(i);
+ hDays.clearBit(i);
+ eDays.clearBit(i);
for(event=eventlist.first();event != 0;event=eventlist.next()) {
ushort recurType = event->recurrence()->doesRecur();
@@ -357,4 +361,5 @@ void KODayMatrix::updateViewTimed()
}
if ( event->isHoliday()) {
+ hDays.setBit(i);
if ( !holiStr.isEmpty() )
holiStr += "\n";
@@ -372,5 +377,6 @@ void KODayMatrix::updateViewTimed()
}
}
- events[i] = numEvents;
+ if ( numEvents )
+ eDays.setBit(i);
//if it is a holy day then draw it red. Sundays are consider holidays, too
if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
@@ -448,6 +454,9 @@ void KODayMatrix::updateEvents()
numEvents--;
}
- }
- events[ i ] = numEvents;
+ }
+ if ( numEvents )
+ eDays.setBit(i);
+ else
+ eDays.clearBit(i);
}
}
@@ -863,5 +872,5 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
// if any events are on that day then draw it using a bold font
- if (events[i] > 0) {
+ if ( eDays.testBit(i) ) {
QFont myFont = font();
myFont.setBold(true);
@@ -870,9 +879,12 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
// if it is a holiday then use the default holiday color
- if (!mHolidays[i].isNull()) {
+ if ( !mHolidays[i].isNull()) {
if ( bDays.testBit(i) ) {
- p.setPen(Qt::green);
+ if ( hDays.testBit(i) )
+ p.setPen(QColor(Qt::green));
+ else
+ p.setPen(QColor(Qt::green).dark());
} else {
- if (actcol == mDefaultTextColor) {
+ if (actcol == mDefaultTextColor ) {
p.setPen(KOPrefs::instance()->mHolidayColor);
} else {
@@ -910,5 +922,5 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
}
// reset bold font to plain font
- if (events[i] > 0) {
+ if ( eDays.testBit(i)) {
QFont myFont = font();
myFont.setBold(false);
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index 2a1959c..38a7f92 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -231,4 +231,6 @@ private:
bool mouseDown;
QBitArray bDays;
+ QBitArray hDays;
+ QBitArray eDays;
QPixmap myPix;
QTimer* mUpdateTimer;
@@ -271,5 +273,5 @@ private:
* used for drawing a bold font if there is at least one event on that day.
*/
- int *events;
+ //int *events;
/** stores holiday names of the days shown in the matrix. */