author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /libkcal/vcalformat.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-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 @@ -21,13 +21,15 @@ #include <qapplication.h> #include <qdatetime.h> #include <qstring.h> -#include <qptrlist.h> +#include <q3ptrlist.h> #include <qregexp.h> #include <qclipboard.h> #include <qdialog.h> #include <qfile.h> +//Added by qt3to4: +#include <Q3CString> #include <kdebug.h> #include <kglobal.h> #include <kmessagebox.h> @@ -107,17 +109,17 @@ bool VCalFormat::save(Calendar *calendar, const QString &fileName) addPropValue(vcal,VCTimeZoneProp, tmpStr.local8Bit()); addPropValue(vcal,VCVersionProp, _VCAL_VERSION); // TODO STUFF - QPtrList<Todo> todoList = mCalendar->rawTodos(); - QPtrListIterator<Todo> qlt(todoList); + Q3PtrList<Todo> todoList = mCalendar->rawTodos(); + Q3PtrListIterator<Todo> qlt(todoList); for (; qlt.current(); ++qlt) { vo = eventToVTodo(qlt.current()); addVObjectProp(vcal, vo); } // EVENT STUFF - QPtrList<Event> events = mCalendar->rawEvents(); + Q3PtrList<Event> events = mCalendar->rawEvents(); Event *ev; for(ev=events.first();ev;ev=events.next()) { vo = eventToVEvent(ev); addVObjectProp(vcal, vo); @@ -137,9 +139,9 @@ bool VCalFormat::save(Calendar *calendar, const QString &fileName) bool VCalFormat::fromString( Calendar *calendar, const QString &text ) { // TODO: Factor out VCalFormat::fromString() - QCString data = text.utf8(); + Q3CString data = text.utf8(); if ( !data.size() ) return false; VObject *vcal = Parse_MIME( data.data(), data.size()); @@ -209,9 +211,9 @@ QString VCalFormat::toString( Calendar *calendar ) addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); // TODO: Use all data. - QPtrList<Event> events = calendar->events(); + Q3PtrList<Event> events = calendar->events(); Event *event = events.first(); if ( !event ) return QString::null; VObject *vevent = eventToVEvent( event ); @@ -270,10 +272,10 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) addPropValue(vtodo, ICOrganizerProp, tmpStr.local8Bit()); // attendees if (anEvent->attendeeCount() != 0) { - QPtrList<Attendee> al = anEvent->attendees(); - QPtrListIterator<Attendee> ai(al); + Q3PtrList<Attendee> al = anEvent->attendees(); + Q3PtrListIterator<Attendee> ai(al); Attendee *curAttendee; for (; ai.current(); ++ai) { curAttendee = ai.current(); @@ -325,9 +327,9 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) tmpStr.sprintf("%i",anEvent->priority()); addPropValue(vtodo, VCPriorityProp, tmpStr.local8Bit()); // related event - if (anEvent->relatedToUid()) { + if (!anEvent->relatedToUid().isEmpty()) { addPropValue(vtodo, VCRelatedToProp, anEvent->relatedToUid().local8Bit()); } @@ -354,9 +356,9 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) } // alarm stuff kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; - QPtrList<Alarm> alarms = anEvent->alarms(); + Q3PtrList<Alarm> alarms = anEvent->alarms(); Alarm* alarm; for (alarm = alarms.first(); alarm; alarm = alarms.next()) { if (alarm->enabled()) { VObject *a; @@ -432,10 +434,10 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) tmpStr = "MAILTO:" + anEvent->organizer(); addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit()); if (anEvent->attendeeCount() != 0) { - QPtrList<Attendee> al = anEvent->attendees(); - QPtrListIterator<Attendee> ai(al); + Q3PtrList<Attendee> al = anEvent->attendees(); + Q3PtrListIterator<Attendee> ai(al); Attendee *curAttendee; // TODO: Put this functionality into Attendee class for (; ai.current(); ++ai) { @@ -460,10 +462,10 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) // recurrence rule stuff if (anEvent->doesRecur()) { // some more variables - QPtrList<Recurrence::rMonthPos> tmpPositions; - QPtrList<int> tmpDays; + Q3PtrList<Recurrence::rMonthPos> tmpPositions; + Q3PtrList<int> tmpDays; int *tmpDay; Recurrence::rMonthPos *tmpPos; QString tmpStr2; int i; @@ -544,9 +546,9 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) tmpStr += tmpStr2; } else if (anEvent->recurrence()->duration() == -1) { tmpStr += "#0"; // defined as repeat forever } else { - tmpStr += qDateTimeToISO(anEvent->recurrence()->endDate(), FALSE); + tmpStr += qDateTimeToISO((QDateTime)anEvent->recurrence()->endDate(), FALSE); } addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit()); } // event repeats @@ -624,9 +626,9 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) } // attachments // TODO: handle binary attachments! - QPtrList<Attachment> attachments = anEvent->attachments(); + Q3PtrList<Attachment> attachments = anEvent->attachments(); for ( Attachment *at = attachments.first(); at; at = attachments.next() ) addPropValue(vevent, VCAttachProp, at->uri().local8Bit()); // resources @@ -635,9 +637,9 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) if (!tmpStr.isEmpty()) addPropValue(vevent, VCResourcesProp, tmpStr.local8Bit()); // alarm stuff - QPtrList<Alarm> alarms = anEvent->alarms(); + Q3PtrList<Alarm> alarms = anEvent->alarms(); Alarm* alarm; for (alarm = alarms.first(); alarm; alarm = alarms.next()) { if (alarm->enabled()) { VObject *a ; @@ -671,9 +673,9 @@ VObject* VCalFormat::eventToVEvent(Event *anEvent) tmpStr.sprintf("%i",anEvent->transparency()); addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); // related event - if (anEvent->relatedToUid()) { + if (!anEvent->relatedToUid().isEmpty()) { addPropValue(vevent, VCRelatedToProp, anEvent->relatedToUid().local8Bit()); } @@ -1407,9 +1409,9 @@ Event* VCalFormat::VEventToEvent(VObject *vevent) QString VCalFormat::qDateToISO(const QDate &qd) { QString tmpStr; - ASSERT(qd.isValid()); + Q_ASSERT(qd.isValid()); tmpStr.sprintf("%.2d%.2d%.2d", qd.year(), qd.month(), qd.day()); return tmpStr; @@ -1419,10 +1421,10 @@ QString VCalFormat::qDateToISO(const QDate &qd) QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) { QString tmpStr; - ASSERT(qdt.date().isValid()); - ASSERT(qdt.time().isValid()); + Q_ASSERT(qdt.date().isValid()); + Q_ASSERT(qdt.time().isValid()); if (zulu && !useLocalTime ) { QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60); tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", tmpDT.date().year(), tmpDT.date().month(), @@ -1453,10 +1455,10 @@ QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr) second = tmpStr.mid(13,2).toInt(); tmpDate.setYMD(year, month, day); tmpTime.setHMS(hour, minute, second); - ASSERT(tmpDate.isValid()); - ASSERT(tmpTime.isValid()); + Q_ASSERT(tmpDate.isValid()); + Q_ASSERT(tmpTime.isValid()); QDateTime tmpDT(tmpDate, tmpTime); // correct for GMT if string is in Zulu format if (dtStr.at(dtStr.length()-1) == 'Z') tmpDT = tmpDT.addSecs (KGlobal::locale()->localTimeOffset( tmpDT )*60); @@ -1647,9 +1649,9 @@ Attendee::Role VCalFormat::readRole(const char *s) const return role; } -QCString VCalFormat::writeRole(Attendee::Role role) const +Q3CString VCalFormat::writeRole(Attendee::Role role) const { if ( role == Attendee::Chair ) return "OWNER"; return "ATTENDEE"; @@ -1685,9 +1687,9 @@ Attendee::PartStat VCalFormat::readStatus(const char *s) const return status; } -QCString VCalFormat::writeStatus(Attendee::PartStat status) const +Q3CString VCalFormat::writeStatus(Attendee::PartStat status) const { switch(status) { default: case Attendee::NeedsAction: |