+calendar_record_h __calendar_get_extended_record(calendar_record_h record, const char *extended_key)
+{
+ calendar_record_h child_record = NULL;
+
+ c_retv_if(!record, child_record);
+ c_retv_if(!CAL_STRLEN(extended_key), child_record);
+
+ calendar_error_e error = CALENDAR_ERROR_NONE;
+
+ unsigned int child_record_count = 0;
+
+ unsigned int property_id = 0;
+
+ if (_calendar_is_task_record(record))
+ property_id = _calendar_todo.extended;
+ else
+ property_id = _calendar_event.extended;
+
+ error = calendar_record_get_child_record_count(record, property_id, &child_record_count);
+ c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_get_child_record_count() is failed(%x)", error);
+
+ int i = 0;
+
+ for (i = 0; i < child_record_count; i++) {
+
+ error = calendar_record_get_child_record_at_p(record, property_id, i, &child_record);
+ if (error != CALENDAR_ERROR_NONE) {
+ ERR("calendar_record_get_child_record_at_p(%d) is failed(%x)", error);
+ continue;
+ }
+
+ char *key = NULL;
+
+ error = calendar_record_get_str_p(child_record, _calendar_extended_property.key, &key);
+ if (error != CALENDAR_ERROR_NONE) {
+ ERR("calendar_record_get_str_p(%d) is failed(%x)", error);
+ continue;
+ }
+
+ if (!CAL_STRCMP(key, extended_key))
+ return child_record;
+
+ }
+
+ return NULL;
+}
+
+void _calendar_set_timezone_city(calendar_record_h record, const char *city)
+{
+ CAL_FN_START;
+
+ c_ret_if(!record);
+ c_ret_if(!CAL_STRLEN(city));
+
+ calendar_record_h child_record = __calendar_get_extended_record(record, CAL_EXTENDED_KEY_TIMEZONE_CITY);
+
+ calendar_error_e error = CALENDAR_ERROR_NONE;
+
+ unsigned int property_id = 0;
+
+ if (_calendar_is_task_record(record))
+ property_id = _calendar_todo.extended;
+ else
+ property_id = _calendar_event.extended;
+
+ if (!child_record) {
+ error = calendar_record_create(_calendar_extended_property._uri, &child_record);
+ c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_create() is failed(%x)", error);
+
+ error = calendar_record_add_child_record(record, property_id, child_record);
+ c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_add_child_record() is failed(%x)", error);
+
+ error = calendar_record_set_str(child_record, _calendar_extended_property.key, CAL_EXTENDED_KEY_TIMEZONE_CITY);
+ c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_set_str() is failed(%x)", error);
+ }
+
+ error = calendar_record_set_str(child_record, _calendar_extended_property.value, city);
+ c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_set_str() is failed(%x)", error);
+}
+
+char * _calendar_get_timezone_city(calendar_record_h record)
+{
+ CAL_FN_START;
+
+ char *timezone_city = NULL;
+
+ c_retv_if(!record, timezone_city);
+
+ calendar_record_h child_record = __calendar_get_extended_record(record, CAL_EXTENDED_KEY_TIMEZONE_CITY);
+
+ if (!child_record)
+ return NULL;
+
+ calendar_error_e error = CALENDAR_ERROR_NONE;
+
+ error = calendar_record_get_str(child_record, _calendar_extended_property.value, &timezone_city);
+ c_warn_if(error != CALENDAR_ERROR_NONE, "calendar_record_get_str() is failed(%x)", error);
+
+ return timezone_city;
+}
+Eina_Bool _calendar_is_event_or_task(calendar_record_h record)
+{
+ c_retv_if(!record, EINA_FALSE);
+
+
+ char* uri = NULL;
+
+ calendar_error_e error = calendar_record_get_uri_p(record, &uri);
+ c_retv_if(error != CALENDAR_ERROR_NONE, EINA_FALSE);
+
+ if (!CAL_STRCMP(uri, _calendar_event._uri) || !CAL_STRCMP(uri, _calendar_todo._uri))
+ return EINA_TRUE;
+
+ return EINA_FALSE;
+}