From d097ac6883dab98ffe326299f7293062573433f8 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Thu, 29 Sep 2005 13:02:56 +0000 Subject: Fixes #317014 svn path=/trunk/; revision=30418 --- calendar/ChangeLog | 20 ++++++++++++++++++++ calendar/gui/comp-editor-factory.c | 8 ++++---- calendar/gui/dialogs/comp-editor-page.h | 1 + calendar/gui/dialogs/comp-editor.h | 1 + calendar/gui/dialogs/task-editor.c | 10 ++++++---- calendar/gui/dialogs/task-editor.h | 4 ++-- calendar/gui/e-calendar-table.c | 17 +++++++++++++---- calendar/gui/e-tasks.c | 5 ++++- calendar/gui/gnome-cal.c | 5 +++-- calendar/gui/tasks-component.c | 8 +++++++- 10 files changed, 61 insertions(+), 18 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 877fcd0f75..09ca8ed37c 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,23 @@ +2005-08-29 Chenthill Palanisamy + + * gui/e-calendar-table.c (e_calendar_table_open_task): Set the + USER_ORG flag while converting a personal task to assigned one. + +2005-09-28 Viren.L + + Fixes #317014 + * gui/e-calendar-table.c (e_calendar_table_open_task): + Set the flags in e_calendar_table_open_task. + * gui/gnome-cal.c (gnome_calendar_new_task):set the NEW_ITEM flag. + * gui/tasks-component.c (create_new_todo), + * gui/e-tasks.c (e_tasks_new_task): 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 * gui/e-cal-model-calendar.c (set_transparency) diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c index ea6507ad06..6a69cb48c9 100644 --- a/calendar/gui/comp-editor-factory.c +++ b/calendar/gui/comp-editor-factory.c @@ -267,20 +267,20 @@ edit_existing (OpenClient *oc, const char *uid) /* 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: diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h index 72a8f057a2..9da69da076 100644 --- a/calendar/gui/dialogs/comp-editor-page.h +++ b/calendar/gui/dialogs/comp-editor-page.h @@ -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 { diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 3ce43fa825..31f977e3ff 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -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); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 4a393f6bf8..85ddbabbc4 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -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)); @@ -356,12 +355,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 diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index d1b8b327d5..a8134829ae 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -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); diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 71eaec8193..6ea5514f45 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -938,6 +938,7 @@ e_calendar_table_open_task (ECalendarTable *cal_table, ECalModelComponent *comp_ { CompEditor *tedit; const char *uid; + guint32 flags = 0; uid = icalcomponent_get_uid (comp_data->icalcomp); @@ -945,17 +946,25 @@ e_calendar_table_open_task (ECalendarTable *cal_table, ECalModelComponent *comp_ if (tedit == NULL) { ECalComponent *comp; - tedit = COMP_EDITOR (task_editor_new (comp_data->client, assign)); - comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); + + if (assign) { + flags |= COMP_EDITOR_IS_ASSIGNED; + + if (itip_organizer_is_user (comp, comp_data->client) || + !e_cal_component_has_attendees (comp)) + flags |= COMP_EDITOR_USER_ORG; + } + + tedit = COMP_EDITOR (task_editor_new (comp_data->client, flags)); 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); } diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 98b86d929f..dc6401d330 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -952,6 +952,7 @@ e_tasks_new_task (ETasks *tasks) ECalComponent *comp; const char *category; ECal *ecal; + guint32 flags = 0; g_return_if_fail (E_IS_TASKS (tasks)); @@ -962,12 +963,14 @@ e_tasks_new_task (ETasks *tasks) if (!ecal) return; + flags |= COMP_EDITOR_NEW_ITEM | COMP_EDITOR_USER_ORG; + comp = cal_comp_task_new_with_defaults (ecal); category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar)); e_cal_component_set_categories (comp, category); - tedit = task_editor_new (ecal, FALSE); + tedit = task_editor_new (ecal, flags); comp_editor_edit_comp (COMP_EDITOR (tedit), comp); g_object_unref (comp); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index e72b96bf53..e0e68fb723 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -2924,18 +2924,19 @@ gnome_calendar_new_task (GnomeCalendar *gcal) ECalComponent *comp; icalcomponent *icalcomp; const char *category; + guint32 flags = 0; 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 (); diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 4cd9994a32..cecab0726d 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -909,6 +909,7 @@ create_new_todo (TasksComponent *task_component, gboolean is_assigned, TasksComp TasksComponentPrivate *priv; ECalComponent *comp; TaskEditor *editor; + guint32 flags = 0; priv = task_component->priv; @@ -916,7 +917,12 @@ create_new_todo (TasksComponent *task_component, gboolean is_assigned, TasksComp if (!ecal) return FALSE; - editor = task_editor_new (ecal, is_assigned); + if (is_assigned) + flags |= COMP_EDITOR_IS_ASSIGNED; + + flags |= COMP_EDITOR_NEW_ITEM | 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); -- cgit v1.2.3