Bug 740956 - Part 2: Make cancelling and uploading repeatable for Filelink. r+a=bienvenu.
authorMike Conley <mconley@mozilla.com>
Wed, 04 Apr 2012 10:20:09 -0400
changeset 10348 e7c41caf1f084c776e83b0fdb7004cf586544301
parent 10347 45bc09d75c4f3dba8d1ea66498188dccd9273b92
child 10349 a4075036955b049cd483b9de9549bc354d086e1c
push id468
push usermconley@mozilla.com
push dateWed, 04 Apr 2012 14:21:01 +0000
treeherdercomm-aurora@e7c41caf1f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs740956
Bug 740956 - Part 2: Make cancelling and uploading repeatable for Filelink. r+a=bienvenu.
mail/components/compose/content/MsgComposeCommands.js
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -723,18 +723,20 @@ var attachmentBucketController = {
         // If Filelink is disabled, hide this menuitem and bailout.
         if (!Services.prefs.getBoolPref("mail.cloud_files.enabled")) {
           cmd.hidden = true;
           return false;
         }
 
         let bucket = document.getElementById("attachmentBucket");
         for (let [,item] in Iterator(bucket.selectedItems)) {
-          if (item && item.uploading)
+          if (item && item.uploading) {
+            cmd.hidden = false;
             return true;
+          }
         }
 
         // Hide the command entirely if the selected attachments aren't cloud
         // files.
         // For some reason, the hidden property isn't propagating from the cmd
         // to the menuitem.
         cmd.hidden = true;
         return false;
@@ -1062,19 +1064,24 @@ uploadListener.prototype = {
           attachmentItem.image = null;
         }
       }
 
       let event = document.createEvent("Events");
       event.initEvent("attachment-uploaded", true, true);
       attachmentItem.dispatchEvent(event);
     }
-    else if (aStatusCode == this.cloudProvider.uploadCanceled) {
+    else if (aStatusCode == Components.interfaces
+                                      .nsIMsgCloudFileProvider
+                                      .uploadCanceled) {
       attachmentItem.setAttribute("tooltiptext", attachmentItem.attachment.url);
       attachmentItem.image = null;
+      attachmentItem.uploading = false;
+      attachmentItem.attachment.sendViaCloud = false;
+      delete attachmentItem.cloudProvider;
     }
     else {
       let title;
       let msg;
       let displayName = cloudFileAccounts.getDisplayName(this.cloudProvider);
       let bundle = getComposeBundle();
 
       switch (aStatusCode) {