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
@@ -320,8 +320,10 @@ void KOTodoEditor::checkRecurrence()
320 } else { 320 } else {
321 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; 321 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
322 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; 322 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
323 } 323 }
324 if ( to < from )
325 to = from;
324 mRecurrence->setDefaults(from,to,!time); 326 mRecurrence->setDefaults(from,to,!time);
325 } 327 }
326 } else { 328 } else {
327 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); 329 tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false );
@@ -349,8 +351,35 @@ void KOTodoEditor::writeTodo(Todo *event)
349 event->setRelatedTo(mRelatedTodo); 351 event->setRelatedTo(mRelatedTodo);
350 } 352 }
351 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 353 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
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
354 event->recurrence()->unsetRecurs(); 383 event->recurrence()->unsetRecurs();
355} 384}
356 385
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 0e847c2..70f00c6 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -189,8 +189,16 @@ void KOTodoViewItem::setMyPixmap()
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 }
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 }
194 // } 202 // }
195 if ( pixi.width() > 1 ) { 203 if ( pixi.width() > 1 ) {
196 setPixmap ( 0,pixi ) ; 204 setPixmap ( 0,pixi ) ;
@@ -199,9 +207,9 @@ void KOTodoViewItem::setMyPixmap()
199 } 207 }
200} 208}
201void KOTodoViewItem::stateChange(bool state) 209void 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
205 if ( m_init ) return; 213 if ( m_init ) return;
206 if (isOn()!=state) { 214 if (isOn()!=state) {
207 setOn(state); 215 setOn(state);
@@ -214,9 +222,20 @@ void KOTodoViewItem::stateChange(bool state)
214 } 222 }
215 QString keyd = "=="; 223 QString keyd = "==";
216 QString keyt = "=="; 224 QString keyt = "==";
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());
220 239
221 if (mTodo->hasDueDate()) { 240 if (mTodo->hasDueDate()) {
222 setText(3, mTodo->dtDueDateStr()); 241 setText(3, mTodo->dtDueDateStr());
@@ -232,8 +251,27 @@ void KOTodoViewItem::stateChange(bool state)
232 keyt.sprintf("%02d%02d",t.hour(),t.minute()); 251 keyt.sprintf("%02d%02d",t.hour(),t.minute());
233 setSortKey(4,keyt); 252 setSortKey(4,keyt);
234 } 253 }
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);
237 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt); 275 else setSortKey(1,QString::number(mTodo->priority())+keyd+keyt);
238 276
239 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete()))); 277 setText(2,i18n("%1 %").arg(QString::number(mTodo->percentComplete())));