author | zautrix <zautrix> | 2005-01-30 12:08:19 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-30 12:08:19 (UTC) |
commit | 1bcef8b3f53419e7155e0862ad61e3e419763d70 (patch) (unidiff) | |
tree | 166b82db7bc30b7d55b042bd37bb92facea6cdf2 /korganizer | |
parent | 446ea98a9f6550c4a3e64bcfc6aab8e8b58776e8 (diff) | |
download | kdepimpi-1bcef8b3f53419e7155e0862ad61e3e419763d70.zip kdepimpi-1bcef8b3f53419e7155e0862ad61e3e419763d70.tar.gz kdepimpi-1bcef8b3f53419e7155e0862ad61e3e419763d70.tar.bz2 |
fixes
-rw-r--r-- | korganizer/koagendaview.cpp | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 9 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 18 |
3 files changed, 22 insertions, 6 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index bbc43e4..42a6f7c 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1152,25 +1152,24 @@ void KOAgendaView::fillAgenda() | |||
1152 | 1152 | ||
1153 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1153 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1154 | 1154 | ||
1155 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1155 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1156 | // Already completed items can be displayed on their original due date | 1156 | // Already completed items can be displayed on their original due date |
1157 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1157 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1158 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1158 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1159 | bool fillIn = false; | 1159 | bool fillIn = false; |
1160 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1160 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1161 | fillIn = true; | 1161 | fillIn = true; |
1162 | if ( ! fillIn && !todo->hasCompletedDate() ) | 1162 | if ( ! fillIn && !todo->hasCompletedDate() ) |
1163 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); | 1163 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); |
1164 | qDebug("refill todo "); | ||
1165 | if ( fillIn ) { | 1164 | if ( fillIn ) { |
1166 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue | 1165 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1167 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1166 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1168 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1167 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
1169 | } | 1168 | } |
1170 | else { | 1169 | else { |
1171 | QDateTime dt; | 1170 | QDateTime dt; |
1172 | if ( todo->hasCompletedDate() ) | 1171 | if ( todo->hasCompletedDate() ) |
1173 | dt = todo->completed(); | 1172 | dt = todo->completed(); |
1174 | else | 1173 | else |
1175 | dt = todo->dtDue();; | 1174 | dt = todo->dtDue();; |
1176 | 1175 | ||
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 14e8b5c..902f3f4 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -849,24 +849,33 @@ void KOTodoView::setNewPriority(int index) | |||
849 | { | 849 | { |
850 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 850 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
851 | mActiveItem->todo()->setPriority(mPriority[index]); | 851 | mActiveItem->todo()->setPriority(mPriority[index]); |
852 | mActiveItem->construct(); | 852 | mActiveItem->construct(); |
853 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); | 853 | todoModified (mActiveItem->todo(), KOGlobals::PRIORITY_MODIFIED); |
854 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 854 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
855 | } | 855 | } |
856 | } | 856 | } |
857 | 857 | ||
858 | void KOTodoView::setNewPercentage(int index) | 858 | void KOTodoView::setNewPercentage(int index) |
859 | { | 859 | { |
860 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { | 860 | if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { |
861 | |||
862 | if ( mPercentage[index] == 100 && !mActiveItem->isOn() ) { | ||
863 | mActiveItem->setOn( true ); | ||
864 | return; | ||
865 | } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { | ||
866 | KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); | ||
867 | if ( par && par->isOn() ) | ||
868 | par->setOn( false ); | ||
869 | } | ||
861 | if (mPercentage[index] == 100) { | 870 | if (mPercentage[index] == 100) { |
862 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); | 871 | mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); |
863 | } else { | 872 | } else { |
864 | mActiveItem->todo()->setCompleted(false); | 873 | mActiveItem->todo()->setCompleted(false); |
865 | } | 874 | } |
866 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); | 875 | mActiveItem->todo()->setPercentComplete(mPercentage[index]); |
867 | mActiveItem->construct(); | 876 | mActiveItem->construct(); |
868 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); | 877 | todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); |
869 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); | 878 | mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); |
870 | } | 879 | } |
871 | } | 880 | } |
872 | 881 | ||
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index 2822237..1edddac 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -194,33 +194,34 @@ void KOTodoViewItem::setMyPixmap() | |||
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 | qDebug("KOTodoViewItem::stateChange "); | 206 | if (isOn()!=state) { |
207 | setOn(state); | ||
208 | //qDebug("SETON "); | ||
209 | return; | ||
210 | } | ||
207 | QString keyd = "=="; | 211 | QString keyd = "=="; |
208 | QString keyt = "=="; | 212 | QString keyt = "=="; |
209 | 213 | //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); | |
210 | mTodo->setCompleted(state); | 214 | mTodo->setCompleted(state); |
211 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); | 215 | if (state) mTodo->setCompleted(QDateTime::currentDateTime()); |
212 | if (isOn()!=state) { | ||
213 | setOn(state); | ||
214 | } | ||
215 | 216 | ||
216 | if (mTodo->hasDueDate()) { | 217 | if (mTodo->hasDueDate()) { |
217 | setText(3, mTodo->dtDueDateStr()); | 218 | setText(3, mTodo->dtDueDateStr()); |
218 | QDate d = mTodo->dtDue().date(); | 219 | QDate d = mTodo->dtDue().date(); |
219 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); | 220 | keyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); |
220 | setSortKey(3,keyd); | 221 | setSortKey(3,keyd); |
221 | if (mTodo->doesFloat()) { | 222 | if (mTodo->doesFloat()) { |
222 | setText(4,""); | 223 | setText(4,""); |
223 | } | 224 | } |
224 | else { | 225 | else { |
225 | setText(4,mTodo->dtDueTimeStr()); | 226 | setText(4,mTodo->dtDueTimeStr()); |
226 | QTime t = mTodo->dtDue().time(); | 227 | QTime t = mTodo->dtDue().time(); |
@@ -231,31 +232,38 @@ void KOTodoViewItem::stateChange(bool state) | |||
231 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); | 232 | if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); |
232 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); | 233 | else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); |
233 | 234 | ||
234 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); | 235 | setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); |
235 | if (mTodo->percentComplete()<100) { | 236 | if (mTodo->percentComplete()<100) { |
236 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 237 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
237 | else setSortKey(2,QString::number(mTodo->percentComplete())); | 238 | else setSortKey(2,QString::number(mTodo->percentComplete())); |
238 | } | 239 | } |
239 | else { | 240 | else { |
240 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); | 241 | if (mTodo->isCompleted()) setSortKey(2,QString::number(999)); |
241 | else setSortKey(2,QString::number(99)); | 242 | else setSortKey(2,QString::number(99)); |
242 | } | 243 | } |
244 | if ( state ) { | ||
243 | QListViewItem * myChild = firstChild(); | 245 | QListViewItem * myChild = firstChild(); |
244 | KOTodoViewItem *item; | 246 | KOTodoViewItem *item; |
245 | while( myChild ) { | 247 | while( myChild ) { |
248 | //qDebug("stateCH "); | ||
246 | item = static_cast<KOTodoViewItem*>(myChild); | 249 | item = static_cast<KOTodoViewItem*>(myChild); |
247 | item->stateChange(state); | 250 | item->stateChange(state); |
248 | myChild = myChild->nextSibling(); | 251 | myChild = myChild->nextSibling(); |
249 | } | 252 | } |
253 | } else { | ||
254 | QListViewItem * myChild = parent(); | ||
255 | if ( myChild ) | ||
256 | (static_cast<KOTodoViewItem*>(myChild))->stateChange(state); | ||
257 | } | ||
250 | mTodoView->modified(true); | 258 | mTodoView->modified(true); |
251 | setMyPixmap(); | 259 | setMyPixmap(); |
252 | mTodoView->setTodoModified( mTodo ); | 260 | mTodoView->setTodoModified( mTodo ); |
253 | } | 261 | } |
254 | 262 | ||
255 | bool KOTodoViewItem::isAlternate() | 263 | bool KOTodoViewItem::isAlternate() |
256 | { | 264 | { |
257 | #ifndef KORG_NOLVALTERNATION | 265 | #ifndef KORG_NOLVALTERNATION |
258 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); | 266 | KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); |
259 | if (lv && lv->alternateBackground().isValid()) | 267 | if (lv && lv->alternateBackground().isValid()) |
260 | { | 268 | { |
261 | KOTodoViewItem *above = 0; | 269 | KOTodoViewItem *above = 0; |