Merge lp:~renatofilho/qtorganizer5-eds/fix-1445577 into lp:qtorganizer5-eds
- fix-1445577
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 93 |
Merged at revision: | 87 |
Proposed branch: | lp:~renatofilho/qtorganizer5-eds/fix-1445577 |
Merge into: | lp:qtorganizer5-eds |
Prerequisite: | lp:~renatofilho/qtorganizer5-eds/fix-1437305 |
Diff against target: |
104 lines (+57/-7) 3 files modified
debian/rules (+3/-0) organizer/qorganizer-eds-engine.cpp (+16/-7) tests/unittest/event-test.cpp (+38/-0) |
To merge this branch: | bzr merge lp:~renatofilho/qtorganizer5-eds/fix-1445577 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Charles Kerr (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Renato Araujo Oliveira Filho | Pending | ||
Alan Pope πΊπ§π± π¦ | Pending | ||
Review via email: mp+273278@code.launchpad.net |
This proposal supersedes a proposal from 2015-08-27.
Commit message
Correct save events with UTC format.
Description of the change
Renato Araujo Oliveira Filho (renatofilho) wrote : Posted in a previous version of this proposal | # |
Gary.Wang (gary-wzl77) wrote : Posted in a previous version of this proposal | # |
Actually, there is no such a timezone settings in app. App just follows system timezone.
My Time & Date in system settings
Time zone:
Asia/Shangehai UTC+8
----Create an event (display correctly in weeklyview)
qml: event.name: Ttttt
qml: event.startDate
qml: event.endDateTime: Fri Jul 24 08:00:00 2015 GMT+0800
----Edit an event with only name changed (wrong display and event backs x hours)
qml: event.name: Ttttt-edit
qml: event.startDate
qml: event.endDateTime: Fri Jul 24 08:00:00 2015 GMT+0800
Gary.Wang (gary-wzl77) wrote : Posted in a previous version of this proposal | # |
I check this issue today and find sth as following:
when user modify a event with start or end date time changed, issue wont' occur.
when user modify a event without start datetime and end date time changed, issue occurs.
Reason for this is if start and end date time are not changed when modification, the timeSpec is for these two datetime is Qt::TimeZone instead of Qt::UTC when parsing them, then
tz.id().constData() == "able/localtime" which cause timezone == null and empty for tzId after icaltimezone_
so finally event backs x(timezone) hours after e_cal_client_
As I mentioned above, we follow system timezone and have no way to set timezone in qml.
The easy fix is if start & end datetime are not floating time, then we need to convert Local timezone to UTC time zone.
Please review latest MP.
Thanks
Renato Araujo Oliveira Filho (renatofilho) wrote : Posted in a previous version of this proposal | # |
Could you resubmit this MR adding "https:/
Gary.Wang (gary-wzl77) wrote : Posted in a previous version of this proposal | # |
OK, I will delete this one later on and create another MP for review since I can't resubmit merge proposal in same branch.
Thanks.
Renato Araujo Oliveira Filho (renatofilho) wrote : Posted in a previous version of this proposal | # |
Could you write a small qml code, that reproduce the error?
We can not save all events with 'UTC' timezone it will cause the alarms to fail, we need to have a way to save events without a specific TZ to floating times.
If js does not support datetime with 'Qt::TimeZone' format we should fix the QML bindings to return it in UTC format. (this need to be done in QtOrganizer)
As workaround we can update the start/stop field before save the event (in calendar app) even if the user does not change it.
But first I need to see the small qml app to make sure that we do not have any other solution.
Gary.Wang (gary-wzl77) wrote : Posted in a previous version of this proposal | # |
This issue can be reproduce easily. Just make sure you have non UTC+0 time
zone on your device. e.g. for me UTC+8
Please find simple qml app here
https:/
Regarding workaround, I've tried add one milliseconds for start/end
datetime before when editing an event, it *works*. But strictly speaking, I
think it's just a workaround not a proper fix.
I have no idea beside eds, if there's another plugins for QtOrganizer(what
kind of plugin use by Jolla)? if it works fine with another plugin, I am
afraid issue lies in eds.
Also applying 'UTC' timezone for all events cause alarm(floating time) to
fail, no idea if there is a way to check if edit item type or sth.
Please try the qml code at first to have a check if it can be reproduced on
your device, Thanks.
It seems we can't check current event type is alarms or
On Tue, Sep 8, 2015 at 9:39 PM, Renato Araujo Oliveira Filho <
<email address hidden>> wrote:
> Could you write a small qml code, that reproduce the error?
>
>
> We can not save all events with 'UTC' timezone it will cause the alarms to
> fail, we need to have a way to save events without a specific TZ to
> floating times.
>
> If js does not support datetime with 'Qt::TimeZone' format we should fix
> the QML bindings to return it in UTC format. (this need to be done in
> QtOrganizer)
>
> As workaround we can update the start/stop field before save the event (in
> calendar app) even if the user does not change it.
>
> But first I need to see the small qml app to make sure that we do not have
> any other solution.
>
> --
>
> https:/
> You are the owner of lp:~gary-wzl77/qtorganizer5-eds/fix_1445577.
>
--
Br
Gary.Wzl
Renato Araujo Oliveira Filho (renatofilho) wrote : Posted in a previous version of this proposal | # |
I am trying to reproduce the bug with the example create by Gary. But the log is showing the correct results.
qml: -------------Create event
qml: Birthdays_145 ---- false
qml: Personal ---- false
qml: renatoteste2gma
qml: HolidaysinBrazi
qml: Personal ---- false
qml: Personal ---- true
qml: Birthdays & Anniversaries ---- true
qml: event Name:Test_
qml: startDate: sex out 2 11:58:43 2015 GMT-0300
qml: endDate: sex out 2 12:58:43 2015 GMT-0300
qml: -------------Create event done
qml: -------
qml: editEvent: QDeclarativeOrg
qml: event Name:Test_
qml: startDate: sex out 2 11:58:43 2015 GMT-0300
qml: endDate: sex out 2 12:58:43 2015 GMT-0300
qml: -------
qml:
-------------Edit event
qml: event Name:edit_
qml: startDate: sex out 2 11:58:43 2015 GMT-0300
qml: endDate: sex out 2 12:58:43 2015 GMT-0300
qml: -------------Edit event done
qml: -------
qml: editEvent: QDeclarativeOrg
qml: event Name:edit_
qml: startDate: sex out 2 11:58:43 2015 GMT-0300
qml: endDate: sex out 2 12:58:43 2015 GMT-0300
qml: -------
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:88
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Gary.Wang (gary-wzl77) wrote : | # |
I have a quick testing on your latest MR.
I see you have a UTC checker when saving an event.
It fixes this problem.
Thanks.
PS: I see you can't reproduce this bug on your side from the comment.I think it's because you have UTC+0 timezone for date/time in your system-setting, If you set non-UTC timezone, it can be reproduced 100%.
- 89. By Renato Araujo Oliveira Filho
-
Trunk merged.
- 90. By Renato Araujo Oliveira Filho
-
Updated changelog.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:89
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:90
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
deb: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 91. By Renato Araujo Oliveira Filho
-
Run tests sequential.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:91
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 92. By Renato Araujo Oliveira Filho
-
Create unit test for events saved on UTC timezone.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:92
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 93. By Renato Araujo Oliveira Filho
-
Trunk merged.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:93
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'debian/rules' |
2 | --- debian/rules 2013-08-15 20:50:06 +0000 |
3 | +++ debian/rules 2015-10-29 17:02:24 +0000 |
4 | @@ -10,3 +10,6 @@ |
5 | |
6 | override_dh_auto_configure: |
7 | dh_auto_configure -- -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/address-book-service |
8 | + |
9 | +override_dh_auto_test: |
10 | + ctest -j1 --output-on-failure |
11 | |
12 | === modified file 'organizer/qorganizer-eds-engine.cpp' |
13 | --- organizer/qorganizer-eds-engine.cpp 2015-10-29 17:02:24 +0000 |
14 | +++ organizer/qorganizer-eds-engine.cpp 2015-10-29 17:02:24 +0000 |
15 | @@ -1211,24 +1211,33 @@ |
16 | QDateTime QOrganizerEDSEngine::fromIcalTime(struct icaltimetype value, const char *tzId) |
17 | { |
18 | uint tmTime; |
19 | + bool allDayEvent = icaltime_is_date(value); |
20 | |
21 | // check if ialtimetype contais a time and timezone |
22 | - if (!icaltime_is_date(value) && tzId) { |
23 | + if (!allDayEvent && tzId) { |
24 | + QByteArray tzLocationName; |
25 | icaltimezone *timezone = icaltimezone_get_builtin_timezone_from_tzid(tzId); |
26 | - // fallback: sometimes the tzId contains the location name |
27 | - if (!timezone) { |
28 | - timezone = icaltimezone_get_builtin_timezone(tzId); |
29 | + |
30 | + if (icaltime_is_utc(value)) { |
31 | + tzLocationName = "UTC"; |
32 | + } else { |
33 | + // fallback: sometimes the tzId contains the location name |
34 | + if (!timezone) { |
35 | + timezone = icaltimezone_get_builtin_timezone(tzId); |
36 | + } |
37 | + tzLocationName = QByteArray(icaltimezone_get_location(timezone)); |
38 | } |
39 | + |
40 | tmTime = icaltime_as_timet_with_zone(value, timezone); |
41 | - QByteArray tzLocationName(icaltimezone_get_location(timezone)); |
42 | QTimeZone qTz(tzLocationName); |
43 | return QDateTime::fromTime_t(tmTime, qTz); |
44 | } else { |
45 | tmTime = icaltime_as_timet(value); |
46 | QDateTime t = QDateTime::fromTime_t(tmTime).toUTC(); |
47 | - // floating time contains invalid timezone |
48 | + // all day or floating time events will be saved with invalid timezone |
49 | return QDateTime(t.date(), |
50 | - (icaltime_is_date(value) ? QTime() : t.time()), |
51 | + // if the event is all day event save with emtpy time |
52 | + (allDayEvent ? QTime() : t.time()), |
53 | QTimeZone()); |
54 | } |
55 | } |
56 | |
57 | === modified file 'tests/unittest/event-test.cpp' |
58 | --- tests/unittest/event-test.cpp 2015-10-29 17:02:24 +0000 |
59 | +++ tests/unittest/event-test.cpp 2015-10-29 17:02:24 +0000 |
60 | @@ -901,6 +901,44 @@ |
61 | QVERIFY(vcard.contains("TRIGGER;VALUE=DURATION;RELATED=START:-PT1M")); |
62 | } |
63 | |
64 | + // BUG: #1445577 |
65 | + void testUTCEvent() |
66 | + { |
67 | + static QString displayLabelValue = QStringLiteral("UTC event"); |
68 | + static QString descriptionValue = QStringLiteral("UTC event"); |
69 | + const QDateTime startDate(QDateTime::currentDateTime().toUTC()); |
70 | + |
71 | + QOrganizerEvent event; |
72 | + event.setStartDateTime(startDate); |
73 | + event.setDisplayLabel(displayLabelValue); |
74 | + event.setDescription(descriptionValue); |
75 | + |
76 | + QtOrganizer::QOrganizerManager::Error error; |
77 | + QMap<int, QtOrganizer::QOrganizerManager::Error> errorMap; |
78 | + QList<QOrganizerItem> items; |
79 | + QSignalSpy createdItem(m_engine, SIGNAL(itemsAdded(QList<QOrganizerItemId>))); |
80 | + items << event; |
81 | + bool saveResult = m_engine->saveItems(&items, |
82 | + QList<QtOrganizer::QOrganizerItemDetail::DetailType>(), |
83 | + &errorMap, |
84 | + &error); |
85 | + QTRY_COMPARE(createdItem.count(), 1); |
86 | + QVERIFY(saveResult); |
87 | + |
88 | + QList<QOrganizerItemId> ids; |
89 | + QOrganizerItemFetchHint hint; |
90 | + ids << items[0].id(); |
91 | + QList<QOrganizerItem> newItems = m_engine->items(ids, hint, &errorMap, &error); |
92 | + QCOMPARE(newItems.size(), 1); |
93 | + |
94 | + QOrganizerEvent newEvent = static_cast<QOrganizerEvent>(newItems[0]); |
95 | + QCOMPARE(newEvent.startDateTime().timeZoneAbbreviation(), QStringLiteral("UTC")); |
96 | + QCOMPARE(newEvent.startDateTime().date(), startDate.date()); |
97 | + QCOMPARE(newEvent.startDateTime().time().hour(), startDate.time().hour()); |
98 | + QCOMPARE(newEvent.startDateTime().time().minute(), startDate.time().minute()); |
99 | + QCOMPARE(newEvent.startDateTime().time().second(), startDate.time().second()); |
100 | + } |
101 | + |
102 | void testExtendedProperties() |
103 | { |
104 | static QString displayLabelValue = QStringLiteral("event with extended property"); |
Reading the bug report I would say that the event is losing the timezone when edited. Is the app setting the correct timezone? If the app does not set the timezone the event will be handled as a Floating event.