author | zautrix <zautrix> | 2005-09-28 00:42:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-09-28 00:42:41 (UTC) |
commit | 4fb9beb1ec26f37a18f98af9d3b6b59acf8c56d2 (patch) (unidiff) | |
tree | cbfbb81858c5ec08ba16e45b511ddbab539af864 | |
parent | e6112c5497b334d6dc38108b37963c5e803413d3 (diff) | |
download | kdepimpi-4fb9beb1ec26f37a18f98af9d3b6b59acf8c56d2.zip kdepimpi-4fb9beb1ec26f37a18f98af9d3b6b59acf8c56d2.tar.gz kdepimpi-4fb9beb1ec26f37a18f98af9d3b6b59acf8c56d2.tar.bz2 |
save tt fix
-rw-r--r-- | libkcal/todo.cpp | 7 | ||||
-rw-r--r-- | libkcal/todo.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 29f725f..2201814 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -98,24 +98,25 @@ void Todo::setRunning( bool run ) | |||
98 | mRunSaveTimer = new QTimer ( this ); | 98 | mRunSaveTimer = new QTimer ( this ); |
99 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( timerSlotSaveRunningInfoToFile() ) ); | 99 | connect ( mRunSaveTimer, SIGNAL( timeout() ), this , SLOT ( timerSlotSaveRunningInfoToFile() ) ); |
100 | } | 100 | } |
101 | mRunning = run; | 101 | mRunning = run; |
102 | mRunLastSave = QDateTime::currentDateTime(); | 102 | mRunLastSave = QDateTime::currentDateTime(); |
103 | if ( mRunning ) { | 103 | if ( mRunning ) { |
104 | restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); | 104 | restartSaveTimer( SAVETIMER_TIMEOUT_SECONDS ); |
105 | mRunStart = QDateTime::currentDateTime(); | 105 | mRunStart = QDateTime::currentDateTime(); |
106 | } else { | 106 | } else { |
107 | mRunSaveTimer->stop(); | 107 | mRunSaveTimer->stop(); |
108 | saveRunningInfoToFile(); | 108 | saveRunningInfoToFile(); |
109 | } | 109 | } |
110 | mLastSavedFileName = ""; | ||
110 | } | 111 | } |
111 | void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end ) | 112 | void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end ) |
112 | { | 113 | { |
113 | if ( !mRunning) return; | 114 | if ( !mRunning) return; |
114 | mRunning = false; | 115 | mRunning = false; |
115 | mRunStart = start; | 116 | mRunStart = start; |
116 | mRunEnd = end; | 117 | mRunEnd = end; |
117 | saveRunningInfoToFile( comment ); | 118 | saveRunningInfoToFile( comment ); |
118 | } | 119 | } |
119 | void Todo::restartSaveTimer( int secs ) | 120 | void Todo::restartSaveTimer( int secs ) |
120 | { | 121 | { |
121 | mRunSaveTimer->start( secs * 1000 ); | 122 | mRunSaveTimer->start( secs * 1000 ); |
@@ -181,24 +182,30 @@ void Todo::saveRunningInfoToFile( QString comment ) | |||
181 | if ( !comment.isEmpty() ) { | 182 | if ( !comment.isEmpty() ) { |
182 | QString des = to->description(); | 183 | QString des = to->description(); |
183 | if ( des.isEmpty () ) | 184 | if ( des.isEmpty () ) |
184 | to->setDescription( "TT-Note: " + comment ); | 185 | to->setDescription( "TT-Note: " + comment ); |
185 | else | 186 | else |
186 | to->setDescription( "TT-Note: " + comment +"\n" + des ); | 187 | to->setDescription( "TT-Note: " + comment +"\n" + des ); |
187 | } | 188 | } |
188 | cal.addIncidence( to ); | 189 | cal.addIncidence( to ); |
189 | ICalFormat format( false ); | 190 | ICalFormat format( false ); |
190 | file = dir +"/" +file +".ics"; | 191 | file = dir +"/" +file +".ics"; |
191 | format.save( &cal, file ); | 192 | format.save( &cal, file ); |
192 | saveParents(); | 193 | saveParents(); |
194 | if ( !mLastSavedFileName.isEmpty() ) { | ||
195 | if ( mLastSavedFileName != file ) { | ||
196 | QFile::remove( mLastSavedFileName ); | ||
197 | } | ||
198 | } | ||
199 | mLastSavedFileName = file; | ||
193 | #ifndef DESKTOP_VERSION | 200 | #ifndef DESKTOP_VERSION |
194 | //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); | 201 | //QPEApplication::setTempScreenSaverMode ( QPEApplication::Enable ); |
195 | #endif | 202 | #endif |
196 | } | 203 | } |
197 | void Todo::saveParents() | 204 | void Todo::saveParents() |
198 | { | 205 | { |
199 | if (!relatedTo() ) | 206 | if (!relatedTo() ) |
200 | return; | 207 | return; |
201 | Incidence * inc = relatedTo(); | 208 | Incidence * inc = relatedTo(); |
202 | if ( inc->typeID() != todoID ) | 209 | if ( inc->typeID() != todoID ) |
203 | return; | 210 | return; |
204 | Todo* to = (Todo*)inc; | 211 | Todo* to = (Todo*)inc; |
diff --git a/libkcal/todo.h b/libkcal/todo.h index 71b7a4e..2131732 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -125,24 +125,25 @@ namespace KCal { | |||
125 | void stopRunning(); | 125 | void stopRunning(); |
126 | int runTime(); | 126 | int runTime(); |
127 | QDateTime runStart () const { return mRunStart;} | 127 | QDateTime runStart () const { return mRunStart;} |
128 | void saveRunningInfo( QString comment, QDateTime start, QDateTime end ); | 128 | void saveRunningInfo( QString comment, QDateTime start, QDateTime end ); |
129 | public slots: | 129 | public slots: |
130 | void saveRunningInfoToFile( QString st ); | 130 | void saveRunningInfoToFile( QString st ); |
131 | void saveRunningInfoToFile( ); | 131 | void saveRunningInfoToFile( ); |
132 | void saveParents(); | 132 | void saveParents(); |
133 | QString durationText(); | 133 | QString durationText(); |
134 | private slots: | 134 | private slots: |
135 | void timerSlotSaveRunningInfoToFile( ); | 135 | void timerSlotSaveRunningInfoToFile( ); |
136 | private: | 136 | private: |
137 | QString mLastSavedFileName; | ||
137 | void restartSaveTimer( int secs ); | 138 | void restartSaveTimer( int secs ); |
138 | int mCurrentTimerDelay; | 139 | int mCurrentTimerDelay; |
139 | bool mRunning; | 140 | bool mRunning; |
140 | QTimer * mRunSaveTimer; | 141 | QTimer * mRunSaveTimer; |
141 | QDateTime mRunStart; | 142 | QDateTime mRunStart; |
142 | QDateTime mRunLastSave; | 143 | QDateTime mRunLastSave; |
143 | QDateTime mRunEnd; | 144 | QDateTime mRunEnd; |
144 | bool accept(Visitor &v) { return v.visit(this); } | 145 | bool accept(Visitor &v) { return v.visit(this); } |
145 | 146 | ||
146 | QDateTime mDtDue; // due date of todo | 147 | QDateTime mDtDue; // due date of todo |
147 | 148 | ||
148 | bool mHasDueDate; // if todo has associated due date | 149 | bool mHasDueDate; // if todo has associated due date |