[evolution-patches] Patch to allow an appointment/meeting to be opened in the editor from command-line.



Hi,

Attached patch will provide a new option to the existing
command=line-options provided to open a calendar.

It uses the "calendar://....." url format as used in the itip-formatter
plugin.

The added "query" options are: 
	1) "source-id" -> specifies the source-uid corresponding to the
calendar-item that we are trying to open in the editor.
	2) "comp-uid" -> specifies the uid of the (e-cal-component) cal item
that we want to edit.
	3) "comp-rid" -> optional recurrance id of the cal item that we want to
edit.

Kindly let me know your comments/suggestions.

Thanks,

V. Varadhan
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2762
diff -u -p -r1.2762 ChangeLog
--- calendar/ChangeLog	6 Jul 2005 13:31:28 -0000	1.2762
+++ calendar/ChangeLog	7 Jul 2005 16:35:21 -0000
@@ -1,3 +1,11 @@
+2005-07-07  Veerapuram Varadhan <vvaradhan novell com>
+
+	* 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  <pchenthill novell com>
 
 	* gui/dialogs/event-page.c: (sensitize_widgets): Enable alarms
Index: calendar/gui/calendar-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-component.c,v
retrieving revision 1.205
diff -u -p -r1.205 calendar-component.c
--- calendar/gui/calendar-component.c	4 Jul 2005 09:37:24 -0000	1.205
+++ calendar/gui/calendar-component.c	7 Jul 2005 16:35:42 -0000
@@ -764,9 +764,20 @@ impl_handleURI (PortableServer_Servant s
 {
 	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 s
 					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 s
 			}
 
 			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);
 	}
 }
Index: calendar/gui/gnome-cal.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.h,v
retrieving revision 1.103
diff -u -p -r1.103 gnome-cal.h
--- calendar/gui/gnome-cal.h	23 Jun 2005 09:11:05 -0000	1.103
+++ calendar/gui/gnome-cal.h	7 Jul 2005 16:36:06 -0000
@@ -187,6 +187,12 @@ void       gnome_calendar_purge         
 
 
 
+/* 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
Index: calendar/gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.380
diff -u -p -r1.380 gnome-cal.c
--- calendar/gui/gnome-cal.c	2 Jul 2005 14:54:44 -0000	1.380
+++ calendar/gui/gnome-cal.c	7 Jul 2005 16:36:23 -0000
@@ -3387,3 +3387,33 @@ ECalMenu *gnome_calendar_get_calendar_me
  
  	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;
+	icalproperty *attendee_prop = NULL;
+
+	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;
+
+	/* FIXME: Do I need to free this icalcomp? */
+	e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, NULL);
+
+	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); 
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]