summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index a42d07b..c055eb8 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -107,49 +107,49 @@ void KOAgendaItem::initColor ()
107 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 107 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
108 else 108 else
109 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 109 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
110 } 110 }
111 else { 111 else {
112 QStringList categories = mIncidence->categories(); 112 QStringList categories = mIncidence->categories();
113 QString cat = categories.first(); 113 QString cat = categories.first();
114 if (cat.isEmpty()) { 114 if (cat.isEmpty()) {
115 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) 115 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) )
116 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 116 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
117 else 117 else
118 mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() ); 118 mBackgroundColor =KOPrefs::instance()->defaultColor( mIncidence->calID() );
119 } else { 119 } else {
120 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 120 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
121 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) { 121 if ( (mIncidence->typeID() == todoID ) &&((static_cast<Todo*>(mIncidence))->isCompleted()) ) {
122 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 122 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
123 mBackgroundColor = KOPrefs::instance()->mTodoDoneColor; 123 mBackgroundColor = KOPrefs::instance()->mTodoDoneColor;
124 } 124 }
125 } 125 }
126 126
127 } 127 }
128 128
129 QColor BackgroundColor ( mBackgroundColor ); 129 QColor BackgroundColor ( mBackgroundColor );
130 if ( mIncidence->calID() > 1 ) { 130 if ( mIncidence->calID() > 1 ) {
131 BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() ); 131 //BackgroundColor = KOPrefs::instance()->defaultColor( mIncidence->calID() );
132 } 132 }
133 mColorGroup = QColorGroup( BackgroundColor.light(), 133 mColorGroup = QColorGroup( BackgroundColor.light(),
134 BackgroundColor.dark(),BackgroundColor.light(), 134 BackgroundColor.dark(),BackgroundColor.light(),
135 BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ; 135 BackgroundColor.dark(),BackgroundColor, black, BackgroundColor) ;
136 setBackgroundColor( mBackgroundColor ); 136 setBackgroundColor( mBackgroundColor );
137 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250); 137 mWhiteText = (mBackgroundColor.red() + mBackgroundColor.green() + mBackgroundColor.blue() < 250);
138} 138}
139void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 139void KOAgendaItem::init ( Incidence *incidence, QDate qd )
140{ 140{
141 mIncidence = incidence; 141 mIncidence = incidence;
142 mDate = qd; 142 mDate = qd;
143 mFirstMultiItem = 0; 143 mFirstMultiItem = 0;
144 mNextMultiItem = 0; 144 mNextMultiItem = 0;
145 mLastMultiItem = 0; 145 mLastMultiItem = 0;
146 computeText(); 146 computeText();
147 initColor(); 147 initColor();
148 mConflictItems.clear(); 148 mConflictItems.clear();
149 setCellXY(0,0,1); 149 setCellXY(0,0,1);
150 setCellXWidth(0); 150 setCellXWidth(0);
151 setSubCell(0); 151 setSubCell(0);
152 setSubCells(1); 152 setSubCells(1);
153 setMultiItem(0,0,0); 153 setMultiItem(0,0,0);
154 startMove(); 154 startMove();
155 mSelected = true; 155 mSelected = true;
@@ -179,48 +179,62 @@ void KOAgendaItem::recreateIncidence()
179 newInc->recreate(); 179 newInc->recreate();
180 if ( mIncidence->doesRecur() ) { 180 if ( mIncidence->doesRecur() ) {
181 mIncidence->addExDate( mDate ); 181 mIncidence->addExDate( mDate );
182 newInc->recurrence()->unsetRecurs(); 182 newInc->recurrence()->unsetRecurs();
183 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 183 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
184 QTime tim = mIncidence->dtStart().time(); 184 QTime tim = mIncidence->dtStart().time();
185 newInc->setDtStart( QDateTime(mDate, tim) ); 185 newInc->setDtStart( QDateTime(mDate, tim) );
186 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 186 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
187 } 187 }
188#endif 188#endif
189 mIncidence = mIncidence->recreateCloneException( mDate ); 189 mIncidence = mIncidence->recreateCloneException( mDate );
190} 190}
191bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 191bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
192{ 192{
193 int size = AGENDA_ICON_SIZE; 193 int size = AGENDA_ICON_SIZE;
194 194
195 int yOff = 0; 195 int yOff = 0;
196 int xOff = 0; 196 int xOff = 0;
197 int x = pos().x() +3; 197 int x = pos().x() +3;
198 int y; 198 int y;
199 if ( mAllDay ) 199 if ( mAllDay )
200 y = pos().y()+3; 200 y = pos().y()+3;
201 else 201 else
202 y = mCellYTop * ( height() / cellHeight() ) +3; 202 y = mCellYTop * ( height() / cellHeight() ) +3;
203
204
205 if ( mIncidence->calID() > 1 ) {
206 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, KOPrefs::instance()->defaultColor( mIncidence->calID() ) );
207 p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 );
208 if ( horLayout ){
209 ++xOff;
210 ++x;
211 }
212 else {
213 ++yOff;
214 ++y;
215 }
216 }
203 if (mIncidence->cancelled()) { 217 if (mIncidence->cancelled()) {
204 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 218 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
205 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 219 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
206 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 220 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
207 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 221 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
208 if ( horLayout ) 222 if ( horLayout )
209 ++xOff; 223 ++xOff;
210 else 224 else
211 ++yOff; 225 ++yOff;
212 } 226 }
213 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { 227 if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) {
214 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 228 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
215 if ( horLayout ) 229 if ( horLayout )
216 ++xOff; 230 ++xOff;
217 else 231 else
218 ++yOff; 232 ++yOff;
219 } 233 }
220 if (mIncidence->recurrence()->doesRecur()) { 234 if (mIncidence->recurrence()->doesRecur()) {
221 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 235 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
222 if ( horLayout ) 236 if ( horLayout )
223 ++xOff; 237 ++xOff;
224 else 238 else
225 ++yOff; 239 ++yOff;
226 } 240 }