Mark as not complete option added - Evolution



hi,

as part of bug #329772,option for marking messages as 'not complete' is
added.

i m attaching the patch.

Thanks,
Ushveen
Index: gui/e-cal-model-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model-tasks.c,v
retrieving revision 1.36
diff -u -p -r1.36 e-cal-model-tasks.c
--- gui/e-cal-model-tasks.c	8 Feb 2006 13:06:02 -0000	1.36
+++ gui/e-cal-model-tasks.c	20 Jun 2006 08:55:22 -0000
@@ -1098,6 +1098,51 @@ e_cal_model_tasks_mark_task_complete (EC
 }
 
 /**
+ * e_cal_model_tasks_mark_task_incomplete
+ */
+void
+e_cal_model_tasks_mark_task_incomplete (ECalModelTasks *model, gint model_row)
+{
+ 	ECalModelComponent *comp_data; 
+	icalproperty *prop,*prop1,*prop2;
+	gboolean set_completed = TRUE;
+
+ 	g_return_if_fail (E_IS_CAL_MODEL_TASKS (model)); 
+ 	g_return_if_fail (model_row >= 0 && model_row < e_table_model_row_count (E_TABLE_MODEL (model))); 
+
+ 	comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), model_row); 
+ 	if (comp_data)
+	{ 
+	    e_table_model_pre_change (E_TABLE_MODEL (model));
+	    /* Status */
+	    prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY); 
+ 	    if (prop) 
+		icalproperty_set_status (prop, ICAL_STATUS_NEEDSACTION);
+	    else 	     
+		icalcomponent_add_property (comp_data->icalcomp, icalproperty_new_status (ICAL_STATUS_NEEDSACTION));
+	    
+	    /*complete property*/
+	    prop1= icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY);
+	    if (prop1) 
+	    {
+		icalcomponent_remove_property (comp_data->icalcomp, prop1);
+		icalproperty_free (prop1);
+	    }
+	    
+	    /* Percent. */
+	    prop1 = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_PERCENTCOMPLETE_PROPERTY);
+	    if (prop1)
+	    {
+		icalcomponent_remove_property (comp_data->icalcomp, prop1);
+		icalproperty_free (prop1);
+	    }
+	    
+	    e_table_model_row_changed (E_TABLE_MODEL (model), model_row); 
+	}
+}
+
+
+/**
  * e_cal_model_tasks_update_due_tasks
  */
 void
Index: gui/e-cal-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.c,v
retrieving revision 1.24
diff -u -p -r1.24 e-cal-popup.c
--- gui/e-cal-popup.c	25 May 2006 06:04:40 -0000	1.24
+++ gui/e-cal-popup.c	20 Jun 2006 08:55:23 -0000
@@ -581,10 +581,10 @@ e_cal_popup_target_new_select(ECalPopup 
 			int i=0;
 			for (; i < t->events->len; i++) {
 				ECalModelComponent *comp_data = (ECalModelComponent *)t->events->pdata[i];
-				if (!icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY)) {
+				if (!icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY)) 
 					mask &= ~E_CAL_POPUP_SELECT_NOTCOMPLETE;
-					break;
-				}
+				else
+					mask &= ~E_CAL_POPUP_SELECT_COMPLETE;
 			}
 		}
 
@@ -636,6 +636,9 @@ e_cal_popup_target_new_select(ECalPopup 
 		if (!icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY))
 			mask &= ~E_CAL_POPUP_SELECT_NOTCOMPLETE;
 
+		if (icalcomponent_get_first_property (comp_data->icalcomp, ICAL_COMPLETED_PROPERTY))
+			mask &= ~E_CAL_POPUP_SELECT_COMPLETE;
+		
 		g_object_unref (comp);
 		g_free (user_email);
 	}
@@ -799,6 +802,7 @@ static const EPopupHookTargetMask ecalph
 	{ "accept", E_CAL_POPUP_SELECT_ACCEPTABLE },
 	{ "not-complete", E_CAL_POPUP_SELECT_NOTCOMPLETE },
 	{ "no-save-schedules", E_CAL_POPUP_SELECT_NOSAVESCHEDULES },
+	{ "complete" , E_CAL_POPUP_SELECT_COMPLETE},
 	{ 0 }
 };
 
Index: gui/e-cal-popup.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-popup.h,v
retrieving revision 1.12
diff -u -p -r1.12 e-cal-popup.h
--- gui/e-cal-popup.h	16 Jan 2006 05:47:06 -0000	1.12
+++ gui/e-cal-popup.h	20 Jun 2006 08:55:23 -0000
@@ -87,6 +87,7 @@ enum _e_cal_popup_target_select_t {
 	E_CAL_POPUP_SELECT_ACCEPTABLE = 1<<14,
 	E_CAL_POPUP_SELECT_NOTCOMPLETE = 1<<15,
 	E_CAL_POPUP_SELECT_NOSAVESCHEDULES = 1<<16,
+	E_CAL_POPUP_SELECT_COMPLETE = 1<<17,
 };
 
 /**
Index: gui/e-calendar-table.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-table.c,v
retrieving revision 1.154
diff -u -p -r1.154 e-calendar-table.c
--- gui/e-calendar-table.c	5 Jun 2006 06:27:23 -0000	1.154
+++ gui/e-calendar-table.c	20 Jun 2006 08:55:23 -0000
@@ -1199,6 +1199,27 @@ mark_row_complete_cb (int model_row, gpo
 	e_cal_model_tasks_mark_task_complete (E_CAL_MODEL_TASKS (cal_table->model), model_row);
 }
 
+/* Used from e_table_selected_row_foreach() */
+static void
+mark_row_incomplete_cb (int model_row, gpointer data)
+{
+	ECalendarTable *cal_table;
+
+	cal_table = E_CALENDAR_TABLE (data);
+	e_cal_model_tasks_mark_task_incomplete (E_CAL_MODEL_TASKS (cal_table->model), model_row);
+}
+
+/* Callback used for the "mark tasks as incomplete" menu item */
+static void
+mark_as_incomplete_cb (EPopup *ep, EPopupItem *pitem, void *data)
+{
+	ECalendarTable *cal_table = data;
+	ETable *etable;
+
+	etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
+	e_table_selected_row_foreach (etable, mark_row_incomplete_cb, cal_table);
+}
+
 /* Callback used for the "mark tasks as complete" menu item */
 static void
 mark_as_complete_cb (EPopup *ep, EPopupItem *pitem, void *data)
 
@@ -1273,11 +1294,13 @@ static EPopupItem tasks_popup_items [] =
 	{ E_POPUP_ITEM, "90.forward", N_("_Forward as iCalendar"), e_calendar_table_on_forward, NULL, "stock_mail-forward", E_CAL_POPUP_SELECT_ONE },
 	{ E_POPUP_ITEM, "a0.markonecomplete", N_("_Mark as Complete"), mark_as_complete_cb, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE | E_CAL_POPUP_SELECT_NOTCOMPLETE},
 	{ E_POPUP_ITEM, "b0.markmanycomplete", N_("_Mark Selected Tasks as Complete"), mark_as_complete_cb, NULL, NULL, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE | E_CAL_POPUP_SELECT_NOTCOMPLETE },
+	{ E_POPUP_ITEM, "c0.markoneincomplete", N_("_Mark as Incomplete"), mark_as_incomplete_cb, NULL, NULL, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE|E_CAL_POPUP_SELECT_COMPLETE},
+	{ E_POPUP_ITEM, "d0.markmanyincomplete", N_("_Mark Selected Tasks as Incomplete"), mark_as_incomplete_cb, NULL, NULL, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE | E_CAL_POPUP_SELECT_COMPLETE },
 
-	{ E_POPUP_BAR, "c0.bar" },
+	{ E_POPUP_BAR, "e0.bar" },
 
-	{ E_POPUP_ITEM, "d0.delete", N_("_Delete"), delete_cb, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE },
-	{ E_POPUP_ITEM, "e0.deletemany", N_("_Delete Selected Tasks"), delete_cb, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE },
+	{ E_POPUP_ITEM, "f0.delete", N_("_Delete"), delete_cb, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_ONE, E_CAL_POPUP_SELECT_EDITABLE },
+	{ E_POPUP_ITEM, "g0.deletemany", N_("_Delete Selected Tasks"), delete_cb, NULL, GTK_STOCK_DELETE, E_CAL_POPUP_SELECT_MANY, E_CAL_POPUP_SELECT_EDITABLE },
 };
 
 static void
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.3054
diff -u -p -r1.3054 ChangeLog
--- ChangeLog	12 Jun 2006 05:19:12 -0000	1.3054
+++ ChangeLog	20 Jun 2006 08:55:26 -0000
@@ -1,3 +1,53 @@

+2006-14-06 Ushveen Kaur <kushveen novell com>
+
+	fixes bug #329772
+	* gui/e-cal-model-tasks.c:
+	function added to change status of a task as incomplete
+	* gui/e-cal-popup.c:
+	status of task checked and changed to incomplete if option selected
+	* gui/e-cal-popup.h:
+	E_CAL_POPUP_SELECT_COMPLETE added
+	* gui/e-calendar-table.c:
+	function added to mark the task in selected row as incomplete


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