author | zautrix <zautrix> | 2005-01-31 09:21:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-31 09:21:57 (UTC) |
commit | 1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd (patch) (unidiff) | |
tree | dd55b89fd37ffb8a880c175c5237f5ca57ca6d4c /korganizer/kotodoviewitem.cpp | |
parent | 9b13105b4cc0ede4ca2d01a3d998fdb90bf67b58 (diff) | |
download | kdepimpi-1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd.zip kdepimpi-1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd.tar.gz kdepimpi-1c5f4d993bf5eeb4a21bacf61671a1a08ed1f3cd.tar.bz2 |
fix
Diffstat (limited to 'korganizer/kotodoviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 1edddac..6bdee18 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -163,96 +163,100 @@ void KOTodoViewItem::construct() | |||
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 { | 197 | } else { |
198 | setPixmap ( 0,QPixmap() ) ; | 198 | setPixmap ( 0,QPixmap() ) ; |
199 | } | 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 | if (isOn()!=state) { | 206 | if (isOn()!=state) { |
207 | setOn(state); | 207 | setOn(state); |
208 | //qDebug("SETON "); | 208 | //qDebug("SETON "); |
209 | return; | 209 | return; |
210 | } | 210 | } |
211 | if ( mTodo->isCompleted() == state ) { | ||
212 | //qDebug("STATECHANGE:nothing to do "); | ||
213 | return; | ||
214 | } | ||
211 | QString keyd = "=="; | 215 | QString keyd = "=="; |
212 | QString keyt = "=="; | 216 | QString keyt = "=="; |
213 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); | 217 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); |
214 | mTodo->setCompleted(state); | 218 | mTodo->setCompleted(state); |
215 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); | 219 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); |
216 | 220 | ||
217 | if (mTodo->hasDueDate()) { | 221 | if (mTodo->hasDueDate()) { |
218 | setText(3, mTodo->dtDueDateStr()); | 222 | setText(3, mTodo->dtDueDateStr()); |
219 | QDate d = mTodo->dtDue().date(); | 223 | QDate d = mTodo->dtDue().date(); |
220 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 224 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
221 | setSortKey(3,keyd); | 225 | setSortKey(3,keyd); |
222 | if (mTodo->doesFloat()) { | 226 | if (mTodo->doesFloat()) { |
223 | setText(4,""); | 227 | setText(4,""); |
224 | } | 228 | } |
225 | else { | 229 | else { |
226 | setText(4,mTodo->dtDueTimeStr()); | 230 | setText(4,mTodo->dtDueTimeStr()); |
227 | QTime t = mTodo->dtDue().time(); | 231 | QTime t = mTodo->dtDue().time(); |
228 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); | 232 | keyt.sprintf("%02d%02d",t.hour(),t.minute()); |
229 | setSortKey(4,keyt); | 233 | setSortKey(4,keyt); |
230 | } | 234 | } |
231 | } | 235 | } |
232 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 236 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
233 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 237 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
234 | 238 | ||
235 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 239 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
236 | if (mTodo->percentComplete()<100) { | 240 | if (mTodo->percentComplete()<100) { |
237 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
238 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 242 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
239 | } | 243 | } |
240 | else { | 244 | else { |
241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 245 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
242 | else setSortKey(2,QString::number(99)); | 246 | else setSortKey(2,QString::number(99)); |
243 | } | 247 | } |
244 | if ( state ) { | 248 | if ( state ) { |
245 | QListViewItem * myChild = firstChild(); | 249 | QListViewItem * myChild = firstChild(); |
246 | KOTodoViewItem *item; | 250 | KOTodoViewItem *item; |
247 | while( myChild ) { | 251 | while( myChild ) { |
248 | //qDebug("stateCH "); | 252 | //qDebug("stateCH "); |
249 | item = static_cast<KOTodoViewItem*>(myChild); | 253 | item = static_cast<KOTodoViewItem*>(myChild); |
250 | item->stateChange(state); | 254 | item->stateChange(state); |
251 | myChild = myChild->nextSibling(); | 255 | myChild = myChild->nextSibling(); |
252 | } | 256 | } |
253 | } else { | 257 | } else { |
254 | QListViewItem * myChild = parent(); | 258 | QListViewItem * myChild = parent(); |
255 | if ( myChild ) | 259 | if ( myChild ) |
256 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | 260 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); |
257 | } | 261 | } |
258 | mTodoView->modified(true); | 262 | mTodoView->modified(true); |