Re: [evolution-patches] patch for bug 317014 [Tasks]



Setting the flags just before creating a new task.



Thanks,
Viren.

>>> chen <pchenthill novell com> 09/27/05 17:37 PM >>>
On Tue, 2005-09-27 at 05:01 -0600, Viren L wrote:
>      if (!priv->assignment_shown) {
> +               flags |= COMP_EDITOR_USER_ORG;
> +               comp_editor_set_flags (COMP_EDITOR (te), fla 

The flags should be set when the task editor is created.

thanks, Chenthill.

Index: gui/e-calendar-table.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-table.c,v
retrieving revision 1.139
diff -u -p -r1.139 e-calendar-table.c
--- gui/e-calendar-table.c	24 Aug 2005 03:07:49 -0000	1.139
+++ gui/e-calendar-table.c	28 Sep 2005 10:52:31 -0000
@@ -89,6 +89,8 @@ static struct tm e_calendar_table_get_cu
 						    gpointer data);
 static void mark_row_complete_cb (int model_row, gpointer data);
 
+static void open_task_with_flags (ECalendarTable *cal_table, ECalModelComponent *comp_data, guint32 flags);
+
 /* Signal IDs */
 enum {
 	USER_CREATED,
@@ -936,26 +938,44 @@ e_calendar_table_paste_clipboard (ECalen
 void
 e_calendar_table_open_task (ECalendarTable *cal_table, ECalModelComponent *comp_data, gboolean assign)
 {
+	guint32 flags = 0;
+
+	if (assign) {
+		ECalComponent *comp = e_cal_component_new ();
+		
+		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));	
+		flags |= COMP_EDITOR_IS_ASSIGNED;
+		
+		if (itip_organizer_is_user (comp, comp_data->client))
+				flags |= COMP_EDITOR_USER_ORG;
+		
+		g_object_unref (comp);
+	}
+	open_task_with_flags (cal_table, comp_data, flags);
+}
+
+static void
+open_task_with_flags (ECalendarTable *cal_table, ECalModelComponent *comp_data, guint32 flags)
+{
 	CompEditor *tedit;
 	const char *uid;
-	
-	uid = icalcomponent_get_uid (comp_data->icalcomp);
 
+	uid = icalcomponent_get_uid (comp_data->icalcomp);
+		
 	tedit = e_comp_editor_registry_find (comp_editor_registry, uid);
 	if (tedit == NULL) {
 		ECalComponent *comp;
 
-		tedit = COMP_EDITOR (task_editor_new (comp_data->client, assign));
-
+		tedit = COMP_EDITOR (task_editor_new (comp_data->client, flags));
 		comp = e_cal_component_new ();
 		e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
+		
 		comp_editor_edit_comp (tedit, comp);
-		if (assign)
+		if (flags & COMP_EDITOR_IS_ASSIGNED)
 			task_editor_show_assignment (TASK_EDITOR (tedit));
 		
 		e_comp_editor_registry_add (comp_editor_registry, tedit, FALSE);
 	}
-	
 	comp_editor_focus (tedit);
 }
 
Index: gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.386
diff -u -p -r1.386 gnome-cal.c
--- gui/gnome-cal.c	24 Aug 2005 03:07:49 -0000	1.386
+++ gui/gnome-cal.c	28 Sep 2005 10:52:32 -0000
@@ -1361,6 +1361,7 @@ setup_widgets (GnomeCalendar *gcal)
 				G_CALLBACK(gnome_calendar_vpane_realized), gcal);
 	g_signal_connect (priv->vpane, "button_release_event",
 			  G_CALLBACK (gnome_calendar_vpane_resized), gcal);
+
 	gtk_widget_show (priv->vpane);
 	gtk_paned_pack2 (GTK_PANED (priv->hpane), priv->vpane, TRUE, TRUE);
 
@@ -1382,6 +1383,7 @@ setup_widgets (GnomeCalendar *gcal)
 	g_signal_connect (priv->date_navigator->calitem, "date_range_changed",
 			  G_CALLBACK (gnome_calendar_on_date_navigator_date_range_changed), gcal);
 
+
 	/* The ToDo list. */
 	priv->todo = e_calendar_table_new ();
 	priv->todo_config = e_calendar_table_config_new (E_CALENDAR_TABLE (priv->todo));
@@ -2924,18 +2926,18 @@ gnome_calendar_new_task		(GnomeCalendar 
 	ECalComponent *comp;
 	icalcomponent *icalcomp;
 	const char *category;
-	
+
 	g_return_if_fail (gcal != NULL);
 	g_return_if_fail (GNOME_IS_CALENDAR (gcal));
 
 	priv = gcal->priv;
-
 	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->todo));
 	ecal = e_cal_model_get_default_client (model);
 	if (!ecal)
 		return;
 	
-	tedit = task_editor_new (ecal, FALSE);
+	flags |= COMP_EDITOR_NEW_ITEM;
+	tedit = task_editor_new (ecal, flags);
 
 	icalcomp = e_cal_model_create_component_with_defaults (model);
 	comp = e_cal_component_new ();
@@ -2943,7 +2945,7 @@ gnome_calendar_new_task		(GnomeCalendar 
 
 	category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar));
 	e_cal_component_set_categories (comp, category);
-
+	
 	comp_editor_edit_comp (COMP_EDITOR (tedit), comp);
 	g_object_unref (comp);
 
@@ -3104,7 +3106,6 @@ gnome_calendar_on_date_navigator_selecti
 
 static void
 gnome_calendar_on_date_navigator_date_range_changed (ECalendarItem *calitem, GnomeCalendar *gcal)
-{
 	update_query (gcal);
 }
 
Index: gui/tasks-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-component.c,v
retrieving revision 1.90
diff -u -p -r1.90 tasks-component.c
--- gui/tasks-component.c	24 Aug 2005 03:07:49 -0000	1.90
+++ gui/tasks-component.c	28 Sep 2005 10:52:32 -0000
@@ -909,14 +909,21 @@ create_new_todo (TasksComponent *task_co
 	TasksComponentPrivate *priv;
 	ECalComponent *comp;
 	TaskEditor *editor;
-	
+	guint32 flags = 0;	
+
 	priv = task_component->priv;
 	
 	ecal = setup_create_ecal (task_component, component_view);
 	if (!ecal)
 		return FALSE;
 
-	editor = task_editor_new (ecal, is_assigned);
+	if (is_assigned)
+		flags |= COMP_EDITOR_IS_ASSIGNED;
+	
+	flags |= COMP_EDITOR_NEW_ITEM;	
+	flags |= COMP_EDITOR_USER_ORG;
+
+	editor = task_editor_new (ecal, flags);
 	comp = cal_comp_task_new_with_defaults (ecal);
 
 	comp_editor_edit_comp (COMP_EDITOR (editor), comp);
Index: gui/comp-editor-factory.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/comp-editor-factory.c,v
retrieving revision 1.44
diff -u -p -r1.44 comp-editor-factory.c
--- gui/comp-editor-factory.c	12 Aug 2005 13:55:49 -0000	1.44
+++ gui/comp-editor-factory.c	28 Sep 2005 10:52:32 -0000
@@ -267,20 +267,20 @@ edit_existing (OpenClient *oc, const cha
 	/* Create the appropriate type of editor */
 	
 	vtype = e_cal_component_get_vtype (comp);
+	if (itip_organizer_is_user (comp, oc->client))
+		flags |= COMP_EDITOR_USER_ORG;
+
 
 	switch (vtype) {
 	case E_CAL_COMPONENT_EVENT:
 		if (e_cal_component_has_attendees (comp))
 			flags |= COMP_EDITOR_MEETING;
 	
-		if (itip_organizer_is_user (comp, oc->client))
-			flags |= COMP_EDITOR_USER_ORG;
-
 		editor = COMP_EDITOR (event_editor_new (oc->client, flags));
 		break;
 
 	case E_CAL_COMPONENT_TODO:
-		editor = COMP_EDITOR (task_editor_new (oc->client, e_cal_component_has_attendees (comp)));
+		editor = COMP_EDITOR (task_editor_new (oc->client, flags));
 		break;
 
 	default:
Index: gui/dialogs/comp-editor.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.h,v
retrieving revision 1.29
diff -u -p -r1.29 comp-editor.h
--- gui/dialogs/comp-editor.h	19 Aug 2005 13:11:56 -0000	1.29
+++ gui/dialogs/comp-editor.h	28 Sep 2005 10:52:32 -0000
@@ -59,6 +59,7 @@ typedef enum {
 	COMP_EDITOR_MEETING = 1<<1,
 	COMP_EDITOR_DELEGATE = 1<<2,
 	COMP_EDITOR_USER_ORG = 1<<3,
+	COMP_EDITOR_IS_ASSIGNED = 1<<4,
 } CompEditorFlags;
 
 GtkType       comp_editor_get_type         (void);
Index: gui/dialogs/comp-editor-page.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor-page.h,v
retrieving revision 1.21
diff -u -p -r1.21 comp-editor-page.h
--- gui/dialogs/comp-editor-page.h	6 Jun 2005 21:05:18 -0000	1.21
+++ gui/dialogs/comp-editor-page.h	28 Sep 2005 10:52:32 -0000
@@ -48,6 +48,7 @@ typedef enum {
 	COMP_EDITOR_PAGE_MEETING = 1<<1,
 	COMP_EDITOR_PAGE_DELEGATE = 1<<2,
 	COMP_EDITOR_PAGE_USER_ORG = 1<<3,
+	COMP_EDITOR_PAGE_IS_ASSIGNED = 1<<4,
 } CompEditorPageFlags;
 
 typedef struct {
Index: gui/dialogs/task-editor.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/task-editor.h,v
retrieving revision 1.15
diff -u -p -r1.15 task-editor.h
--- gui/dialogs/task-editor.h	2 Dec 2004 14:05:50 -0000	1.15
+++ gui/dialogs/task-editor.h	28 Sep 2005 10:52:32 -0000
@@ -53,8 +53,8 @@ struct _TaskEditorClass {
 
 GtkType     task_editor_get_type       (void);
 TaskEditor *task_editor_construct      (TaskEditor *te,
-					ECal  *client, gboolean is_assigned);
-TaskEditor *task_editor_new            (ECal  *client, gboolean is_assigned);
+					ECal  *client);
+TaskEditor *task_editor_new            (ECal  *client, CompEditorFlags flags);
 void        task_editor_show_assignment(TaskEditor *te);
 
 
Index: gui/dialogs/task-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/task-editor.c,v
retrieving revision 1.84
diff -u -p -r1.84 task-editor.c
--- gui/dialogs/task-editor.c	18 Aug 2005 11:20:23 -0000	1.84
+++ gui/dialogs/task-editor.c	28 Sep 2005 10:52:32 -0000
@@ -122,14 +122,13 @@ task_editor_init (TaskEditor *te)
 }
 
 TaskEditor *
-task_editor_construct (TaskEditor *te, ECal *client, gboolean is_assigned)
+task_editor_construct (TaskEditor *te, ECal *client)
 {
 	TaskEditorPrivate *priv;
 	gboolean read_only = FALSE;
-	
+
 	priv = te->priv;
 
-	priv->is_assigned = is_assigned;
 	priv->task_page = task_page_new ();
 	g_object_ref (priv->task_page);
 	gtk_object_sink (GTK_OBJECT (priv->task_page));
@@ -153,6 +152,7 @@ task_editor_construct (TaskEditor *te, E
 		if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS))
 			task_page_show_options (priv->task_page);
 
+				
 		comp_editor_set_group_item (COMP_EDITOR (te), TRUE);
 		priv->meet_page = meeting_page_new (priv->model, client);
 		g_object_ref (priv->meet_page);
@@ -356,12 +356,15 @@ task_editor_finalize (GObject *object)
  * editor could not be created.
  **/
 TaskEditor *
-task_editor_new (ECal *client, gboolean is_assigned)
+task_editor_new (ECal *client, CompEditorFlags flags)
 {
 	TaskEditor *te;
 
 	te = g_object_new (TYPE_TASK_EDITOR, NULL);
-	return task_editor_construct (te, client, is_assigned);
+	te->priv->is_assigned = flags & COMP_EDITOR_IS_ASSIGNED;
+	comp_editor_set_flags (COMP_EDITOR (te), flags);
+
+	return task_editor_construct (te, client);
 }
 
 static void
@@ -370,8 +373,9 @@ show_assignment (TaskEditor *te)
 	TaskEditorPrivate *priv;
 
 	priv = te->priv;
-
+	
 	task_page_set_assignment (priv->task_page, TRUE);
+
 	if (!priv->assignment_shown) {
 		comp_editor_append_page (COMP_EDITOR (te),
 					 COMP_EDITOR_PAGE (priv->meet_page),
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2807
diff -u -p -r1.2807 ChangeLog
--- ChangeLog	28 Sep 2005 10:12:15 -0000	1.2807
+++ ChangeLog	28 Sep 2005 10:52:35 -0000
@@ -1,3 +1,18 @@
+2005-09-28  Viren.L  <lviren novell com>
+	Fixes #317014
+	
+	* gui/e-calendar-table.c (e_calendar_table_open_task), (open_task_with_flags):
+	Set the flag in e_calendar_table_open_task and open the editor in 
+	open_task_with_flags.
+	* gui/gnome-cal.c (gnome_calendar_new_task):set the NEW_ITEM flag.
+	* gui/tasks-component.c (create_new_todo): set NEW_ITEM & USER_ORG flag.
+	* gui/comp-editor-factory.c (edit_existing):check itip_organizer_is_user
+	  for tasks as well. 
+	* gui/dialogs/comp-editor.h: Added COMP_EDITOR_IS_ASSIGNED to CompEditorFlags.
+	* gui/dialogs/comp-editor-page.h: Added COMP_EDITOR_PAGE_IS_ASSIGNED to page flags.
+	* gui/dialogs/task-editor.[ch]: Changed parameters for task_editor_new and
+	  task_editor_construct.
+
 2005-09-28  Tor Lillqvist  <tml novell com>
 
 	* gui/e-cal-model-calendar.c (set_transparency)


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