[evolution-ews] Bug 788202 - Convert Task dates to time zone set in Evolution
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-ews] Bug 788202 - Convert Task dates to time zone set in Evolution
- Date: Thu, 29 Mar 2018 14:10:13 +0000 (UTC)
commit 49e3133af0a382104a59ce0bf182e8f69ca410c8
Author: Milan Crha <mcrha redhat com>
Date: Thu Mar 29 16:10:58 2018 +0200
Bug 788202 - Convert Task dates to time zone set in Evolution
src/calendar/e-cal-backend-ews.c | 8 +++++---
src/server/CMakeLists.txt | 3 +++
src/server/e-ews-calendar-utils.c | 9 +++++++++
3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-ews.c b/src/calendar/e-cal-backend-ews.c
index 1d48492..4430a13 100644
--- a/src/calendar/e-cal-backend-ews.c
+++ b/src/calendar/e-cal-backend-ews.c
@@ -38,6 +38,7 @@
#include <libical/icalproperty.h>
#include <libical/icalparameter.h>
+#include <calendar/gui/calendar-config.h>
#include <calendar/gui/itip-utils.h>
#include "server/e-source-ews-folder.h"
@@ -418,13 +419,14 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
}
if (item_type == E_EWS_ITEM_TYPE_TASK) {
+ icaltimezone *user_timezone = calendar_config_get_icaltimezone ();
const gchar *percent_complete;
/*start date*/
has_this_date = FALSE;
e_ews_item_task_has_start_date (item, &has_this_date);
if (has_this_date) {
- start_date = icaltime_from_timet_with_zone (e_ews_item_get_start_date (item),
0, utc_zone);
+ start_date = icaltime_from_timet_with_zone (e_ews_item_get_start_date (item),
0, user_timezone);
start_date.is_date = 1;
icalprop = icalproperty_new_dtstart (start_date);
icalcomponent_add_property (icalcomp, icalprop);
@@ -453,7 +455,7 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
/*due date*/
e_ews_item_task_has_due_date (item, &has_this_date);
if (has_this_date) {
- due_date = icaltime_from_timet_with_zone (e_ews_item_get_due_date (item), 0,
utc_zone);
+ due_date = icaltime_from_timet_with_zone (e_ews_item_get_due_date (item), 0,
user_timezone);
due_date.is_date = 1;
icalprop = icalproperty_new_due (due_date);
icalcomponent_add_property (icalcomp, icalprop);
@@ -463,7 +465,7 @@ ecb_ews_item_to_component_sync (ECalBackendEws *cbews,
has_this_date = FALSE;
e_ews_item_task_has_complete_date (item, &has_this_date);
if (has_this_date) {
- complete_date = icaltime_from_timet_with_zone (e_ews_item_get_complete_date
(item), 0, utc_zone);
+ complete_date = icaltime_from_timet_with_zone (e_ews_item_get_complete_date
(item), 0, user_timezone);
icalprop = icalproperty_new_completed (complete_date);
icalcomponent_add_property (icalcomp, icalprop);
}
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
index 5b2ab0c..e33acef 100644
--- a/src/server/CMakeLists.txt
+++ b/src/server/CMakeLists.txt
@@ -54,6 +54,7 @@ target_compile_definitions(evolution-ews PRIVATE
target_compile_options(evolution-ews PUBLIC
${CAMEL_CFLAGS}
+ ${EVOLUTION_CALENDAR_CFLAGS}
${LIBEBACKEND_CFLAGS}
${LIBECAL_CFLAGS}
${LIBEDATACAL_CFLAGS}
@@ -69,6 +70,7 @@ target_include_directories(evolution-ews PUBLIC
${CMAKE_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
${CAMEL_INCLUDE_DIRS}
+ ${EVOLUTION_CALENDAR_INCLUDE_DIRS}
${LIBEBACKEND_INCLUDE_DIRS}
${LIBECAL_INCLUDE_DIRS}
${LIBEDATACAL_INCLUDE_DIRS}
@@ -79,6 +81,7 @@ target_include_directories(evolution-ews PUBLIC
target_link_libraries(evolution-ews
${CAMEL_LDFLAGS}
+ ${EVOLUTION_CALENDAR_LDFLAGS}
${LIBEBACKEND_LDFLAGS}
${LIBECAL_LDFLAGS}
${LIBEDATACAL_LDFLAGS}
diff --git a/src/server/e-ews-calendar-utils.c b/src/server/e-ews-calendar-utils.c
index 406e87c..19d2e38 100644
--- a/src/server/e-ews-calendar-utils.c
+++ b/src/server/e-ews-calendar-utils.c
@@ -21,6 +21,7 @@
#include <glib/gi18n-lib.h>
#include <libecal/libecal.h>
+#include <calendar/gui/calendar-config.h>
#include "e-ews-message.h"
#include "ews-errors.h"
@@ -395,6 +396,7 @@ e_ews_cal_utils_set_time (ESoapMessage *msg,
icaltimetype *tt,
gboolean with_timezone)
{
+ struct icaltimetype local_tt;
gchar *str;
gchar *tz_ident = NULL;
@@ -422,6 +424,13 @@ e_ews_cal_utils_set_time (ESoapMessage *msg,
}
}
+ if (tt->is_date) {
+ local_tt = *tt;
+ local_tt.zone = calendar_config_get_icaltimezone ();
+ local_tt = icaltime_from_timet_with_zone (icaltime_as_timet_with_zone (local_tt,
local_tt.zone), FALSE, icaltimezone_get_utc_timezone ());
+ tt = &local_tt;
+ }
+
str = g_strdup_printf (
"%04d-%02d-%02dT%02d:%02d:%02d%s",
tt->year, tt->month, tt->day,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]