summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-07 18:08:51 (UTC)
committer zautrix <zautrix>2005-03-07 18:08:51 (UTC)
commit668f49ee87c1b3b51e103ed8bb570a035c96b546 (patch) (unidiff)
tree9310b2a5f19589641c7bab924e87599c021141a1
parent55c82dcc9b3c04c06b4eb73654d2b7f09a2e502c (diff)
downloadkdepimpi-668f49ee87c1b3b51e103ed8bb570a035c96b546.zip
kdepimpi-668f49ee87c1b3b51e103ed8bb570a035c96b546.tar.gz
kdepimpi-668f49ee87c1b3b51e103ed8bb570a035c96b546.tar.bz2
start datetime fix for float
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidencebase.cpp4
-rw-r--r--libkcal/todo.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp
index 1e99082..b5fe2e6 100644
--- a/libkcal/incidencebase.cpp
+++ b/libkcal/incidencebase.cpp
@@ -143,129 +143,131 @@ QString IncidenceBase::uid() const
143{ 143{
144 return mUid; 144 return mUid;
145} 145}
146 146
147void IncidenceBase::setLastModified(const QDateTime &lm) 147void IncidenceBase::setLastModified(const QDateTime &lm)
148{ 148{
149 // DON'T! updated() because we call this from 149 // DON'T! updated() because we call this from
150 // Calendar::updateEvent(). 150 // Calendar::updateEvent().
151 mLastModified = getEvenTime(lm); 151 mLastModified = getEvenTime(lm);
152 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1()); 152 //qDebug("IncidenceBase::setLastModified %s ",lm.toString().latin1());
153} 153}
154 154
155QDateTime IncidenceBase::lastModified() const 155QDateTime IncidenceBase::lastModified() const
156{ 156{
157 return mLastModified; 157 return mLastModified;
158} 158}
159 159
160void IncidenceBase::setOrganizer(const QString &o) 160void IncidenceBase::setOrganizer(const QString &o)
161{ 161{
162 // we don't check for readonly here, because it is 162 // we don't check for readonly here, because it is
163 // possible that by setting the organizer we are changing 163 // possible that by setting the organizer we are changing
164 // the event's readonly status... 164 // the event's readonly status...
165 mOrganizer = o; 165 mOrganizer = o;
166 if (mOrganizer.left(7).upper() == "MAILTO:") 166 if (mOrganizer.left(7).upper() == "MAILTO:")
167 mOrganizer = mOrganizer.remove(0,7); 167 mOrganizer = mOrganizer.remove(0,7);
168 168
169 updated(); 169 updated();
170} 170}
171 171
172QString IncidenceBase::organizer() const 172QString IncidenceBase::organizer() const
173{ 173{
174 return mOrganizer; 174 return mOrganizer;
175} 175}
176 176
177void IncidenceBase::setReadOnly( bool readOnly ) 177void IncidenceBase::setReadOnly( bool readOnly )
178{ 178{
179 mReadOnly = readOnly; 179 mReadOnly = readOnly;
180} 180}
181 181
182void IncidenceBase::setDtStart(const QDateTime &dtStart) 182void IncidenceBase::setDtStart(const QDateTime &dtStart)
183{ 183{
184// if (mReadOnly) return; 184// if (mReadOnly) return;
185 mDtStart = getEvenTime(dtStart); 185 mDtStart = getEvenTime(dtStart);
186 updated(); 186 updated();
187} 187}
188 188
189 189
190QDateTime IncidenceBase::dtStart() const 190QDateTime IncidenceBase::dtStart() const
191{ 191{
192 return mDtStart; 192 return mDtStart;
193} 193}
194 194
195QString IncidenceBase::dtStartTimeStr() const 195QString IncidenceBase::dtStartTimeStr() const
196{ 196{
197 return KGlobal::locale()->formatTime(dtStart().time()); 197 return KGlobal::locale()->formatTime(dtStart().time());
198} 198}
199 199
200QString IncidenceBase::dtStartDateStr(bool shortfmt) const 200QString IncidenceBase::dtStartDateStr(bool shortfmt) const
201{ 201{
202 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt); 202 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
203} 203}
204 204
205QString IncidenceBase::dtStartStr(bool shortfmt) const 205QString IncidenceBase::dtStartStr(bool shortfmt) const
206{ 206{
207 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt); 207 if ( doesFloat() )
208 return KGlobal::locale()->formatDate(dtStart().date(),shortfmt);
209 return KGlobal::locale()->formatDateTime(dtStart(), shortfmt);
208} 210}
209 211
210 212
211bool IncidenceBase::doesFloat() const 213bool IncidenceBase::doesFloat() const
212{ 214{
213 return mFloats; 215 return mFloats;
214} 216}
215 217
216void IncidenceBase::setFloats(bool f) 218void IncidenceBase::setFloats(bool f)
217{ 219{
218 if (mReadOnly) return; 220 if (mReadOnly) return;
219 mFloats = f; 221 mFloats = f;
220 updated(); 222 updated();
221} 223}
222 224
223 225
224bool IncidenceBase::addAttendee(Attendee *a, bool doupdate) 226bool IncidenceBase::addAttendee(Attendee *a, bool doupdate)
225{ 227{
226 if (mReadOnly) return false; 228 if (mReadOnly) return false;
227 if (a->name().left(7).upper() == "MAILTO:") 229 if (a->name().left(7).upper() == "MAILTO:")
228 a->setName(a->name().remove(0,7)); 230 a->setName(a->name().remove(0,7));
229 231
230 QPtrListIterator<Attendee> qli(mAttendees); 232 QPtrListIterator<Attendee> qli(mAttendees);
231 233
232 qli.toFirst(); 234 qli.toFirst();
233 while (qli) { 235 while (qli) {
234 if (*qli.current() == *a) 236 if (*qli.current() == *a)
235 return false; 237 return false;
236 ++qli; 238 ++qli;
237 } 239 }
238 mAttendees.append(a); 240 mAttendees.append(a);
239 if (doupdate) updated(); 241 if (doupdate) updated();
240 return true; 242 return true;
241} 243}
242 244
243#if 0 245#if 0
244void IncidenceBase::removeAttendee(Attendee *a) 246void IncidenceBase::removeAttendee(Attendee *a)
245{ 247{
246 if (mReadOnly) return; 248 if (mReadOnly) return;
247 mAttendees.removeRef(a); 249 mAttendees.removeRef(a);
248 updated(); 250 updated();
249} 251}
250 252
251void IncidenceBase::removeAttendee(const char *n) 253void IncidenceBase::removeAttendee(const char *n)
252{ 254{
253 Attendee *a; 255 Attendee *a;
254 256
255 if (mReadOnly) return; 257 if (mReadOnly) return;
256 for (a = mAttendees.first(); a; a = mAttendees.next()) 258 for (a = mAttendees.first(); a; a = mAttendees.next())
257 if (a->getName() == n) { 259 if (a->getName() == n) {
258 mAttendees.remove(); 260 mAttendees.remove();
259 break; 261 break;
260 } 262 }
261} 263}
262#endif 264#endif
263 265
264void IncidenceBase::clearAttendees() 266void IncidenceBase::clearAttendees()
265{ 267{
266 if (mReadOnly) return; 268 if (mReadOnly) return;
267 mAttendees.clear(); 269 mAttendees.clear();
268} 270}
269 271
270#if 0 272#if 0
271Attendee *IncidenceBase::getAttendee(const char *n) const 273Attendee *IncidenceBase::getAttendee(const char *n) const
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 39d16b6..a496404 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -130,129 +130,131 @@ bool KCal::operator==( const Todo& t1, const Todo& t2 )
130 } else 130 } else
131 if ( t1.dtDue() != t2.dtDue() ) 131 if ( t1.dtDue() != t2.dtDue() )
132 return false; 132 return false;
133 } else 133 } else
134 return false;// float != 134 return false;// float !=
135 } 135 }
136 136
137 } else 137 } else
138 return false; 138 return false;
139 if ( t1.percentComplete() != t2.percentComplete() ) 139 if ( t1.percentComplete() != t2.percentComplete() )
140 return false; 140 return false;
141 if ( t1.isCompleted() ) { 141 if ( t1.isCompleted() ) {
142 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { 142 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) {
143 if ( t1.hasCompletedDate() ) { 143 if ( t1.hasCompletedDate() ) {
144 if ( t1.completed() != t2.completed() ) 144 if ( t1.completed() != t2.completed() )
145 return false; 145 return false;
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
155void Todo::setDtDue(const QDateTime &dtDue) 155void 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
177QDateTime Todo::dtDue() const 177QDateTime Todo::dtDue() const
178{ 178{
179 return mDtDue; 179 return mDtDue;
180} 180}
181 181
182QString Todo::dtDueTimeStr() const 182QString Todo::dtDueTimeStr() const
183{ 183{
184 return KGlobal::locale()->formatTime(mDtDue.time()); 184 return KGlobal::locale()->formatTime(mDtDue.time());
185} 185}
186 186
187QString Todo::dtDueDateStr(bool shortfmt) const 187QString 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
192QString Todo::dtDueStr(bool shortfmt) const 192QString 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
199int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos ) 201int 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}
223int Todo::hasDueSubTodo( bool checkSubtodos ) //= true 225int Todo::hasDueSubTodo( bool checkSubtodos ) //= true
224{ 226{
225 return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos ); 227 return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos );
226} 228}
227bool Todo::hasDueDate() const 229bool Todo::hasDueDate() const
228{ 230{
229 return mHasDueDate; 231 return mHasDueDate;
230} 232}
231 233
232void Todo::setHasDueDate(bool f) 234void 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
241void Todo::setStatus(const QString &statStr) 243void Todo::setStatus(const QString &statStr)
242{ 244{
243 if (mReadOnly) return; 245 if (mReadOnly) return;
244 QString ss(statStr.upper()); 246 QString ss(statStr.upper());
245 247
246 if (ss == "X-ACTION") 248 if (ss == "X-ACTION")
247 mStatus = NEEDS_ACTION; 249 mStatus = NEEDS_ACTION;
248 else if (ss == "NEEDS ACTION") 250 else if (ss == "NEEDS ACTION")
249 mStatus = NEEDS_ACTION; 251 mStatus = NEEDS_ACTION;
250 else if (ss == "ACCEPTED") 252 else if (ss == "ACCEPTED")
251 mStatus = ACCEPTED; 253 mStatus = ACCEPTED;
252 else if (ss == "SENT") 254 else if (ss == "SENT")
253 mStatus = SENT; 255 mStatus = SENT;
254 else if (ss == "TENTATIVE") 256 else if (ss == "TENTATIVE")
255 mStatus = TENTATIVE; 257 mStatus = TENTATIVE;
256 else if (ss == "CONFIRMED") 258 else if (ss == "CONFIRMED")
257 mStatus = CONFIRMED; 259 mStatus = CONFIRMED;
258 else if (ss == "DECLINED") 260 else if (ss == "DECLINED")