aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchen@src.gnome.org>2006-12-04 17:43:51 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2006-12-04 17:43:51 +0800
commit0db239af79eef98aaae13e887814460c5d0bcfd9 (patch)
tree3eb13a5089130386df0f921cc12505d010384a34 /calendar
parente37627d16f5d85cef7e143b32764529ad109d178 (diff)
downloadgsoc2013-evolution-0db239af79eef98aaae13e887814460c5d0bcfd9.tar
gsoc2013-evolution-0db239af79eef98aaae13e887814460c5d0bcfd9.tar.gz
gsoc2013-evolution-0db239af79eef98aaae13e887814460c5d0bcfd9.tar.bz2
gsoc2013-evolution-0db239af79eef98aaae13e887814460c5d0bcfd9.tar.lz
gsoc2013-evolution-0db239af79eef98aaae13e887814460c5d0bcfd9.tar.xz
gsoc2013-evolution-0db239af79eef98aaae13e887814460c5d0bcfd9.tar.zst
gsoc2013-evolution-0db239af79eef98aaae13e887814460c5d0bcfd9.zip
Fixes #270751
svn path=/trunk/; revision=33040
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog16
-rw-r--r--calendar/gui/GNOME_Evolution_Calendar.server.in.in10
-rw-r--r--calendar/gui/e-calendar-table.c18
-rw-r--r--calendar/gui/e-calendar-table.h3
-rw-r--r--calendar/gui/e-tasks.c37
-rw-r--r--calendar/gui/e-tasks.h4
-rw-r--r--calendar/gui/tasks-component.c75
-rw-r--r--calendar/gui/tasks-control.c2
8 files changed, 154 insertions, 11 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 8b21550e06..9727771e43 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,19 @@
+2006-12-04 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
+
+ Fixes #270751.
+ Adds support for command line uri in tasks.
+ * gui/GNOME_Evolution_Calendar.server.in.in: Added the specification
+ for task uri.
+ * gui/e-calendar-table.c: (e_calendar_table_open_selected),
+ (e_calendar_table_open_task), (open_task_by_row),
+ (e_calendar_table_on_open_task), (e_calendar_table_on_assign):
+ * gui/e-calendar-table.h:
+ * gui/tasks-control.c: (tasks_control_assign_cmd):
+ * gui/e-tasks.c: (e_tasks_open_task_id):
+ * gui/e-tasks.h: Pass just the required arguments.
+ * gui/tasks-component.c: (impl_handleURI),
+ (tasks_component_class_init): Implement the uri interface
+
2006-11-28 Wang Xin <jedy.wang@sun.com>
Fix for bug #380064
diff --git a/calendar/gui/GNOME_Evolution_Calendar.server.in.in b/calendar/gui/GNOME_Evolution_Calendar.server.in.in
index d12140b3bb..e450d91d51 100644
--- a/calendar/gui/GNOME_Evolution_Calendar.server.in.in
+++ b/calendar/gui/GNOME_Evolution_Calendar.server.in.in
@@ -49,6 +49,11 @@
<oaf_attribute name="evolution:button_tooltips" type="string" _value="Calendars"/>
<oaf_attribute name="evolution:button_icon" type="string" value="stock_calendar"/>
<oaf_attribute name="evolution:button_sort_order" type="string" value="-8"/>
+
+ <oaf_attribute name="evolution:uri_schemas" type="stringv">
+ <item value="calendar"/>
+ </oaf_attribute>
+
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Evolution_Tasks_Component:@VERSION@"
@@ -69,6 +74,11 @@
<oaf_attribute name="evolution:button_tooltips" type="string" _value="Tasks"/>
<oaf_attribute name="evolution:button_icon" type="string" value="stock_todo"/>
<oaf_attribute name="evolution:button_sort_order" type="string" value="-8"/>
+
+ <oaf_attribute name="evolution:uri_schemas" type="stringv">
+ <item value="task"/>
+ </oaf_attribute>
+
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Evolution_Memos_Component:@VERSION@"
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 33f001e8c3..79fdd1bb1a 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -604,7 +604,7 @@ e_calendar_table_open_selected (ECalendarTable *cal_table)
comp_data = e_calendar_table_get_selected_comp (cal_table);
prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
if (comp_data != NULL)
- e_calendar_table_open_task (cal_table, comp_data, prop ? TRUE : FALSE);
+ e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, prop ? TRUE : FALSE);
}
/**
@@ -1020,30 +1020,30 @@ e_calendar_table_paste_clipboard (ECalendarTable *cal_table)
/* Opens a task in the task editor */
void
-e_calendar_table_open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean assign)
+e_calendar_table_open_task (ECalendarTable *cal_table, ECal *client, icalcomponent *icalcomp, gboolean assign)
{
CompEditor *tedit;
const char *uid;
guint32 flags = 0;
- uid = icalcomponent_get_uid (comp_data->icalcomp);
+ uid = icalcomponent_get_uid (icalcomp);
tedit = e_comp_editor_registry_find (comp_editor_registry, uid);
if (tedit == NULL) {
ECalComponent *comp;
comp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+ e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp));
if (assign) {
flags |= COMP_EDITOR_IS_ASSIGNED;
- if (itip_organizer_is_user (comp, comp_data->client) ||
+ if (itip_organizer_is_user (comp, client) ||
!e_cal_component_has_attendees (comp))
flags |= COMP_EDITOR_USER_ORG;
}
- tedit = COMP_EDITOR (task_editor_new (comp_data->client, flags));
+ tedit = COMP_EDITOR (task_editor_new (client, flags));
comp_editor_edit_comp (tedit, comp);
if (flags & COMP_EDITOR_IS_ASSIGNED)
@@ -1063,7 +1063,7 @@ open_task_by_row (ECalendarTable *cal_table, int row)
comp_data = e_cal_model_get_component_at (cal_table->model, row);
prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
- e_calendar_table_open_task (cal_table, comp_data, prop ? TRUE : FALSE);
+ e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, prop ? TRUE : FALSE);
}
static void
@@ -1088,7 +1088,7 @@ e_calendar_table_on_open_task (EPopup *ep, EPopupItem *pitem, void *data)
comp_data = e_calendar_table_get_selected_comp (cal_table);
prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
if (comp_data)
- e_calendar_table_open_task (cal_table, comp_data, prop ? TRUE : FALSE);
+ e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, prop ? TRUE : FALSE);
}
static void
@@ -1168,7 +1168,7 @@ e_calendar_table_on_assign (EPopup *ep, EPopupItem *pitem, void *data)
comp_data = e_calendar_table_get_selected_comp (cal_table);
if (comp_data)
- e_calendar_table_open_task (cal_table, comp_data, TRUE);
+ e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, TRUE);
}
static void
diff --git a/calendar/gui/e-calendar-table.h b/calendar/gui/e-calendar-table.h
index 56de26b689..2e2f4cfd72 100644
--- a/calendar/gui/e-calendar-table.h
+++ b/calendar/gui/e-calendar-table.h
@@ -105,7 +105,8 @@ void e_calendar_table_set_status_message (ECalendarTable *cal_table,
const gchar *message,
int percent);
void e_calendar_table_open_task (ECalendarTable *cal_table,
- ECalModelComponent *comp_data,
+ ECal *client,
+ icalcomponent *icalcomp,
gboolean assign);
ECalModelComponent * e_calendar_table_get_selected_comp (ECalendarTable *cal_table);
void e_calendar_table_hide_completed_tasks (ECalendarTable *table, GList *clients_list, gboolean config_changed);
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index 0c533adc75..14a2a80ffc 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -1415,6 +1415,43 @@ e_tasks_discard_view_menus (ETasks *tasks)
priv->view_menus = NULL;
}
+void
+e_tasks_open_task_id (ETasks *tasks,
+ 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 = tasks->priv->clients_list; 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_table_open_task (E_CALENDAR_TABLE (tasks->priv->tasks_view), client, icalcomp, attendee_prop);
+ icalcomponent_free (icalcomp);
+
+ return;
+}
+
/**
* e_tasks_get_calendar_table:
* @tasks: A tasks widget.
diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h
index e7ff9a8f96..1a7a465da2 100644
--- a/calendar/gui/e-tasks.h
+++ b/calendar/gui/e-tasks.h
@@ -73,6 +73,10 @@ gboolean e_tasks_set_default_source (ETasks *tasks, ESource *source);
ECal *e_tasks_get_default_client (ETasks *tasks);
void e_tasks_open_task (ETasks *tasks);
+void e_tasks_open_task_id (ETasks *tasks,
+ const char *src_uid,
+ const char *comp_uid,
+ const char *comp_rid);
void e_tasks_new_task (ETasks *tasks);
void e_tasks_complete_selected (ETasks *tasks);
void e_tasks_delete_selected (ETasks *tasks);
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index 1ecdba1811..4e9643dc92 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -32,6 +32,7 @@
#include <gconf/gconf-client.h>
#include <libecal/e-cal.h>
#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-url.h>
#include <libedataserverui/e-source-selector.h>
#include <shell/e-user-creatable-items-handler.h>
#include <shell/e-component-view.h>
@@ -1154,6 +1155,79 @@ impl_createView (PortableServer_Servant servant,
return BONOBO_OBJREF(ecv);
}
+static void
+impl_handleURI (PortableServer_Servant servant, const char *uri, CORBA_Environment *ev)
+{
+ TasksComponent *tasks_component = TASKS_COMPONENT (bonobo_object_from_servant (servant));
+ TasksComponentPrivate *priv;
+ GList *l;
+ TasksComponentView *view = NULL;
+
+ char *src_uid = NULL;
+ char *uid = NULL;
+ char *rid = NULL;
+
+ priv = tasks_component->priv;
+
+ l = g_list_last (priv->views);
+ if (!l)
+ return;
+
+ view = l->data;
+
+ if (!strncmp (uri, "task:", 5)) {
+ EUri *euri = e_uri_new (uri);
+ const char *p;
+ char *header, *content;
+ size_t len, clen;
+
+ p = euri->query;
+ if (p) {
+ while (*p) {
+ len = strcspn (p, "=&");
+
+ /* If it's malformed, give up. */
+ if (p[len] != '=')
+ break;
+
+ header = (char *) p;
+ header[len] = '\0';
+ p += len + 1;
+
+ clen = strcspn (p, "&");
+
+ content = g_strndup (p, clen);
+ 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;
+ if (*p == '&') {
+ p++;
+ if (!strcmp (p, "amp;"))
+ p += 4;
+ }
+ }
+
+ if (uid && src_uid) {
+ e_tasks_open_task_id (view->tasks, src_uid, uid, rid);
+ }
+
+ g_free (src_uid);
+ g_free (uid);
+ g_free (rid);
+ }
+ e_uri_free (euri);
+ }
+
+ return;
+}
+
static GNOME_Evolution_CreatableItemTypeList *
impl__get_userCreatableItems (PortableServer_Servant servant,
CORBA_Environment *ev)
@@ -1285,6 +1359,7 @@ tasks_component_class_init (TasksComponentClass *klass)
epv->createView = impl_createView;
epv->_get_userCreatableItems = impl__get_userCreatableItems;
epv->requestCreateItem = impl_requestCreateItem;
+ epv->handleURI = impl_handleURI;
object_class->dispose = impl_dispose;
object_class->finalize = impl_finalize;
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 0ef93c932a..8633af8d4e 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -521,7 +521,7 @@ tasks_control_assign_cmd (BonoboUIComponent *uic,
cal_table = e_tasks_get_calendar_table (tasks);
comp_data = e_calendar_table_get_selected_comp (cal_table);
if (comp_data)
- e_calendar_table_open_task (cal_table, comp_data, TRUE);
+ e_calendar_table_open_task (cal_table, comp_data->client, comp_data->icalcomp, TRUE);
}
static void