-rw-r--r-- | libkcal/vcalformat.cpp | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 2e19740..9cbaf16 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -17,21 +17,23 @@ | |||
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qapplication.h> | 22 | #include <qapplication.h> |
23 | #include <qdatetime.h> | 23 | #include <qdatetime.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qptrlist.h> | 25 | #include <q3ptrlist.h> |
26 | #include <qregexp.h> | 26 | #include <qregexp.h> |
27 | #include <qclipboard.h> | 27 | #include <qclipboard.h> |
28 | #include <qdialog.h> | 28 | #include <qdialog.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3CString> | ||
30 | 32 | ||
31 | #include <kdebug.h> | 33 | #include <kdebug.h> |
32 | #include <kglobal.h> | 34 | #include <kglobal.h> |
33 | #include <kmessagebox.h> | 35 | #include <kmessagebox.h> |
34 | #include <kiconloader.h> | 36 | #include <kiconloader.h> |
35 | #include <klocale.h> | 37 | #include <klocale.h> |
36 | 38 | ||
37 | #include "vcc.h" | 39 | #include "vcc.h" |
@@ -103,25 +105,25 @@ bool VCalFormat::save(Calendar *calendar, const QString &fileName) | |||
103 | // addPropValue(vcal,VCLocationProp, "0.0"); | 105 | // addPropValue(vcal,VCLocationProp, "0.0"); |
104 | addPropValue(vcal,VCProdIdProp, productId()); | 106 | addPropValue(vcal,VCProdIdProp, productId()); |
105 | tmpStr = mCalendar->getTimeZoneStr(); | 107 | tmpStr = mCalendar->getTimeZoneStr(); |
106 | //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() ); | 108 | //qDebug("mCalendar->getTimeZoneStr() %s",tmpStr.latin1() ); |
107 | addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); | 109 | addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); |
108 | addPropValue(vcal,VCVersionProp, _VCAL_VERSION); | 110 | addPropValue(vcal,VCVersionProp, _VCAL_VERSION); |
109 | 111 | ||
110 | // TODO STUFF | 112 | // TODO STUFF |
111 | QPtrList<Todo> todoList = mCalendar->rawTodos(); | 113 | Q3PtrList<Todo> todoList = mCalendar->rawTodos(); |
112 | QPtrListIterator<Todo> qlt(todoList); | 114 | Q3PtrListIterator<Todo> qlt(todoList); |
113 | for (; qlt.current(); ++qlt) { | 115 | for (; qlt.current(); ++qlt) { |
114 | vo = eventToVTodo(qlt.current()); | 116 | vo = eventToVTodo(qlt.current()); |
115 | addVObjectProp(vcal, vo); | 117 | addVObjectProp(vcal, vo); |
116 | } | 118 | } |
117 | 119 | ||
118 | // EVENT STUFF | 120 | // EVENT STUFF |
119 | QPtrList<Event> events = mCalendar->rawEvents(); | 121 | Q3PtrList<Event> events = mCalendar->rawEvents(); |
120 | Event *ev; | 122 | Event *ev; |
121 | for(ev=events.first();ev;ev=events.next()) { | 123 | for(ev=events.first();ev;ev=events.next()) { |
122 | vo = eventToVEvent(ev); | 124 | vo = eventToVEvent(ev); |
123 | addVObjectProp(vcal, vo); | 125 | addVObjectProp(vcal, vo); |
124 | } | 126 | } |
125 | 127 | ||
126 | writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal); | 128 | writeVObjectToFile(QFile::encodeName(fileName).data() ,vcal); |
127 | cleanVObjects(vcal); | 129 | cleanVObjects(vcal); |
@@ -133,17 +135,17 @@ bool VCalFormat::save(Calendar *calendar, const QString &fileName) | |||
133 | return false; // error | 135 | return false; // error |
134 | } | 136 | } |
135 | } | 137 | } |
136 | 138 | ||
137 | bool VCalFormat::fromString( Calendar *calendar, const QString &text ) | 139 | bool VCalFormat::fromString( Calendar *calendar, const QString &text ) |
138 | { | 140 | { |
139 | // TODO: Factor out VCalFormat::fromString() | 141 | // TODO: Factor out VCalFormat::fromString() |
140 | 142 | ||
141 | QCString data = text.utf8(); | 143 | Q3CString data = text.utf8(); |
142 | 144 | ||
143 | if ( !data.size() ) return false; | 145 | if ( !data.size() ) return false; |
144 | 146 | ||
145 | VObject *vcal = Parse_MIME( data.data(), data.size()); | 147 | VObject *vcal = Parse_MIME( data.data(), data.size()); |
146 | if ( !vcal ) return false; | 148 | if ( !vcal ) return false; |
147 | 149 | ||
148 | VObjectIterator i; | 150 | VObjectIterator i; |
149 | VObject *curvo; | 151 | VObject *curvo; |
@@ -205,17 +207,17 @@ QString VCalFormat::toString( Calendar *calendar ) | |||
205 | VObject *vcal = newVObject(VCCalProp); | 207 | VObject *vcal = newVObject(VCCalProp); |
206 | 208 | ||
207 | addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); | 209 | addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); |
208 | QString tmpStr = mCalendar->getTimeZoneStr(); | 210 | QString tmpStr = mCalendar->getTimeZoneStr(); |
209 | addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); | 211 | addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); |
210 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); | 212 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); |
211 | 213 | ||
212 | // TODO: Use all data. | 214 | // TODO: Use all data. |
213 | QPtrList<Event> events = calendar->events(); | 215 | Q3PtrList<Event> events = calendar->events(); |
214 | Event *event = events.first(); | 216 | Event *event = events.first(); |
215 | if ( !event ) return QString::null; | 217 | if ( !event ) return QString::null; |
216 | 218 | ||
217 | VObject *vevent = eventToVEvent( event ); | 219 | VObject *vevent = eventToVEvent( event ); |
218 | 220 | ||
219 | addVObjectProp( vcal, vevent ); | 221 | addVObjectProp( vcal, vevent ); |
220 | 222 | ||
221 | char *buf = writeMemVObject( 0, 0, vcal ); | 223 | char *buf = writeMemVObject( 0, 0, vcal ); |
@@ -266,18 +268,18 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
266 | addPropValue(vtodo, VCLastModifiedProp, tmpStr.local8Bit()); | 268 | addPropValue(vtodo, VCLastModifiedProp, tmpStr.local8Bit()); |
267 | 269 | ||
268 | // organizer stuff | 270 | // organizer stuff |
269 | tmpStr = "MAILTO:" + anEvent->organizer(); | 271 | tmpStr = "MAILTO:" + anEvent->organizer(); |
270 | addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit()); | 272 | addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit()); |
271 | 273 | ||
272 | // attendees | 274 | // attendees |
273 | if (anEvent->attendeeCount() != 0) { | 275 | if (anEvent->attendeeCount() != 0) { |
274 | QPtrList<Attendee> al = anEvent->attendees(); | 276 | Q3PtrList<Attendee> al = anEvent->attendees(); |
275 | QPtrListIterator<Attendee> ai(al); | 277 | Q3PtrListIterator<Attendee> ai(al); |
276 | Attendee *curAttendee; | 278 | Attendee *curAttendee; |
277 | 279 | ||
278 | for (; ai.current(); ++ai) { | 280 | for (; ai.current(); ++ai) { |
279 | curAttendee = ai.current(); | 281 | curAttendee = ai.current(); |
280 | if (!curAttendee->email().isEmpty() && | 282 | if (!curAttendee->email().isEmpty() && |
281 | !curAttendee->name().isEmpty()) | 283 | !curAttendee->name().isEmpty()) |
282 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + | 284 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + |
283 | curAttendee->email() + ">"; | 285 | curAttendee->email() + ">"; |
@@ -321,17 +323,17 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
321 | addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit()); | 323 | addPropValue(vtodo, VCCompletedProp, tmpStr.local8Bit()); |
322 | } | 324 | } |
323 | 325 | ||
324 | // priority | 326 | // priority |
325 | tmpStr.sprintf("%i",anEvent->priority()); | 327 | tmpStr.sprintf("%i",anEvent->priority()); |
326 | addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); | 328 | addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); |
327 | 329 | ||
328 | // related event | 330 | // related event |
329 | if (anEvent->relatedToUid()) { | 331 | if (!anEvent->relatedToUid().isEmpty()) { |
330 | addPropValue(vtodo, VCRelatedToProp, | 332 | addPropValue(vtodo, VCRelatedToProp, |
331 | anEvent->relatedToUid().local8Bit()); | 333 | anEvent->relatedToUid().local8Bit()); |
332 | } | 334 | } |
333 | 335 | ||
334 | // categories | 336 | // categories |
335 | QStringList tmpStrList = anEvent->categories(); | 337 | QStringList tmpStrList = anEvent->categories(); |
336 | tmpStr = ""; | 338 | tmpStr = ""; |
337 | QString catStr; | 339 | QString catStr; |
@@ -350,17 +352,17 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
350 | } | 352 | } |
351 | if (!tmpStr.isEmpty()) { | 353 | if (!tmpStr.isEmpty()) { |
352 | tmpStr.truncate(tmpStr.length()-1); | 354 | tmpStr.truncate(tmpStr.length()-1); |
353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); | 355 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); |
354 | } | 356 | } |
355 | 357 | ||
356 | // alarm stuff | 358 | // alarm stuff |
357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; | 359 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; |
358 | QPtrList<Alarm> alarms = anEvent->alarms(); | 360 | Q3PtrList<Alarm> alarms = anEvent->alarms(); |
359 | Alarm* alarm; | 361 | Alarm* alarm; |
360 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 362 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
361 | if (alarm->enabled()) { | 363 | if (alarm->enabled()) { |
362 | VObject *a; | 364 | VObject *a; |
363 | tmpStr = qDateTimeToISO(alarm->time()); | 365 | tmpStr = qDateTimeToISO(alarm->time()); |
364 | if (alarm->type() == Alarm::Audio) { | 366 | if (alarm->type() == Alarm::Audio) { |
365 | a = addProp(vtodo, VCAAlarmProp); | 367 | a = addProp(vtodo, VCAAlarmProp); |
366 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 368 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
@@ -428,18 +430,18 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) | |||
428 | tmpStr = qDateTimeToISO(anEvent->lastModified()); | 430 | tmpStr = qDateTimeToISO(anEvent->lastModified()); |
429 | addPropValue(vevent, VCLastModifiedProp, tmpStr.local8Bit()); | 431 | addPropValue(vevent, VCLastModifiedProp, tmpStr.local8Bit()); |
430 | 432 | ||
431 | // attendee and organizer stuff | 433 | // attendee and organizer stuff |
432 | tmpStr = "MAILTO:" + anEvent->organizer(); | 434 | tmpStr = "MAILTO:" + anEvent->organizer(); |
433 | addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit()); | 435 | addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit()); |
434 | 436 | ||
435 | if (anEvent->attendeeCount() != 0) { | 437 | if (anEvent->attendeeCount() != 0) { |
436 | QPtrList<Attendee> al = anEvent->attendees(); | 438 | Q3PtrList<Attendee> al = anEvent->attendees(); |
437 | QPtrListIterator<Attendee> ai(al); | 439 | Q3PtrListIterator<Attendee> ai(al); |
438 | Attendee *curAttendee; | 440 | Attendee *curAttendee; |
439 | 441 | ||
440 | // TODO: Put this functionality into Attendee class | 442 | // TODO: Put this functionality into Attendee class |
441 | for (; ai.current(); ++ai) { | 443 | for (; ai.current(); ++ai) { |
442 | curAttendee = ai.current(); | 444 | curAttendee = ai.current(); |
443 | if (!curAttendee->email().isEmpty() && | 445 | if (!curAttendee->email().isEmpty() && |
444 | !curAttendee->name().isEmpty()) | 446 | !curAttendee->name().isEmpty()) |
445 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + | 447 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + |
@@ -456,18 +458,18 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) | |||
456 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); | 458 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); |
457 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); | 459 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); |
458 | } | 460 | } |
459 | } | 461 | } |
460 | 462 | ||
461 | // recurrence rule stuff | 463 | // recurrence rule stuff |
462 | if (anEvent->doesRecur()) { | 464 | if (anEvent->doesRecur()) { |
463 | // some more variables | 465 | // some more variables |
464 | QPtrList<Recurrence::rMonthPos> tmpPositions; | 466 | Q3PtrList<Recurrence::rMonthPos> tmpPositions; |
465 | QPtrList<int> tmpDays; | 467 | Q3PtrList<int> tmpDays; |
466 | int *tmpDay; | 468 | int *tmpDay; |
467 | Recurrence::rMonthPos *tmpPos; | 469 | Recurrence::rMonthPos *tmpPos; |
468 | QString tmpStr2; | 470 | QString tmpStr2; |
469 | int i; | 471 | int i; |
470 | 472 | ||
471 | switch(anEvent->recurrence()->doesRecur()) { | 473 | switch(anEvent->recurrence()->doesRecur()) { |
472 | case Recurrence::rDaily: | 474 | case Recurrence::rDaily: |
473 | tmpStr.sprintf("D%i ",anEvent->recurrence()->frequency()); | 475 | tmpStr.sprintf("D%i ",anEvent->recurrence()->frequency()); |
@@ -540,17 +542,17 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) | |||
540 | } // switch | 542 | } // switch |
541 | 543 | ||
542 | if (anEvent->recurrence()->duration() > 0) { | 544 | if (anEvent->recurrence()->duration() > 0) { |
543 | tmpStr2.sprintf("#%i",anEvent->recurrence()->duration()); | 545 | tmpStr2.sprintf("#%i",anEvent->recurrence()->duration()); |
544 | tmpStr += tmpStr2; | 546 | tmpStr += tmpStr2; |
545 | } else if (anEvent->recurrence()->duration() == -1) { | 547 | } else if (anEvent->recurrence()->duration() == -1) { |
546 | tmpStr += "#0"; // defined as repeat forever | 548 | tmpStr += "#0"; // defined as repeat forever |
547 | } else { | 549 | } else { |
548 | tmpStr += qDateTimeToISO(anEvent->recurrence()->endDate(), FALSE); | 550 | tmpStr += qDateTimeToISO((QDateTime)anEvent->recurrence()->endDate(), FALSE); |
549 | } | 551 | } |
550 | addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit()); | 552 | addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit()); |
551 | 553 | ||
552 | } // event repeats | 554 | } // event repeats |
553 | 555 | ||
554 | // exceptions to recurrence | 556 | // exceptions to recurrence |
555 | DateList dateList = anEvent->exDates(); | 557 | DateList dateList = anEvent->exDates(); |
556 | DateList::ConstIterator it; | 558 | DateList::ConstIterator it; |
@@ -620,28 +622,28 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) | |||
620 | } | 622 | } |
621 | if (!tmpStr.isEmpty()) { | 623 | if (!tmpStr.isEmpty()) { |
622 | tmpStr.truncate(tmpStr.length()-1); | 624 | tmpStr.truncate(tmpStr.length()-1); |
623 | addPropValue(vevent, VCCategoriesProp, tmpStr.local8Bit()); | 625 | addPropValue(vevent, VCCategoriesProp, tmpStr.local8Bit()); |
624 | } | 626 | } |
625 | 627 | ||
626 | // attachments | 628 | // attachments |
627 | // TODO: handle binary attachments! | 629 | // TODO: handle binary attachments! |
628 | QPtrList<Attachment> attachments = anEvent->attachments(); | 630 | Q3PtrList<Attachment> attachments = anEvent->attachments(); |
629 | for ( Attachment *at = attachments.first(); at; at = attachments.next() ) | 631 | for ( Attachment *at = attachments.first(); at; at = attachments.next() ) |
630 | addPropValue(vevent, VCAttachProp, at->uri().local8Bit()); | 632 | addPropValue(vevent, VCAttachProp, at->uri().local8Bit()); |
631 | 633 | ||
632 | // resources | 634 | // resources |
633 | tmpStrList = anEvent->resources(); | 635 | tmpStrList = anEvent->resources(); |
634 | tmpStr = tmpStrList.join(";"); | 636 | tmpStr = tmpStrList.join(";"); |
635 | if (!tmpStr.isEmpty()) | 637 | if (!tmpStr.isEmpty()) |
636 | addPropValue(vevent, VCResourcesProp, tmpStr.local8Bit()); | 638 | addPropValue(vevent, VCResourcesProp, tmpStr.local8Bit()); |
637 | 639 | ||
638 | // alarm stuff | 640 | // alarm stuff |
639 | QPtrList<Alarm> alarms = anEvent->alarms(); | 641 | Q3PtrList<Alarm> alarms = anEvent->alarms(); |
640 | Alarm* alarm; | 642 | Alarm* alarm; |
641 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 643 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
642 | if (alarm->enabled()) { | 644 | if (alarm->enabled()) { |
643 | VObject *a ; | 645 | VObject *a ; |
644 | tmpStr = qDateTimeToISO(alarm->time()); | 646 | tmpStr = qDateTimeToISO(alarm->time()); |
645 | if (alarm->type() == Alarm::Audio) { | 647 | if (alarm->type() == Alarm::Audio) { |
646 | a = addProp(vevent, VCAAlarmProp); | 648 | a = addProp(vevent, VCAAlarmProp); |
647 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 649 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
@@ -667,17 +669,17 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) | |||
667 | tmpStr.sprintf("%i",anEvent->priority()); | 669 | tmpStr.sprintf("%i",anEvent->priority()); |
668 | addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit()); | 670 | addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit()); |
669 | 671 | ||
670 | // transparency | 672 | // transparency |
671 | tmpStr.sprintf("%i",anEvent->transparency()); | 673 | tmpStr.sprintf("%i",anEvent->transparency()); |
672 | addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); | 674 | addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); |
673 | 675 | ||
674 | // related event | 676 | // related event |
675 | if (anEvent->relatedToUid()) { | 677 | if (!anEvent->relatedToUid().isEmpty()) { |
676 | addPropValue(vevent, VCRelatedToProp, | 678 | addPropValue(vevent, VCRelatedToProp, |
677 | anEvent->relatedToUid().local8Bit()); | 679 | anEvent->relatedToUid().local8Bit()); |
678 | } | 680 | } |
679 | 681 | ||
680 | if (anEvent->pilotId()) { | 682 | if (anEvent->pilotId()) { |
681 | // pilot sync stuff | 683 | // pilot sync stuff |
682 | tmpStr.sprintf("%i",anEvent->pilotId()); | 684 | tmpStr.sprintf("%i",anEvent->pilotId()); |
683 | addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit()); | 685 | addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit()); |
@@ -1403,30 +1405,30 @@ Event* VCalFormat::VEventToEvent(VObject *vevent) | |||
1403 | return anEvent; | 1405 | return anEvent; |
1404 | } | 1406 | } |
1405 | 1407 | ||
1406 | 1408 | ||
1407 | QString VCalFormat::qDateToISO(const QDate &qd) | 1409 | QString VCalFormat::qDateToISO(const QDate &qd) |
1408 | { | 1410 | { |
1409 | QString tmpStr; | 1411 | QString tmpStr; |
1410 | 1412 | ||
1411 | ASSERT(qd.isValid()); | 1413 | Q_ASSERT(qd.isValid()); |
1412 | 1414 | ||
1413 | tmpStr.sprintf("%.2d%.2d%.2d", | 1415 | tmpStr.sprintf("%.2d%.2d%.2d", |
1414 | qd.year(), qd.month(), qd.day()); | 1416 | qd.year(), qd.month(), qd.day()); |
1415 | return tmpStr; | 1417 | return tmpStr; |
1416 | 1418 | ||
1417 | } | 1419 | } |
1418 | 1420 | ||
1419 | QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) | 1421 | QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) |
1420 | { | 1422 | { |
1421 | QString tmpStr; | 1423 | QString tmpStr; |
1422 | 1424 | ||
1423 | ASSERT(qdt.date().isValid()); | 1425 | Q_ASSERT(qdt.date().isValid()); |
1424 | ASSERT(qdt.time().isValid()); | 1426 | Q_ASSERT(qdt.time().isValid()); |
1425 | if (zulu && !useLocalTime ) { | 1427 | if (zulu && !useLocalTime ) { |
1426 | QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60); | 1428 | QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60); |
1427 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", | 1429 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", |
1428 | tmpDT.date().year(), tmpDT.date().month(), | 1430 | tmpDT.date().year(), tmpDT.date().month(), |
1429 | tmpDT.date().day(), tmpDT.time().hour(), | 1431 | tmpDT.date().day(), tmpDT.time().hour(), |
1430 | tmpDT.time().minute(), tmpDT.time().second()); | 1432 | tmpDT.time().minute(), tmpDT.time().second()); |
1431 | } else { | 1433 | } else { |
1432 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d", | 1434 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d", |
@@ -1449,18 +1451,18 @@ QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr) | |||
1449 | month = tmpStr.mid(4,2).toInt(); | 1451 | month = tmpStr.mid(4,2).toInt(); |
1450 | day = tmpStr.mid(6,2).toInt(); | 1452 | day = tmpStr.mid(6,2).toInt(); |
1451 | hour = tmpStr.mid(9,2).toInt(); | 1453 | hour = tmpStr.mid(9,2).toInt(); |
1452 | minute = tmpStr.mid(11,2).toInt(); | 1454 | minute = tmpStr.mid(11,2).toInt(); |
1453 | second = tmpStr.mid(13,2).toInt(); | 1455 | second = tmpStr.mid(13,2).toInt(); |
1454 | tmpDate.setYMD(year, month, day); | 1456 | tmpDate.setYMD(year, month, day); |
1455 | tmpTime.setHMS(hour, minute, second); | 1457 | tmpTime.setHMS(hour, minute, second); |
1456 | 1458 | ||
1457 | ASSERT(tmpDate.isValid()); | 1459 | Q_ASSERT(tmpDate.isValid()); |
1458 | ASSERT(tmpTime.isValid()); | 1460 | Q_ASSERT(tmpTime.isValid()); |
1459 | QDateTime tmpDT(tmpDate, tmpTime); | 1461 | QDateTime tmpDT(tmpDate, tmpTime); |
1460 | // correct for GMT if string is in Zulu format | 1462 | // correct for GMT if string is in Zulu format |
1461 | if (dtStr.at(dtStr.length()-1) == 'Z') | 1463 | if (dtStr.at(dtStr.length()-1) == 'Z') |
1462 | tmpDT = tmpDT.addSecs (KGlobal::locale()->localTimeOffset( tmpDT )*60); | 1464 | tmpDT = tmpDT.addSecs (KGlobal::locale()->localTimeOffset( tmpDT )*60); |
1463 | return tmpDT; | 1465 | return tmpDT; |
1464 | } | 1466 | } |
1465 | 1467 | ||
1466 | QDate VCalFormat::ISOToQDate(const QString &dateStr) | 1468 | QDate VCalFormat::ISOToQDate(const QString &dateStr) |
@@ -1643,17 +1645,17 @@ Attendee::Role VCalFormat::readRole(const char *s) const | |||
1643 | 1645 | ||
1644 | if ( statStr == "OWNER") | 1646 | if ( statStr == "OWNER") |
1645 | role = Attendee::Chair; | 1647 | role = Attendee::Chair; |
1646 | // enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair }; | 1648 | // enum Role { ReqParticipant, OptParticipant, NonParticipant, Chair }; |
1647 | 1649 | ||
1648 | return role; | 1650 | return role; |
1649 | } | 1651 | } |
1650 | 1652 | ||
1651 | QCString VCalFormat::writeRole(Attendee::Role role) const | 1653 | Q3CString VCalFormat::writeRole(Attendee::Role role) const |
1652 | { | 1654 | { |
1653 | if ( role == Attendee::Chair ) | 1655 | if ( role == Attendee::Chair ) |
1654 | return "OWNER"; | 1656 | return "OWNER"; |
1655 | return "ATTENDEE"; | 1657 | return "ATTENDEE"; |
1656 | } | 1658 | } |
1657 | Attendee::PartStat VCalFormat::readStatus(const char *s) const | 1659 | Attendee::PartStat VCalFormat::readStatus(const char *s) const |
1658 | { | 1660 | { |
1659 | QString statStr = s; | 1661 | QString statStr = s; |
@@ -1681,17 +1683,17 @@ Attendee::PartStat VCalFormat::readStatus(const char *s) const | |||
1681 | else { | 1683 | else { |
1682 | kdDebug(5800) << "error setting attendee mStatus, unknown mStatus!" << endl; | 1684 | kdDebug(5800) << "error setting attendee mStatus, unknown mStatus!" << endl; |
1683 | status = Attendee::NeedsAction; | 1685 | status = Attendee::NeedsAction; |
1684 | } | 1686 | } |
1685 | 1687 | ||
1686 | return status; | 1688 | return status; |
1687 | } | 1689 | } |
1688 | 1690 | ||
1689 | QCString VCalFormat::writeStatus(Attendee::PartStat status) const | 1691 | Q3CString VCalFormat::writeStatus(Attendee::PartStat status) const |
1690 | { | 1692 | { |
1691 | switch(status) { | 1693 | switch(status) { |
1692 | default: | 1694 | default: |
1693 | case Attendee::NeedsAction: | 1695 | case Attendee::NeedsAction: |
1694 | return "NEEDS ACTION"; | 1696 | return "NEEDS ACTION"; |
1695 | break; | 1697 | break; |
1696 | case Attendee::Accepted: | 1698 | case Attendee::Accepted: |
1697 | return "ACCEPTED"; | 1699 | return "ACCEPTED"; |