[california/wip/740088-invite] Note event creation/update in email message



commit c9021649a80cf329571b4a4f610b1aa69aed13ac
Author: Jim Nelson <jim yorba org>
Date:   Thu Nov 20 15:15:54 2014 -0800

    Note event creation/update in email message

 src/host/host-create-update-event.vala |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/host/host-create-update-event.vala b/src/host/host-create-update-event.vala
index 27d9af5..cf16fc7 100644
--- a/src/host/host-create-update-event.vala
+++ b/src/host/host-create-update-event.vala
@@ -370,8 +370,7 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         
         Toolkit.set_unbusy(this, cursor);
         
-        // TODO: PUBLISH or REQUEST?
-        invite_attendees(target, iCal.icalproperty_method.REQUEST);
+        invite_attendees(target, true);
         
         if (create_err == null)
             notify_success();
@@ -425,7 +424,7 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         Toolkit.set_unbusy(this, cursor);
         
         // PUBLISH is used to update an existing event
-        invite_attendees(target, iCal.icalproperty_method.PUBLISH);
+        invite_attendees(target, false);
         
         if (update_err == null)
             notify_success();
@@ -433,7 +432,7 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
             report_error(_("Unable to update event: %s").printf(update_err.message));
     }
     
-    private void invite_attendees(Component.Event event, iCal.icalproperty_method method) {
+    private void invite_attendees(Component.Event event, bool is_create) {
         // Make list of invitees, which are attendees who are not organizers
         Gee.List<Component.Person> invitees = traverse<Component.Person>(event.attendees)
             .filter(attendee => !event.organizers.contains(attendee))
@@ -446,7 +445,7 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
             return;
         
         // TODO: Differentiate between instance updates and master updates
-        Component.iCalendar ics = event.export_master(method);
+        Component.iCalendar ics = event.export_master(iCal.icalproperty_method.REQUEST);
         
         // export .ics to temporary directory so the filename is a pristine "invite.ics"
         string? temporary_filename = null;
@@ -481,17 +480,18 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         
         argv += "--subject";
         if (String.is_empty(event.summary)) {
-            argv += _("Event invitation");
+            argv += is_create ? _("Event invitation") : _("Updated event invitation");
         } else if (String.is_empty(event.location)) {
-            argv += _("Invitation: %s").printf(event.summary);
+            argv += (is_create ? _("Invitation: %s") : _("Updated invitation: %s")).printf(event.summary);
         } else {
             // Invitation: <summary> at <location>
-            argv += _("Invitation: %s at %s").printf(event.summary, event.location);
+            argv += (is_create ? _("Invitation: %s at %s") : _("Updated invitation: %s at %s")).printf(
+                event.summary, event.location);
         }
         
         // TODO: Generate a better body for the email (w/ event summary)
         argv += "--body";
-        argv += generate_invite_body(event);
+        argv += generate_invite_body(event, is_create);
         
         argv += "--attach";
         argv += temporary_filename;
@@ -506,13 +506,16 @@ public class CreateUpdateEvent : Gtk.Grid, Toolkit.Card {
         }
     }
     
-    private static string generate_invite_body(Component.Event event) {
+    private static string generate_invite_body(Component.Event event, bool is_create) {
         StringBuilder builder = new StringBuilder();
         
         // Salutations for an email
         append_line(builder, _("Hello,"));
         append_line(builder);
-        append_line(builder, _("Attached is an invitation to a new event:"));
+        append_line(builder, is_create
+            ? _("Attached is an invitation to a new event:")
+            : _("Attached is an updated event invitation:")
+        );
         append_line(builder);
         
         // Summary


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