summaryrefslogtreecommitdiffstats
path: root/kde/patch/kcalcore/kcalcore_libical3.patch
blob: 0a5155f8c08c295cdaf2e3e79fee37f5e60595dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
From 27eaa211b23a6bb0bcba5a91cf7cadfc1e888e21 Mon Sep 17 00:00:00 2001
From: Allen Winter <winter@kde.org>
Date: Fri, 6 Oct 2017 10:39:20 -0400
Subject: icalformat_p.cpp, icaltimezones.cpp - follow API changes in libical3

---
 src/icalformat_p.cpp  | 11 ++++++-----
 src/icaltimezones.cpp | 10 ++++------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/icalformat_p.cpp b/src/icalformat_p.cpp
index bd1d8a3..c2e4548 100644
--- a/src/icalformat_p.cpp
+++ b/src/icalformat_p.cpp
@@ -2355,7 +2355,6 @@ icaltimetype ICalFormatImpl::writeICalDate(const QDate &date)
     t.second = 0;
 
     t.is_date = 1;
-    t.is_utc = 0;
     t.zone = nullptr;
 
     return t;
@@ -2377,7 +2376,9 @@ icaltimetype ICalFormatImpl::writeICalDateTime(const QDateTime &datetime, bool d
         t.second = datetime.time().second();
     }
     t.zone = nullptr;   // zone is NOT set
-    t.is_utc = datetime.isUtc() ? 1 : 0;
+    if ( datetime.isUtc() ) {
+        t = icaltime_convert_to_zone(t, icaltimezone_get_utc_timezone());
+    }
 
     // _dumpIcaltime( t );
 
@@ -2450,7 +2452,7 @@ icalproperty *ICalFormatImpl::writeICalDateTimeProperty(const icalproperty_kind
     }
 
     KTimeZone ktz;
-    if (!t.is_utc) {
+    if (!icaltime_is_utc(t)) {
         ktz = dt.timeZone();
     }
 
@@ -2483,7 +2484,7 @@ QDateTime ICalFormatImpl::readICalDateTime(icalproperty *p, const icaltimetype &
 //  _dumpIcaltime( t );
 
     KDateTime::Spec timeSpec;
-    if (t.is_utc  ||  t.zone == icaltimezone_get_utc_timezone()) {
+    if (icaltime_is_utc(t) ||  t.zone == icaltimezone_get_utc_timezone()) {
         timeSpec = KDateTime::UTC;   // the time zone is UTC
         utc = false;    // no need to convert to UTC
     } else {
diff --git a/src/icaltimezones.cpp b/src/icaltimezones.cpp
index 2f6d42f..f8f8d5d 100644
--- a/src/icaltimezones.cpp
+++ b/src/icaltimezones.cpp
@@ -54,7 +54,7 @@ static QDateTime toQDateTime(const icaltimetype &t)
 {
     return QDateTime(QDate(t.year, t.month, t.day),
                      QTime(t.hour, t.minute, t.second),
-                     (t.is_utc ? Qt::UTC : Qt::LocalTime));
+                     (icaltime_is_utc(t) ? Qt::UTC : Qt::LocalTime));
 }
 
 // Maximum date for time zone data.
@@ -81,7 +81,6 @@ static icaltimetype writeLocalICalDateTime(const QDateTime &utc, int offset)
     t.second = local.time().second();
     t.is_date = 0;
     t.zone = nullptr;
-    t.is_utc = 0;
     return t;
 }
 
@@ -888,7 +887,7 @@
         }
         case ICAL_LASTMODIFIED_PROPERTY: {
             const icaltimetype t = icalproperty_get_lastmodified(p);
-            if (t.is_utc) {
+            if (icaltime_is_utc(t)) {
                 data->d->lastModified = toQDateTime(t);
             } else {
                 qCDebug(KCALCORE_LOG) << "LAST-MODIFIED not UTC";
@@ -1261,7 +1260,7 @@ bool ICalTimeZoneParser::parsePhase(icalcomponent *c, ICalTimeZonePhase &phase)
     // Convert DTSTART to QDateTime, and from local time to UTC
     const QDateTime localStart = toQDateTime(dtstart);     // local time
     dtstart.second -= prevOffset;
-    dtstart.is_utc = 1;
+    dtstart = icaltime_convert_to_zone(dtstart, icaltimezone_get_utc_timezone());
     const QDateTime utcStart = toQDateTime(icaltime_normalize(dtstart));       // UTC
 
     transitions += utcStart;
@@ -1286,13 +1285,12 @@ bool ICalTimeZoneParser::parsePhase(icalcomponent *c, ICalTimeZonePhase &phase)
                     t.minute = dtstart.minute;
                     t.second = dtstart.second;
                     t.is_date = 0;
-                    t.is_utc = 0;    // dtstart is in local time
                 }
                 // RFC2445 states that RDATE must be in local time,
                 // but we support UTC as well to be safe.
-                if (!t.is_utc) {
+                if (!icaltime_is_utc(t)) {
                     t.second -= prevOffset;    // convert to UTC
-                    t.is_utc = 1;
+                    t = icaltime_convert_to_zone(t, icaltimezone_get_utc_timezone());
                     t = icaltime_normalize(t);
                 }
                 transitions += toQDateTime(t);
-- 
cgit v0.11.2