-rw-r--r-- | libkcal/phoneformat.cpp | 44 | ||||
-rw-r--r-- | libkcal/vcalformat.cpp | 19 | ||||
-rw-r--r-- | libkcal/vcalformat.h | 5 |
3 files changed, 55 insertions, 13 deletions
diff --git a/libkcal/phoneformat.cpp b/libkcal/phoneformat.cpp index 6276498..1769b37 100644 --- a/libkcal/phoneformat.cpp +++ b/libkcal/phoneformat.cpp | |||
@@ -433,36 +433,41 @@ public: | |||
433 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); | 433 | r->setMonthly( Recurrence::rMonthlyPos, freq, -1 ); |
434 | QBitArray days( 7 ); | 434 | QBitArray days( 7 ); |
435 | days.fill( false ); | 435 | days.fill( false ); |
436 | days.setBit( dayOfWeek - 1 ); | 436 | days.setBit( dayOfWeek - 1 ); |
437 | r->addMonthlyPos( pos, days ); | 437 | r->addMonthlyPos( pos, days ); |
438 | } else if ( rtype == 4 ) { | 438 | } else if ( rtype == 4 ) { |
439 | if ( hasEndDate ) | 439 | if ( hasEndDate ) |
440 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 440 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
441 | else | 441 | else |
442 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); | 442 | r->setYearly( Recurrence::rYearlyMonth, freq, -1 ); |
443 | r->addYearlyNum( startDate.month() ); | 443 | r->addYearlyNum( startDate.month() ); |
444 | } | 444 | } |
445 | } else { | 445 | } else { |
446 | event->recurrence()->unsetRecurs(); | 446 | event->recurrence()->unsetRecurs(); |
447 | } | 447 | } |
448 | 448 | ||
449 | QStringList categoryList; | 449 | QStringList cat = event->categories(); |
450 | categoryList << getCategory( Note ); | 450 | QString nCat = getCategory( Note ); |
451 | event->setCategories( categoryList ); | 451 | |
452 | // strange 0 semms to mean: alarm enabled | 452 | if ( !nCat.isEmpty() ) |
453 | if ( !cat.contains( nCat )) { | ||
454 | cat << nCat; | ||
455 | event->setCategories( cat ); | ||
456 | } | ||
457 | |||
453 | if ( alarm ) { | 458 | if ( alarm ) { |
454 | Alarm *alarm; | 459 | Alarm *alarm; |
455 | if ( event->alarms().count() > 0 ) | 460 | if ( event->alarms().count() > 0 ) |
456 | alarm = event->alarms().first(); | 461 | alarm = event->alarms().first(); |
457 | else { | 462 | else { |
458 | alarm = new Alarm( event ); | 463 | alarm = new Alarm( event ); |
459 | event->addAlarm( alarm ); | 464 | event->addAlarm( alarm ); |
460 | } | 465 | } |
461 | alarm->setType( Alarm::Audio ); | 466 | alarm->setType( Alarm::Audio ); |
462 | alarm->setEnabled( true ); | 467 | alarm->setEnabled( true ); |
463 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); | 468 | int alarmOffset = alarmDt.secsTo( event->dtStart() ); |
464 | alarm->setStartOffset( -alarmOffset ); | 469 | alarm->setStartOffset( -alarmOffset ); |
465 | } else { | 470 | } else { |
466 | Alarm *alarm; | 471 | Alarm *alarm; |
467 | if ( event->alarms().count() > 0 ) { | 472 | if ( event->alarms().count() > 0 ) { |
468 | alarm = event->alarms().first(); | 473 | alarm = event->alarms().first(); |
@@ -519,33 +524,33 @@ public: | |||
519 | if(dt.time().isValid()){ | 524 | if(dt.time().isValid()){ |
520 | const QTime& time = dt.time(); | 525 | const QTime& time = dt.time(); |
521 | timestr.sprintf("T%02d%02d%02d", | 526 | timestr.sprintf("T%02d%02d%02d", |
522 | time.hour(), time.minute(), time.second()); | 527 | time.hour(), time.minute(), time.second()); |
523 | } | 528 | } |
524 | return datestr + timestr; | 529 | return datestr + timestr; |
525 | } | 530 | } |
526 | QDate datefromGSM ( GSM_DateTime*dtp ) { | 531 | QDate datefromGSM ( GSM_DateTime*dtp ) { |
527 | return QDate ( dtp->Year, dtp->Month, dtp->Day ); | 532 | return QDate ( dtp->Year, dtp->Month, dtp->Day ); |
528 | } | 533 | } |
529 | QString getCategory( GSM_CalendarEntry*Note) | 534 | QString getCategory( GSM_CalendarEntry*Note) |
530 | { | 535 | { |
531 | QString CATEGORY; | 536 | QString CATEGORY; |
532 | switch (Note->Type) { | 537 | switch (Note->Type) { |
533 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; | 538 | case GSM_CAL_REMINDER : CATEGORY = QString("Reminder"); break; |
534 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; | 539 | case GSM_CAL_CALL : CATEGORY = QString("Call"); break; |
535 | case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; | 540 | //case GSM_CAL_MEETING : CATEGORY = QString("Meeting"); break; |
536 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; | 541 | case GSM_CAL_BIRTHDAY : CATEGORY = QString("Birthday"); break; |
537 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; | 542 | case GSM_CAL_MEMO : CATEGORY = QString("Memo"); break; |
538 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; | 543 | case GSM_CAL_TRAVEL : CATEGORY = QString("Travel"); break; |
539 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; | 544 | case GSM_CAL_VACATION : CATEGORY = QString("Vacation"); break; |
540 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; | 545 | case GSM_CAL_ALARM : CATEGORY = QString("Alarm"); break; |
541 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; | 546 | case GSM_CAL_DAILY_ALARM : CATEGORY = QString("Daily alarm"); break; |
542 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; | 547 | case GSM_CAL_T_ATHL : CATEGORY = QString("Training/Athletism"); break; |
543 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; | 548 | case GSM_CAL_T_BALL : CATEGORY = QString("Training/Ball Games"); break; |
544 | case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; | 549 | case GSM_CAL_T_CYCL : CATEGORY = QString("Training/Cycling"); break; |
545 | case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; | 550 | case GSM_CAL_T_BUDO : CATEGORY = QString("Training/Budo"); break; |
546 | case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; | 551 | case GSM_CAL_T_DANC : CATEGORY = QString("Training/Dance"); break; |
547 | case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; | 552 | case GSM_CAL_T_EXTR : CATEGORY = QString("Training/Extreme Sports"); break; |
548 | case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; | 553 | case GSM_CAL_T_FOOT : CATEGORY = QString("Training/Football"); break; |
549 | case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; | 554 | case GSM_CAL_T_GOLF : CATEGORY = QString("Training/Golf"); break; |
550 | case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; | 555 | case GSM_CAL_T_GYM : CATEGORY = QString("Training/Gym"); break; |
551 | case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; | 556 | case GSM_CAL_T_HORS : CATEGORY = QString("Training/Horse Races"); break; |
@@ -1057,39 +1062,66 @@ bool PhoneFormat::save( Calendar *calendar) | |||
1057 | file.close(); | 1062 | file.close(); |
1058 | 1063 | ||
1059 | 1064 | ||
1060 | message = i18n(" Parsing temp file ... "); | 1065 | message = i18n(" Parsing temp file ... "); |
1061 | status.setText ( message ); | 1066 | status.setText ( message ); |
1062 | qApp->processEvents(); | 1067 | qApp->processEvents(); |
1063 | GSM_Backup Backup; | 1068 | GSM_Backup Backup; |
1064 | error=GSM_ReadBackupFile( (char*) fileName.latin1() ,&Backup); | 1069 | error=GSM_ReadBackupFile( (char*) fileName.latin1() ,&Backup); |
1065 | qDebug("Read file result %d ",error ); | 1070 | qDebug("Read file result %d ",error ); |
1066 | //algo 4 writing event | 1071 | //algo 4 writing event |
1067 | int max, i; | 1072 | int max, i; |
1068 | procCount = 0; | 1073 | procCount = 0; |
1069 | message = i18n(" Writing event # "); | 1074 | message = i18n(" Writing event # "); |
1070 | if (Backup.Calendar[0] != NULL) { | 1075 | if (Backup.Calendar[0] != NULL) { |
1071 | max = 0; | 1076 | max = 0; |
1072 | while (Backup.Calendar[max]!=NULL) max++; | 1077 | while (Backup.Calendar[max]!=NULL) max++; |
1078 | |||
1079 | GSM_DateTime*dtp; | ||
1080 | |||
1073 | for (i=0;i<max;i++) { | 1081 | for (i=0;i<max;i++) { |
1074 | status.setText ( message + QString::number ( ++procCount ) ); | 1082 | status.setText ( message + QString::number ( ++procCount ) ); |
1075 | qApp->processEvents(); | 1083 | qApp->processEvents(); |
1076 | Note = *Backup.Calendar[i]; | 1084 | Note = *Backup.Calendar[i]; |
1085 | |||
1086 | #if 0 | ||
1087 | int j; | ||
1088 | for (j=0;j<Note.EntriesNum;j++) { | ||
1089 | //qDebug(" for ev"); | ||
1090 | switch (Note.Entries[j].EntryType) { | ||
1091 | case CAL_START_DATETIME: | ||
1092 | //Note->Entries[i].Date.Hour = 5; | ||
1093 | dtp = &Note.Entries[j].Date; | ||
1094 | qDebug("start event %d %d %d - %d %d %d", dtp->Year, dtp->Month, dtp->Day, dtp->Hour, dtp->Minute, dtp->Second ); | ||
1095 | break; | ||
1096 | case CAL_END_DATETIME: | ||
1097 | dtp = &Note.Entries[j].Date; | ||
1098 | qDebug("end event %d %d %d - %d %d %d", dtp->Year, dtp->Month, dtp->Day, dtp->Hour, dtp->Minute, dtp->Second ); | ||
1099 | break; | ||
1100 | } | ||
1101 | } | ||
1102 | int type = Note.Type; | ||
1103 | qDebug(" event type %d - %d %d - %d %d %d",type, GSM_CAL_CALL , GSM_CAL_MEETING ,GSM_CAL_BIRTHDAY, GSM_CAL_MEMO ,GSM_CAL_ALARM ); | ||
1104 | #endif | ||
1105 | |||
1106 | Note.Type = GSM_CAL_MEETING; | ||
1107 | // pending: fix in gammu GSM_ReadBackupFile the type settings | ||
1108 | int loc = Note.Location; | ||
1077 | Note.Location = 0; | 1109 | Note.Location = 0; |
1078 | error=Phone->AddCalendar(&s,&Note); | 1110 | error=Phone->AddCalendar(&s,&Note); |
1079 | qDebug("add event %d %d", error, Note.Location ); | 1111 | qDebug("add event %d %d %d", error, Note.Location, loc ); |
1080 | } | 1112 | } |
1081 | } | 1113 | } |
1082 | //algo 4 writing todo | 1114 | //algo 4 writing todo |
1083 | procCount = 0; | 1115 | procCount = 0; |
1084 | message = i18n(" Writing todo # "); | 1116 | message = i18n(" Writing todo # "); |
1085 | if (Backup.ToDo[0] != NULL) { | 1117 | if (Backup.ToDo[0] != NULL) { |
1086 | max = 0; | 1118 | max = 0; |
1087 | while (Backup.ToDo[max]!=NULL) max++; | 1119 | while (Backup.ToDo[max]!=NULL) max++; |
1088 | for (i=0;i<max;i++) { | 1120 | for (i=0;i<max;i++) { |
1089 | status.setText ( message + QString::number ( ++procCount ) ); | 1121 | status.setText ( message + QString::number ( ++procCount ) ); |
1090 | qApp->processEvents(); | 1122 | qApp->processEvents(); |
1091 | ToDoEntry = *Backup.ToDo[i]; | 1123 | ToDoEntry = *Backup.ToDo[i]; |
1092 | error = Phone->AddToDo(&s,&ToDoEntry); | 1124 | error = Phone->AddToDo(&s,&ToDoEntry); |
1093 | qDebug("add todo %d ", error); | 1125 | qDebug("add todo %d ", error); |
1094 | } | 1126 | } |
1095 | } | 1127 | } |
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 9307f12..0ebd7d1 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -16,49 +16,51 @@ | |||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
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 <qptrlist.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 | 30 | ||
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | ||
32 | #include <kmessagebox.h> | 33 | #include <kmessagebox.h> |
33 | #include <kiconloader.h> | 34 | #include <kiconloader.h> |
34 | #include <klocale.h> | 35 | #include <klocale.h> |
35 | 36 | ||
36 | #include "vcc.h" | 37 | #include "vcc.h" |
37 | #include "vobject.h" | 38 | #include "vobject.h" |
38 | 39 | ||
39 | #include "vcaldrag.h" | 40 | #include "vcaldrag.h" |
40 | #include "calendar.h" | 41 | #include "calendar.h" |
41 | 42 | ||
42 | #include "vcalformat.h" | 43 | #include "vcalformat.h" |
43 | 44 | ||
44 | using namespace KCal; | 45 | using namespace KCal; |
45 | 46 | ||
46 | VCalFormat::VCalFormat() | 47 | VCalFormat::VCalFormat() |
47 | { | 48 | { |
48 | mCalendar = 0; | 49 | mCalendar = 0; |
50 | useLocalTime = false; | ||
49 | } | 51 | } |
50 | 52 | ||
51 | VCalFormat::~VCalFormat() | 53 | VCalFormat::~VCalFormat() |
52 | { | 54 | { |
53 | } | 55 | } |
54 | 56 | ||
55 | bool VCalFormat::load(Calendar *calendar, const QString &fileName) | 57 | bool VCalFormat::load(Calendar *calendar, const QString &fileName) |
56 | { | 58 | { |
57 | mCalendar = calendar; | 59 | mCalendar = calendar; |
58 | 60 | ||
59 | clearException(); | 61 | clearException(); |
60 | 62 | ||
61 | kdDebug(5800) << "VCalFormat::load() " << fileName << endl; | 63 | kdDebug(5800) << "VCalFormat::load() " << fileName << endl; |
62 | 64 | ||
63 | VObject *vcal = 0; | 65 | VObject *vcal = 0; |
64 | 66 | ||
@@ -153,50 +155,58 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text ) | |||
153 | strcmp( vObjectName( curvo ), VCTodoProp ) ); | 155 | strcmp( vObjectName( curvo ), VCTodoProp ) ); |
154 | 156 | ||
155 | if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) { | 157 | if ( strcmp( vObjectName( curvo ), VCEventProp ) == 0 ) { |
156 | Event *event = VEventToEvent( curvo ); | 158 | Event *event = VEventToEvent( curvo ); |
157 | calendar->addEvent( event ); | 159 | calendar->addEvent( event ); |
158 | } else { | 160 | } else { |
159 | kdDebug(5800) << "VCalFormat::fromString(): Unknown object type." << endl; | 161 | kdDebug(5800) << "VCalFormat::fromString(): Unknown object type." << endl; |
160 | deleteVObject( vcal ); | 162 | deleteVObject( vcal ); |
161 | return false; | 163 | return false; |
162 | } | 164 | } |
163 | 165 | ||
164 | deleteVObject( vcal ); | 166 | deleteVObject( vcal ); |
165 | 167 | ||
166 | return true; | 168 | return true; |
167 | } | 169 | } |
168 | 170 | ||
169 | QString VCalFormat::eventToString( Event * event, Calendar *calendar) | 171 | QString VCalFormat::eventToString( Event * event, Calendar *calendar, bool useLocal) |
170 | { | 172 | { |
173 | |||
171 | if ( !event ) return QString::null; | 174 | if ( !event ) return QString::null; |
175 | bool useL = useLocalTime; | ||
176 | useLocalTime = useLocal; | ||
172 | mCalendar = calendar; | 177 | mCalendar = calendar; |
173 | VObject *vevent = eventToVEvent( event ); | 178 | VObject *vevent = eventToVEvent( event ); |
174 | char *buf = writeMemVObject( 0, 0, vevent ); | 179 | char *buf = writeMemVObject( 0, 0, vevent ); |
175 | QString result( buf ); | 180 | QString result( buf ); |
176 | cleanVObject( vevent ); | 181 | cleanVObject( vevent ); |
182 | useLocalTime = useL; | ||
177 | return result; | 183 | return result; |
178 | } | 184 | } |
179 | QString VCalFormat::todoToString( Todo * todo, Calendar *calendar ) | 185 | QString VCalFormat::todoToString( Todo * todo, Calendar *calendar, bool useLocal ) |
180 | { | 186 | { |
187 | |||
181 | if ( !todo ) return QString::null; | 188 | if ( !todo ) return QString::null; |
189 | bool useL = useLocalTime; | ||
190 | useLocalTime = useLocal; | ||
182 | mCalendar = calendar; | 191 | mCalendar = calendar; |
183 | VObject *vevent = eventToVTodo( todo ); | 192 | VObject *vevent = eventToVTodo( todo ); |
184 | char *buf = writeMemVObject( 0, 0, vevent ); | 193 | char *buf = writeMemVObject( 0, 0, vevent ); |
185 | QString result( buf ); | 194 | QString result( buf ); |
186 | cleanVObject( vevent ); | 195 | cleanVObject( vevent ); |
196 | useLocalTime = useL; | ||
187 | return result; | 197 | return result; |
188 | } | 198 | } |
189 | 199 | ||
190 | QString VCalFormat::toString( Calendar *calendar ) | 200 | QString VCalFormat::toString( Calendar *calendar ) |
191 | { | 201 | { |
192 | // TODO: Factor out VCalFormat::asString() | 202 | // TODO: Factor out VCalFormat::asString() |
193 | 203 | ||
194 | VObject *vcal = newVObject(VCCalProp); | 204 | VObject *vcal = newVObject(VCCalProp); |
195 | 205 | ||
196 | addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); | 206 | addPropValue( vcal, VCProdIdProp, CalFormat::productId() ); |
197 | QString tmpStr = mCalendar->getTimeZoneStr(); | 207 | QString tmpStr = mCalendar->getTimeZoneStr(); |
198 | addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); | 208 | addPropValue( vcal, VCTimeZoneProp, tmpStr.local8Bit() ); |
199 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); | 209 | addPropValue( vcal, VCVersionProp, _VCAL_VERSION ); |
200 | 210 | ||
201 | // TODO: Use all data. | 211 | // TODO: Use all data. |
202 | QPtrList<Event> events = calendar->events(); | 212 | QPtrList<Event> events = calendar->events(); |
@@ -1421,35 +1431,34 @@ QString VCalFormat::qDateToISO(const QDate &qd) | |||
1421 | QString tmpStr; | 1431 | QString tmpStr; |
1422 | 1432 | ||
1423 | ASSERT(qd.isValid()); | 1433 | ASSERT(qd.isValid()); |
1424 | 1434 | ||
1425 | tmpStr.sprintf("%.2d%.2d%.2d", | 1435 | tmpStr.sprintf("%.2d%.2d%.2d", |
1426 | qd.year(), qd.month(), qd.day()); | 1436 | qd.year(), qd.month(), qd.day()); |
1427 | return tmpStr; | 1437 | return tmpStr; |
1428 | 1438 | ||
1429 | } | 1439 | } |
1430 | 1440 | ||
1431 | QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) | 1441 | QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu) |
1432 | { | 1442 | { |
1433 | QString tmpStr; | 1443 | QString tmpStr; |
1434 | 1444 | ||
1435 | ASSERT(qdt.date().isValid()); | 1445 | ASSERT(qdt.date().isValid()); |
1436 | ASSERT(qdt.time().isValid()); | 1446 | ASSERT(qdt.time().isValid()); |
1437 | if (zulu) { | 1447 | if (zulu && !useLocalTime ) { |
1438 | QDateTime tmpDT(qdt); | 1448 | QDateTime tmpDT = qdt.addSecs ( -KGlobal::locale()->localTimeOffset( qdt )*60); |
1439 | tmpDT = tmpDT.addSecs(60*(-mCalendar->getTimeZone())); // correct to GMT. | ||
1440 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", | 1449 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2dZ", |
1441 | tmpDT.date().year(), tmpDT.date().month(), | 1450 | tmpDT.date().year(), tmpDT.date().month(), |
1442 | tmpDT.date().day(), tmpDT.time().hour(), | 1451 | tmpDT.date().day(), tmpDT.time().hour(), |
1443 | tmpDT.time().minute(), tmpDT.time().second()); | 1452 | tmpDT.time().minute(), tmpDT.time().second()); |
1444 | } else { | 1453 | } else { |
1445 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d", | 1454 | tmpStr.sprintf("%.2d%.2d%.2dT%.2d%.2d%.2d", |
1446 | qdt.date().year(), qdt.date().month(), | 1455 | qdt.date().year(), qdt.date().month(), |
1447 | qdt.date().day(), qdt.time().hour(), | 1456 | qdt.date().day(), qdt.time().hour(), |
1448 | qdt.time().minute(), qdt.time().second()); | 1457 | qdt.time().minute(), qdt.time().second()); |
1449 | } | 1458 | } |
1450 | return tmpStr; | 1459 | return tmpStr; |
1451 | } | 1460 | } |
1452 | 1461 | ||
1453 | QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr) | 1462 | QDateTime VCalFormat::ISOToQDateTime(const QString & dtStr) |
1454 | { | 1463 | { |
1455 | QDate tmpDate; | 1464 | QDate tmpDate; |
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index 7b9ca26..848be78 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h | |||
@@ -49,34 +49,34 @@ class VCalFormat : public CalFormat { | |||
49 | */ | 49 | */ |
50 | bool load(Calendar *,const QString &fileName); | 50 | bool load(Calendar *,const QString &fileName); |
51 | /** writes out the calendar to disk in vCalendar format. Returns true if | 51 | /** writes out the calendar to disk in vCalendar format. Returns true if |
52 | * successful and false on error. | 52 | * successful and false on error. |
53 | * @param fileName the name of the file | 53 | * @param fileName the name of the file |
54 | */ | 54 | */ |
55 | bool save(Calendar *,const QString &fileName); | 55 | bool save(Calendar *,const QString &fileName); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | Parse string and populate calendar with that information. | 58 | Parse string and populate calendar with that information. |
59 | */ | 59 | */ |
60 | bool fromString( Calendar *, const QString & ); | 60 | bool fromString( Calendar *, const QString & ); |
61 | /** | 61 | /** |
62 | Return calendar information as string. | 62 | Return calendar information as string. |
63 | */ | 63 | */ |
64 | QString toString( Calendar * ); | 64 | QString toString( Calendar * ); |
65 | QString eventToString( Event *, Calendar *calendar ); | 65 | QString eventToString( Event *, Calendar *calendar, bool useLocalTime = true ); |
66 | QString todoToString( Todo * ,Calendar *calendar ); | 66 | QString todoToString( Todo * ,Calendar *calendar, bool useLocalTime = true ); |
67 | 67 | ||
68 | protected: | 68 | protected: |
69 | /** translates a VObject of the TODO type into a Event */ | 69 | /** translates a VObject of the TODO type into a Event */ |
70 | Todo *VTodoToEvent(VObject *vtodo); | 70 | Todo *VTodoToEvent(VObject *vtodo); |
71 | /** translates a VObject into a Event and returns a pointer to it. */ | 71 | /** translates a VObject into a Event and returns a pointer to it. */ |
72 | Event *VEventToEvent(VObject *vevent); | 72 | Event *VEventToEvent(VObject *vevent); |
73 | /** translate a Event into a VTodo-type VObject and return pointer */ | 73 | /** translate a Event into a VTodo-type VObject and return pointer */ |
74 | VObject *eventToVTodo(const Todo *anEvent); | 74 | VObject *eventToVTodo(const Todo *anEvent); |
75 | /** translate a Event into a VObject and returns a pointer to it. */ | 75 | /** translate a Event into a VObject and returns a pointer to it. */ |
76 | VObject* eventToVEvent(const Event *anEvent); | 76 | VObject* eventToVEvent(const Event *anEvent); |
77 | 77 | ||
78 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ | 78 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ |
79 | QString qDateToISO(const QDate &); | 79 | QString qDateToISO(const QDate &); |
80 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ | 80 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ |
81 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); | 81 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); |
82 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a | 82 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a |
@@ -87,24 +87,25 @@ class VCalFormat : public CalFormat { | |||
87 | QDate ISOToQDate(const QString & dtStr); | 87 | QDate ISOToQDate(const QString & dtStr); |
88 | /** takes a vCalendar tree of VObjects, and puts all of them that have | 88 | /** takes a vCalendar tree of VObjects, and puts all of them that have |
89 | * the "event" property into the dictionary, todos in the todo-list, etc. */ | 89 | * the "event" property into the dictionary, todos in the todo-list, etc. */ |
90 | void populate(VObject *vcal); | 90 | void populate(VObject *vcal); |
91 | 91 | ||
92 | /** takes a number 0 - 6 and returns the two letter string of that day, | 92 | /** takes a number 0 - 6 and returns the two letter string of that day, |
93 | * i.e. MO, TU, WE, etc. */ | 93 | * i.e. MO, TU, WE, etc. */ |
94 | const char *dayFromNum(int day); | 94 | const char *dayFromNum(int day); |
95 | /** the reverse of the above function. */ | 95 | /** the reverse of the above function. */ |
96 | int numFromDay(const QString &day); | 96 | int numFromDay(const QString &day); |
97 | 97 | ||
98 | Attendee::PartStat readStatus(const char *s) const; | 98 | Attendee::PartStat readStatus(const char *s) const; |
99 | QCString writeStatus(Attendee::PartStat status) const; | 99 | QCString writeStatus(Attendee::PartStat status) const; |
100 | 100 | ||
101 | private: | 101 | private: |
102 | Calendar *mCalendar; | 102 | Calendar *mCalendar; |
103 | bool useLocalTime; | ||
103 | 104 | ||
104 | QPtrList<Event> mEventsRelate; // events with relations | 105 | QPtrList<Event> mEventsRelate; // events with relations |
105 | QPtrList<Todo> mTodosRelate; // todos with relations | 106 | QPtrList<Todo> mTodosRelate; // todos with relations |
106 | }; | 107 | }; |
107 | 108 | ||
108 | } | 109 | } |
109 | 110 | ||
110 | #endif | 111 | #endif |