-rw-r--r-- | libkcal/todo.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 39d16b6..a496404 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -146,97 +146,99 @@ bool KCal::operator==( const Todo& t1, const Todo& t2 ) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | } else | 148 | } else |
149 | return false; | 149 | return false; |
150 | } | 150 | } |
151 | return true; | 151 | return true; |
152 | 152 | ||
153 | } | 153 | } |
154 | 154 | ||
155 | void Todo::setDtDue(const QDateTime &dtDue) | 155 | void Todo::setDtDue(const QDateTime &dtDue) |
156 | { | 156 | { |
157 | //int diffsecs = mDtDue.secsTo(dtDue); | 157 | //int diffsecs = mDtDue.secsTo(dtDue); |
158 | 158 | ||
159 | /*if (mReadOnly) return; | 159 | /*if (mReadOnly) return; |
160 | const QPtrList<Alarm>& alarms = alarms(); | 160 | const QPtrList<Alarm>& alarms = alarms(); |
161 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { | 161 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { |
162 | if (alarm->enabled()) { | 162 | if (alarm->enabled()) { |
163 | alarm->setTime(alarm->time().addSecs(diffsecs)); | 163 | alarm->setTime(alarm->time().addSecs(diffsecs)); |
164 | } | 164 | } |
165 | }*/ | 165 | }*/ |
166 | mDtDue = getEvenTime(dtDue); | 166 | mDtDue = getEvenTime(dtDue); |
167 | 167 | ||
168 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; | 168 | //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; |
169 | 169 | ||
170 | /*const QPtrList<Alarm>& alarms = alarms(); | 170 | /*const QPtrList<Alarm>& alarms = alarms(); |
171 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) | 171 | for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) |
172 | alarm->setAlarmStart(mDtDue);*/ | 172 | alarm->setAlarmStart(mDtDue);*/ |
173 | 173 | ||
174 | updated(); | 174 | updated(); |
175 | } | 175 | } |
176 | 176 | ||
177 | QDateTime Todo::dtDue() const | 177 | QDateTime Todo::dtDue() const |
178 | { | 178 | { |
179 | return mDtDue; | 179 | return mDtDue; |
180 | } | 180 | } |
181 | 181 | ||
182 | QString Todo::dtDueTimeStr() const | 182 | QString Todo::dtDueTimeStr() const |
183 | { | 183 | { |
184 | return KGlobal::locale()->formatTime(mDtDue.time()); | 184 | return KGlobal::locale()->formatTime(mDtDue.time()); |
185 | } | 185 | } |
186 | 186 | ||
187 | QString Todo::dtDueDateStr(bool shortfmt) const | 187 | QString Todo::dtDueDateStr(bool shortfmt) const |
188 | { | 188 | { |
189 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | 189 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); |
190 | } | 190 | } |
191 | 191 | ||
192 | QString Todo::dtDueStr(bool shortfmt) const | 192 | QString Todo::dtDueStr(bool shortfmt) const |
193 | { | 193 | { |
194 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); | 194 | if ( doesFloat() ) |
195 | return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); | ||
196 | return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); | ||
195 | } | 197 | } |
196 | // retval 0 : no found | 198 | // retval 0 : no found |
197 | // 1 : due for date found | 199 | // 1 : due for date found |
198 | // 2 : overdue for date found | 200 | // 2 : overdue for date found |
199 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) | 201 | int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) |
200 | { | 202 | { |
201 | int retval = 0; | 203 | int retval = 0; |
202 | if ( isCompleted() ) | 204 | if ( isCompleted() ) |
203 | return 0; | 205 | return 0; |
204 | if ( hasDueDate() ) { | 206 | if ( hasDueDate() ) { |
205 | if ( dtDue().date() < date ) | 207 | if ( dtDue().date() < date ) |
206 | return 2; | 208 | return 2; |
207 | // we do not return, because we may find an overdue sub todo | 209 | // we do not return, because we may find an overdue sub todo |
208 | if ( dtDue().date() == date ) | 210 | if ( dtDue().date() == date ) |
209 | retval = 1; | 211 | retval = 1; |
210 | } | 212 | } |
211 | if ( checkSubtodos ) { | 213 | if ( checkSubtodos ) { |
212 | Incidence *aTodo; | 214 | Incidence *aTodo; |
213 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { | 215 | for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) { |
214 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); | 216 | int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos ); |
215 | if ( ret == 2 ) | 217 | if ( ret == 2 ) |
216 | return 2; | 218 | return 2; |
217 | if ( ret == 1) | 219 | if ( ret == 1) |
218 | retval = 1; | 220 | retval = 1; |
219 | } | 221 | } |
220 | } | 222 | } |
221 | return retval; | 223 | return retval; |
222 | } | 224 | } |
223 | int Todo::hasDueSubTodo( bool checkSubtodos ) //= true | 225 | int Todo::hasDueSubTodo( bool checkSubtodos ) //= true |
224 | { | 226 | { |
225 | return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); | 227 | return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); |
226 | } | 228 | } |
227 | bool Todo::hasDueDate() const | 229 | bool Todo::hasDueDate() const |
228 | { | 230 | { |
229 | return mHasDueDate; | 231 | return mHasDueDate; |
230 | } | 232 | } |
231 | 233 | ||
232 | void Todo::setHasDueDate(bool f) | 234 | void Todo::setHasDueDate(bool f) |
233 | { | 235 | { |
234 | if (mReadOnly) return; | 236 | if (mReadOnly) return; |
235 | mHasDueDate = f; | 237 | mHasDueDate = f; |
236 | updated(); | 238 | updated(); |
237 | } | 239 | } |
238 | 240 | ||
239 | 241 | ||
240 | #if 0 | 242 | #if 0 |
241 | void Todo::setStatus(const QString &statStr) | 243 | void Todo::setStatus(const QString &statStr) |
242 | { | 244 | { |