Bug 245043 - When saving to ical file, ktimetracker adds timezone info to DTSTART but not to DTEND
Summary: When saving to ical file, ktimetracker adds timezone info to DTSTART but not ...
Status: RESOLVED FIXED
Alias: None
Product: ktimetracker
Classification: Applications
Component: general (other bugs)
Version First Reported In: 4.6.x
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Thorsten Staerk
URL:
Keywords:
: 206734 233027 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-18 15:25 UTC by Dion Moult
Modified: 2011-10-14 11:44 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 4.7.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dion Moult 2010-07-18 15:25:03 UTC
Version:           4.4.2 (using KDE 4.4.4) 
OS:                Linux

Title really says it all.

Reproducible: Always

Steps to Reproduce:
Here is a demo ical file saved by KTimeTracker: http://e2-productions.com/pim/calendars/timetracker.ics

Actual Results:  
Look at it in any decent calendar app, I used KOrganiser. Times will be skewed and quite nonsensical.

Expected Results:  
This PHP Calendar application shows it "correctly":
http://e2-productions.com/pim/day.php?cal=calendar,routine,timetracker&getdate=20100718

I say "correctly" in quotes because even though the webapp shows what I expected to see, that is only because it completely ignores timezones.
Comment 1 Reinhold Kainhofer 2010-07-21 20:54:02 UTC
I completely agree with that report. As the end times are exported in UTC (i.e. a Z appended to the time!), any calendar application that uses timezones will use the correct UTC time, so all events are way too long (here in Europe) or way too short (in timezones with UTC+XX)... This is really bad, as interoperability with KOrganizer is widely announced on the homepage and in the help.

It shouldn't be too hard, as the timezone is already correctly set for the start time. All that needs to be done is to copy the appropriate call for the end time, too.
Comment 2 Thorsten Staerk 2010-07-22 05:57:52 UTC
I cannot fix this because I have not been able to compile kdepim for months. Nightmare! People render the build impossible without telling anyone what they are thinking again and again.

The problem is not the I need to fix my building environment. The problem is that I need a weekend to fix my building environment and that next weekend I would need to do the same. That is why I don't do it.
Comment 3 Dion Moult 2010-07-22 06:08:05 UTC
Do you think we could get this in before 4.5?
This page (http://community.kde.org/Promo/Strategy/Akonadi) states that KDEPIM is nearing stabilisation.
Comment 4 Thorsten Staerk 2010-07-22 22:43:54 UTC
Dion, thank you for your question and sorry I am not able to answer it.

Good news: I got kdepim to build today.
Bad news: My vacation is now over.
Ergo: Your chance to step in and show you are a coding hero :)
Comment 5 Thorsten Staerk 2011-09-28 10:12:33 UTC
Reinhold, Sergio, Dion,

I wrote a tutorial in order to better work on this: http://techbase.kde.org/Development/Tutorials/PIM/ical

And I made my build environment working. Bug fixing can start!
Comment 6 Thorsten Staerk 2011-09-28 10:32:42 UTC
Here is an example how dtStart is set, timetrackerstorage.cpp, line 888:
            e->setDtStart(KDateTime::currentLocalDateTime());
Here is an example how dtEnd is set, timetrackerstorage.cpp, line 909 ff:
                QString s=when.toString("yyyy-MM-ddThh:mm:ss.zzzZ"); // need the KDE standard from the ISO standard, not the QT one
                KDateTime kwhen=KDateTime::fromString(s);
                kDebug() << "kwhen ==" <<  kwhen;
                (*i)->setDtEnd(kwhen);

The problem is that I am converting a QDateTime to a KDateTime and I don't see a possibility of doing this but QDateTime::toString("yyyy-MM-ddThh:mm:ss.zzzZ")
Comment 7 Thorsten Staerk 2011-09-28 10:41:02 UTC
this patch resolves it. Still to check:
- other occurences of setDtEnd. What does bookTime mean?

diff --git a/ktimetracker/timetrackerstorage.cpp b/ktimetracker/timetrackerstorage.cpp
index 54fa1cb..4d499d2 100644
--- a/ktimetracker/timetrackerstorage.cpp
+++ b/ktimetracker/timetrackerstorage.cpp
@@ -906,10 +906,7 @@ void timetrackerstorage::stopTimer( const Task* task, const QDateTime &when )
             if (!(*i)->hasEndDate())
             {
                 kDebug(5970) << "this event has no enddate";
-                QString s=when.toString("yyyy-MM-ddThh:mm:ss.zzzZ"); // need the KDE standard from the ISO standard, not the QT one
-                KDateTime kwhen=KDateTime::fromString(s);
-                kDebug() << "kwhen ==" <<  kwhen;
-                (*i)->setDtEnd(kwhen);
+                (*i)->setDtEnd(KDateTime(when, KDateTime::Spec::LocalZone()));
             }
             else
             {
Comment 8 Thorsten Staerk 2011-09-28 10:50:31 UTC
Git commit 4bc7bb091c622a2ba1919e52b6b3c4103e9ac0be by Thorsten Staerk.
Committed on 28/09/2011 at 12:49.
Pushed by tstaerk into branch 'master'.

Set DtEnd with TimeZoneID.

BUGS:245043

M  +1    -25   ktimetracker/timetrackerstorage.cpp
M  +0    -19   ktimetracker/timetrackerstorage.h
M  +0    -54   ktimetracker/timetrackerwidget.cpp
M  +0    -1    ktimetracker/timetrackerwidget.h

http://commits.kde.org/kdepim/4bc7bb091c622a2ba1919e52b6b3c4103e9ac0be
Comment 9 Thorsten Staerk 2011-09-28 11:00:45 UTC
Fixed in 4.8
Comment 10 Thorsten Staerk 2011-09-28 15:18:55 UTC
*** Bug 206734 has been marked as a duplicate of this bug. ***
Comment 11 Thorsten Staerk 2011-10-03 03:48:35 UTC
Git commit 99088965bc17d40a1b64463f5de05550fd615873 by Thorsten Staerk.
Committed on 03/10/2011 at 05:47.
Pushed by tstaerk into branch 'KDE/4.7'.

Use same timezone for dtStart and dtEnd.
BUGS:245043

M  +1    -4    ktimetracker/timetrackerstorage.cpp

http://commits.kde.org/kdepim/99088965bc17d40a1b64463f5de05550fd615873
Comment 12 Thorsten Staerk 2011-10-03 15:43:35 UTC
Git commit d96b1393e2fb03a82871a70fbf17c27540bfb834 by Thorsten Staerk.
Committed on 03/10/2011 at 17:43.
Pushed by tstaerk into branch 'master'.

Do not add UTC difference when exporting history.
BUGS:188769,210905
CCBUGS:245043

M  +4    -7    ktimetracker/timetrackerstorage.cpp

http://commits.kde.org/kdepim/d96b1393e2fb03a82871a70fbf17c27540bfb834
Comment 13 Thorsten Staerk 2011-10-14 11:44:47 UTC
*** Bug 233027 has been marked as a duplicate of this bug. ***