author | zecke <zecke> | 2002-10-18 03:12:54 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-18 03:12:54 (UTC) |
commit | 07a1cb4baaf544e0e594040bbe8e5872ccb34c0f (patch) (unidiff) | |
tree | ba556d2f587a65bfc3b15fc844a9383f5ef66c9e | |
parent | 86b3550348cf896b568e98d21da577c3f35a1a4a (diff) | |
download | opie-07a1cb4baaf544e0e594040bbe8e5872ccb34c0f.zip opie-07a1cb4baaf544e0e594040bbe8e5872ccb34c0f.tar.gz opie-07a1cb4baaf544e0e594040bbe8e5872ccb34c0f.tar.bz2 |
Fix the behaviour of isOverDue.
We currently check if the Record got a DueDate
and then do some calculations.
I added a check to see if the item isCompleted.
If it is completed it can not be overdue
Stefan: Only one item left which is overdue ;)
-rw-r--r-- | libopie/pim/otodo.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/otodo.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libopie/pim/otodo.cpp b/libopie/pim/otodo.cpp index 6dd4c0e..765d5a9 100644 --- a/libopie/pim/otodo.cpp +++ b/libopie/pim/otodo.cpp | |||
@@ -158,65 +158,65 @@ void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | |||
158 | { | 158 | { |
159 | changeOrModify(); | 159 | changeOrModify(); |
160 | data->hasAlarmDateTime = hasAlarmDateTime; | 160 | data->hasAlarmDateTime = hasAlarmDateTime; |
161 | } | 161 | } |
162 | void OTodo::setDescription(const QString &desc ) | 162 | void OTodo::setDescription(const QString &desc ) |
163 | { | 163 | { |
164 | // qWarning( "desc " + desc ); | 164 | // qWarning( "desc " + desc ); |
165 | changeOrModify(); | 165 | changeOrModify(); |
166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
167 | } | 167 | } |
168 | void OTodo::setSummary( const QString& sum ) | 168 | void OTodo::setSummary( const QString& sum ) |
169 | { | 169 | { |
170 | changeOrModify(); | 170 | changeOrModify(); |
171 | data->sum = sum; | 171 | data->sum = sum; |
172 | } | 172 | } |
173 | void OTodo::setPriority(int prio ) | 173 | void OTodo::setPriority(int prio ) |
174 | { | 174 | { |
175 | changeOrModify(); | 175 | changeOrModify(); |
176 | data->priority = prio; | 176 | data->priority = prio; |
177 | } | 177 | } |
178 | void OTodo::setDueDate( QDate date ) | 178 | void OTodo::setDueDate( QDate date ) |
179 | { | 179 | { |
180 | changeOrModify(); | 180 | changeOrModify(); |
181 | data->date = date; | 181 | data->date = date; |
182 | } | 182 | } |
183 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) | 183 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) |
184 | { | 184 | { |
185 | changeOrModify(); | 185 | changeOrModify(); |
186 | data->alarmDateTime = alarm; | 186 | data->alarmDateTime = alarm; |
187 | } | 187 | } |
188 | bool OTodo::isOverdue( ) | 188 | bool OTodo::isOverdue( ) |
189 | { | 189 | { |
190 | if( data->hasDate ) | 190 | if( data->hasDate && !data->isCompleted) |
191 | return QDate::currentDate() > data->date; | 191 | return QDate::currentDate() > data->date; |
192 | return false; | 192 | return false; |
193 | } | 193 | } |
194 | void OTodo::setProgress(ushort progress ) | 194 | void OTodo::setProgress(ushort progress ) |
195 | { | 195 | { |
196 | changeOrModify(); | 196 | changeOrModify(); |
197 | data->prog = progress; | 197 | data->prog = progress; |
198 | } | 198 | } |
199 | QString OTodo::toShortText() const { | 199 | QString OTodo::toShortText() const { |
200 | return summary(); | 200 | return summary(); |
201 | } | 201 | } |
202 | /*! | 202 | /*! |
203 | Returns a richt text string | 203 | Returns a richt text string |
204 | */ | 204 | */ |
205 | QString OTodo::toRichText() const | 205 | QString OTodo::toRichText() const |
206 | { | 206 | { |
207 | QString text; | 207 | QString text; |
208 | QStringList catlist; | 208 | QStringList catlist; |
209 | 209 | ||
210 | // Description of the todo | 210 | // Description of the todo |
211 | if ( !summary().isEmpty() ) { | 211 | if ( !summary().isEmpty() ) { |
212 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; | 212 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; |
213 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 213 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
214 | } | 214 | } |
215 | if( !description().isEmpty() ){ | 215 | if( !description().isEmpty() ){ |
216 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; | 216 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
217 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; | 217 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; |
218 | } | 218 | } |
219 | text += "<br><br><br>"; | 219 | text += "<br><br><br>"; |
220 | 220 | ||
221 | text += "<b>" + QObject::tr( "Priority:") +" </b>" | 221 | text += "<b>" + QObject::tr( "Priority:") +" </b>" |
222 | + QString::number( priority() ) + " <br>"; | 222 | + QString::number( priority() ) + " <br>"; |
diff --git a/libopie2/opiepim/otodo.cpp b/libopie2/opiepim/otodo.cpp index 6dd4c0e..765d5a9 100644 --- a/libopie2/opiepim/otodo.cpp +++ b/libopie2/opiepim/otodo.cpp | |||
@@ -158,65 +158,65 @@ void OTodo::setHasAlarmDateTime( bool hasAlarmDateTime ) | |||
158 | { | 158 | { |
159 | changeOrModify(); | 159 | changeOrModify(); |
160 | data->hasAlarmDateTime = hasAlarmDateTime; | 160 | data->hasAlarmDateTime = hasAlarmDateTime; |
161 | } | 161 | } |
162 | void OTodo::setDescription(const QString &desc ) | 162 | void OTodo::setDescription(const QString &desc ) |
163 | { | 163 | { |
164 | // qWarning( "desc " + desc ); | 164 | // qWarning( "desc " + desc ); |
165 | changeOrModify(); | 165 | changeOrModify(); |
166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); | 166 | data->desc = Qtopia::simplifyMultiLineSpace(desc ); |
167 | } | 167 | } |
168 | void OTodo::setSummary( const QString& sum ) | 168 | void OTodo::setSummary( const QString& sum ) |
169 | { | 169 | { |
170 | changeOrModify(); | 170 | changeOrModify(); |
171 | data->sum = sum; | 171 | data->sum = sum; |
172 | } | 172 | } |
173 | void OTodo::setPriority(int prio ) | 173 | void OTodo::setPriority(int prio ) |
174 | { | 174 | { |
175 | changeOrModify(); | 175 | changeOrModify(); |
176 | data->priority = prio; | 176 | data->priority = prio; |
177 | } | 177 | } |
178 | void OTodo::setDueDate( QDate date ) | 178 | void OTodo::setDueDate( QDate date ) |
179 | { | 179 | { |
180 | changeOrModify(); | 180 | changeOrModify(); |
181 | data->date = date; | 181 | data->date = date; |
182 | } | 182 | } |
183 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) | 183 | void OTodo::setAlarmDateTime( const QDateTime& alarm ) |
184 | { | 184 | { |
185 | changeOrModify(); | 185 | changeOrModify(); |
186 | data->alarmDateTime = alarm; | 186 | data->alarmDateTime = alarm; |
187 | } | 187 | } |
188 | bool OTodo::isOverdue( ) | 188 | bool OTodo::isOverdue( ) |
189 | { | 189 | { |
190 | if( data->hasDate ) | 190 | if( data->hasDate && !data->isCompleted) |
191 | return QDate::currentDate() > data->date; | 191 | return QDate::currentDate() > data->date; |
192 | return false; | 192 | return false; |
193 | } | 193 | } |
194 | void OTodo::setProgress(ushort progress ) | 194 | void OTodo::setProgress(ushort progress ) |
195 | { | 195 | { |
196 | changeOrModify(); | 196 | changeOrModify(); |
197 | data->prog = progress; | 197 | data->prog = progress; |
198 | } | 198 | } |
199 | QString OTodo::toShortText() const { | 199 | QString OTodo::toShortText() const { |
200 | return summary(); | 200 | return summary(); |
201 | } | 201 | } |
202 | /*! | 202 | /*! |
203 | Returns a richt text string | 203 | Returns a richt text string |
204 | */ | 204 | */ |
205 | QString OTodo::toRichText() const | 205 | QString OTodo::toRichText() const |
206 | { | 206 | { |
207 | QString text; | 207 | QString text; |
208 | QStringList catlist; | 208 | QStringList catlist; |
209 | 209 | ||
210 | // Description of the todo | 210 | // Description of the todo |
211 | if ( !summary().isEmpty() ) { | 211 | if ( !summary().isEmpty() ) { |
212 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; | 212 | text += "<b>" + QObject::tr( "Summary:") + "</b><br>"; |
213 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; | 213 | text += Qtopia::escapeString(summary() ).replace(QRegExp( "[\n]"), "<br>" ) + "<br>"; |
214 | } | 214 | } |
215 | if( !description().isEmpty() ){ | 215 | if( !description().isEmpty() ){ |
216 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; | 216 | text += "<b>" + QObject::tr( "Description:" ) + "</b><br>"; |
217 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; | 217 | text += Qtopia::escapeString(description() ).replace(QRegExp( "[\n]"), "<br>" ) ; |
218 | } | 218 | } |
219 | text += "<br><br><br>"; | 219 | text += "<br><br><br>"; |
220 | 220 | ||
221 | text += "<b>" + QObject::tr( "Priority:") +" </b>" | 221 | text += "<b>" + QObject::tr( "Priority:") +" </b>" |
222 | + QString::number( priority() ) + " <br>"; | 222 | + QString::number( priority() ) + " <br>"; |