author | zautrix <zautrix> | 2004-08-20 23:53:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-20 23:53:07 (UTC) |
commit | ab07441b413dff6d478e2c3a39b823b4269931c5 (patch) (unidiff) | |
tree | 5de6576a6c0e20e4af2db7baa5019aa983e2195a /libkcal/vcalformat.cpp | |
parent | bc33238f8038a03e04f25ea608c53e784616fee6 (diff) | |
download | kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.zip kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.tar.gz kdepimpi-ab07441b413dff6d478e2c3a39b823b4269931c5.tar.bz2 |
Sync fixes and fix of config loading bug
-rw-r--r-- | libkcal/vcalformat.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 9307f12..0ebd7d1 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -24,16 +24,17 @@ | |||
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" |
@@ -41,16 +42,17 @@ | |||
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 | { |
@@ -161,34 +163,42 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text ) | |||
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); |
@@ -1429,19 +1439,18 @@ QString VCalFormat::qDateToISO(const QDate &qd) | |||
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(), |