summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-04-17 17:29:12 (UTC)
committer zautrix <zautrix>2005-04-17 17:29:12 (UTC)
commite3e76014e70643b0828f30f5c5277e212495d37c (patch) (unidiff)
tree6c1b65d08bbecf7f5d83db636cebe3425b1521e8 /libkcal
parent70b45fe97813c4fd336b7ca8fdedab13f9c2e039 (diff)
downloadkdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.zip
kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.gz
kdepimpi-e3e76014e70643b0828f30f5c5277e212495d37c.tar.bz2
fixes
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/alarm.cpp2
-rw-r--r--libkcal/kincidenceformatter.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/libkcal/alarm.cpp b/libkcal/alarm.cpp
index d8f15b5..6de1566 100644
--- a/libkcal/alarm.cpp
+++ b/libkcal/alarm.cpp
@@ -169,313 +169,313 @@ void Alarm::setAudioFile(const QString &audioFile)
169 if (mType == Audio) { 169 if (mType == Audio) {
170 mFile = audioFile; 170 mFile = audioFile;
171 mParent->updated(); 171 mParent->updated();
172 } 172 }
173} 173}
174 174
175QString Alarm::audioFile() const 175QString Alarm::audioFile() const
176{ 176{
177 return (mType == Audio) ? mFile : QString::null; 177 return (mType == Audio) ? mFile : QString::null;
178} 178}
179 179
180void Alarm::setProcedureAlarm(const QString &programFile, const QString &arguments) 180void Alarm::setProcedureAlarm(const QString &programFile, const QString &arguments)
181{ 181{
182 mType = Procedure; 182 mType = Procedure;
183 mFile = programFile; 183 mFile = programFile;
184 mDescription = arguments; 184 mDescription = arguments;
185 mParent->updated(); 185 mParent->updated();
186} 186}
187 187
188void Alarm::setProgramFile(const QString &programFile) 188void Alarm::setProgramFile(const QString &programFile)
189{ 189{
190 if (mType == Procedure) { 190 if (mType == Procedure) {
191 mFile = programFile; 191 mFile = programFile;
192 mParent->updated(); 192 mParent->updated();
193 } 193 }
194} 194}
195 195
196QString Alarm::programFile() const 196QString Alarm::programFile() const
197{ 197{
198 return (mType == Procedure) ? mFile : QString::null; 198 return (mType == Procedure) ? mFile : QString::null;
199} 199}
200 200
201void Alarm::setProgramArguments(const QString &arguments) 201void Alarm::setProgramArguments(const QString &arguments)
202{ 202{
203 if (mType == Procedure) { 203 if (mType == Procedure) {
204 mDescription = arguments; 204 mDescription = arguments;
205 mParent->updated(); 205 mParent->updated();
206 } 206 }
207} 207}
208 208
209QString Alarm::programArguments() const 209QString Alarm::programArguments() const
210{ 210{
211 return (mType == Procedure) ? mDescription : QString::null; 211 return (mType == Procedure) ? mDescription : QString::null;
212} 212}
213 213
214void Alarm::setEmailAlarm(const QString &subject, const QString &text, 214void Alarm::setEmailAlarm(const QString &subject, const QString &text,
215 const QValueList<Person> &addressees, const QStringList &attachments) 215 const QValueList<Person> &addressees, const QStringList &attachments)
216{ 216{
217 mType = Email; 217 mType = Email;
218 mMailSubject = subject; 218 mMailSubject = subject;
219 mDescription = text; 219 mDescription = text;
220 mMailAddresses = addressees; 220 mMailAddresses = addressees;
221 mMailAttachFiles = attachments; 221 mMailAttachFiles = attachments;
222 mParent->updated(); 222 mParent->updated();
223} 223}
224 224
225void Alarm::setMailAddress(const Person &mailAddress) 225void Alarm::setMailAddress(const Person &mailAddress)
226{ 226{
227 if (mType == Email) { 227 if (mType == Email) {
228 mMailAddresses.clear(); 228 mMailAddresses.clear();
229 mMailAddresses += mailAddress; 229 mMailAddresses += mailAddress;
230 mParent->updated(); 230 mParent->updated();
231 } 231 }
232} 232}
233 233
234void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses) 234void Alarm::setMailAddresses(const QValueList<Person> &mailAddresses)
235{ 235{
236 if (mType == Email) { 236 if (mType == Email) {
237 mMailAddresses = mailAddresses; 237 mMailAddresses = mailAddresses;
238 mParent->updated(); 238 mParent->updated();
239 } 239 }
240} 240}
241 241
242void Alarm::addMailAddress(const Person &mailAddress) 242void Alarm::addMailAddress(const Person &mailAddress)
243{ 243{
244 if (mType == Email) { 244 if (mType == Email) {
245 mMailAddresses += mailAddress; 245 mMailAddresses += mailAddress;
246 mParent->updated(); 246 mParent->updated();
247 } 247 }
248} 248}
249 249
250QValueList<Person> Alarm::mailAddresses() const 250QValueList<Person> Alarm::mailAddresses() const
251{ 251{
252 return (mType == Email) ? mMailAddresses : QValueList<Person>(); 252 return (mType == Email) ? mMailAddresses : QValueList<Person>();
253} 253}
254 254
255void Alarm::setMailSubject(const QString &mailAlarmSubject) 255void Alarm::setMailSubject(const QString &mailAlarmSubject)
256{ 256{
257 if (mType == Email) { 257 if (mType == Email) {
258 mMailSubject = mailAlarmSubject; 258 mMailSubject = mailAlarmSubject;
259 mParent->updated(); 259 mParent->updated();
260 } 260 }
261} 261}
262 262
263QString Alarm::mailSubject() const 263QString Alarm::mailSubject() const
264{ 264{
265 return (mType == Email) ? mMailSubject : QString::null; 265 return (mType == Email) ? mMailSubject : QString::null;
266} 266}
267 267
268void Alarm::setMailAttachment(const QString &mailAttachFile) 268void Alarm::setMailAttachment(const QString &mailAttachFile)
269{ 269{
270 if (mType == Email) { 270 if (mType == Email) {
271 mMailAttachFiles.clear(); 271 mMailAttachFiles.clear();
272 mMailAttachFiles += mailAttachFile; 272 mMailAttachFiles += mailAttachFile;
273 mParent->updated(); 273 mParent->updated();
274 } 274 }
275} 275}
276 276
277void Alarm::setMailAttachments(const QStringList &mailAttachFiles) 277void Alarm::setMailAttachments(const QStringList &mailAttachFiles)
278{ 278{
279 if (mType == Email) { 279 if (mType == Email) {
280 mMailAttachFiles = mailAttachFiles; 280 mMailAttachFiles = mailAttachFiles;
281 mParent->updated(); 281 mParent->updated();
282 } 282 }
283} 283}
284 284
285void Alarm::addMailAttachment(const QString &mailAttachFile) 285void Alarm::addMailAttachment(const QString &mailAttachFile)
286{ 286{
287 if (mType == Email) { 287 if (mType == Email) {
288 mMailAttachFiles += mailAttachFile; 288 mMailAttachFiles += mailAttachFile;
289 mParent->updated(); 289 mParent->updated();
290 } 290 }
291} 291}
292 292
293QStringList Alarm::mailAttachments() const 293QStringList Alarm::mailAttachments() const
294{ 294{
295 return (mType == Email) ? mMailAttachFiles : QStringList(); 295 return (mType == Email) ? mMailAttachFiles : QStringList();
296} 296}
297 297
298void Alarm::setMailText(const QString &text) 298void Alarm::setMailText(const QString &text)
299{ 299{
300 if (mType == Email) { 300 if (mType == Email) {
301 mDescription = text; 301 mDescription = text;
302 mParent->updated(); 302 mParent->updated();
303 } 303 }
304} 304}
305 305
306QString Alarm::mailText() const 306QString Alarm::mailText() const
307{ 307{
308 return (mType == Email) ? mDescription : QString::null; 308 return (mType == Email) ? mDescription : QString::null;
309} 309}
310 310
311void Alarm::setDisplayAlarm(const QString &text) 311void Alarm::setDisplayAlarm(const QString &text)
312{ 312{
313 mType = Display; 313 mType = Display;
314 mDescription = text; 314 mDescription = text;
315 mParent->updated(); 315 mParent->updated();
316} 316}
317 317
318void Alarm::setText(const QString &text) 318void Alarm::setText(const QString &text)
319{ 319{
320 if (mType == Display) { 320 if (mType == Display) {
321 mDescription = text; 321 mDescription = text;
322 mParent->updated(); 322 mParent->updated();
323 } 323 }
324} 324}
325 325
326QString Alarm::text() const 326QString Alarm::text() const
327{ 327{
328 return (mType == Display) ? mDescription : QString::null; 328 return (mType == Display) ? mDescription : QString::null;
329} 329}
330 330
331void Alarm::setTime(const QDateTime &alarmTime) 331void Alarm::setTime(const QDateTime &alarmTime)
332{ 332{
333 mAlarmTime = alarmTime; 333 mAlarmTime = alarmTime;
334 mHasTime = true; 334 mHasTime = true;
335 335
336 mParent->updated(); 336 mParent->updated();
337} 337}
338int Alarm::offset() 338int Alarm::offset()
339{ 339{
340 if ( hasTime() ) { 340 if ( hasTime() ) {
341 if (mParent->type()=="Todo") { 341 if (mParent->type()=="Todo") {
342 Todo *t = static_cast<Todo*>(mParent); 342 Todo *t = static_cast<Todo*>(mParent);
343 return t->dtDue().secsTo( mAlarmTime ) ; 343 return t->dtDue().secsTo( mAlarmTime ) ;
344 } else 344 } else
345 return mParent->dtStart().secsTo( mAlarmTime ) ; 345 return mParent->dtStart().secsTo( mAlarmTime ) ;
346 } 346 }
347 else 347 else
348 { 348 {
349 return mOffset.asSeconds(); 349 return mOffset.asSeconds();
350 } 350 }
351 351
352} 352}
353QString Alarm::offsetText() 353QString Alarm::offsetText()
354{ 354{
355 int min = -offset()/60; 355 int min = -offset()/60;
356 int hours = min /60; 356 int hours = min /60;
357 min = min % 60; 357 min = min % 60;
358 int days = hours /24; 358 int days = hours /24;
359 hours = hours % 24; 359 hours = hours % 24;
360 QString message; 360 QString message;
361 qDebug("%d %d %d ", days, hours, min ); 361 //qDebug("%d %d %d ", days, hours, min );
362 if ( days > 0 ) 362 if ( days > 0 )
363 message += i18n("%1d").arg( days ); 363 message += i18n("%1d").arg( days );
364 if ( hours > 0 ) { 364 if ( hours > 0 ) {
365 if ( !message.isEmpty() ) message += "/"; 365 if ( !message.isEmpty() ) message += "/";
366 message += i18n("%1h").arg( hours ); 366 message += i18n("%1h").arg( hours );
367 } 367 }
368 if ( min > 0 ) { 368 if ( min > 0 ) {
369 if ( !message.isEmpty() ) message += "/"; 369 if ( !message.isEmpty() ) message += "/";
370 message += i18n("%1min").arg( min ); 370 message += i18n("%1min").arg( min );
371 } 371 }
372 if ( message.isEmpty() ) 372 if ( message.isEmpty() )
373 message = i18n("%1min").arg( 0 ); 373 message = i18n("%1min").arg( 0 );
374 return message; 374 return message;
375} 375}
376 376
377 377
378QDateTime Alarm::time() const 378QDateTime Alarm::time() const
379{ 379{
380 if ( hasTime() ) 380 if ( hasTime() )
381 return mAlarmTime; 381 return mAlarmTime;
382 else 382 else
383 { 383 {
384 if (mParent->type()=="Todo") { 384 if (mParent->type()=="Todo") {
385 Todo *t = static_cast<Todo*>(mParent); 385 Todo *t = static_cast<Todo*>(mParent);
386 return mOffset.end( t->dtDue() ); 386 return mOffset.end( t->dtDue() );
387 } else if (mEndOffset) { 387 } else if (mEndOffset) {
388 return mOffset.end( mParent->dtEnd() ); 388 return mOffset.end( mParent->dtEnd() );
389 } else { 389 } else {
390 return mOffset.end( mParent->dtStart() ); 390 return mOffset.end( mParent->dtStart() );
391 } 391 }
392 } 392 }
393} 393}
394 394
395bool Alarm::hasTime() const 395bool Alarm::hasTime() const
396{ 396{
397 return mHasTime; 397 return mHasTime;
398} 398}
399 399
400void Alarm::setSnoozeTime(int alarmSnoozeTime) 400void Alarm::setSnoozeTime(int alarmSnoozeTime)
401{ 401{
402 mAlarmSnoozeTime = alarmSnoozeTime; 402 mAlarmSnoozeTime = alarmSnoozeTime;
403 mParent->updated(); 403 mParent->updated();
404} 404}
405 405
406int Alarm::snoozeTime() const 406int Alarm::snoozeTime() const
407{ 407{
408 return mAlarmSnoozeTime; 408 return mAlarmSnoozeTime;
409} 409}
410 410
411void Alarm::setRepeatCount(int alarmRepeatCount) 411void Alarm::setRepeatCount(int alarmRepeatCount)
412{ 412{
413 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl; 413 kdDebug(5800) << "Alarm::setRepeatCount(): " << alarmRepeatCount << endl;
414 414
415 mAlarmRepeatCount = alarmRepeatCount; 415 mAlarmRepeatCount = alarmRepeatCount;
416 mParent->updated(); 416 mParent->updated();
417} 417}
418 418
419int Alarm::repeatCount() const 419int Alarm::repeatCount() const
420{ 420{
421 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl; 421 kdDebug(5800) << "Alarm::repeatCount(): " << mAlarmRepeatCount << endl;
422 return mAlarmRepeatCount; 422 return mAlarmRepeatCount;
423} 423}
424 424
425void Alarm::toggleAlarm() 425void Alarm::toggleAlarm()
426{ 426{
427 mAlarmEnabled = !mAlarmEnabled; 427 mAlarmEnabled = !mAlarmEnabled;
428 mParent->updated(); 428 mParent->updated();
429} 429}
430 430
431void Alarm::setEnabled(bool enable) 431void Alarm::setEnabled(bool enable)
432{ 432{
433 mAlarmEnabled = enable; 433 mAlarmEnabled = enable;
434 mParent->updated(); 434 mParent->updated();
435} 435}
436 436
437bool Alarm::enabled() const 437bool Alarm::enabled() const
438{ 438{
439 return mAlarmEnabled; 439 return mAlarmEnabled;
440} 440}
441 441
442void Alarm::setStartOffset( const Duration &offset ) 442void Alarm::setStartOffset( const Duration &offset )
443{ 443{
444 mOffset = offset; 444 mOffset = offset;
445 mEndOffset = false; 445 mEndOffset = false;
446 mHasTime = false; 446 mHasTime = false;
447 mParent->updated(); 447 mParent->updated();
448} 448}
449 449
450Duration Alarm::startOffset() const 450Duration Alarm::startOffset() const
451{ 451{
452 return (mHasTime || mEndOffset) ? 0 : mOffset; 452 return (mHasTime || mEndOffset) ? 0 : mOffset;
453} 453}
454 454
455bool Alarm::hasStartOffset() const 455bool Alarm::hasStartOffset() const
456{ 456{
457 return !mHasTime && !mEndOffset; 457 return !mHasTime && !mEndOffset;
458} 458}
459 459
460bool Alarm::hasEndOffset() const 460bool Alarm::hasEndOffset() const
461{ 461{
462 return !mHasTime && mEndOffset; 462 return !mHasTime && mEndOffset;
463} 463}
464 464
465void Alarm::setEndOffset( const Duration &offset ) 465void Alarm::setEndOffset( const Duration &offset )
466{ 466{
467 mOffset = offset; 467 mOffset = offset;
468 mEndOffset = true; 468 mEndOffset = true;
469 mHasTime = false; 469 mHasTime = false;
470 mParent->updated(); 470 mParent->updated();
471} 471}
472 472
473Duration Alarm::endOffset() const 473Duration Alarm::endOffset() const
474{ 474{
475 return (mHasTime || !mEndOffset) ? 0 : mOffset; 475 return (mHasTime || !mEndOffset) ? 0 : mOffset;
476} 476}
477 477
478void Alarm::setParent( Incidence *parent ) 478void Alarm::setParent( Incidence *parent )
479{ 479{
480 mParent = parent; 480 mParent = parent;
481} 481}
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 8ae5b46..7d61b7f 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -94,329 +94,329 @@ void KIncidenceFormatter::setEvent(Event *event)
94 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") 94 mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>")
95 .arg(event->dtStartTimeStr()) 95 .arg(event->dtStartTimeStr())
96 .arg(event->dtEndTimeStr())); 96 .arg(event->dtEndTimeStr()));
97 mText.append(i18n("<p><b>On:</b> %1</p> ") 97 mText.append(i18n("<p><b>On:</b> %1</p> ")
98 .arg(event->dtStartDateStr( shortDate ))); 98 .arg(event->dtStartDateStr( shortDate )));
99 } 99 }
100 } 100 }
101 if (!event->location().isEmpty()) { 101 if (!event->location().isEmpty()) {
102 addTag("b",i18n("Location: ")); 102 addTag("b",i18n("Location: "));
103 mText.append(deTag(event->location())+"<br>"); 103 mText.append(deTag(event->location())+"<br>");
104 } 104 }
105 105
106 if (event->recurrence()->doesRecur()) { 106 if (event->recurrence()->doesRecur()) {
107 107
108 QString recurText = event->recurrence()->recurrenceText(); 108 QString recurText = event->recurrence()->recurrenceText();
109 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 109 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
110 110
111 bool ok; 111 bool ok;
112 QDate start = QDate::currentDate(); 112 QDate start = QDate::currentDate();
113 QDateTime next; 113 QDateTime next;
114 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); 114 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
115 if ( ok ) { 115 if ( ok ) {
116 addTag("p",i18n("<b>Next recurrence is on:</b>") ); 116 addTag("p",i18n("<b>Next recurrence is on:</b>") );
117 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); 117 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
118 118
119 } else { 119 } else {
120 bool last; 120 bool last;
121 QDate nextd; 121 QDate nextd;
122 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); 122 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
123 if ( last ) { 123 if ( last ) {
124 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 124 addTag("p",i18n("<b>Last recurrence was on:</b>") );
125 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); 125 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
126 } 126 }
127 } 127 }
128 } 128 }
129 129
130 130
131 if (event->isAlarmEnabled()) { 131 if (event->isAlarmEnabled()) {
132 Alarm *alarm =event->alarms().first() ; 132 Alarm *alarm =event->alarms().first() ;
133 QDateTime t = alarm->time(); 133 QDateTime t = alarm->time();
134 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 134 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
135 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); 135 addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate ));
136 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 136 //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
137 //addTag("p",s); 137 //addTag("p",s);
138 } 138 }
139 139
140 140
141 141
142 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 142 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
143 // mText.append(event->secrecyStr()+"<br>"); 143 // mText.append(event->secrecyStr()+"<br>");
144 formatCategories(event); 144 formatCategories(event);
145 145
146 formatReadOnly(event); 146 formatReadOnly(event);
147 formatAttendees(event); 147 formatAttendees(event);
148 148
149 if ( mCreated ) { 149 if ( mCreated ) {
150#ifdef DESKTOP_VERSION 150#ifdef DESKTOP_VERSION
151 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 151 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
152#else 152#else
153 addTag("p",i18n("<b>Created: ") +" </b>"); 153 addTag("p",i18n("<b>Created: ") +" </b>");
154 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 154 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
155#endif 155#endif
156 156
157 } 157 }
158 if ( mModified ) { 158 if ( mModified ) {
159#ifdef DESKTOP_VERSION 159#ifdef DESKTOP_VERSION
160 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 160 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
161#else 161#else
162 addTag("p",i18n("<b>Last modified: ") +" </b>"); 162 addTag("p",i18n("<b>Last modified: ") +" </b>");
163 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 163 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
164#endif 164#endif
165 165
166 } 166 }
167 if ( mDetails ) { 167 if ( mDetails ) {
168 if (!event->description().isEmpty()) { 168 if (!event->description().isEmpty()) {
169 addTag("p",i18n("<b>Details: </b>")); 169 addTag("p",i18n("<b>Details: </b>"));
170 addTag("p",deTag(event->description())); 170 addTag("p",deTag(event->description()));
171 } 171 }
172 } 172 }
173 173
174} 174}
175 175
176void KIncidenceFormatter::setTodo(Todo *event ) 176void KIncidenceFormatter::setTodo(Todo *event )
177{ 177{
178 int mode = 0; 178 int mode = 0;
179 mCurrentIncidence = event; 179 mCurrentIncidence = event;
180 bool shortDate = true; 180 bool shortDate = true;
181 if (mode == 0 ) 181 if (mode == 0 )
182 addTag("h3",deTag(event->summary())); 182 addTag("h3",deTag(event->summary()));
183 else { 183 else {
184 if ( mColorMode == 1 ) { 184 if ( mColorMode == 1 ) {
185 mText +="<font color=\"#00A000\">"; 185 mText +="<font color=\"#00A000\">";
186 } 186 }
187 if ( mColorMode == 2 ) { 187 if ( mColorMode == 2 ) {
188 mText +="<font color=\"#B00000\">"; 188 mText +="<font color=\"#B00000\">";
189 } 189 }
190 if ( mode == 1 ) { 190 if ( mode == 1 ) {
191 addTag("h2",i18n( "Local: " ) +deTag(event->summary())); 191 addTag("h2",i18n( "Local: " ) +deTag(event->summary()));
192 } else { 192 } else {
193 addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); 193 addTag("h2",i18n( "Remote: " ) +deTag(event->summary()));
194 } 194 }
195 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); 195 addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) );
196 if ( mColorMode ) 196 if ( mColorMode )
197 mText += "</font>"; 197 mText += "</font>";
198 } 198 }
199 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { 199 if ( event->percentComplete() == 100 && event->hasCompletedDate() ) {
200 mText +="<font color=\"#B00000\">"; 200 mText +="<font color=\"#B00000\">";
201 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); 201 addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) );
202 mText += "</font>"; 202 mText += "</font>";
203 } else { 203 } else {
204 mText.append(i18n("<p><i>%1 % completed</i></p>") 204 mText.append(i18n("<p><i>%1 % completed</i></p>")
205 .arg(event->percentComplete())); 205 .arg(event->percentComplete()));
206 } 206 }
207 if (event->cancelled ()) { 207 if (event->cancelled ()) {
208 mText +="<font color=\"#B00000\">"; 208 mText +="<font color=\"#B00000\">";
209 addTag("i",i18n("This todo has been cancelled!")); 209 addTag("i",i18n("This todo has been cancelled!"));
210 mText.append("<br>"); 210 mText.append("<br>");
211 mText += "</font>"; 211 mText += "</font>";
212 } 212 }
213 213
214 214
215 if (event->recurrence()->doesRecur()) { 215 if (event->recurrence()->doesRecur()) {
216 216
217 QString recurText = event->recurrence()->recurrenceText(); 217 QString recurText = event->recurrence()->recurrenceText();
218 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); 218 addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>");
219 } 219 }
220 220
221 if (event->hasStartDate()) { 221 if (event->hasStartDate()) {
222 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); 222 mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate)));
223 } 223 }
224 224
225 225
226 if (event->hasDueDate()) { 226 if (event->hasDueDate()) {
227 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); 227 mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate)));
228 } 228 }
229 229
230 if (!event->location().isEmpty()) { 230 if (!event->location().isEmpty()) {
231 addTag("b",i18n("Location: ")); 231 addTag("b",i18n("Location: "));
232 mText.append(deTag(event->location())+"<br>"); 232 mText.append(deTag(event->location())+"<br>");
233 } 233 }
234 234
235 mText.append(i18n("<p><b>Priority:</b> %2</p>") 235 mText.append(i18n("<p><b>Priority:</b> %2</p>")
236 .arg(QString::number(event->priority()))); 236 .arg(QString::number(event->priority())));
237 237
238 if (event->isAlarmEnabled()) { 238 if (event->isAlarmEnabled()) {
239 Alarm *alarm =event->alarms().first() ; 239 Alarm *alarm =event->alarms().first() ;
240 QDateTime t = alarm->time(); 240 QDateTime t = alarm->time();
241 QString s =i18n("( %1 before )").arg( alarm->offsetText() ); 241 QString s =i18n("( %1 before )").arg( alarm->offsetText() );
242 addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); 242 addTag("p",i18n("<b>Alarm on: ") + s +" </b>");
243 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); 243 addTag("p", KGlobal::locale()->formatDateTime( t, shortDate ));
244 //addTag("p",s); 244 //addTag("p",s);
245 } 245 }
246 246
247 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); 247 addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() );
248 formatCategories(event); 248 formatCategories(event);
249 249
250 formatReadOnly(event); 250 formatReadOnly(event);
251 formatAttendees(event); 251 formatAttendees(event);
252 if ( mCreated ) { 252 if ( mCreated ) {
253#ifdef DESKTOP_VERSION 253#ifdef DESKTOP_VERSION
254 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); 254 addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate ));
255#else 255#else
256 addTag("p",i18n("<b>Created: ") +" </b>"); 256 addTag("p",i18n("<b>Created: ") +" </b>");
257 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); 257 addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate ));
258#endif 258#endif
259 259
260 } 260 }
261 if ( mModified ) { 261 if ( mModified ) {
262#ifdef DESKTOP_VERSION 262#ifdef DESKTOP_VERSION
263 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 263 addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
264#else 264#else
265 addTag("p",i18n("<b>Last modified: ") +" </b>"); 265 addTag("p",i18n("<b>Last modified: ") +" </b>");
266 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); 266 addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ));
267#endif 267#endif
268 268
269 } 269 }
270 if ( mDetails ) { 270 if ( mDetails ) {
271 if (!event->description().isEmpty()) { 271 if (!event->description().isEmpty()) {
272 addTag("p",i18n("<b>Details: </b>")); 272 addTag("p",i18n("<b>Details: </b>"));
273 addTag("p",deTag(event->description())); 273 addTag("p",deTag(event->description()));
274 } 274 }
275 } 275 }
276} 276}
277 277
278void KIncidenceFormatter::setJournal(Journal* ) 278void KIncidenceFormatter::setJournal(Journal* )
279{ 279{
280 280
281} 281}
282 282
283void KIncidenceFormatter::formatCategories(Incidence *event) 283void KIncidenceFormatter::formatCategories(Incidence *event)
284{ 284{
285 if (!event->categoriesStr().isEmpty()) { 285 if (!event->categoriesStr().isEmpty()) {
286 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStr() ); 286 addTag("p",i18n("<b>Categories: </b>")+event->categoriesStrWithSpace() );
287 //mText.append(event->categoriesStr()); 287 //mText.append(event->categoriesStr());
288 } 288 }
289} 289}
290void KIncidenceFormatter::addTag(const QString & tag,const QString & text) 290void KIncidenceFormatter::addTag(const QString & tag,const QString & text)
291{ 291{
292 int number=text.contains("\n"); 292 int number=text.contains("\n");
293 QString str = "<" + tag + ">"; 293 QString str = "<" + tag + ">";
294 QString tmpText=text; 294 QString tmpText=text;
295 QString tmpStr=str; 295 QString tmpStr=str;
296 if(number !=-1) 296 if(number !=-1)
297 { 297 {
298 if (number > 0) { 298 if (number > 0) {
299 int pos=0; 299 int pos=0;
300 QString tmp; 300 QString tmp;
301 for(int i=0;i<=number;i++) { 301 for(int i=0;i<=number;i++) {
302 pos=tmpText.find("\n"); 302 pos=tmpText.find("\n");
303 tmp=tmpText.left(pos); 303 tmp=tmpText.left(pos);
304 tmpText=tmpText.right(tmpText.length()-pos-1); 304 tmpText=tmpText.right(tmpText.length()-pos-1);
305 tmpStr+=tmp+"<br>"; 305 tmpStr+=tmp+"<br>";
306 } 306 }
307 } 307 }
308 else tmpStr += tmpText; 308 else tmpStr += tmpText;
309 tmpStr+="</" + tag + ">"; 309 tmpStr+="</" + tag + ">";
310 mText.append(tmpStr); 310 mText.append(tmpStr);
311 } 311 }
312 else 312 else
313 { 313 {
314 str += text + "</" + tag + ">"; 314 str += text + "</" + tag + ">";
315 mText.append(str); 315 mText.append(str);
316 } 316 }
317} 317}
318 318
319void KIncidenceFormatter::formatAttendees(Incidence *event) 319void KIncidenceFormatter::formatAttendees(Incidence *event)
320{ 320{
321 QPtrList<Attendee> attendees = event->attendees(); 321 QPtrList<Attendee> attendees = event->attendees();
322 if (attendees.count()) { 322 if (attendees.count()) {
323 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); 323 QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small);
324 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); 324 QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small);
325 addTag("h3",i18n("Organizer")); 325 addTag("h3",i18n("Organizer"));
326 mText.append("<ul><li>"); 326 mText.append("<ul><li>");
327#if 0 327#if 0
328 //ndef KORG_NOKABC 328 //ndef KORG_NOKABC
329 329
330 KABC::AddressBook *add_book = KABC::StdAddressBook::self(); 330 KABC::AddressBook *add_book = KABC::StdAddressBook::self();
331 KABC::Addressee::List addressList; 331 KABC::Addressee::List addressList;
332 addressList = add_book->findByEmail(event->organizer()); 332 addressList = add_book->findByEmail(event->organizer());
333 KABC::Addressee o = addressList.first(); 333 KABC::Addressee o = addressList.first();
334 if (!o.isEmpty() && addressList.size()<2) { 334 if (!o.isEmpty() && addressList.size()<2) {
335 mText += "<a href=\"uid:" + o.uid() + "\">"; 335 mText += "<a href=\"uid:" + o.uid() + "\">";
336 mText += o.formattedName(); 336 mText += o.formattedName();
337 mText += "</a>\n"; 337 mText += "</a>\n";
338 } else { 338 } else {
339 mText.append(event->organizer()); 339 mText.append(event->organizer());
340 } 340 }
341#else 341#else
342 mText.append(event->organizer()); 342 mText.append(event->organizer());
343#endif 343#endif
344 if (iconPath) { 344 if (iconPath) {
345 mText += " <a href=\"mailto:" + event->organizer() + "\">"; 345 mText += " <a href=\"mailto:" + event->organizer() + "\">";
346 mText += "<IMG src=\"" + iconPath + "\">"; 346 mText += "<IMG src=\"" + iconPath + "\">";
347 mText += "</a>\n"; 347 mText += "</a>\n";
348 } 348 }
349 mText.append("</li></ul>"); 349 mText.append("</li></ul>");
350 350
351 addTag("h3",i18n("Attendees")); 351 addTag("h3",i18n("Attendees"));
352 Attendee *a; 352 Attendee *a;
353 mText.append("<ul>"); 353 mText.append("<ul>");
354 for(a=attendees.first();a;a=attendees.next()) { 354 for(a=attendees.first();a;a=attendees.next()) {
355#if 0 355#if 0
356//ndef KORG_NOKABC 356//ndef KORG_NOKABC
357 if (a->name().isEmpty()) { 357 if (a->name().isEmpty()) {
358 addressList = add_book->findByEmail(a->email()); 358 addressList = add_book->findByEmail(a->email());
359 KABC::Addressee o = addressList.first(); 359 KABC::Addressee o = addressList.first();
360 if (!o.isEmpty() && addressList.size()<2) { 360 if (!o.isEmpty() && addressList.size()<2) {
361 mText += "<a href=\"uid:" + o.uid() + "\">"; 361 mText += "<a href=\"uid:" + o.uid() + "\">";
362 mText += o.formattedName(); 362 mText += o.formattedName();
363 mText += "</a>\n"; 363 mText += "</a>\n";
364 } else { 364 } else {
365 mText += "<li>"; 365 mText += "<li>";
366 mText.append(a->email()); 366 mText.append(a->email());
367 mText += "\n"; 367 mText += "\n";
368 } 368 }
369 } else { 369 } else {
370 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 370 mText += "<li><a href=\"uid:" + a->uid() + "\">";
371 if (!a->name().isEmpty()) mText += a->name(); 371 if (!a->name().isEmpty()) mText += a->name();
372 else mText += a->email(); 372 else mText += a->email();
373 mText += "</a>\n"; 373 mText += "</a>\n";
374 } 374 }
375#else 375#else
376 //qDebug("nokabc "); 376 //qDebug("nokabc ");
377 mText += "<li><a href=\"uid:" + a->uid() + "\">"; 377 mText += "<li><a href=\"uid:" + a->uid() + "\">";
378 if (!a->name().isEmpty()) mText += a->name(); 378 if (!a->name().isEmpty()) mText += a->name();
379 else mText += a->email(); 379 else mText += a->email();
380 mText += "</a>\n"; 380 mText += "</a>\n";
381#endif 381#endif
382 382
383 if (!a->email().isEmpty()) { 383 if (!a->email().isEmpty()) {
384 if (iconPath) { 384 if (iconPath) {
385 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; 385 mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">";
386 if ( a->RSVP() ) 386 if ( a->RSVP() )
387 mText += "<IMG src=\"" + iconPath + "\">"; 387 mText += "<IMG src=\"" + iconPath + "\">";
388 else 388 else
389 mText += "<IMG src=\"" + NOiconPath + "\">"; 389 mText += "<IMG src=\"" + NOiconPath + "\">";
390 mText += "</a>\n"; 390 mText += "</a>\n";
391 } 391 }
392 } 392 }
393 if (a->status() != Attendee::NeedsAction ) 393 if (a->status() != Attendee::NeedsAction )
394 mText +="[" + a->statusStr() + "] "; 394 mText +="[" + a->statusStr() + "] ";
395 if (a->role() == Attendee::Chair ) 395 if (a->role() == Attendee::Chair )
396 mText +="(" + a->roleStr().left(1) + ".)"; 396 mText +="(" + a->roleStr().left(1) + ".)";
397 } 397 }
398 mText.append("</li></ul>"); 398 mText.append("</li></ul>");
399 } 399 }
400} 400}
401 401
402void KIncidenceFormatter::formatReadOnly(Incidence *event) 402void KIncidenceFormatter::formatReadOnly(Incidence *event)
403{ 403{
404 if (event->isReadOnly()) { 404 if (event->isReadOnly()) {
405 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 405 addTag("p","<em>(" + i18n("read-only") + ")</em>");
406 } 406 }
407} 407}
408QString KIncidenceFormatter::deTag(QString text) 408QString KIncidenceFormatter::deTag(QString text)
409{ 409{
410#if QT_VERSION >= 0x030000 410#if QT_VERSION >= 0x030000
411 text.replace( '<' , "&lt;" ); 411 text.replace( '<' , "&lt;" );
412 text.replace( '>' , "&gt;" ); 412 text.replace( '>' , "&gt;" );
413#else 413#else
414 if ( text.find ('<') >= 0 ) { 414 if ( text.find ('<') >= 0 ) {
415 text.replace( QRegExp("<") , "&lt;" ); 415 text.replace( QRegExp("<") , "&lt;" );
416 } 416 }
417 if ( text.find ('>') >= 0 ) { 417 if ( text.find ('>') >= 0 ) {
418 text.replace( QRegExp(">") , "&gt;" ); 418 text.replace( QRegExp(">") , "&gt;" );
419 } 419 }
420#endif 420#endif
421 return text; 421 return text;
422} 422}