author | zautrix <zautrix> | 2005-04-28 09:08:21 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-28 09:08:21 (UTC) |
commit | 8fbdf5d2b0ee1e1496cb856e0ead37c668066353 (patch) (side-by-side diff) | |
tree | 964dd57f1492857fb9471a0af9943d08c56e5c6e /libkcal | |
parent | 42786862c89c0de78cec783f251eae66bcbc53db (diff) | |
download | kdepimpi-8fbdf5d2b0ee1e1496cb856e0ead37c668066353.zip kdepimpi-8fbdf5d2b0ee1e1496cb856e0ead37c668066353.tar.gz kdepimpi-8fbdf5d2b0ee1e1496cb856e0ead37c668066353.tar.bz2 |
added comment for todo
-rw-r--r-- | libkcal/todo.cpp | 13 | ||||
-rw-r--r-- | libkcal/todo.h | 3 |
2 files changed, 14 insertions, 2 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 002d3f2..f7e38a7 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -52,66 +52,77 @@ Todo::Todo(const Todo &t) : QObject(),Incidence(t) mHasCompletedDate = t.mHasCompletedDate; mPercentComplete = t.mPercentComplete; mRunning = false; mRunSaveTimer = 0; } Todo::~Todo() { setRunning( false ); //qDebug("Todo::~Todo() "); } +void Todo::setRunningFalse( QString s ) +{ + if ( ! mRunning ) + return; + mRunning = false; + mRunSaveTimer->stop(); + saveRunningInfoToFile( s ); +} void Todo::setRunning( bool run ) { if ( run == mRunning ) return; //qDebug("Todo::setRunning %d ", run); if ( !mRunSaveTimer ) { mRunSaveTimer = new QTimer ( this ); connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( saveRunningInfoToFile() ) ); } mRunning = run; if ( mRunning ) { mRunSaveTimer->start( 1000 * 60 * 5 ); // 5 min mRunStart = QDateTime::currentDateTime(); } else { mRunSaveTimer->stop(); saveRunningInfoToFile(); } } -void Todo::saveRunningInfoToFile() +void Todo::saveRunningInfoToFile( QString comment ) { //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { qDebug("Running time < 30 seconds. Skipped. "); return; } QString dir = KGlobalSettings::timeTrackerDir(); //qDebug("%s ", dir.latin1()); QString file = "%1%2%3-%4%5%6-"; file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); file.replace ( QRegExp (" "), "0" ); file += uid(); //qDebug("File %s ",file.latin1() ); CalendarLocal cal; cal.setLocalTime(); Todo * to = (Todo*) clone(); to->setFloats( false ); to->setDtStart( mRunStart ); to->setHasStartDate( true ); to->setDtDue( QDateTime::currentDateTime() ); to->setHasDueDate( true ); to->setUid( file ); + if ( !comment.isEmpty() ) { + to->setDescription( comment ); + } cal.addIncidence( to ); ICalFormat format; file = dir +"/" +file +".ics"; format.save( &cal, file ); saveParents(); } void Todo::saveParents() { if (!relatedTo() ) return; Incidence * inc = relatedTo(); diff --git a/libkcal/todo.h b/libkcal/todo.h index ec1ffda..a5354ce 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h @@ -111,28 +111,29 @@ namespace KCal { QString completedStr(bool shortF = true) const; /** set date and time of completion */ void setCompleted(const QDateTime &completed); /** Return true, if todo has a date associated with completion */ bool hasCompletedDate() const; bool contains ( Todo*); void checkSetCompletedFalse(); bool setRecurDates(); bool isRunning() {return mRunning;} bool hasRunningSub(); void setRunning( bool ); + void setRunningFalse( QString ); int runTime(); QDateTime runStart () const { return mRunStart;} public slots: - void saveRunningInfoToFile(); + void saveRunningInfoToFile( QString st = QString::null ); void saveParents(); private: bool mRunning; QTimer * mRunSaveTimer; QDateTime mRunStart; bool accept(Visitor &v) { return v.visit(this); } QDateTime mDtDue; // due date of todo bool mHasDueDate; // if todo has associated due date // int mStatus; // confirmed/delegated/tentative/etc |