summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoeditor.cpp29
-rw-r--r--korganizer/kotodoviewitem.cpp42
2 files changed, 69 insertions, 2 deletions
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 069dda8..9232e09 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -323,2 +323,4 @@ void KOTodoEditor::checkRecurrence()
323 } 323 }
324 if ( to < from )
325 to = from;
324 mRecurrence->setDefaults(from,to,!time); 326 mRecurrence->setDefaults(from,to,!time);
@@ -352,2 +354,29 @@ void KOTodoEditor::writeTodo(Todo *event)
352 mRecurrence->writeEvent(event); 354 mRecurrence->writeEvent(event);
355 event->setRecurrenceID( event->dtStart().addSecs(-1) );
356 event->setRecurDates();
357#if 0
358 bool ok;
359 QDateTime next = event->getNextOccurence( event->dtStart().addSecs(-1), &ok );
360 if ( ok ) {
361 QDateTime from,to;
362 bool time = mGeneral->mTimeButton->isChecked();
363 if ( time ) {
364 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
365 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
366 } else {
367 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
368 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
369 }
370 if ( to < from )
371 to = from;
372 int secs = from.secsTo( to );
373 event->setRecurrenceID( next );
374 event->setDtStart( next );
375 event->setDtDue( next.addSecs( secs ) );
376 }
377 else {
378 event->setHasRecurrenceID( false );
379 event->recurrence()->unsetRecurs();
380 }
381#endif
353 } else 382 } else
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 0e847c2..70f00c6 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -192,2 +192,10 @@ void KOTodoViewItem::setMyPixmap()
192 pixSize += size; 192 pixSize += size;
193 }
194 if ( mTodo->doesRecur() ) {
195 pixi.resize(size, pixSize+size);
196 pPix.fill( Qt::blue );
197 p.begin( &pixi );
198 p. drawPixmap ( 0, pixSize, pPix);
199 p.end();
200 pixSize += size;
193 } 201 }
@@ -202,3 +210,3 @@ void KOTodoViewItem::stateChange(bool state)
202{ 210{
203 // qDebug("KOTodoViewItem::stateChange "); 211 // qDebug("KOTodoViewItem::stateChange %d ", state);
204 // do not change setting on startup 212 // do not change setting on startup
@@ -217,3 +225,14 @@ void KOTodoViewItem::stateChange(bool state)
217 //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1()); 225 //qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1());
218 mTodo->setCompleted(state); 226 if ( mTodo->doesRecur() ){
227 QDateTime start = mTodo->dtStart();
228 mTodo->setCompleted(state);
229 if ( start != mTodo->dtStart() ) {
230 if ( state && !mTodo->isCompleted() ) {
231 setOn( false );
232 state = false;
233 }
234 }
235 } else
236 mTodo->setCompleted(state);
237
219 if (state) mTodo->setCompleted(QDateTime::currentDateTime()); 238 if (state) mTodo->setCompleted(QDateTime::currentDateTime());
@@ -235,2 +254,21 @@ void KOTodoViewItem::stateChange(bool state)
235 } 254 }
255 if (mTodo->hasStartDate()) {
256 QString skeyt = "==";
257 QString skeyd = "==";
258 setText(5, mTodo->dtStartDateStr());
259 QDate d = mTodo->dtStart().date();
260 skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
261
262 if (mTodo->doesFloat()) {
263 setText(6,"");
264 }
265 else {
266 setText(6,mTodo->dtStartTimeStr());
267 QTime t = mTodo->dtStart().time();
268 skeyt.sprintf("%02d%02d",t.hour(),t.minute());
269
270 }
271 setSortKey(5,skeyd);
272 setSortKey(6,skeyt);
273 }
236 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt); 274 if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);