aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/e-cal-model-tasks.c45
-rw-r--r--calendar/gui/e-cal-popup.c10
-rw-r--r--calendar/gui/e-cal-popup.h1
-rw-r--r--calendar/gui/e-calendar-table.c29
5 files changed, 91 insertions, 6 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index bc7cd6d853..b801b4cb9c 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,15 @@
+2006-06-14 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.
+
2006-07-11 Li Yuan <li.yuan@sun.com>
* gui/e-week-view.c: (e_week_view_remove_event_cb):
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index d0f343a9b2..c914dbf8c1 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -1098,6 +1098,51 @@ e_cal_model_tasks_mark_task_complete (ECalModelTasks *model, gint model_row)
}
/**
+ * 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
diff --git a/calendar/gui/e-cal-popup.c b/calendar/gui/e-cal-popup.c
index 32967f04b5..6020cd4b07 100644
--- a/calendar/gui/e-cal-popup.c
+++ b/calendar/gui/e-cal-popup.c
@@ -581,10 +581,10 @@ e_cal_popup_target_new_select(ECalPopup *eabp, struct _ECalModel *model, GPtrArr
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 *eabp, struct _ECalModel *model, GPtrArr
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_select_masks[] = {
{ "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 }
};
diff --git a/calendar/gui/e-cal-popup.h b/calendar/gui/e-cal-popup.h
index a4a612e918..c94faf0b3d 100644
--- a/calendar/gui/e-cal-popup.h
+++ b/calendar/gui/e-cal-popup.h
@@ -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,
};
/**
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 1da490ebb5..300b9dbeb0 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -1199,6 +1199,27 @@ mark_row_complete_cb (int model_row, gpointer data)
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