summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp18
-rw-r--r--libkcal/todo.cpp5
-rw-r--r--libkcal/todo.h2
3 files changed, 13 insertions, 12 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index c52f2b3..6d07d4c 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -158,50 +158,50 @@ void KIncidenceFormatter::setTodo(Todo *event )
158 if ( mColorMode == 2 ) { 158 if ( mColorMode == 2 ) {
159 mText +="<font color=\"#B00000\">"; 159 mText +="<font color=\"#B00000\">";
160 } 160 }
161 if ( mode == 1 ) { 161 if ( mode == 1 ) {
162 addTag("h2",i18n( "Local: " ) +event->summary()); 162 addTag("h2",i18n( "Local: " ) +event->summary());
163 } else { 163 } else {
164 addTag("h2",i18n( "Remote: " ) +event->summary()); 164 addTag("h2",i18n( "Remote: " ) +event->summary());
165 } 165 }
166 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 166 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
167 if ( mColorMode ) 167 if ( mColorMode )
168 mText += "</font>"; 168 mText += "</font>";
169 } 169 }
170 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
171 mText +="<font color=\"#B00000\">";
172 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
173 mText += "</font>";
174 } else {
175 mText.append(i18n("<p><i>%1 % completed</i></p>")
176 .arg(event->percentComplete()));
177 }
170 if (event->cancelled ()) { 178 if (event->cancelled ()) {
171 mText +="<font color=\"#B00000\">"; 179 mText +="<font color=\"#B00000\">";
172 addTag("i",i18n("This todo has been cancelled!")); 180 addTag("i",i18n("This todo has been cancelled!"));
173 mText.append("<br>"); 181 mText.append("<br>");
174 mText += "</font>"; 182 mText += "</font>";
175 } 183 }
176 184
177 if (!event->location().isEmpty()) { 185 if (!event->location().isEmpty()) {
178 addTag("b",i18n("Location: ")); 186 addTag("b",i18n("Location: "));
179 mText.append(event->location()+"<br>"); 187 mText.append(event->location()+"<br>");
180 } 188 }
181 if (event->hasDueDate()) { 189 if (event->hasDueDate()) {
182 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 190 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
183 } 191 }
184 mText.append(i18n("<p><b>Priority:</b> %2</p>") 192 mText.append(i18n("<p><b>Priority:</b> %2</p>")
185 .arg(QString::number(event->priority()))); 193 .arg(QString::number(event->priority())));
186 194
187 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 195 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
188 mText.append(i18n("<p><i>Completed on %1</i></p>")
189 .arg( event->completedStr() ));
190 } else {
191 mText.append(i18n("<p><i>%1 % completed</i></p>")
192 .arg(event->percentComplete()));
193 }
194
195 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
196 formatCategories(event); 196 formatCategories(event);
197 if (!event->description().isEmpty()) { 197 if (!event->description().isEmpty()) {
198 addTag("p",i18n("<b>Details: </b>")); 198 addTag("p",i18n("<b>Details: </b>"));
199 addTag("p",event->description()); 199 addTag("p",event->description());
200 } 200 }
201 201
202 202
203 203
204 formatReadOnly(event); 204 formatReadOnly(event);
205 formatAttendees(event); 205 formatAttendees(event);
206 206
207} 207}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7362bdf..7d04793 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -291,31 +291,32 @@ void Todo::setCompleted(bool completed)
291 else { 291 else {
292 mPercentComplete = 0; 292 mPercentComplete = 0;
293 mHasCompletedDate = false; 293 mHasCompletedDate = false;
294 } 294 }
295 updated(); 295 updated();
296} 296}
297 297
298QDateTime Todo::completed() const 298QDateTime Todo::completed() const
299{ 299{
300 return mCompleted; 300 return mCompleted;
301} 301}
302 302
303QString Todo::completedStr() const 303QString Todo::completedStr( bool shortF ) const
304{ 304{
305 return KGlobal::locale()->formatDateTime(mCompleted); 305 return KGlobal::locale()->formatDateTime(mCompleted, shortF);
306} 306}
307 307
308void Todo::setCompleted(const QDateTime &completed) 308void Todo::setCompleted(const QDateTime &completed)
309{ 309{
310 qDebug("Todo::setCompleted ");
310 mHasCompletedDate = true; 311 mHasCompletedDate = true;
311 mPercentComplete = 100; 312 mPercentComplete = 100;
312 mCompleted = getEvenTime(completed); 313 mCompleted = getEvenTime(completed);
313 updated(); 314 updated();
314} 315}
315 316
316bool Todo::hasCompletedDate() const 317bool Todo::hasCompletedDate() const
317{ 318{
318 return mHasCompletedDate; 319 return mHasCompletedDate;
319} 320}
320 321
321int Todo::percentComplete() const 322int Todo::percentComplete() const
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 0f22c59..41f5841 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -84,25 +84,25 @@ class Todo : public Incidence
84 Return how many percent of the task are completed. Returns a value 84 Return how many percent of the task are completed. Returns a value
85 between 0 and 100. 85 between 0 and 100.
86 */ 86 */
87 int percentComplete() const; 87 int percentComplete() const;
88 /** 88 /**
89 Set how many percent of the task are completed. Valid values are in the 89 Set how many percent of the task are completed. Valid values are in the
90 range from 0 to 100. 90 range from 0 to 100.
91 */ 91 */
92 void setPercentComplete(int); 92 void setPercentComplete(int);
93 93
94 /** return date and time when todo was completed */ 94 /** return date and time when todo was completed */
95 QDateTime completed() const; 95 QDateTime completed() const;
96 QString completedStr() const; 96 QString completedStr(bool shortF = true) const;
97 /** set date and time of completion */ 97 /** set date and time of completion */
98 void setCompleted(const QDateTime &completed); 98 void setCompleted(const QDateTime &completed);
99 99
100 /** Return true, if todo has a date associated with completion */ 100 /** Return true, if todo has a date associated with completion */
101 bool hasCompletedDate() const; 101 bool hasCompletedDate() const;
102 bool contains ( Todo*); 102 bool contains ( Todo*);
103 103
104 private: 104 private:
105 bool accept(Visitor &v) { return v.visit(this); } 105 bool accept(Visitor &v) { return v.visit(this); }
106 106
107 QDateTime mDtDue; // due date of todo 107 QDateTime mDtDue; // due date of todo
108 108