author | zautrix <zautrix> | 2005-01-21 15:38:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-21 15:38:31 (UTC) |
commit | 4afdcfcac216b428ada79f4750cf7447e3175333 (patch) (unidiff) | |
tree | 8f70936ac23137c3f6fb00fce33edbfe3d821f59 /korganizer | |
parent | 234b9425bebd41b556277cdd94138fafecc32b45 (diff) | |
download | kdepimpi-4afdcfcac216b428ada79f4750cf7447e3175333.zip kdepimpi-4afdcfcac216b428ada79f4750cf7447e3175333.tar.gz kdepimpi-4afdcfcac216b428ada79f4750cf7447e3175333.tar.bz2 |
some fixes
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 347d982..ead8628 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -149,153 +149,153 @@ void KOTodoViewItem::construct() | |||
149 | // found in the description. White spaces are removed from beginning and end | 149 | // found in the description. White spaces are removed from beginning and end |
150 | // of sort id. | 150 | // of sort id. |
151 | int pos = mTodo->description().findRev('#'); | 151 | int pos = mTodo->description().findRev('#'); |
152 | if (pos < 0) { | 152 | if (pos < 0) { |
153 | setText(6,""); | 153 | setText(6,""); |
154 | } else { | 154 | } else { |
155 | QString str = mTodo->description().mid(pos+1); | 155 | QString str = mTodo->description().mid(pos+1); |
156 | str.stripWhiteSpace(); | 156 | str.stripWhiteSpace(); |
157 | setText(6,str); | 157 | setText(6,str); |
158 | } | 158 | } |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | m_known = false; | 161 | m_known = false; |
162 | m_init = false; | 162 | m_init = false; |
163 | 163 | ||
164 | setMyPixmap(); | 164 | setMyPixmap(); |
165 | 165 | ||
166 | } | 166 | } |
167 | void KOTodoViewItem::setMyPixmap() | 167 | void KOTodoViewItem::setMyPixmap() |
168 | { | 168 | { |
169 | int size = 5; | 169 | int size = 5; |
170 | QPixmap pixi = QPixmap( 1, 1 ); | 170 | QPixmap pixi = QPixmap( 1, 1 ); |
171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { | 171 | // if ( !mTodo->isCompleted() && mTodo->hasDueDate() && mTodo->dtDue() < QDateTime::currentDateTime() ) { |
172 | // pixi = SmallIcon("redcross16"); | 172 | // pixi = SmallIcon("redcross16"); |
173 | // } else { | 173 | // } else { |
174 | QPainter p; | 174 | QPainter p; |
175 | 175 | ||
176 | int pixSize = 0; | 176 | int pixSize = 0; |
177 | QPixmap pPix = QPixmap( size, size ); | 177 | QPixmap pPix = QPixmap( size, size ); |
178 | if ( mTodo->description().length() > 0 ) { | 178 | if ( mTodo->description().length() > 0 ) { |
179 | pixi.resize(size, pixSize+size); | 179 | pixi.resize(size, pixSize+size); |
180 | pPix.fill( Qt::darkGreen ); | 180 | pPix.fill( Qt::darkGreen ); |
181 | p.begin( &pixi ); | 181 | p.begin( &pixi ); |
182 | p. drawPixmap ( 0, pixSize, pPix); | 182 | p. drawPixmap ( 0, pixSize, pPix); |
183 | p.end(); | 183 | p.end(); |
184 | pixSize += size; | 184 | pixSize += size; |
185 | } | 185 | } |
186 | if ( mTodo->isAlarmEnabled() ) { | 186 | if ( mTodo->isAlarmEnabled() ) { |
187 | pixi.resize(size, pixSize+size); | 187 | pixi.resize(size, pixSize+size); |
188 | pPix.fill( Qt::red ); | 188 | pPix.fill( Qt::red ); |
189 | p.begin( &pixi ); | 189 | p.begin( &pixi ); |
190 | p. drawPixmap ( 0, pixSize, pPix); | 190 | p. drawPixmap ( 0, pixSize, pPix); |
191 | p.end(); | 191 | p.end(); |
192 | pixSize += size; | 192 | pixSize += size; |
193 | } | 193 | } |
194 | // } | 194 | // } |
195 | if ( pixi.width() > 1 ) { | 195 | if ( pixi.width() > 1 ) { |
196 | setPixmap ( 0,pixi ) ; | 196 | setPixmap ( 0,pixi ) ; |
197 | } else { | ||
198 | setPixmap ( 0,QPixmap() ) ; | ||
197 | } | 199 | } |
198 | |||
199 | |||
200 | } | 200 | } |
201 | void KOTodoViewItem::stateChange(bool state) | 201 | void KOTodoViewItem::stateChange(bool state) |
202 | { | 202 | { |
203 | // qDebug("KOTodoViewItem::stateChange "); | 203 | // qDebug("KOTodoViewItem::stateChange "); |
204 | // do not change setting on startup | 204 | // do not change setting on startup |
205 | if ( m_init ) return; | 205 | if ( m_init ) return; |
206 | 206 | ||
207 | kdDebug() << "State changed, modified " << state << endl; | 207 | kdDebug() << "State changed, modified " << state << endl; |
208 | QString keyd = "=="; | 208 | QString keyd = "=="; |
209 | QString keyt = "=="; | 209 | QString keyt = "=="; |
210 | 210 | ||
211 | if (state) mTodo->setCompleted(state); | 211 | if (state) mTodo->setCompleted(state); |
212 | else mTodo->setPercentComplete(0); | 212 | else mTodo->setPercentComplete(0); |
213 | if (isOn()!=state) { | 213 | if (isOn()!=state) { |
214 | setOn(state); | 214 | setOn(state); |
215 | } | 215 | } |
216 | 216 | ||
217 | if (mTodo->hasDueDate()) { | 217 | if (mTodo->hasDueDate()) { |
218 | setText(3, mTodo->dtDueDateStr()); | 218 | setText(3, mTodo->dtDueDateStr()); |
219 | QDate d = mTodo->dtDue().date(); | 219 | QDate d = mTodo->dtDue().date(); |
220 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 220 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
221 | setSortKey(3,keyd); | 221 | setSortKey(3,keyd); |
222 | if (mTodo->doesFloat()) { | 222 | if (mTodo->doesFloat()) { |
223 | setText(4,""); | 223 | setText(4,""); |
224 | } | 224 | } |
225 | else { | 225 | else { |
226 | setText(4,mTodo->dtDueTimeStr()); | 226 | setText(4,mTodo->dtDueTimeStr()); |
227 | QTime t = mTodo->dtDue().time(); | 227 | QTime t = mTodo->dtDue().time(); |
228 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 228 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
229 | setSortKey(4,keyt); | 229 | setSortKey(4,keyt); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 232 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
233 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 233 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
234 | 234 | ||
235 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 235 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
236 | if (mTodo->percentComplete()<100) { | 236 | if (mTodo->percentComplete()<100) { |
237 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 237 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
238 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 238 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
239 | } | 239 | } |
240 | else { | 240 | else { |
241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
242 | else setSortKey(2,QString::number(99)); | 242 | else setSortKey(2,QString::number(99)); |
243 | } | 243 | } |
244 | QListViewItem * myChild = firstChild(); | 244 | QListViewItem * myChild = firstChild(); |
245 | KOTodoViewItem *item; | 245 | KOTodoViewItem *item; |
246 | while( myChild ) { | 246 | while( myChild ) { |
247 | item = static_cast<KOTodoViewItem*>(myChild); | 247 | item = static_cast<KOTodoViewItem*>(myChild); |
248 | item->stateChange(state); | 248 | item->stateChange(state); |
249 | myChild = myChild->nextSibling(); | 249 | myChild = myChild->nextSibling(); |
250 | } | 250 | } |
251 | mTodoView->modified(true); | 251 | mTodoView->modified(true); |
252 | mTodoView->setTodoModified( mTodo ); | ||
253 | setMyPixmap(); | 252 | setMyPixmap(); |
253 | mTodoView->setTodoModified( mTodo ); | ||
254 | } | 254 | } |
255 | 255 | ||
256 | bool KOTodoViewItem::isAlternate() | 256 | bool KOTodoViewItem::isAlternate() |
257 | { | 257 | { |
258 | #ifndef KORG_NOLVALTERNATION | 258 | #ifndef KORG_NOLVALTERNATION |
259 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 259 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
260 | if (lv && lv->alternateBackground().isValid()) | 260 | if (lv && lv->alternateBackground().isValid()) |
261 | { | 261 | { |
262 | KOTodoViewItem *above = 0; | 262 | KOTodoViewItem *above = 0; |
263 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); | 263 | above = dynamic_cast<KOTodoViewItem *>(itemAbove()); |
264 | m_known = above ? above->m_known : true; | 264 | m_known = above ? above->m_known : true; |
265 | if (m_known) | 265 | if (m_known) |
266 | { | 266 | { |
267 | m_odd = above ? !above->m_odd : false; | 267 | m_odd = above ? !above->m_odd : false; |
268 | } | 268 | } |
269 | else | 269 | else |
270 | { | 270 | { |
271 | KOTodoViewItem *item; | 271 | KOTodoViewItem *item; |
272 | bool previous = true; | 272 | bool previous = true; |
273 | if (QListViewItem::parent()) | 273 | if (QListViewItem::parent()) |
274 | { | 274 | { |
275 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); | 275 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); |
276 | if (item) | 276 | if (item) |
277 | previous = item->m_odd; | 277 | previous = item->m_odd; |
278 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); | 278 | item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); |
279 | } | 279 | } |
280 | else | 280 | else |
281 | { | 281 | { |
282 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); | 282 | item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); |
283 | } | 283 | } |
284 | 284 | ||
285 | while(item) | 285 | while(item) |
286 | { | 286 | { |
287 | item->m_odd = previous = !previous; | 287 | item->m_odd = previous = !previous; |
288 | item->m_known = true; | 288 | item->m_known = true; |
289 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); | 289 | item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | return m_odd; | 292 | return m_odd; |
293 | } | 293 | } |
294 | return false; | 294 | return false; |
295 | #else | 295 | #else |
296 | return false; | 296 | return false; |
297 | #endif | 297 | #endif |
298 | } | 298 | } |
299 | 299 | ||
300 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 300 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
301 | { | 301 | { |