summaryrefslogtreecommitdiffabout
path: root/libkcal/vcalformat.cpp
Side-by-side diff
Diffstat (limited to 'libkcal/vcalformat.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/vcalformat.cpp19
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
@@ -29,6 +29,7 @@
#include <qfile.h>
#include <kdebug.h>
+#include <kglobal.h>
#include <kmessagebox.h>
#include <kiconloader.h>
#include <klocale.h>
@@ -46,6 +47,7 @@ using namespace KCal;
VCalFormat::VCalFormat()
{
mCalendar = 0;
+ useLocalTime = false;
}
VCalFormat::~VCalFormat()
@@ -166,24 +168,32 @@ bool VCalFormat::fromString( Calendar *calendar, const QString &text )
return true;
}
-QString VCalFormat::eventToString( Event * event, Calendar *calendar)
+QString VCalFormat::eventToString( Event * event, Calendar *calendar, bool useLocal)
{
+
if ( !event ) return QString::null;
+ bool useL = useLocalTime;
+ useLocalTime = useLocal;
mCalendar = calendar;
VObject *vevent = eventToVEvent( event );
char *buf = writeMemVObject( 0, 0, vevent );
QString result( buf );
cleanVObject( vevent );
+ useLocalTime = useL;
return result;
}
-QString VCalFormat::todoToString( Todo * todo, Calendar *calendar )
+QString VCalFormat::todoToString( Todo * todo, Calendar *calendar, bool useLocal )
{
+
if ( !todo ) return QString::null;
+ bool useL = useLocalTime;
+ useLocalTime = useLocal;
mCalendar = calendar;
VObject *vevent = eventToVTodo( todo );
char *buf = writeMemVObject( 0, 0, vevent );
QString result( buf );
cleanVObject( vevent );
+ useLocalTime = useL;
return result;
}
@@ -1434,9 +1444,8 @@ QString VCalFormat::qDateTimeToISO(const QDateTime &qdt, bool zulu)
ASSERT(qdt.date().isValid());
ASSERT(qdt.time().isValid());
- if (zulu) {
- QDateTime tmpDT(qdt);
- tmpDT = tmpDT.addSecs(60*(-mCalendar->getTimeZone())); // correct to GMT.
+ 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(),
tmpDT.date().day(), tmpDT.time().hour(),