Fix bug 695247 - Allow opening event if invitation has already been processed. r=decathlon,a=philipp
authorPhilipp Kewisch <mozilla@kewis.ch>
Wed, 02 Nov 2011 23:39:51 +0100
changeset 8980 be53f3a1377dd3e67ad8667d061494486bafc00a
parent 8979 cefa766b7b7f07692ed69a289bf312624f056157
child 8981 faca33ff533f4a3f05a8afc6e817c52ee63e717a
push idunknown
push userunknown
push dateunknown
reviewersdecathlon, philipp
bugs695247
Fix bug 695247 - Allow opening event if invitation has already been processed. r=decathlon,a=philipp
calendar/base/modules/calItipUtils.jsm
calendar/lightning/content/imip-bar.js
--- a/calendar/base/modules/calItipUtils.jsm
+++ b/calendar/base/modules/calItipUtils.jsm
@@ -281,16 +281,19 @@ cal.itip = {
             data[btn] = { label: null, actionMethod: "" };
         }
 
 
         if (Components.isSuccessCode(rc) && !actionFunc) {
             // This case, they clicked on an old message that has already been
             // added/updated, we want to tell them that.
             data.label = _gs("imipBarAlreadyProcessedText");
+            // TODO this needs its own string, but we are in string freeze. (Details...)
+            data.button1.label = cal.calGetString("calendar", "Open");
+            data.button1.actionMethod = "X-SHOWDETAILS"; // not a real method, but helps us decide
         } else if (Components.isSuccessCode(rc)) {
 
             cal.LOG("iTIP options on: " + actionFunc.method);
             switch (actionFunc.method) {
                 case "REPLY":
                     // fall-thru intended
                 case "PUBLISH:UPDATE":
                 case "REQUEST:UPDATE-MINOR":
@@ -983,16 +986,19 @@ ItipFindItemListener.prototype = {
                                                                            aId,
                                                                            aDetail) {
         let rc = Components.results.NS_OK;
         const method = this.mItipItem.receivedMethod.toUpperCase();
         let actionMethod = method;
         let operations = [];
 
         if (this.mFoundItems.length > 0) {
+            // Save the target calendar on the itip item
+            this.mItipItem.targetCalendar = this.mFoundItems[0].calendar;
+
             cal.LOG("iTIP on " + method + ": found " + this.mFoundItems.length + " items.");
             switch (method) {
                 // XXX todo: there's still a potential flaw, if multiple PUBLISH/REPLY/REQUEST on
                 //           occurrences happen at once; those lead to multiple
                 //           occurrence modifications. Since those modifications happen
                 //           implicitly on the parent (ics/memory/storage calls modifyException),
                 //           the generation check will fail. We should really consider to allow
                 //           deletion/modification/addition of occurrences directly on the providers,
--- a/calendar/lightning/content/imip-bar.js
+++ b/calendar/lightning/content/imip-bar.js
@@ -156,17 +156,24 @@ var ltnImipBar = {
                                            "ltnImipBar.executeAction('" + data[button].actionMethod + "')");
 
                 showElement(buttonElement);
             }
         }
     },
 
     executeAction: function ltnExecAction(partStat) {
-        if (cal.itip.promptCalendar(ltnImipBar.actionFunc.method, ltnImipBar.itipItem, window)) {
+        if (partStat == "X-SHOWDETAILS") {
+            let items = ltnImipBar.itipItem.getItemList({});
+            if (items.length) {
+                let item = items[0].isMutable ? items[0] : items[0].clone();
+                item.calendar = ltnImipBar.itipItem.targetCalendar;
+                modifyEventWithDialog(item);
+            }
+        } else if (cal.itip.promptCalendar(ltnImipBar.actionFunc.method, ltnImipBar.itipItem, window)) {
             // hide the buttons now, to disable pressing them twice...
             hideElement("imip-button1");
             hideElement("imip-button2");
             hideElement("imip-button3");
 
             let opListener = {
                 onOperationComplete: function ltnItipActionListener_onOperationComplete(aCalendar,
                                                                                         aStatus,