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
@@ -1,338 +1,338 @@
1#include "kincidenceformatter.h" 1#include "kincidenceformatter.h"
2#include <kstaticdeleter.h> 2#include <kstaticdeleter.h>
3#include <kglobal.h> 3#include <kglobal.h>
4#include <klocale.h> 4#include <klocale.h>
5#ifdef DEKTOP_VERSION 5#ifdef DEKTOP_VERSION
6#include <kabc/stdaddressbook.h> 6#include <kabc/stdaddressbook.h>
7#define size count 7#define size count
8#endif 8#endif
9 9
10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0; 10KIncidenceFormatter* KIncidenceFormatter::mInstance = 0;
11static KStaticDeleter<KIncidenceFormatter> insd; 11static KStaticDeleter<KIncidenceFormatter> insd;
12 12
13QString KIncidenceFormatter::getFormattedText( Incidence * inc ) 13QString KIncidenceFormatter::getFormattedText( Incidence * inc )
14{ 14{
15// #ifndef QT_NO_INPUTDIALOG 15// #ifndef QT_NO_INPUTDIALOG
16// return QInputDialog::getItem( caption, label, items, current, editable ); 16// return QInputDialog::getItem( caption, label, items, current, editable );
17// #else 17// #else
18// return QString::null; 18// return QString::null;
19// #endif 19// #endif
20 mText = ""; 20 mText = "";
21 if ( inc->type() == "Event" ) 21 if ( inc->type() == "Event" )
22 setEvent((Event *) inc ); 22 setEvent((Event *) inc );
23 else if ( inc->type() == "Todo" ) 23 else if ( inc->type() == "Todo" )
24 setTodo((Todo *) inc ); 24 setTodo((Todo *) inc );
25 return mText; 25 return mText;
26} 26}
27 27
28KIncidenceFormatter* KIncidenceFormatter::instance() 28KIncidenceFormatter* KIncidenceFormatter::instance()
29{ 29{
30 if (!mInstance) { 30 if (!mInstance) {
31 mInstance = insd.setObject(new KIncidenceFormatter()); 31 mInstance = insd.setObject(new KIncidenceFormatter());
32 } 32 }
33 return mInstance; 33 return mInstance;
34} 34}
35KIncidenceFormatter::~KIncidenceFormatter() 35KIncidenceFormatter::~KIncidenceFormatter()
36{ 36{
37 if (mInstance == this) 37 if (mInstance == this)
38 mInstance = insd.setObject(0); 38 mInstance = insd.setObject(0);
39 //qDebug("KIncidenceFormatter::~KIncidenceFormatter "); 39 //qDebug("KIncidenceFormatter::~KIncidenceFormatter ");
40} 40}
41KIncidenceFormatter::KIncidenceFormatter() 41KIncidenceFormatter::KIncidenceFormatter()
42{ 42{
43 mColorMode = 0; 43 mColorMode = 0;
44} 44}
45void KIncidenceFormatter::setEvent(Event *event) 45void KIncidenceFormatter::setEvent(Event *event)
46{ 46{
47 int mode = 0; 47 int mode = 0;
48 mCurrentIncidence = event; 48 mCurrentIncidence = event;
49 bool shortDate = true; 49 bool shortDate = true;
50 if ( mode == 0 ) { 50 if ( mode == 0 ) {
51 addTag("h3",event->summary()); 51 addTag("h3",event->summary());
52 } 52 }
53 else { 53 else {
54 if ( mColorMode == 1 ) { 54 if ( mColorMode == 1 ) {
55 mText +="<font color=\"#00A000\">"; 55 mText +="<font color=\"#00A000\">";
56 } 56 }
57 if ( mColorMode == 2 ) { 57 if ( mColorMode == 2 ) {
58 mText +="<font color=\"#C00000\">"; 58 mText +="<font color=\"#C00000\">";
59 } 59 }
60 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 60 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
61 if ( mode == 1 ) { 61 if ( mode == 1 ) {
62 addTag("h2",i18n( "Local: " ) +event->summary()); 62 addTag("h2",i18n( "Local: " ) +event->summary());
63 } else { 63 } else {
64 addTag("h2",i18n( "Remote: " ) +event->summary()); 64 addTag("h2",i18n( "Remote: " ) +event->summary());
65 } 65 }
66 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 66 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
67 if ( mColorMode ) 67 if ( mColorMode )
68 mText += "</font>"; 68 mText += "</font>";
69 } 69 }
70 if (event->cancelled ()) { 70 if (event->cancelled ()) {
71 mText +="<font color=\"#B00000\">"; 71 mText +="<font color=\"#B00000\">";
72 addTag("i",i18n("This event has been cancelled!")); 72 addTag("i",i18n("This event has been cancelled!"));
73 mText.append("<br>"); 73 mText.append("<br>");
74 mText += "</font>"; 74 mText += "</font>";
75 } 75 }
76 if (!event->location().isEmpty()) { 76 if (!event->location().isEmpty()) {
77 addTag("b",i18n("Location: ")); 77 addTag("b",i18n("Location: "));
78 mText.append(event->location()+"<br>"); 78 mText.append(event->location()+"<br>");
79 } 79 }
80 if (event->doesFloat()) { 80 if (event->doesFloat()) {
81 if (event->isMultiDay()) { 81 if (event->isMultiDay()) {
82 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") 82 mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>")
83 .arg(event->dtStartDateStr(shortDate)) 83 .arg(event->dtStartDateStr(shortDate))
84 .arg(event->dtEndDateStr(shortDate))); 84 .arg(event->dtEndDateStr(shortDate)));
85 } else { 85 } else {
86 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); 86 mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate )));
87 } 87 }
88 } else { 88 } else {
89 if (event->isMultiDay()) { 89 if (event->isMultiDay()) {
90 mText.append(i18n("<p><b>From:</b> %1</p> ") 90 mText.append(i18n("<p><b>From:</b> %1</p> ")
91 .arg(event->dtStartStr( shortDate))); 91 .arg(event->dtStartStr( shortDate)));
92 mText.append(i18n("<p><b>To:</b> %1</p>") 92 mText.append(i18n("<p><b>To:</b> %1</p>")
93 .arg(event->dtEndStr(shortDate))); 93 .arg(event->dtEndStr(shortDate)));
94 } else { 94 } else {
95 mText.append(i18n("<p><b>On:</b> %1</p> ") 95 mText.append(i18n("<p><b>On:</b> %1</p> ")
96 .arg(event->dtStartDateStr( shortDate ))); 96 .arg(event->dtStartDateStr( shortDate )));
97 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 97 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
98 .arg(event->dtStartTimeStr()) 98 .arg(event->dtStartTimeStr())
99 .arg(event->dtEndTimeStr())); 99 .arg(event->dtEndTimeStr()));
100 } 100 }
101 } 101 }
102 102
103 if (event->recurrence()->doesRecur()) { 103 if (event->recurrence()->doesRecur()) {
104 104
105 QString recurText = event->recurrence()->recurrenceText(); 105 QString recurText = event->recurrence()->recurrenceText();
106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
107 bool last; 107 bool last;
108 QDate start = QDate::currentDate(); 108 QDate start = QDate::currentDate();
109 QDate next; 109 QDate next;
110 next = event->recurrence()->getPreviousDate( start , &last ); 110 next = event->recurrence()->getPreviousDate( start , &last );
111 if ( !last ) { 111 if ( !last ) {
112 next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); 112 next = event->recurrence()->getNextDate( start.addDays( - 1 ) );
113 addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) ); 113 addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) );
114 //addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 114 //addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
115 } else { 115 } else {
116 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 116 addTag("p",i18n("<b>Last recurrence was on:</b>") );
117 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 117 addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
118 } 118 }
119 } 119 }
120 120
121 121
122 if (event->isAlarmEnabled()) { 122 if (event->isAlarmEnabled()) {
123 Alarm *alarm =event->alarms().first() ; 123 Alarm *alarm =event->alarms().first() ;
124 QDateTime t = alarm->time(); 124 QDateTime t = alarm->time();
125 int min = t.secsTo( event->dtStart() )/60; 125 int min = t.secsTo( event->dtStart() )/60;
126 QString s =i18n("(%1 min before)").arg( min ); 126 QString s =i18n("(%1 min before)").arg( min );
127 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 127 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
128 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 128 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
129 //addTag("p",s); 129 //addTag("p",s);
130 } 130 }
131 131
132 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 132 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
133 // mText.append(event->secrecyStr()+"<br>"); 133 // mText.append(event->secrecyStr()+"<br>");
134 formatCategories(event); 134 formatCategories(event);
135 if (!event->description().isEmpty()) { 135 if (!event->description().isEmpty()) {
136 addTag("p",i18n("<b>Details: </b>")); 136 addTag("p",i18n("<b>Details: </b>"));
137 addTag("p",event->description()); 137 addTag("p",event->description());
138 } 138 }
139 139
140 140
141 formatReadOnly(event); 141 formatReadOnly(event);
142 formatAttendees(event); 142 formatAttendees(event);
143 143
144 144
145} 145}
146 146
147void KIncidenceFormatter::setTodo(Todo *event ) 147void KIncidenceFormatter::setTodo(Todo *event )
148{ 148{
149 int mode = 0; 149 int mode = 0;
150 mCurrentIncidence = event; 150 mCurrentIncidence = event;
151 bool shortDate = true; 151 bool shortDate = true;
152 if (mode == 0 ) 152 if (mode == 0 )
153 addTag("h3",event->summary()); 153 addTag("h3",event->summary());
154 else { 154 else {
155 if ( mColorMode == 1 ) { 155 if ( mColorMode == 1 ) {
156 mText +="<font color=\"#00A000\">"; 156 mText +="<font color=\"#00A000\">";
157 } 157 }
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}
208 208
209void KIncidenceFormatter::setJournal(Journal* ) 209void KIncidenceFormatter::setJournal(Journal* )
210{ 210{
211 211
212} 212}
213 213
214void KIncidenceFormatter::formatCategories(Incidence *event) 214void KIncidenceFormatter::formatCategories(Incidence *event)
215{ 215{
216 if (!event->categoriesStr().isEmpty()) { 216 if (!event->categoriesStr().isEmpty()) {
217 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); 217 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() );
218 //mText.append(event->categoriesStr()); 218 //mText.append(event->categoriesStr());
219 } 219 }
220} 220}
221void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 221void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
222{ 222{
223 int number=text.contains("\n"); 223 int number=text.contains("\n");
224 QString str = "<" + tag + ">"; 224 QString str = "<" + tag + ">";
225 QString tmpText=text; 225 QString tmpText=text;
226 QString tmpStr=str; 226 QString tmpStr=str;
227 if(number !=-1) 227 if(number !=-1)
228 { 228 {
229 if (number > 0) { 229 if (number > 0) {
230 int pos=0; 230 int pos=0;
231 QString tmp; 231 QString tmp;
232 for(int i=0;i<=number;i++) { 232 for(int i=0;i<=number;i++) {
233 pos=tmpText.find("\n"); 233 pos=tmpText.find("\n");
234 tmp=tmpText.left(pos); 234 tmp=tmpText.left(pos);
235 tmpText=tmpText.right(tmpText.length()-pos-1); 235 tmpText=tmpText.right(tmpText.length()-pos-1);
236 tmpStr+=tmp+"<br>"; 236 tmpStr+=tmp+"<br>";
237 } 237 }
238 } 238 }
239 else tmpStr += tmpText; 239 else tmpStr += tmpText;
240 tmpStr+="</" + tag + ">"; 240 tmpStr+="</" + tag + ">";
241 mText.append(tmpStr); 241 mText.append(tmpStr);
242 } 242 }
243 else 243 else
244 { 244 {
245 str += text + "</" + tag + ">"; 245 str += text + "</" + tag + ">";
246 mText.append(str); 246 mText.append(str);
247 } 247 }
248} 248}
249 249
250void KIncidenceFormatter::formatAttendees(Incidence *event) 250void KIncidenceFormatter::formatAttendees(Incidence *event)
251{ 251{
252 QPtrList<Attendee> attendees = event->attendees(); 252 QPtrList<Attendee> attendees = event->attendees();
253 if (attendees.count()) { 253 if (attendees.count()) {
254 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 254 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
255 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 255 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
256 addTag("h3",i18n("Organizer")); 256 addTag("h3",i18n("Organizer"));
257 mText.append("<ul><li>"); 257 mText.append("<ul><li>");
258#if 0 258#if 0
259 //ndef KORG_NOKABC 259 //ndef KORG_NOKABC
260 260
261 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 261 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
262 KABC::Addressee::List addressList; 262 KABC::Addressee::List addressList;
263 addressList = add_book->findByEmail(event->organizer()); 263 addressList = add_book->findByEmail(event->organizer());
264 KABC::Addressee o = addressList.first(); 264 KABC::Addressee o = addressList.first();
265 if (!o.isEmpty() && addressList.size()<2) { 265 if (!o.isEmpty() && addressList.size()<2) {
266 mText += "<a href=\"uid:" + o.uid() + "\">"; 266 mText += "<a href=\"uid:" + o.uid() + "\">";
267 mText += o.formattedName(); 267 mText += o.formattedName();
268 mText += "</a>\n"; 268 mText += "</a>\n";
269 } else { 269 } else {
270 mText.append(event->organizer()); 270 mText.append(event->organizer());
271 } 271 }
272#else 272#else
273 mText.append(event->organizer()); 273 mText.append(event->organizer());
274#endif 274#endif
275 if (iconPath) { 275 if (iconPath) {
276 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 276 mText += " <a href=\"mailto:" + event->organizer() + "\">";
277 mText += "<IMG src=\"" + iconPath + "\">"; 277 mText += "<IMG src=\"" + iconPath + "\">";
278 mText += "</a>\n"; 278 mText += "</a>\n";
279 } 279 }
280 mText.append("</li></ul>"); 280 mText.append("</li></ul>");
281 281
282 addTag("h3",i18n("Attendees")); 282 addTag("h3",i18n("Attendees"));
283 Attendee *a; 283 Attendee *a;
284 mText.append("<ul>"); 284 mText.append("<ul>");
285 for(a=attendees.first();a;a=attendees.next()) { 285 for(a=attendees.first();a;a=attendees.next()) {
286#if 0 286#if 0
287//ndef KORG_NOKABC 287//ndef KORG_NOKABC
288 if (a->name().isEmpty()) { 288 if (a->name().isEmpty()) {
289 addressList = add_book->findByEmail(a->email()); 289 addressList = add_book->findByEmail(a->email());
290 KABC::Addressee o = addressList.first(); 290 KABC::Addressee o = addressList.first();
291 if (!o.isEmpty() && addressList.size()<2) { 291 if (!o.isEmpty() && addressList.size()<2) {
292 mText += "<a href=\"uid:" + o.uid() + "\">"; 292 mText += "<a href=\"uid:" + o.uid() + "\">";
293 mText += o.formattedName(); 293 mText += o.formattedName();
294 mText += "</a>\n"; 294 mText += "</a>\n";
295 } else { 295 } else {
296 mText += "<li>"; 296 mText += "<li>";
297 mText.append(a->email()); 297 mText.append(a->email());
298 mText += "\n"; 298 mText += "\n";
299 } 299 }
300 } else { 300 } else {
301 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 301 mText += "<li><a href=\"uid:" + a->uid() + "\">";
302 if (!a->name().isEmpty()) mText += a->name(); 302 if (!a->name().isEmpty()) mText += a->name();
303 else mText += a->email(); 303 else mText += a->email();
304 mText += "</a>\n"; 304 mText += "</a>\n";
305 } 305 }
306#else 306#else
307 //qDebug("nokabc "); 307 //qDebug("nokabc ");
308 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 308 mText += "<li><a href=\"uid:" + a->uid() + "\">";
309 if (!a->name().isEmpty()) mText += a->name(); 309 if (!a->name().isEmpty()) mText += a->name();
310 else mText += a->email(); 310 else mText += a->email();
311 mText += "</a>\n"; 311 mText += "</a>\n";
312#endif 312#endif
313 313
314 if (!a->email().isEmpty()) { 314 if (!a->email().isEmpty()) {
315 if (iconPath) { 315 if (iconPath) {
316 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; 316 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
317 if ( a->RSVP() ) 317 if ( a->RSVP() )
318 mText += "<IMG src=\"" + iconPath + "\">"; 318 mText += "<IMG src=\"" + iconPath + "\">";
319 else 319 else
320 mText += "<IMG src=\"" + NOiconPath + "\">"; 320 mText += "<IMG src=\"" + NOiconPath + "\">";
321 mText += "</a>\n"; 321 mText += "</a>\n";
322 } 322 }
323 } 323 }
324 if (a->status() != Attendee::NeedsAction ) 324 if (a->status() != Attendee::NeedsAction )
325 mText +="[" + a->statusStr() + "] "; 325 mText +="[" + a->statusStr() + "] ";
326 if (a->role() == Attendee::Chair ) 326 if (a->role() == Attendee::Chair )
327 mText +="(" + a->roleStr().left(1) + ".)"; 327 mText +="(" + a->roleStr().left(1) + ".)";
328 } 328 }
329 mText.append("</li></ul>"); 329 mText.append("</li></ul>");
330 } 330 }
331} 331}
332 332
333void KIncidenceFormatter::formatReadOnly(Incidence *event) 333void KIncidenceFormatter::formatReadOnly(Incidence *event)
334{ 334{
335 if (event->isReadOnly()) { 335 if (event->isReadOnly()) {
336 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 336 addTag("p","<em>(" + i18n("read-only") + ")</em>");
337 } 337 }
338} 338}
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7362bdf..7d04793 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -47,333 +47,334 @@ Todo::Todo(const Todo &t) : Incidence(t)
47} 47}
48 48
49Todo::~Todo() 49Todo::~Todo()
50{ 50{
51 51
52} 52}
53 53
54Incidence *Todo::clone() 54Incidence *Todo::clone()
55{ 55{
56 return new Todo(*this); 56 return new Todo(*this);
57} 57}
58 58
59bool Todo::contains ( Todo* from ) 59bool Todo::contains ( Todo* from )
60{ 60{
61 61
62 if ( !from->summary().isEmpty() ) 62 if ( !from->summary().isEmpty() )
63 if ( !summary().startsWith( from->summary() )) 63 if ( !summary().startsWith( from->summary() ))
64 return false; 64 return false;
65 if ( from->hasStartDate() ) { 65 if ( from->hasStartDate() ) {
66 if ( !hasStartDate() ) 66 if ( !hasStartDate() )
67 return false; 67 return false;
68 if ( from->dtStart() != dtStart()) 68 if ( from->dtStart() != dtStart())
69 return false; 69 return false;
70 } 70 }
71 if ( from->hasDueDate() ){ 71 if ( from->hasDueDate() ){
72 if ( !hasDueDate() ) 72 if ( !hasDueDate() )
73 return false; 73 return false;
74 if ( from->dtDue() != dtDue()) 74 if ( from->dtDue() != dtDue())
75 return false; 75 return false;
76 } 76 }
77 if ( !from->location().isEmpty() ) 77 if ( !from->location().isEmpty() )
78 if ( !location().startsWith( from->location() ) ) 78 if ( !location().startsWith( from->location() ) )
79 return false; 79 return false;
80 if ( !from->description().isEmpty() ) 80 if ( !from->description().isEmpty() )
81 if ( !description().startsWith( from->description() )) 81 if ( !description().startsWith( from->description() ))
82 return false; 82 return false;
83 if ( from->alarms().count() ) { 83 if ( from->alarms().count() ) {
84 Alarm *a = from->alarms().first(); 84 Alarm *a = from->alarms().first();
85 if ( a->enabled() ){ 85 if ( a->enabled() ){
86 if ( !alarms().count() ) 86 if ( !alarms().count() )
87 return false; 87 return false;
88 Alarm *b = alarms().first(); 88 Alarm *b = alarms().first();
89 if( ! b->enabled() ) 89 if( ! b->enabled() )
90 return false; 90 return false;
91 if ( ! (a->offset() == b->offset() )) 91 if ( ! (a->offset() == b->offset() ))
92 return false; 92 return false;
93 } 93 }
94 } 94 }
95 95
96 QStringList cat = categories(); 96 QStringList cat = categories();
97 QStringList catFrom = from->categories(); 97 QStringList catFrom = from->categories();
98 QString nCat; 98 QString nCat;
99 int iii; 99 int iii;
100 for ( iii = 0; iii < catFrom.count();++iii ) { 100 for ( iii = 0; iii < catFrom.count();++iii ) {
101 nCat = catFrom[iii]; 101 nCat = catFrom[iii];
102 if ( !nCat.isEmpty() ) 102 if ( !nCat.isEmpty() )
103 if ( !cat.contains( nCat )) { 103 if ( !cat.contains( nCat )) {
104 return false; 104 return false;
105 } 105 }
106 } 106 }
107 if ( from->isCompleted() ) { 107 if ( from->isCompleted() ) {
108 if ( !isCompleted() ) 108 if ( !isCompleted() )
109 return false; 109 return false;
110 } 110 }
111 if( priority() != from->priority() ) 111 if( priority() != from->priority() )
112 return false; 112 return false;
113 113
114 114
115 return true; 115 return true;
116 116
117} 117}
118bool KCal::operator==( const Todo& t1, const Todo& t2 ) 118bool KCal::operator==( const Todo& t1, const Todo& t2 )
119{ 119{
120 120
121 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 ); 121 bool ret = operator==( (const Incidence&)t1, (const Incidence&)t2 );
122 if ( ! ret ) 122 if ( ! ret )
123 return false; 123 return false;
124 if ( t1.hasDueDate() == t2.hasDueDate() ) { 124 if ( t1.hasDueDate() == t2.hasDueDate() ) {
125 if ( t1.hasDueDate() ) { 125 if ( t1.hasDueDate() ) {
126 if ( t1.doesFloat() == t2.doesFloat() ) { 126 if ( t1.doesFloat() == t2.doesFloat() ) {
127 if ( t1.doesFloat() ) { 127 if ( t1.doesFloat() ) {
128 if ( t1.dtDue().date() != t2.dtDue().date() ) 128 if ( t1.dtDue().date() != t2.dtDue().date() )
129 return false; 129 return false;
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 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt);
195} 195}
196 196
197bool Todo::hasDueDate() const 197bool Todo::hasDueDate() const
198{ 198{
199 return mHasDueDate; 199 return mHasDueDate;
200} 200}
201 201
202void Todo::setHasDueDate(bool f) 202void Todo::setHasDueDate(bool f)
203{ 203{
204 if (mReadOnly) return; 204 if (mReadOnly) return;
205 mHasDueDate = f; 205 mHasDueDate = f;
206 updated(); 206 updated();
207} 207}
208 208
209 209
210#if 0 210#if 0
211void Todo::setStatus(const QString &statStr) 211void Todo::setStatus(const QString &statStr)
212{ 212{
213 if (mReadOnly) return; 213 if (mReadOnly) return;
214 QString ss(statStr.upper()); 214 QString ss(statStr.upper());
215 215
216 if (ss == "X-ACTION") 216 if (ss == "X-ACTION")
217 mStatus = NEEDS_ACTION; 217 mStatus = NEEDS_ACTION;
218 else if (ss == "NEEDS ACTION") 218 else if (ss == "NEEDS ACTION")
219 mStatus = NEEDS_ACTION; 219 mStatus = NEEDS_ACTION;
220 else if (ss == "ACCEPTED") 220 else if (ss == "ACCEPTED")
221 mStatus = ACCEPTED; 221 mStatus = ACCEPTED;
222 else if (ss == "SENT") 222 else if (ss == "SENT")
223 mStatus = SENT; 223 mStatus = SENT;
224 else if (ss == "TENTATIVE") 224 else if (ss == "TENTATIVE")
225 mStatus = TENTATIVE; 225 mStatus = TENTATIVE;
226 else if (ss == "CONFIRMED") 226 else if (ss == "CONFIRMED")
227 mStatus = CONFIRMED; 227 mStatus = CONFIRMED;
228 else if (ss == "DECLINED") 228 else if (ss == "DECLINED")
229 mStatus = DECLINED; 229 mStatus = DECLINED;
230 else if (ss == "COMPLETED") 230 else if (ss == "COMPLETED")
231 mStatus = COMPLETED; 231 mStatus = COMPLETED;
232 else if (ss == "DELEGATED") 232 else if (ss == "DELEGATED")
233 mStatus = DELEGATED; 233 mStatus = DELEGATED;
234 234
235 updated(); 235 updated();
236} 236}
237 237
238void Todo::setStatus(int status) 238void Todo::setStatus(int status)
239{ 239{
240 if (mReadOnly) return; 240 if (mReadOnly) return;
241 mStatus = status; 241 mStatus = status;
242 updated(); 242 updated();
243} 243}
244 244
245int Todo::status() const 245int Todo::status() const
246{ 246{
247 return mStatus; 247 return mStatus;
248} 248}
249 249
250QString Todo::statusStr() const 250QString Todo::statusStr() const
251{ 251{
252 switch(mStatus) { 252 switch(mStatus) {
253 case NEEDS_ACTION: 253 case NEEDS_ACTION:
254 return QString("NEEDS ACTION"); 254 return QString("NEEDS ACTION");
255 break; 255 break;
256 case ACCEPTED: 256 case ACCEPTED:
257 return QString("ACCEPTED"); 257 return QString("ACCEPTED");
258 break; 258 break;
259 case SENT: 259 case SENT:
260 return QString("SENT"); 260 return QString("SENT");
261 break; 261 break;
262 case TENTATIVE: 262 case TENTATIVE:
263 return QString("TENTATIVE"); 263 return QString("TENTATIVE");
264 break; 264 break;
265 case CONFIRMED: 265 case CONFIRMED:
266 return QString("CONFIRMED"); 266 return QString("CONFIRMED");
267 break; 267 break;
268 case DECLINED: 268 case DECLINED:
269 return QString("DECLINED"); 269 return QString("DECLINED");
270 break; 270 break;
271 case COMPLETED: 271 case COMPLETED:
272 return QString("COMPLETED"); 272 return QString("COMPLETED");
273 break; 273 break;
274 case DELEGATED: 274 case DELEGATED:
275 return QString("DELEGATED"); 275 return QString("DELEGATED");
276 break; 276 break;
277 } 277 }
278 return QString(""); 278 return QString("");
279} 279}
280#endif 280#endif
281 281
282bool Todo::isCompleted() const 282bool Todo::isCompleted() const
283{ 283{
284 if (mPercentComplete == 100) return true; 284 if (mPercentComplete == 100) return true;
285 else return false; 285 else return false;
286} 286}
287 287
288void Todo::setCompleted(bool completed) 288void Todo::setCompleted(bool completed)
289{ 289{
290 if (completed) mPercentComplete = 100; 290 if (completed) mPercentComplete = 100;
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
322{ 323{
323 return mPercentComplete; 324 return mPercentComplete;
324} 325}
325 326
326void Todo::setPercentComplete(int v) 327void Todo::setPercentComplete(int v)
327{ 328{
328 mPercentComplete = v; 329 mPercentComplete = v;
329 if ( v != 100 ) 330 if ( v != 100 )
330 mHasCompletedDate = false; 331 mHasCompletedDate = false;
331 updated(); 332 updated();
332} 333}
333QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const 334QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
334{ 335{
335 if ( isCompleted() || ! hasDueDate() || cancelled() ) { 336 if ( isCompleted() || ! hasDueDate() || cancelled() ) {
336 *ok = false; 337 *ok = false;
337 return QDateTime (); 338 return QDateTime ();
338 } 339 }
339 QDateTime incidenceStart; 340 QDateTime incidenceStart;
340 incidenceStart = dtDue(); 341 incidenceStart = dtDue();
341 bool enabled = false; 342 bool enabled = false;
342 Alarm* alarm; 343 Alarm* alarm;
343 int off; 344 int off;
344 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; 345 QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );;
345 // if ( QDateTime::currentDateTime() > incidenceStart ){ 346 // if ( QDateTime::currentDateTime() > incidenceStart ){
346// *ok = false; 347// *ok = false;
347// return incidenceStart; 348// return incidenceStart;
348// } 349// }
349 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { 350 for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) {
350 if (alarm->enabled()) { 351 if (alarm->enabled()) {
351 if ( alarm->hasTime () ) { 352 if ( alarm->hasTime () ) {
352 if ( alarm->time() < alarmStart ) { 353 if ( alarm->time() < alarmStart ) {
353 alarmStart = alarm->time(); 354 alarmStart = alarm->time();
354 enabled = true; 355 enabled = true;
355 off = alarmStart.secsTo( incidenceStart ); 356 off = alarmStart.secsTo( incidenceStart );
356 } 357 }
357 358
358 } else { 359 } else {
359 int secs = alarm->startOffset().asSeconds(); 360 int secs = alarm->startOffset().asSeconds();
360 if ( incidenceStart.addSecs( secs ) < alarmStart ) { 361 if ( incidenceStart.addSecs( secs ) < alarmStart ) {
361 alarmStart = incidenceStart.addSecs( secs ); 362 alarmStart = incidenceStart.addSecs( secs );
362 enabled = true; 363 enabled = true;
363 off = -secs; 364 off = -secs;
364 } 365 }
365 } 366 }
366 } 367 }
367 } 368 }
368 if ( enabled ) { 369 if ( enabled ) {
369 if ( alarmStart > QDateTime::currentDateTime() ) { 370 if ( alarmStart > QDateTime::currentDateTime() ) {
370 *ok = true; 371 *ok = true;
371 * offset = off; 372 * offset = off;
372 return alarmStart; 373 return alarmStart;
373 } 374 }
374 } 375 }
375 *ok = false; 376 *ok = false;
376 return QDateTime (); 377 return QDateTime ();
377 378
378} 379}
379 380
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 0f22c59..41f5841 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -1,122 +1,122 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef TODO_H 20#ifndef TODO_H
21#define TODO_H 21#define TODO_H
22// 22//
23// Todo component, representing a VTODO object 23// Todo component, representing a VTODO object
24// 24//
25 25
26#include "incidence.h" 26#include "incidence.h"
27 27
28namespace KCal { 28namespace KCal {
29 29
30/** 30/**
31 This class provides a Todo in the sense of RFC2445. 31 This class provides a Todo in the sense of RFC2445.
32*/ 32*/
33class Todo : public Incidence 33class Todo : public Incidence
34{ 34{
35 public: 35 public:
36 Todo(); 36 Todo();
37 Todo(const Todo &); 37 Todo(const Todo &);
38 ~Todo(); 38 ~Todo();
39 typedef ListBase<Todo> List; 39 typedef ListBase<Todo> List;
40 QCString type() const { return "Todo"; } 40 QCString type() const { return "Todo"; }
41 41
42 /** Return an exact copy of this todo. */ 42 /** Return an exact copy of this todo. */
43 Incidence *clone(); 43 Incidence *clone();
44 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 44 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const;
45 45
46 /** for setting the todo's due date/time with a QDateTime. */ 46 /** for setting the todo's due date/time with a QDateTime. */
47 void setDtDue(const QDateTime &dtDue); 47 void setDtDue(const QDateTime &dtDue);
48 /** returns an event's Due date/time as a QDateTime. */ 48 /** returns an event's Due date/time as a QDateTime. */
49 QDateTime dtDue() const; 49 QDateTime dtDue() const;
50 /** returns an event's due time as a string formatted according to the 50 /** returns an event's due time as a string formatted according to the
51 users locale settings */ 51 users locale settings */
52 QString dtDueTimeStr() const; 52 QString dtDueTimeStr() const;
53 /** returns an event's due date as a string formatted according to the 53 /** returns an event's due date as a string formatted according to the
54 users locale settings */ 54 users locale settings */
55 QString dtDueDateStr(bool shortfmt=true) const; 55 QString dtDueDateStr(bool shortfmt=true) const;
56 /** returns an event's due date and time as a string formatted according 56 /** returns an event's due date and time as a string formatted according
57 to the users locale settings */ 57 to the users locale settings */
58 QString dtDueStr(bool shortfmt=true) const; 58 QString dtDueStr(bool shortfmt=true) const;
59 59
60 /** returns TRUE or FALSE depending on whether the todo has a due date */ 60 /** returns TRUE or FALSE depending on whether the todo has a due date */
61 bool hasDueDate() const; 61 bool hasDueDate() const;
62 /** sets the event's hasDueDate value. */ 62 /** sets the event's hasDueDate value. */
63 void setHasDueDate(bool f); 63 void setHasDueDate(bool f);
64 64
65 65
66 /** sets the event's status to the string specified. The string 66 /** sets the event's status to the string specified. The string
67 * must be a recognized value for the status field, i.e. a string 67 * must be a recognized value for the status field, i.e. a string
68 * equivalent of the possible status enumerations previously described. */ 68 * equivalent of the possible status enumerations previously described. */
69// void setStatus(const QString &statStr); 69// void setStatus(const QString &statStr);
70 /** sets the event's status to the value specified. See the enumeration 70 /** sets the event's status to the value specified. See the enumeration
71 * above for possible values. */ 71 * above for possible values. */
72// void setStatus(int); 72// void setStatus(int);
73 /** return the event's status. */ 73 /** return the event's status. */
74// int status() const; 74// int status() const;
75 /** return the event's status in string format. */ 75 /** return the event's status in string format. */
76// QString statusStr() const; 76// QString statusStr() const;
77 77
78 /** return, if this todo is completed */ 78 /** return, if this todo is completed */
79 bool isCompleted() const; 79 bool isCompleted() const;
80 /** set completed state of this todo */ 80 /** set completed state of this todo */
81 void setCompleted(bool); 81 void setCompleted(bool);
82 82
83 /** 83 /**
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
109 bool mHasDueDate; // if todo has associated due date 109 bool mHasDueDate; // if todo has associated due date
110 110
111// int mStatus; // confirmed/delegated/tentative/etc 111// int mStatus; // confirmed/delegated/tentative/etc
112 112
113 QDateTime mCompleted; 113 QDateTime mCompleted;
114 bool mHasCompletedDate; 114 bool mHasCompletedDate;
115 115
116 int mPercentComplete; 116 int mPercentComplete;
117}; 117};
118 118
119 bool operator==( const Todo&, const Todo& ); 119 bool operator==( const Todo&, const Todo& );
120} 120}
121 121
122#endif 122#endif