author | zecke <zecke> | 2002-11-02 13:12:09 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-02 13:12:09 (UTC) |
commit | c795a77698b9fc785fb5f04fab8fed33f0570c3f (patch) (unidiff) | |
tree | d34d959a2e2d3937632f1eaea10fbd72cd7ac996 /library/backend | |
parent | 87504764286a40162d74b03f26e040d4142c0cab (diff) | |
download | opie-c795a77698b9fc785fb5f04fab8fed33f0570c3f.zip opie-c795a77698b9fc785fb5f04fab8fed33f0570c3f.tar.gz opie-c795a77698b9fc785fb5f04fab8fed33f0570c3f.tar.bz2 |
Actually use local time in vCal
-rw-r--r-- | library/backend/event.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/library/backend/event.cpp b/library/backend/event.cpp index 7ccf16b..2d02a34 100644 --- a/library/backend/event.cpp +++ b/library/backend/event.cpp | |||
@@ -1102,75 +1102,75 @@ namespace { | |||
1102 | * Convert QDateTime to iso8601 but take | 1102 | * Convert QDateTime to iso8601 but take |
1103 | * local time and do not use the Z at the end | 1103 | * local time and do not use the Z at the end |
1104 | * | 1104 | * |
1105 | */ | 1105 | */ |
1106 | QCString toISOLocal( const QDateTime& dt ) { | 1106 | QCString toISOLocal( const QDateTime& dt ) { |
1107 | QCString str; | 1107 | QCString str; |
1108 | /* | 1108 | /* |
1109 | * year month day T Hour Minute Second | 1109 | * year month day T Hour Minute Second |
1110 | * 4 2 2 2 2 2 digits | 1110 | * 4 2 2 2 2 2 digits |
1111 | */ | 1111 | */ |
1112 | str.sprintf("%04d%02d%02dT%02d%02d%02d", | 1112 | str.sprintf("%04d%02d%02dT%02d%02d%02d", |
1113 | dt.date().year(), | 1113 | dt.date().year(), |
1114 | dt.date().month(), | 1114 | dt.date().month(), |
1115 | dt.date().year(), | 1115 | dt.date().year(), |
1116 | dt.time().hour(), | 1116 | dt.time().hour(), |
1117 | dt.time().minute(), | 1117 | dt.time().minute(), |
1118 | dt.time().second() ); | 1118 | dt.time().second() ); |
1119 | 1119 | ||
1120 | 1120 | ||
1121 | 1121 | ||
1122 | return str; | 1122 | return str; |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | 1125 | ||
1126 | }; | 1126 | }; |
1127 | 1127 | ||
1128 | static VObject *createVObject( const Event &e ) | 1128 | static VObject *createVObject( const Event &e ) |
1129 | { | 1129 | { |
1130 | VObject *vcal = newVObject( VCCalProp ); | 1130 | VObject *vcal = newVObject( VCCalProp ); |
1131 | safeAddPropValue( vcal, VCVersionProp, "1.0" ); | 1131 | safeAddPropValue( vcal, VCVersionProp, "1.0" ); |
1132 | VObject *event = safeAddProp( vcal, VCEventProp ); | 1132 | VObject *event = safeAddProp( vcal, VCEventProp ); |
1133 | 1133 | ||
1134 | safeAddPropValue( event, VCDTstartProp, TimeConversion::toISO8601( e.start() ) ); | 1134 | safeAddPropValue( event, VCDTstartProp, toISOLocal( e.start() ) ); |
1135 | safeAddPropValue( event, VCDTendProp, TimeConversion::toISO8601( e.end() ) ); | 1135 | safeAddPropValue( event, VCDTendProp, toISOLocal( e.end() ) ); |
1136 | safeAddPropValue( event, "X-Qtopia-NOTES", e.description() ); | 1136 | safeAddPropValue( event, "X-Qtopia-NOTES", e.description() ); |
1137 | safeAddPropValue( event, VCDescriptionProp, e.description() ); | 1137 | safeAddPropValue( event, VCDescriptionProp, e.description() ); |
1138 | safeAddPropValue( event, VCLocationProp, e.location() ); | 1138 | safeAddPropValue( event, VCLocationProp, e.location() ); |
1139 | 1139 | ||
1140 | if ( e.hasAlarm() ) { | 1140 | if ( e.hasAlarm() ) { |
1141 | VObject *alarm = safeAddProp( event, VCAAlarmProp ); | 1141 | VObject *alarm = safeAddProp( event, VCAAlarmProp ); |
1142 | QDateTime dt = e.start(); | 1142 | QDateTime dt = e.start(); |
1143 | dt = dt.addSecs( -e.alarmTime()*60 ); | 1143 | dt = dt.addSecs( -e.alarmTime()*60 ); |
1144 | safeAddPropValue( alarm, VCRunTimeProp, TimeConversion::toISO8601( dt ) ); | 1144 | safeAddPropValue( alarm, VCRunTimeProp, toISOLocal( dt ) ); |
1145 | safeAddPropValue( alarm, VCAudioContentProp, | 1145 | safeAddPropValue( alarm, VCAudioContentProp, |
1146 | (e.alarmSound() == Event::Silent ? "silent" : "alarm" ) ); | 1146 | (e.alarmSound() == Event::Silent ? "silent" : "alarm" ) ); |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | safeAddPropValue( event, "X-Qtopia-TIMEZONE", e.timeZone() ); | 1149 | safeAddPropValue( event, "X-Qtopia-TIMEZONE", e.timeZone() ); |
1150 | 1150 | ||
1151 | if ( e.type() == Event::AllDay ) | 1151 | if ( e.type() == Event::AllDay ) |
1152 | safeAddPropValue( event, "X-Qtopia-AllDay", e.timeZone() ); | 1152 | safeAddPropValue( event, "X-Qtopia-AllDay", e.timeZone() ); |
1153 | 1153 | ||
1154 | // ### repeat missing | 1154 | // ### repeat missing |
1155 | 1155 | ||
1156 | // ### categories missing | 1156 | // ### categories missing |
1157 | 1157 | ||
1158 | return vcal; | 1158 | return vcal; |
1159 | } | 1159 | } |
1160 | 1160 | ||
1161 | 1161 | ||
1162 | static Event parseVObject( VObject *obj ) | 1162 | static Event parseVObject( VObject *obj ) |
1163 | { | 1163 | { |
1164 | Event e; | 1164 | Event e; |
1165 | 1165 | ||
1166 | bool haveAlarm = FALSE; | 1166 | bool haveAlarm = FALSE; |
1167 | bool haveStart = FALSE; | 1167 | bool haveStart = FALSE; |
1168 | bool haveEnd = FALSE; | 1168 | bool haveEnd = FALSE; |
1169 | QDateTime alarmTime; | 1169 | QDateTime alarmTime; |
1170 | Event::SoundTypeChoice soundType = Event::Silent; | 1170 | Event::SoundTypeChoice soundType = Event::Silent; |
1171 | 1171 | ||
1172 | VObjectIterator it; | 1172 | VObjectIterator it; |
1173 | initPropIterator( &it, obj ); | 1173 | initPropIterator( &it, obj ); |
1174 | while( moreIteration( &it ) ) { | 1174 | while( moreIteration( &it ) ) { |
1175 | VObject *o = nextVObject( &it ); | 1175 | VObject *o = nextVObject( &it ); |
1176 | QCString name = vObjectName( o ); | 1176 | QCString name = vObjectName( o ); |