/** * Assign the sensitivity to the icommon parameter which corresponds to the * classification which is set in ecalcomp. * * @param e_cal_comp * @param i_common */ static void sensitivity_e_to_i(const ECalComponent *e_cal_comp, I_common *i_common) { ECalComponentClassification classif; e_cal_component_get_classification((ECalComponent*) e_cal_comp, &classif); switch (classif) { case E_CAL_COMPONENT_CLASS_PUBLIC: i_common->sensitivity = ICOMMON_SENSITIVITY_PUBLIC; break; case E_CAL_COMPONENT_CLASS_PRIVATE: i_common->sensitivity = ICOMMON_SENSITIVITY_PRIVATE; break; case E_CAL_COMPONENT_CLASS_CONFIDENTIAL: i_common->sensitivity = ICOMMON_SENSITIVITY_CONFIDENTIAL; break; default: i_common->sensitivity = ICOMMON_SENSITIVITY_PUBLIC; break; } }
static gboolean matches_classification (ECalComponent *comp, const gchar *str) { ECalComponentClassification classification; ECalComponentClassification classification1; if (!*str) return FALSE; if (g_str_equal (str, "Public")) classification1 = E_CAL_COMPONENT_CLASS_PUBLIC; else if (g_str_equal (str, "Private")) classification1 = E_CAL_COMPONENT_CLASS_PRIVATE; else if (g_str_equal (str, "Confidential")) classification1 = E_CAL_COMPONENT_CLASS_CONFIDENTIAL; else classification1 = E_CAL_COMPONENT_CLASS_UNKNOWN; e_cal_component_get_classification (comp, &classification); return (classification == classification1 ? TRUE : FALSE); }
/* * converts a ECalComponent object to a EMemoLocalRecord */ static void local_record_from_comp (EMemoLocalRecord *local, ECalComponent *comp, EMemoConduitContext *ctxt) { const char *uid; GSList *d_list = NULL; ECalComponentText *description; ECalComponentClassification classif; LOG (g_message ( "local_record_from_comp\n" )); g_return_if_fail (local != NULL); g_return_if_fail (comp != NULL); local->comp = comp; g_object_ref (comp); LOG(fprintf(stderr, "local_record_from_comp: calling e_cal_component_get_uid\n")); e_cal_component_get_uid (local->comp, &uid); LOG(fprintf(stderr, "local_record_from_comp: got UID - %s, calling e_pilot_map_lookup_pid\n", uid)); local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid, TRUE); LOG(fprintf(stderr, "local_record_from_comp: local->local.ID == %lu\n", local->local.ID)); compute_status (ctxt, local, uid); LOG(fprintf(stderr, "local_record_from_comp: local->local.attr: %d\n", local->local.attr)); local->memo = g_new0 (struct Memo,1); /* Don't overwrite the category */ if (local->local.ID != 0) { #ifdef PILOT_LINK_0_12 struct Memo memo; pi_buffer_t * record; #else char record[0xffff]; #endif int cat = 0; #ifdef PILOT_LINK_0_12 record = pi_buffer_new(DLP_BUF_SIZE); if(record == NULL){ pi_set_error(ctxt->dbi->pilot_socket, PI_ERR_GENERIC_MEMORY); return; } #endif LOG(fprintf(stderr, "local_record_from_comp: calling dlp_ReadRecordById\n")); if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, ctxt->dbi->db_handle, #ifdef PILOT_LINK_0_12 local->local.ID, record, NULL, NULL, &cat) > 0) { local->local.category = cat; memset (&memo, 0, sizeof (struct Memo)); unpack_Memo (&memo, record, memo_v1); local->memo->text = strdup (memo.text); free_Memo (&memo); } pi_buffer_free (record); #else local->local.ID, &record, NULL, NULL, NULL, &cat) > 0) { local->local.category = cat; } #endif LOG(fprintf(stderr, "local_record_from_comp: done calling dlp_ReadRecordById\n")); } /*Category support*/ e_pilot_local_category_to_remote(&(local->local.category), comp, &(ctxt->ai.category)); /* STOP: don't replace these with g_strdup, since free_Memo uses free to deallocate */ e_cal_component_get_description_list (comp, &d_list); if (d_list) { description = (ECalComponentText *) d_list->data; if (description && description->value){ local->memo->text = e_pilot_utf8_to_pchar (description->value); } else{ local->memo->text = NULL; } } else { local->memo->text = NULL; } e_cal_component_get_classification (comp, &classif); if (classif == E_CAL_COMPONENT_CLASS_PRIVATE) local->local.secret = 1; else local->local.secret = 0; local->local.archived = 0; }
static void preview_comp (EWebViewPreview *preview, ECalComponent *comp) { ECalComponentText text = { 0 }; ECalComponentDateTime dt; ECalComponentClassification classif; const gchar *str; gchar *tmp; gint percent; gboolean have; GHashTable *timezones; icaltimezone *users_zone; GSList *slist, *l; g_return_if_fail (preview != NULL); g_return_if_fail (comp != NULL); timezones = g_object_get_data (G_OBJECT (preview), "iCalImp-timezones"); users_zone = g_object_get_data (G_OBJECT (preview), "iCalImp-userszone"); str = NULL; switch (e_cal_component_get_vtype (comp)) { case E_CAL_COMPONENT_EVENT: str = e_cal_component_has_attendees (comp) ? C_("iCalImp", "Meeting") : C_("iCalImp", "Event"); break; case E_CAL_COMPONENT_TODO: str = C_("iCalImp", "Task"); break; case E_CAL_COMPONENT_JOURNAL: str = C_("iCalImp", "Memo"); break; default: str = "??? Other ???"; break; } have = FALSE; if (e_cal_component_has_recurrences (comp)) { e_web_view_preview_add_section (preview, have ? NULL : str, C_("iCalImp", "has recurrences")); have = TRUE; } if (e_cal_component_is_instance (comp)) { e_web_view_preview_add_section (preview, have ? NULL : str, C_("iCalImp", "is an instance")); have = TRUE; } if (e_cal_component_has_alarms (comp)) { e_web_view_preview_add_section (preview, have ? NULL : str, C_("iCalImp", "has reminders")); have = TRUE; } if (e_cal_component_has_attachments (comp)) { e_web_view_preview_add_section (preview, have ? NULL : str, C_("iCalImp", "has attachments")); have = TRUE; } if (!have) { e_web_view_preview_add_section (preview, str, ""); } str = NULL; classif = E_CAL_COMPONENT_CLASS_NONE; e_cal_component_get_classification (comp, &classif); if (classif == E_CAL_COMPONENT_CLASS_PUBLIC) { /* Translators: Appointment's classification */ str = C_("iCalImp", "Public"); } else if (classif == E_CAL_COMPONENT_CLASS_PRIVATE) { /* Translators: Appointment's classification */ str = C_("iCalImp", "Private"); } else if (classif == E_CAL_COMPONENT_CLASS_CONFIDENTIAL) { /* Translators: Appointment's classification */ str = C_("iCalImp", "Confidential"); } if (str) /* Translators: Appointment's classification section name */ e_web_view_preview_add_section (preview, C_("iCalImp", "Classification"), str); e_cal_component_get_summary (comp, &text); if ((text.value && *text.value) || (text.altrep && *text.altrep)) /* Translators: Appointment's summary */ e_web_view_preview_add_section (preview, C_("iCalImp", "Summary"), (text.value && *text.value) ? text.value : text.altrep); str = NULL; e_cal_component_get_location (comp, &str); if (str && *str) /* Translators: Appointment's location */ e_web_view_preview_add_section (preview, C_("iCalImp", "Location"), str); dt.value = NULL; e_cal_component_get_dtstart (comp, &dt); if (dt.value) { tmp = format_dt (&dt, timezones, users_zone); if (tmp) /* Translators: Appointment's start time */ e_web_view_preview_add_section (preview, C_("iCalImp", "Start"), tmp); g_free (tmp); } e_cal_component_free_datetime (&dt); dt.value = NULL; e_cal_component_get_due (comp, &dt); if (dt.value) { tmp = format_dt (&dt, timezones, users_zone); if (tmp) /* Translators: 'Due' like the time due a task should be finished */ e_web_view_preview_add_section (preview, C_("iCalImp", "Due"), tmp); g_free (tmp); } else { e_cal_component_free_datetime (&dt); dt.value = NULL; e_cal_component_get_dtend (comp, &dt); if (dt.value) { tmp = format_dt (&dt, timezones, users_zone); if (tmp) /* Translators: Appointment's end time */ e_web_view_preview_add_section (preview, C_("iCalImp", "End"), tmp); g_free (tmp); } } e_cal_component_free_datetime (&dt); str = NULL; e_cal_component_get_categories (comp, &str); if (str && *str) /* Translators: Appointment's categories */ e_web_view_preview_add_section (preview, C_("iCalImp", "Categories"), str); percent = e_cal_component_get_percent_as_int (comp); if (percent >= 0) { tmp = NULL; if (percent == 100) { icaltimetype *completed = NULL; e_cal_component_get_completed (comp, &completed); if (completed) { dt.tzid = "UTC"; dt.value = completed; tmp = format_dt (&dt, timezones, users_zone); e_cal_component_free_icaltimetype (completed); } } if (!tmp) tmp = g_strdup_printf ("%d%%", percent); /* Translators: Appointment's complete value (either percentage, or a date/time of a completion) */ e_web_view_preview_add_section (preview, C_("iCalImp", "Completed"), tmp); g_free (tmp); } str = NULL; e_cal_component_get_url (comp, &str); if (str && *str) /* Translators: Appointment's URL */ e_web_view_preview_add_section (preview, C_("iCalImp", "URL"), str); if (e_cal_component_has_organizer (comp)) { ECalComponentOrganizer organizer = { 0 }; e_cal_component_get_organizer (comp, &organizer); if (organizer.value && *organizer.value) { if (organizer.cn && *organizer.cn) { tmp = g_strconcat (organizer.cn, " <", strip_mailto (organizer.value), ">", NULL); /* Translators: Appointment's organizer */ e_web_view_preview_add_section (preview, C_("iCalImp", "Organizer"), tmp); g_free (tmp); } else { e_web_view_preview_add_section (preview, C_("iCalImp", "Organizer"), strip_mailto (organizer.value)); } } } if (e_cal_component_has_attendees (comp)) { GSList *attendees = NULL, *a; have = FALSE; e_cal_component_get_attendee_list (comp, &attendees); for (a = attendees; a; a = a->next) { ECalComponentAttendee *attnd = a->data; if (!attnd || !attnd->value || !*attnd->value) continue; if (attnd->cn && *attnd->cn) { tmp = g_strconcat (attnd->cn, " <", strip_mailto (attnd->value), ">", NULL); /* Translators: Appointment's attendees */ e_web_view_preview_add_section (preview, have ? NULL : C_("iCalImp", "Attendees"), tmp); g_free (tmp); } else { e_web_view_preview_add_section (preview, have ? NULL : C_("iCalImp", "Attendees"), strip_mailto (attnd->value)); } have = TRUE; } e_cal_component_free_attendee_list (attendees); } slist = NULL; e_cal_component_get_description_list (comp, &slist); for (l = slist; l; l = l->next) { ECalComponentText *txt = l->data; e_web_view_preview_add_section (preview, l != slist ? NULL : C_("iCalImp", "Description"), (txt && txt->value) ? txt->value : ""); } e_cal_component_free_text_list (slist); }