summaryrefslogtreecommitdiffabout
path: root/korganizer/komonthview.cpp
authorzautrix <zautrix>2005-06-27 19:29:38 (UTC)
committer zautrix <zautrix>2005-06-27 19:29:38 (UTC)
commitd730e4b5cd81965f224b69efcc91dd58253f0b98 (patch) (side-by-side diff)
tree38874ec3d889bee7ab12a79a1ef690e6c47aac5f /korganizer/komonthview.cpp
parent427221638f1e652bd57a37835a1de0134266c3f7 (diff)
downloadkdepimpi-d730e4b5cd81965f224b69efcc91dd58253f0b98.zip
kdepimpi-d730e4b5cd81965f224b69efcc91dd58253f0b98.tar.gz
kdepimpi-d730e4b5cd81965f224b69efcc91dd58253f0b98.tar.bz2
fixes
Diffstat (limited to 'korganizer/komonthview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp57
1 files changed, 16 insertions, 41 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 00e5a6f..aeb3974 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -275,53 +275,32 @@ void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
if(e->button() == RightButton) {
emit rightClick();
}
}
-MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
+MonthViewItem::MonthViewItem( Incidence *incidence, const QString & s)
: QListBoxItem()
{
- mDisplayHightlighted = false;
mblockRepaint = true;
- setText( s );
- mMultiday = 0;
- mIncidence = incidence;
- mDate = qd;
- mRecur = false;
- mAlarm = false;
- mReply = false;
- mInfo = false;
- mdayPos = 0;
isWeekItem = KOPrefs::instance()->mMonthViewWeek;
+ recycle( incidence, s );
}
-void MonthViewItem::recycle( Incidence *incidence, QDate qd, const QString & s)
+void MonthViewItem::recycle( Incidence *incidence, const QString & s)
{
mDisplayHightlighted = false;
setText( s );
mMultiday = 0;
mIncidence = incidence;
- mDate = qd;
- mRecur = false;
- mAlarm = false;
- mReply = false;
- mInfo = false;
- mdayPos = 0;
-}
-void MonthViewItem::clearData()
-{
- mDisplayHightlighted = false;
- setText( "" );
- mMultiday = 0;
- mIncidence = 0;
mRecur = false;
mAlarm = false;
mReply = false;
mInfo = false;
mdayPos = 0;
}
+
bool MonthViewItem::setHighlightedFalse()
{
if ( !mDisplayHightlighted )
return false;
mDisplayHightlighted = false;
return true;
@@ -341,23 +320,23 @@ bool MonthViewItem::setHighlighted( Incidence * inc )
return true;
}
return false;
}
void MonthViewItem::paint(QPainter *p)
{
- if ( mblockRepaint ) {
+ if ( mblockRepaint || !mIncidence ) {
return;
}
#if QT_VERSION >= 0x030000
bool sel = isSelected();
#else
bool sel = selected();
#endif
int heihei = height( listBox () );
int x = 1;
- if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted )
+ if (KOPrefs::instance()->mMonthViewUsesCategoryColor || mDisplayHightlighted || sel )
{
if ( mDisplayHightlighted )
sel = true;
p->setBackgroundColor( palette().color( QPalette::Normal, \
sel ? QColorGroup::Highlight : QColorGroup::Background ) );
p->eraseRect( 0, 0, listBox()->maxItemWidth(), heihei );
@@ -392,13 +371,13 @@ void MonthViewItem::paint(QPainter *p)
x += size + 1;
}
}
if ( mMultiday ) {
int yyy = y+(size/2);
int sizeM = size+2;
- p->setBrush( QBrush::SolidPattern );
+ p->setBrush( QBrush( p->pen().color() ) );
p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, 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 );
@@ -431,13 +410,13 @@ void MonthViewItem::paint(QPainter *p)
p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
x += half+half + 4;
} else {
int val = td->percentComplete()/20;
- p->fillRect ( x+1, y-2, val ,size+4,Qt::black );
+ p->fillRect ( x+1, y-2, val ,size+4,p->pen().color() );
p->drawRect ( x, y-2,7,size+4);
x += size + 3;
}
}
QFontMetrics fm = p->fontMetrics();
int yPos;
@@ -665,13 +644,13 @@ void MonthViewCell::startUpdateCell()
}
MonthViewItem* CurrentAvailItem = (MonthViewItem*) firstItem ();
//clear();
while ( CurrentAvailItem ) {
MonthViewItem *item = CurrentAvailItem;
//item->setHighlightedFalse();
- item->clearData();
+ item->recycle( 0, "");
CurrentAvailItem = (MonthViewItem *)item->next();
mAvailItemList.append( item );
takeItem ( item );
}
#ifdef DESKTOP_VERSION
@@ -761,15 +740,15 @@ int MonthViewCell::insertEvent(Event *event)
}
MonthViewItem *item ;
if ( mAvailItemList.count() ) {
item = mAvailItemList.first();
mAvailItemList.remove( item );
- item->recycle( event, mDate, text );
+ item->recycle( event, text );
} else {
- item = new MonthViewItem( event, mDate, text );
+ item = new MonthViewItem( event, text );
}
QPalette pal;
if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
QStringList categories = event->categories();
QString cat = categories.first();
@@ -791,12 +770,13 @@ int MonthViewCell::insertEvent(Event *event)
}
}
} else {
pal = mStandardPalette ;
}
+ pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
item->setPalette( pal );
item->setRecur( event->recurrence()->doesRecur() );
item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() );
item->setMoreInfo( event->description().length() > 0 );
#ifdef DESKTOP_VERSION
Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
@@ -850,15 +830,15 @@ void MonthViewCell::insertTodo(Todo *todo)
}
text += todo->summary();
MonthViewItem *item ;
if ( mAvailItemList.count() ) {
item = mAvailItemList.first();
mAvailItemList.remove( item );
- item->recycle( todo, mDate, text );
+ item->recycle( todo, text );
} else {
- item = new MonthViewItem( todo, mDate, text );
+ item = new MonthViewItem( todo, text );
}
//MonthViewItem *item = new MonthViewItem( todo, mDate, text );
//item->setPalette( mStandardPalette );
QPalette pal;
if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
QStringList categories = todo->categories();
@@ -881,12 +861,13 @@ void MonthViewCell::insertTodo(Todo *todo)
}
}
} else {
pal = mStandardPalette ;
}
+ pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor);
item->setPalette( pal );
item->setRecur( todo->recurrence()->doesRecur() );
item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() );
item->setMoreInfo( todo->description().length() > 0 );
insertItem( item , count());
#ifdef DESKTOP_VERSION
@@ -1020,19 +1001,13 @@ Incidence *MonthViewCell::selectedIncidence()
QDate MonthViewCell::selectedIncidenceDate()
{
QDate qd;
int index = currentItem();
if ( index < 0 ) return qd;
-
- MonthViewItem *mitem =
- static_cast<MonthViewItem *>( item( index ) );
-
- if ( !mitem ) return qd;
-
- return mitem->incidenceDate();
+ return mDate;
}
void MonthViewCell::deselect()
{
clearSelection();
enableScrollBars( false );