From 6a70408ad082eae0acbb9e1d367a934abf7cf6fb Mon Sep 17 00:00:00 2001 From: Veerapuram Varadhan Date: Mon, 11 Jul 2005 16:23:57 +0000 Subject: Added support for opening a calendar-item in the editor when its ESource * Added support for opening a calendar-item in the editor when its ESource id and ECalComponent id/rid are passed in the invocation URI. svn path=/trunk/; revision=29722 --- calendar/ChangeLog | 8 ++++++++ calendar/gui/calendar-component.c | 33 ++++++++++++++++++++++++--------- calendar/gui/gnome-cal.c | 36 ++++++++++++++++++++++++++++++++++++ calendar/gui/gnome-cal.h | 6 ++++++ 4 files changed, 74 insertions(+), 9 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 02a9cf9ba3..98296f6a54 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -31,6 +31,14 @@ * gui/itip-utils.c: (itip_organizer_is_user), (itip_get_comp_attendee): Fixed some memory leaks. +2005-07-07 Veerapuram Varadhan + + * gui/calendar-component.c: (impl_handleURI): Added support for + opening a calendar-item in the editor when its source-UID and UID/RID + is passed in the command-line. + * gui/gnome-cal.[c,h]: (gnome_calendar_edit_appointment): Newly added + for the above functionality. + 2005-07-06 Chenthill Palanisamy * gui/dialogs/event-page.c: (sensitize_widgets): Enable alarms diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index f747370004..801c946248 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -764,9 +764,20 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme { CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant)); CalendarComponentPrivate *priv; + GList *l; + CalendarComponentView *view = NULL; + char *src_uid = NULL; + char *uid = NULL; + char *rid = NULL; priv = calendar_component->priv; + + l = g_list_last (priv->views); + if (!l) + return; + view = l->data; + if (!strncmp (uri, "calendar:", 9)) { EUri *euri = e_uri_new (uri); const char *p; @@ -795,8 +806,14 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme start = time_from_isodate (content); } else if (!g_ascii_strcasecmp (header, "enddate")) { end = time_from_isodate (content); + } else if (!g_ascii_strcasecmp (header, "source-uid")) { + src_uid = g_strdup (content); + } else if (!g_ascii_strcasecmp (header, "comp-uid")) { + uid = g_strdup (content); + } else if (!g_ascii_strcasecmp (header, "comp-rid")) { + rid = g_strdup (content); } - + g_free (content); p += clen; @@ -808,20 +825,18 @@ impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environme } if (start != -1) { - GList *l; if (end == -1) end = start; - - l = g_list_last (priv->views); - if (l) { - CalendarComponentView *view = l->data; - gnome_calendar_set_selected_time_range (view->calendar, start, end); - } } + if (src_uid && uid) + gnome_calendar_edit_appointment (view->calendar, src_uid, uid, rid); + + g_free (src_uid); + g_free (uid); + g_free (rid); } - e_uri_free (euri); } } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index a672b534ff..51b54126e8 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -3393,3 +3393,39 @@ ECalMenu *gnome_calendar_get_calendar_menu (GnomeCalendar *gcal) return gcal->priv->calendar_menu; } + +void +gnome_calendar_edit_appointment (GnomeCalendar *gcal, + const char* src_uid, + const char* comp_uid, + const char* comp_rid) +{ + ECal *client = NULL; + GList *l; + icalcomponent* icalcomp = NULL; + icalproperty *attendee_prop = NULL; + + if (!src_uid || !comp_uid) + return; + + for (l = gcal->priv->clients_list[E_CAL_SOURCE_TYPE_EVENT]; l != NULL; l = l->next) { + client = l->data; + ESource *client_src = e_cal_get_source (client); + + if (!strcmp (src_uid, e_source_peek_uid (client_src))) + break; + } + + if (!client) + return; + + e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, NULL); + + if (!icalcomp) + return; + + attendee_prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY); + e_calendar_view_edit_appointment (gcal->priv->views[gcal->priv->current_view_type], + client, icalcomp, attendee_prop ? TRUE:FALSE); + icalcomponent_free (icalcomp); +} diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index f7f6a7f3ae..9558df8221 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -187,6 +187,12 @@ void gnome_calendar_purge (GnomeCalendar *gcal, +/* Direct calendar component operations */ +void gnome_calendar_edit_appointment (GnomeCalendar *gcal, + const char* src_uid, + const char* comp_uid, + const char* comp_rid); + G_END_DECLS #endif -- cgit v1.2.3