summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-13 17:05:02 (UTC)
committer zautrix <zautrix>2005-02-13 17:05:02 (UTC)
commit293271fe9e6a9061da329183f8f488d79580f7da (patch) (side-by-side diff)
tree3a0234eabdf58440a484e960b5eef912a63d0056 /korganizer
parent0a33f91e166747406ca2ccb5819881feeecfdb40 (diff)
downloadkdepimpi-293271fe9e6a9061da329183f8f488d79580f7da.zip
kdepimpi-293271fe9e6a9061da329183f8f488d79580f7da.tar.gz
kdepimpi-293271fe9e6a9061da329183f8f488d79580f7da.tar.bz2
todo rec fixes
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()
}
+ if ( to < from )
+ to = from;
mRecurrence->setDefaults(from,to,!time);
@@ -352,2 +354,29 @@ void KOTodoEditor::writeTodo(Todo *event)
mRecurrence->writeEvent(event);
+ event->setRecurrenceID( event->dtStart().addSecs(-1) );
+ event->setRecurDates();
+#if 0
+ bool ok;
+ QDateTime next = event->getNextOccurence( event->dtStart().addSecs(-1), &ok );
+ if ( ok ) {
+ QDateTime from,to;
+ bool time = mGeneral->mTimeButton->isChecked();
+ if ( time ) {
+ to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
+ from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
+ } else {
+ to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
+ from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
+ }
+ if ( to < from )
+ to = from;
+ int secs = from.secsTo( to );
+ event->setRecurrenceID( next );
+ event->setDtStart( next );
+ event->setDtDue( next.addSecs( secs ) );
+ }
+ else {
+ event->setHasRecurrenceID( false );
+ event->recurrence()->unsetRecurs();
+ }
+#endif
} 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()
pixSize += size;
+ }
+ if ( mTodo->doesRecur() ) {
+ pixi.resize(size, pixSize+size);
+ pPix.fill( Qt::blue );
+ p.begin( &pixi );
+ p. drawPixmap ( 0, pixSize, pPix);
+ p.end();
+ pixSize += size;
}
@@ -202,3 +210,3 @@ void KOTodoViewItem::stateChange(bool state)
{
- // qDebug("KOTodoViewItem::stateChange ");
+ // qDebug("KOTodoViewItem::stateChange %d ", state);
// do not change setting on startup
@@ -217,3 +225,14 @@ void KOTodoViewItem::stateChange(bool state)
//qDebug("KOTodoViewItem::stateChange %s ", text(0).latin1());
- mTodo->setCompleted(state);
+ if ( mTodo->doesRecur() ){
+ QDateTime start = mTodo->dtStart();
+ mTodo->setCompleted(state);
+ if ( start != mTodo->dtStart() ) {
+ if ( state && !mTodo->isCompleted() ) {
+ setOn( false );
+ state = false;
+ }
+ }
+ } else
+ mTodo->setCompleted(state);
+
if (state) mTodo->setCompleted(QDateTime::currentDateTime());
@@ -235,2 +254,21 @@ void KOTodoViewItem::stateChange(bool state)
}
+ if (mTodo->hasStartDate()) {
+ QString skeyt = "==";
+ QString skeyd = "==";
+ setText(5, mTodo->dtStartDateStr());
+ QDate d = mTodo->dtStart().date();
+ skeyd.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
+
+ if (mTodo->doesFloat()) {
+ setText(6,"");
+ }
+ else {
+ setText(6,mTodo->dtStartTimeStr());
+ QTime t = mTodo->dtStart().time();
+ skeyt.sprintf("%02d%02d",t.hour(),t.minute());
+
+ }
+ setSortKey(5,skeyd);
+ setSortKey(6,skeyt);
+ }
if (mTodo->isCompleted()) setSortKey(1,QString::number(9)+keyd+keyt);