aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-03-30 05:45:33 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-03-30 05:45:33 +0800
commita3aae682ce9911e451faae370ed4e88b2d6f4a2a (patch)
tree2f1fdfd7de8ec1d25d2891ac9497b283f2d30410 /calendar
parent5b8bbd736fce436933bbb1f6f02df36c1b86a5fc (diff)
downloadgsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.tar
gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.tar.gz
gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.tar.bz2
gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.tar.lz
gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.tar.xz
gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.tar.zst
gsoc2013-evolution-a3aae682ce9911e451faae370ed4e88b2d6f4a2a.zip
implement new pop up menu items for "Save as", "Print", "Assign Task",
2002-03-29 JP Rosevear <jpr@ximian.com> * gui/e-calendar-table.c: implement new pop up menu items for "Save as", "Print", "Assign Task", "Forward as iCalendar" * gui/e-day-view.c: similarly, also "Publish Free/Busy Information" and "New Meeting" and "New Task" * gui/e-week-view.c: ditto * gui/dialogs/task-editor.c (show_assignment): move the assignment page stuff here (task_editor_show_assignment): use it (assign_task_cmd): ditto * gui/dialogs/task-editor.h: new proto * gui/dialogs/comp-editor.c (save_as_cmd): use new e-util file selector function svn path=/trunk/; revision=16287
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog24
-rw-r--r--calendar/gui/dialogs/comp-editor.c99
-rw-r--r--calendar/gui/dialogs/task-editor.c41
-rw-r--r--calendar/gui/dialogs/task-editor.h4
-rw-r--r--calendar/gui/e-calendar-table.c123
-rw-r--r--calendar/gui/e-day-view.c242
-rw-r--r--calendar/gui/e-week-view.c247
7 files changed, 664 insertions, 116 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 7edd2e538e..279583485c 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,27 @@
+2002-03-29 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-calendar-table.c: implement new pop up menu items for
+ "Save as", "Print", "Assign Task", "Forward as iCalendar"
+
+ * gui/e-day-view.c: similarly, also "Publish Free/Busy
+ Information" and "New Meeting" and "New Task"
+
+ * gui/e-week-view.c: ditto
+
+ * gui/dialogs/task-editor.c (show_assignment): move the assignment
+ page stuff here
+ (task_editor_show_assignment): use it
+ (assign_task_cmd): ditto
+
+ * gui/dialogs/task-editor.h: new proto
+
+ * gui/dialogs/comp-editor.c (save_as_cmd): use new e-util file
+ selector function
+
+ * meeting-mockup.glade: Remove old file
+
+ * topic.dat
+
2002-03-19 Dan Winship <danw@ximian.com>
* cal-util/Makefile.am: s/libversit.la/libversit.a/
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 7615e79589..cad55ebf08 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -38,6 +38,7 @@
#include <bonobo/bonobo-ui-container.h>
#include <bonobo/bonobo-ui-util.h>
#include <gal/widgets/e-unicode.h>
+#include <e-util/e-dialog-utils.h>
#include <evolution-shell-component-utils.h>
#include "../print.h"
#include "save-comp.h"
@@ -1058,89 +1059,37 @@ save_close_cmd (GtkWidget *widget, gpointer data)
}
static void
-save_as_ok (GtkWidget *widget, gpointer data)
-{
- CompEditor *editor = COMP_EDITOR (data);
- CompEditorPrivate *priv;
- struct stat s;
- char *path;
- int ret = 0;
-
- priv = editor->priv;
-
- path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (priv->filesel));
-
- if (stat (path, &s) == 0) {
- GtkWidget *dlg;
- GtkWidget *text;
-
- dlg = gnome_dialog_new (_("Overwrite file?"),
- GNOME_STOCK_BUTTON_YES,
- GNOME_STOCK_BUTTON_NO,
- NULL);
- text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?"));
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4);
- gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE);
- gtk_widget_show (text);
-
- ret = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
- }
-
- if (ret == 0) {
- FILE *file;
- gchar *ical_string;
-
- ical_string = cal_client_get_component_as_string (priv->client, priv->comp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- gtk_main_quit ();
- return;
- }
-
- file = fopen (path, "w");
- if (file == NULL) {
- g_warning ("Couldn't save item");
- gtk_main_quit ();
- return;
- }
-
- fprintf (file, ical_string);
- g_free (ical_string);
- fclose (file);
-
- gtk_main_quit ();
- }
-}
-
-static void
save_as_cmd (GtkWidget *widget, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
- GtkFileSelection *fs;
- char *path;
-
+ char *filename;
+ char *ical_string;
+ FILE *file;
+
priv = editor->priv;
commit_all_fields (editor);
- fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save As...")));
- path = g_strdup_printf ("%s/", g_get_home_dir ());
- gtk_file_selection_set_filename (fs, path);
- g_free (path);
-
- gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
- GTK_SIGNAL_FUNC (save_as_ok), editor);
- gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked",
- GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
-
- priv->filesel = GTK_WIDGET (fs);
- gtk_widget_show (priv->filesel);
- gtk_grab_add (priv->filesel);
- gtk_main ();
-
- gtk_widget_destroy (priv->filesel);
- priv->filesel = NULL;
+ filename = e_file_dialog_save (_("Save as..."));
+ if (filename == NULL)
+ return;
+
+ ical_string = cal_client_get_component_as_string (priv->client, priv->comp);
+ if (ical_string == NULL) {
+ g_warning ("Couldn't convert item to a string");
+ return;
+ }
+
+ file = fopen (filename, "w");
+ if (file == NULL) {
+ g_warning ("Couldn't save item");
+ return;
+ }
+
+ fprintf (file, ical_string);
+ g_free (ical_string);
+ fclose (file);
}
static void
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index c5c4d61826..1ede12fff3 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -42,7 +42,7 @@ struct _TaskEditorPrivate {
EMeetingModel *model;
- gboolean meeting_shown;
+ gboolean assignment_shown;
gboolean existing_org;
gboolean updating;
};
@@ -134,7 +134,7 @@ set_menu_sens (TaskEditor *te)
priv = te->priv;
- sens = priv->meeting_shown;
+ sens = priv->assignment_shown;
comp_editor_set_ui_prop (COMP_EDITOR (te),
"/commands/ActionAssignTask",
"sensitive", sens ? "0" : "1");
@@ -191,7 +191,7 @@ task_editor_init (TaskEditor *te)
comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs);
- priv->meeting_shown = TRUE;
+ priv->assignment_shown = TRUE;
priv->existing_org = FALSE;
priv->updating = FALSE;
@@ -217,11 +217,11 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_model_remove_all_attendees (priv->model);
if (attendees == NULL) {
comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page));
- priv->meeting_shown = FALSE;
+ priv->assignment_shown = FALSE;
} else {
GSList *l;
- if (!priv->meeting_shown)
+ if (!priv->assignment_shown)
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
@@ -233,12 +233,12 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_model_add_attendee (priv->model, ia);
gtk_object_unref (GTK_OBJECT (ia));
}
- priv->meeting_shown = TRUE;
+ priv->assignment_shown = TRUE;
}
cal_component_free_attendee_list (attendees);
set_menu_sens (te);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown);
+ comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown);
priv->updating = FALSE;
@@ -312,27 +312,44 @@ task_editor_new (void)
}
static void
-assign_task_cmd (GtkWidget *widget, gpointer data)
+show_assignment (TaskEditor *te)
{
- TaskEditor *te = TASK_EDITOR (data);
TaskEditorPrivate *priv;
priv = te->priv;
- if (!priv->meeting_shown) {
+ if (!priv->assignment_shown) {
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
- priv->meeting_shown = TRUE;
+ priv->assignment_shown = TRUE;
set_menu_sens (te);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown);
+ comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown);
+ comp_editor_set_changed (COMP_EDITOR (te), TRUE);
}
comp_editor_show_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page));
}
+void
+task_editor_show_assignment (TaskEditor *te)
+{
+ g_return_if_fail (te != NULL);
+ g_return_if_fail (IS_TASK_EDITOR (te));
+
+ show_assignment (te);
+}
+
+static void
+assign_task_cmd (GtkWidget *widget, gpointer data)
+{
+ TaskEditor *te = TASK_EDITOR (data);
+
+ show_assignment (te);
+}
+
static void
refresh_task_cmd (GtkWidget *widget, gpointer data)
{
diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h
index 3f17b6e45f..e9888f446a 100644
--- a/calendar/gui/dialogs/task-editor.h
+++ b/calendar/gui/dialogs/task-editor.h
@@ -53,9 +53,9 @@ struct _TaskEditorClass {
};
GtkType task_editor_get_type (void);
-TaskEditor *task_editor_construct (TaskEditor *ee);
+TaskEditor *task_editor_construct (TaskEditor *te);
TaskEditor *task_editor_new (void);
-
+void task_editor_show_assignment(TaskEditor *te);
#endif /* __TASK_EDITOR_H__ */
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 62f4d426c9..2f56f2b11d 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -39,12 +39,14 @@
#include <gal/e-table/e-cell-combo.h>
#include <gal/util/e-unicode-i18n.h>
#include <gal/widgets/e-popup-menu.h>
+#include <e-util/e-dialog-utils.h>
#include <widgets/misc/e-cell-date-edit.h>
#include <widgets/misc/e-cell-percent.h>
#include "e-calendar-table.h"
#include "e-cell-date-edit-text.h"
#include "calendar-config.h"
#include "calendar-model.h"
+#include "print.h"
#include "dialogs/delete-comp.h"
#include "dialogs/task-editor.h"
@@ -73,12 +75,20 @@ static gint e_calendar_table_on_right_click (ETable *table,
ECalendarTable *cal_table);
static void e_calendar_table_on_open_task (GtkWidget *menuitem,
gpointer data);
+static void e_calendar_table_on_save_as (GtkWidget *menuitem,
+ gpointer data);
+static void e_calendar_table_on_print_task (GtkWidget *menuitem,
+ gpointer data);
static void e_calendar_table_on_cut (GtkWidget *menuitem,
gpointer data);
static void e_calendar_table_on_copy (GtkWidget *menuitem,
gpointer data);
static void e_calendar_table_on_paste (GtkWidget *menuitem,
gpointer data);
+static void e_calendar_table_on_assign (GtkWidget *menuitem,
+ gpointer data);
+static void e_calendar_table_on_forward (GtkWidget *menuitem,
+ gpointer data);
static gint e_calendar_table_on_key_press (ETable *table,
gint row,
gint col,
@@ -886,13 +896,15 @@ e_calendar_table_paste_clipboard (ECalendarTable *cal_table)
/* Opens a task in the task editor */
static void
-open_task (ECalendarTable *cal_table, CalComponent *comp)
+open_task (ECalendarTable *cal_table, CalComponent *comp, gboolean assign)
{
TaskEditor *tedit;
tedit = task_editor_new ();
comp_editor_set_cal_client (COMP_EDITOR (tedit), calendar_model_get_cal_client (cal_table->model));
comp_editor_edit_comp (COMP_EDITOR (tedit), comp);
+ if (assign)
+ task_editor_show_assignment (TASK_EDITOR (tedit));
comp_editor_focus (COMP_EDITOR (tedit));
}
@@ -903,7 +915,7 @@ open_task_by_row (ECalendarTable *cal_table, int row)
CalComponent *comp;
comp = calendar_model_get_component (cal_table->model, row);
- open_task (cal_table, comp);
+ open_task (cal_table, comp, FALSE);
}
static void
@@ -959,6 +971,11 @@ enum {
static EPopupMenu tasks_popup_menu [] = {
{ N_("_Open"), NULL,
e_calendar_table_on_open_task, NULL, NULL, MASK_SINGLE },
+ { N_("_Save as..."), NULL,
+ e_calendar_table_on_save_as, NULL, NULL, MASK_SINGLE },
+ { N_("_Print..."), NULL,
+ e_calendar_table_on_print_task, NULL, NULL, MASK_SINGLE },
+
E_POPUP_SEPARATOR,
{ N_("C_ut"), NULL,
@@ -969,14 +986,20 @@ static EPopupMenu tasks_popup_menu [] = {
e_calendar_table_on_paste, NULL, NULL, 0 },
E_POPUP_SEPARATOR,
-
+
+ { N_("_Assign Task"), NULL,
+ e_calendar_table_on_assign, NULL, NULL, MASK_SINGLE },
+ { N_("_Forward as iCalendar"), NULL,
+ e_calendar_table_on_forward, NULL, NULL, MASK_SINGLE },
{ N_("_Mark as Complete"), NULL,
mark_as_complete_cb, NULL, NULL, MASK_SINGLE },
- { N_("_Delete this Task"), NULL,
- delete_cb, NULL, NULL, MASK_SINGLE },
-
- { N_("_Mark Tasks as Complete"), NULL,
+ { N_("_Mark Selected Tasks as Complete"), NULL,
mark_as_complete_cb, NULL, NULL, MASK_MULTIPLE },
+
+ E_POPUP_SEPARATOR,
+
+ { N_("_Delete"), NULL,
+ delete_cb, NULL, NULL, MASK_SINGLE },
{ N_("_Delete Selected Tasks"), NULL,
delete_cb, NULL, NULL, MASK_MULTIPLE },
@@ -1021,7 +1044,62 @@ e_calendar_table_on_open_task (GtkWidget *menuitem,
comp = get_selected_comp (cal_table);
if (comp)
- open_task (cal_table, comp);
+ open_task (cal_table, comp, FALSE);
+}
+
+static void
+e_calendar_table_on_save_as (GtkWidget *widget, gpointer data)
+{
+ ECalendarTable *cal_table;
+ CalClient *client;
+ CalComponent *comp;
+ char *filename;
+ char *ical_string;
+ FILE *file;
+
+ cal_table = E_CALENDAR_TABLE (data);
+
+ client = calendar_model_get_cal_client (cal_table->model);
+ comp = get_selected_comp (cal_table);
+ if (comp == NULL)
+ return;
+
+ filename = e_file_dialog_save (_("Save as..."));
+ if (filename == NULL)
+ return;
+
+ ical_string = cal_client_get_component_as_string (client, comp);
+ if (ical_string == NULL) {
+ g_warning ("Couldn't convert item to a string");
+ return;
+ }
+
+ file = fopen (filename, "w");
+ if (file == NULL) {
+ g_warning ("Couldn't save item");
+ return;
+ }
+
+ fprintf (file, ical_string);
+ g_free (ical_string);
+ fclose (file);
+}
+
+static void
+e_calendar_table_on_print_task (GtkWidget *widget, gpointer data)
+{
+ ECalendarTable *cal_table;
+ CalClient *client;
+ CalComponent *comp;
+
+ cal_table = E_CALENDAR_TABLE (data);
+
+ client = calendar_model_get_cal_client (cal_table->model);
+ comp = get_selected_comp (cal_table);
+ if (comp == NULL)
+ return;
+
+ print_comp (comp, client, FALSE);
}
static void
@@ -1051,6 +1129,35 @@ e_calendar_table_on_paste (GtkWidget *menuitem, gpointer data)
e_calendar_table_paste_clipboard (cal_table);
}
+static void
+e_calendar_table_on_assign (GtkWidget *widget, gpointer data)
+{
+ ECalendarTable *cal_table;
+ CalComponent *comp;
+
+ cal_table = E_CALENDAR_TABLE (data);
+
+ comp = get_selected_comp (cal_table);
+ if (comp)
+ open_task (cal_table, comp, TRUE);
+}
+
+static void
+e_calendar_table_on_forward (GtkWidget *widget, gpointer data)
+{
+ ECalendarTable *cal_table;
+ CalClient *client;
+ CalComponent *comp;
+
+ cal_table = E_CALENDAR_TABLE (data);
+
+ client = calendar_model_get_cal_client (cal_table->model);
+ comp = get_selected_comp (cal_table);
+ if (comp)
+ itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
+ client, NULL);
+}
+
static gint
e_calendar_table_on_key_press (ETable *table,
gint row,
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index cde934845a..3dede7fa96 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -46,10 +46,12 @@
#include <gal/widgets/e-unicode.h>
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <libgnome/gnome-i18n.h>
+#include <e-util/e-dialog-utils.h>
#include "cal-util/timeutil.h"
#include "dialogs/delete-comp.h"
#include "dialogs/send-comp.h"
+#include "print.h"
#include "comp-util.h"
#include "itip-utils.h"
#include "calendar-commands.h"
@@ -331,12 +333,28 @@ static void e_day_view_on_new_appointment (GtkWidget *widget,
gpointer data);
static void e_day_view_on_new_event (GtkWidget *widget,
gpointer data);
+static void e_day_view_on_new_meeting (GtkWidget *widget,
+ gpointer data);
+static void e_day_view_on_new_task (GtkWidget *widget,
+ gpointer data);
static void e_day_view_on_goto_today (GtkWidget *widget,
gpointer data);
static void e_day_view_on_goto_date (GtkWidget *widget,
gpointer data);
static void e_day_view_on_edit_appointment (GtkWidget *widget,
gpointer data);
+static void e_day_view_on_save_as (GtkWidget *widget,
+ gpointer data);
+static void e_day_view_on_print (GtkWidget *widget,
+ gpointer data);
+static void e_day_view_on_print_event (GtkWidget *widget,
+ gpointer data);
+static void e_day_view_on_meeting (GtkWidget *widget,
+ gpointer data);
+static void e_day_view_on_forward (GtkWidget *widget,
+ gpointer data);
+static void e_day_view_on_publish (GtkWidget *widget,
+ gpointer data);
static void e_day_view_on_delete_occurrence (GtkWidget *widget,
gpointer data);
static void e_day_view_on_delete_appointment (GtkWidget *widget,
@@ -3526,9 +3544,18 @@ static EPopupMenu main_items [] = {
e_day_view_on_new_appointment, NULL, NULL, 0 },
{ N_("New All Day _Event"), NULL,
e_day_view_on_new_event, NULL, NULL, 0 },
+ { N_("New Meeting"), NULL,
+ e_day_view_on_new_meeting, NULL, NULL, 0 },
+ { N_("New Task"), NULL,
+ e_day_view_on_new_task, NULL, NULL, 0 },
E_POPUP_SEPARATOR,
+ { N_("Print..."), NULL,
+ e_day_view_on_print, NULL, NULL, 0 },
+
+ E_POPUP_SEPARATOR,
+
{ N_("_Paste"), NULL,
e_day_view_on_paste, NULL, NULL, 0 },
@@ -3539,19 +3566,30 @@ static EPopupMenu main_items [] = {
{ N_("_Go to Date..."), NULL,
e_day_view_on_goto_date, NULL, NULL, 0 },
+ E_POPUP_SEPARATOR,
+
+ { N_("_Publish Free/Busy Information"), NULL,
+ e_day_view_on_publish, NULL, NULL, 0 },
+
+ E_POPUP_SEPARATOR,
+
+ { N_("_Configure..."), NULL,
+ e_day_view_on_paste, NULL, NULL, 0 },
+
E_POPUP_TERMINATOR
};
static EPopupMenu child_items [] = {
{ N_("_Open"), NULL,
e_day_view_on_edit_appointment, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
- { N_("_Delete this Appointment"), NULL,
- e_day_view_on_delete_appointment, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
+ { N_("_Save As..."), NULL,
+ e_day_view_on_save_as, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
+ { N_("_Print..."), NULL,
+ e_day_view_on_print_event, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
/* Only show this separator if one of the above is shown. */
{ "", NULL, NULL, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
-
{ N_("C_ut"), NULL,
e_day_view_on_cut, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
{ N_("_Copy"), NULL,
@@ -3559,18 +3597,24 @@ static EPopupMenu child_items [] = {
{ N_("_Paste"), NULL,
e_day_view_on_paste, NULL, NULL, 0 },
+ E_POPUP_SEPARATOR,
- /*
- * The following are only shown if this is a recurring event
- */
- { "", NULL, NULL, NULL, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("_Schedule Meeting..."), NULL,
+ e_day_view_on_meeting, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
+ { N_("_Forward as iCalendar..."), NULL,
+ e_day_view_on_forward, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
+
+ E_POPUP_SEPARATOR,
+
+ { N_("_Delete"), NULL,
+ e_day_view_on_delete_appointment, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
{ N_("Make this Occurrence _Movable"), NULL,
e_day_view_on_unrecur_appointment, NULL, NULL, MASK_RECURRING | MASK_EDITING },
{ N_("Delete this _Occurrence"), NULL,
e_day_view_on_delete_occurrence, NULL, NULL, MASK_RECURRING | MASK_EDITING },
{ N_("Delete _All Occurrences"), NULL,
e_day_view_on_delete_appointment, NULL, NULL, MASK_RECURRING | MASK_EDITING },
-
+
E_POPUP_TERMINATOR
};
@@ -3668,6 +3712,44 @@ e_day_view_on_new_event (GtkWidget *widget, gpointer data)
}
static void
+e_day_view_on_new_meeting (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view = E_DAY_VIEW (data);
+ time_t dtstart, dtend;
+ struct icaltimetype itt;
+
+ /* Edit a new event. If only one day is selected in the top canvas,
+ we set the time to the first 1/2-hour of the working day. */
+ if (day_view->selection_in_top_canvas
+ && day_view->selection_start_day != -1
+ && day_view->selection_start_day == day_view->selection_end_day) {
+ dtstart = day_view->day_starts[day_view->selection_start_day];
+ itt = icaltime_from_timet_with_zone (dtstart, FALSE,
+ day_view->zone);
+ itt.hour = calendar_config_get_day_start_hour ();
+ itt.minute = calendar_config_get_day_start_minute ();
+ dtstart = icaltime_as_timet_with_zone (itt, day_view->zone);
+
+ icaltime_adjust (&itt, 0, 0, 30, 0);
+ dtend = icaltime_as_timet_with_zone (itt, day_view->zone);
+ } else {
+ e_day_view_get_selected_time_range (day_view, &dtstart,
+ &dtend);
+ }
+
+ gnome_calendar_new_appointment_for (
+ day_view->calendar, dtstart, dtend, FALSE, TRUE);
+}
+
+static void
+e_day_view_on_new_task (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view = E_DAY_VIEW (data);
+
+ gnome_calendar_new_task (day_view->calendar);
+}
+
+static void
e_day_view_on_goto_date (GtkWidget *widget, gpointer data)
{
EDayView *day_view = E_DAY_VIEW (data);
@@ -3701,6 +3783,150 @@ e_day_view_on_edit_appointment (GtkWidget *widget, gpointer data)
g_warning ("Calendar not set");
}
+static void
+e_day_view_on_save_as (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view;
+ EDayViewEvent *event;
+ char *filename;
+ char *ical_string;
+ FILE *file;
+
+ day_view = E_DAY_VIEW (data);
+
+ event = e_day_view_get_popup_menu_event (day_view);
+ if (event == NULL)
+ return;
+
+ filename = e_file_dialog_save (_("Save as..."));
+ if (filename == NULL)
+ return;
+
+ ical_string = cal_client_get_component_as_string (day_view->client, event->comp);
+ if (ical_string == NULL) {
+ g_warning ("Couldn't convert item to a string");
+ return;
+ }
+
+ file = fopen (filename, "w");
+ if (file == NULL) {
+ g_warning ("Couldn't save item");
+ return;
+ }
+
+ fprintf (file, ical_string);
+ g_free (ical_string);
+ fclose (file);
+}
+
+static void
+e_day_view_on_print (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view;
+ time_t start;
+ GnomeCalendarViewType view_type;
+ PrintView print_view;
+
+ day_view = E_DAY_VIEW (data);
+
+ gnome_calendar_get_current_time_range (day_view->calendar, &start, NULL);
+ view_type = gnome_calendar_get_view (day_view->calendar);
+
+ switch (view_type) {
+ case GNOME_CAL_DAY_VIEW:
+ print_view = PRINT_VIEW_DAY;
+ break;
+
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ print_view = PRINT_VIEW_WEEK;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ return;
+ }
+
+ print_calendar (day_view->calendar, FALSE, start, print_view);
+}
+
+static void
+e_day_view_on_print_event (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view;
+ EDayViewEvent *event;
+
+ day_view = E_DAY_VIEW (data);
+
+ event = e_day_view_get_popup_menu_event (day_view);
+ if (event == NULL)
+ return;
+
+ print_comp (event->comp, day_view->client, FALSE);
+}
+
+static void
+e_day_view_on_meeting (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view;
+ EDayViewEvent *event;
+
+ day_view = E_DAY_VIEW (data);
+
+ event = e_day_view_get_popup_menu_event (day_view);
+ if (event == NULL)
+ return;
+
+ if (day_view->calendar)
+ gnome_calendar_edit_object (day_view->calendar, event->comp, TRUE);
+ else
+ g_warning ("Calendar not set");
+}
+
+static void
+e_day_view_on_forward (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view;
+ EDayViewEvent *event;
+
+ day_view = E_DAY_VIEW (data);
+
+ event = e_day_view_get_popup_menu_event (day_view);
+ if (event == NULL)
+ return;
+
+ itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, event->comp,
+ day_view->client, NULL);
+}
+
+static void
+e_day_view_on_publish (GtkWidget *widget, gpointer data)
+{
+ EDayView *day_view;
+ icaltimezone *utc;
+ time_t start = time (NULL), end;
+ GList *comp_list;
+
+ day_view = E_DAY_VIEW (data);
+
+ utc = icaltimezone_get_utc_timezone ();
+ start = time_day_begin_with_zone (start, utc);
+ end = time_add_week_with_zone (start, 6, utc);
+
+ comp_list = cal_client_get_free_busy (day_view->client, NULL, start, end);
+ if (comp_list) {
+ GList *l;
+
+ for (l = comp_list; l; l = l->next) {
+ CalComponent *comp = CAL_COMPONENT (l->data);
+ itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
+ day_view->client, NULL);
+
+ gtk_object_unref (GTK_OBJECT (comp));
+ }
+
+ g_list_free (comp_list);
+ }
+}
static void
e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 8e687eae53..ce8bba0635 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -47,6 +47,7 @@
#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-canvas-utils.h>
#include <gal/widgets/e-unicode.h>
+#include <e-util/e-dialog-utils.h>
#include "dialogs/delete-comp.h"
#include "dialogs/send-comp.h"
#include "comp-util.h"
@@ -54,6 +55,7 @@
#include "cal-util/timeutil.h"
#include "calendar-commands.h"
#include "calendar-config.h"
+#include "print.h"
#include "goto.h"
#include "e-week-view-event-item.h"
#include "e-week-view-layout.h"
@@ -174,12 +176,28 @@ static void e_week_view_on_new_appointment (GtkWidget *widget,
gpointer data);
static void e_week_view_on_new_event (GtkWidget *widget,
gpointer data);
+static void e_week_view_on_new_meeting (GtkWidget *widget,
+ gpointer data);
+static void e_week_view_on_new_task (GtkWidget *widget,
+ gpointer data);
static void e_week_view_on_goto_today (GtkWidget *widget,
gpointer data);
static void e_week_view_on_goto_date (GtkWidget *widget,
gpointer data);
static void e_week_view_on_edit_appointment (GtkWidget *widget,
gpointer data);
+static void e_week_view_on_save_as (GtkWidget *widget,
+ gpointer data);
+static void e_week_view_on_print (GtkWidget *widget,
+ gpointer data);
+static void e_week_view_on_print_event (GtkWidget *widget,
+ gpointer data);
+static void e_week_view_on_meeting (GtkWidget *widget,
+ gpointer data);
+static void e_week_view_on_forward (GtkWidget *widget,
+ gpointer data);
+static void e_week_view_on_publish (GtkWidget *widget,
+ gpointer data);
static void e_week_view_on_delete_occurrence (GtkWidget *widget,
gpointer data);
static void e_week_view_on_delete_appointment (GtkWidget *widget,
@@ -3414,6 +3432,15 @@ static EPopupMenu main_items [] = {
e_week_view_on_new_appointment, NULL, NULL, 0 },
{ N_("New All Day _Event"), NULL,
e_week_view_on_new_event, NULL, NULL, 0 },
+ { N_("New Meeting"), NULL,
+ e_week_view_on_new_meeting, NULL, NULL, 0 },
+ { N_("New Task"), NULL,
+ e_week_view_on_new_task, NULL, NULL, 0 },
+
+ E_POPUP_SEPARATOR,
+
+ { N_("_Print..."), NULL,
+ e_week_view_on_print, NULL, NULL, 0 },
E_POPUP_SEPARATOR,
@@ -3425,16 +3452,28 @@ static EPopupMenu main_items [] = {
{ N_("Go to _Today"), NULL,
e_week_view_on_goto_today, NULL, NULL, 0 },
{ N_("_Go to Date..."), NULL,
- e_week_view_on_goto_date, NULL, NULL, 0 },
-
+ e_week_view_on_goto_date, NULL, NULL, 0 },
+
+ E_POPUP_SEPARATOR,
+
+ { N_("_Publish Free/Busy Information"), NULL,
+ e_week_view_on_publish, NULL, NULL, 0 },
+
+ E_POPUP_SEPARATOR,
+
+ { N_("_Configure..."), NULL,
+ e_week_view_on_paste, NULL, NULL, 0 },
+
E_POPUP_TERMINATOR
};
static EPopupMenu child_items [] = {
{ N_("_Open"), NULL,
e_week_view_on_edit_appointment, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
- { N_("_Delete this Appointment"), NULL,
- e_week_view_on_delete_appointment, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
+ { N_("_Save As..."), NULL,
+ e_week_view_on_save_as, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
+ { N_("_Print..."), NULL,
+ e_week_view_on_print_event, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
/* Only show this separator if one of the above is shown. */
{ "", NULL, NULL, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
@@ -3448,15 +3487,15 @@ static EPopupMenu child_items [] = {
E_POPUP_SEPARATOR,
- { N_("New _Appointment..."), NULL,
- e_week_view_on_new_appointment, NULL, NULL, 0 },
+ { N_("_Schedule Meeting..."), NULL,
+ e_week_view_on_meeting, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
+ { N_("_Forward as iCalendar..."), NULL,
+ e_week_view_on_forward, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
- { "", NULL, NULL, NULL, NULL, MASK_SINGLE },
+ E_POPUP_SEPARATOR,
- /*
- * The following are only shown if this is a recurring event
- */
- { "", NULL, NULL, NULL, NULL, MASK_SINGLE },
+ { N_("_Delete this Appointment"), NULL,
+ e_week_view_on_delete_appointment, NULL, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
{ N_("Make this Occurrence _Movable"), NULL,
e_week_view_on_unrecur_appointment, NULL, NULL, MASK_RECURRING | MASK_EDITING },
{ N_("Delete this _Occurrence"), NULL,
@@ -3548,6 +3587,40 @@ e_week_view_on_new_event (GtkWidget *widget, gpointer data)
}
static void
+e_week_view_on_new_meeting (GtkWidget *widget, gpointer data)
+{
+ EWeekView *week_view = E_WEEK_VIEW (data);
+ time_t dtstart, dtend;
+ struct icaltimetype itt;
+
+ if (week_view->selection_start_day == week_view->selection_end_day) {
+ dtstart = week_view->day_starts[week_view->selection_start_day];
+ itt = icaltime_from_timet_with_zone (dtstart, FALSE,
+ week_view->zone);
+ itt.hour = calendar_config_get_day_start_hour ();
+ itt.minute = calendar_config_get_day_start_minute ();
+ dtstart = icaltime_as_timet_with_zone (itt, week_view->zone);
+
+ icaltime_adjust (&itt, 0, 0, 30, 0);
+ dtend = icaltime_as_timet_with_zone (itt, week_view->zone);
+ } else {
+ dtstart = week_view->day_starts[week_view->selection_start_day];
+ dtend = week_view->day_starts[week_view->selection_end_day + 1];
+ }
+
+ gnome_calendar_new_appointment_for (
+ week_view->calendar, dtstart, dtend, FALSE, TRUE);
+}
+
+static void
+e_week_view_on_new_task (GtkWidget *widget, gpointer data)
+{
+ EWeekView *week_view = E_WEEK_VIEW (data);
+
+ gnome_calendar_new_task (week_view->calendar);
+}
+
+static void
e_week_view_on_goto_date (GtkWidget *widget, gpointer data)
{
EWeekView *week_view = E_WEEK_VIEW (data);
@@ -3584,6 +3657,158 @@ e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data)
g_warning ("Calendar not set");
}
+static void
+e_week_view_on_print (GtkWidget *widget, gpointer data)
+{
+ EWeekView *week_view;
+ time_t start;
+ GnomeCalendarViewType view_type;
+ PrintView print_view;
+
+ week_view = E_WEEK_VIEW (data);
+
+ gnome_calendar_get_current_time_range (week_view->calendar, &start, NULL);
+ view_type = gnome_calendar_get_view (week_view->calendar);
+
+ switch (view_type) {
+ case GNOME_CAL_WEEK_VIEW:
+ print_view = PRINT_VIEW_WEEK;
+ break;
+
+ case GNOME_CAL_MONTH_VIEW:
+ print_view = PRINT_VIEW_MONTH;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ return;
+ }
+
+ print_calendar (week_view->calendar, FALSE, start, print_view);
+}
+
+static void
+e_week_view_on_save_as (GtkWidget *widget, gpointer data)
+{
+ EWeekView *week_view;
+ EWeekViewEvent *event;
+ char *filename;
+ char *ical_string;
+ FILE *file;
+
+ week_view = E_WEEK_VIEW (data);
+
+ if (week_view->popup_event_num == -1)
+ return;
+
+ event = &g_array_index (week_view->events, EWeekViewEvent,
+ week_view->popup_event_num);
+
+ filename = e_file_dialog_save (_("Save as..."));
+ if (filename == NULL)
+ return;
+
+ ical_string = cal_client_get_component_as_string (week_view->client, event->comp);
+ if (ical_string == NULL) {
+ g_warning ("Couldn't convert item to a string");
+ return;
+ }
+
+ file = fopen (filename, "w");
+ if (file == NULL) {
+ g_warning ("Couldn't save item");
+ return;
+ }
+
+ fprintf (file, ical_string);
+ g_free (ical_string);
+ fclose (file);
+}
+
+static void
+e_week_view_on_print_event (GtkWidget *widget, gpointer data)
+{
+ EWeekView *week_view;
+ EWeekViewEvent *event;
+
+ week_view = E_WEEK_VIEW (data);
+
+ if (week_view->popup_event_num == -1)
+ return;
+
+ event = &g_array_index (week_view->events, EWeekViewEvent,
+ week_view->popup_event_num);
+
+ print_comp (event->comp, week_view->client, FALSE);
+}
+
+static void
+e_week_view_on_meeting (GtkWidget *widget, gpointer data)
+{
+ EWeekView *week_view;
+ EWeekViewEvent *event;
+
+ week_view = E_WEEK_VIEW (data);
+
+ if (week_view->popup_event_num == -1)
+ return;
+
+ event = &g_array_index (week_view->events, EWeekViewEvent,
+ week_view->popup_event_num);
+
+ if (week_view->calendar)
+ gnome_calendar_edit_object (week_view->calendar, event->comp, TRUE);
+ else
+ g_warning ("Calendar not set");
+}
+
+static void
+e_week_view_on_forward (GtkWidget *widget, gpointer data)
+{
+ EWeekView *week_view;
+ EWeekViewEvent *event;
+
+ week_view = E_WEEK_VIEW (data);
+
+ if (week_view->popup_event_num == -1)
+ return;
+
+ event = &g_array_index (week_view->events, EWeekViewEvent,
+ week_view->popup_event_num);
+
+ itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, event->comp,
+ week_view->client, NULL);
+}
+
+static void
+e_week_view_on_publish (GtkWidget *widget, gpointer data)
+{
+ EWeekView *week_view;
+ icaltimezone *utc;
+ time_t start = time (NULL), end;
+ GList *comp_list;
+
+ week_view = E_WEEK_VIEW (data);
+
+ utc = icaltimezone_get_utc_timezone ();
+ start = time_day_begin_with_zone (start, utc);
+ end = time_add_week_with_zone (start, 6, utc);
+
+ comp_list = cal_client_get_free_busy (week_view->client, NULL, start, end);
+ if (comp_list) {
+ GList *l;
+
+ for (l = comp_list; l; l = l->next) {
+ CalComponent *comp = CAL_COMPONENT (l->data);
+ itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
+ week_view->client, NULL);
+
+ gtk_object_unref (GTK_OBJECT (comp));
+ }
+
+ g_list_free (comp_list);
+ }
+}
static void
e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)