summaryrefslogtreecommitdiff
authorzecke <zecke>2002-11-02 13:00:32 (UTC)
committer zecke <zecke>2002-11-02 13:00:32 (UTC)
commit87504764286a40162d74b03f26e040d4142c0cab (patch) (unidiff)
treed2dd2ccee3d42a8818a5adc2d63c609403ea04b3
parentffd0a764e4ac7f9bf29edf3b9b4d341e153ecf4a (diff)
downloadopie-87504764286a40162d74b03f26e040d4142c0cab.zip
opie-87504764286a40162d74b03f26e040d4142c0cab.tar.gz
opie-87504764286a40162d74b03f26e040d4142c0cab.tar.bz2
Until Opie is compatible to RFC2445 we will beam
vCal Events in local time. So lousy handys (my Nokia6210) gets the dates 'right'
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/backend/event.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/library/backend/event.cpp b/library/backend/event.cpp
index 7cac314..7ccf16b 100644
--- a/library/backend/event.cpp
+++ b/library/backend/event.cpp
@@ -1086,16 +1086,50 @@ static inline VObject *safeAddPropValue( VObject *o, const char *prop, const QSt
1086static inline VObject *safeAddProp( VObject *o, const char *prop) 1086static inline VObject *safeAddProp( VObject *o, const char *prop)
1087{ 1087{
1088 VObject *ret = 0; 1088 VObject *ret = 0;
1089 if ( o ) 1089 if ( o )
1090 ret = addProp( o, prop ); 1090 ret = addProp( o, prop );
1091 return ret; 1091 return ret;
1092} 1092}
1093 1093
1094/*
1095 * Until we support vCal/iCal right
1096 * we will make DTSTART and other things
1097 * be floating in the sense of
1098 * RFC 2445
1099 */
1100namespace {
1101/*
1102 * Convert QDateTime to iso8601 but take
1103 * local time and do not use the Z at the end
1104 *
1105 */
1106 QCString toISOLocal( const QDateTime& dt ) {
1107 QCString str;
1108 /*
1109 * year month day T Hour Minute Second
1110 * 4 2 2 2 2 2 digits
1111 */
1112 str.sprintf("%04d%02d%02dT%02d%02d%02d",
1113 dt.date().year(),
1114 dt.date().month(),
1115 dt.date().year(),
1116 dt.time().hour(),
1117 dt.time().minute(),
1118 dt.time().second() );
1119
1120
1121
1122 return str;
1123 }
1124
1125
1126};
1127
1094static VObject *createVObject( const Event &e ) 1128static VObject *createVObject( const Event &e )
1095{ 1129{
1096 VObject *vcal = newVObject( VCCalProp ); 1130 VObject *vcal = newVObject( VCCalProp );
1097 safeAddPropValue( vcal, VCVersionProp, "1.0" ); 1131 safeAddPropValue( vcal, VCVersionProp, "1.0" );
1098 VObject *event = safeAddProp( vcal, VCEventProp ); 1132 VObject *event = safeAddProp( vcal, VCEventProp );
1099 1133
1100 safeAddPropValue( event, VCDTstartProp, TimeConversion::toISO8601( e.start() ) ); 1134 safeAddPropValue( event, VCDTstartProp, TimeConversion::toISO8601( e.start() ) );
1101 safeAddPropValue( event, VCDTendProp, TimeConversion::toISO8601( e.end() ) ); 1135 safeAddPropValue( event, VCDTendProp, TimeConversion::toISO8601( e.end() ) );