Bug 1634946 - Re-instate 'Initially Show Attachment Pane' option. r=mkmelin a=wsmwk
authorJorg K <jorgk@jorgk.com>
Fri, 12 Jun 2020 15:31:26 +1200
changeset 39368 e149840af8ce7284ee53c47d026246dde1b0ac2f
parent 39367 8d70324cc50fc8404942967057cbc68dbd7751f0
child 39369 db11539cc578c7f08860f716e096183c7566edd1
push id402
push userclokep@gmail.com
push dateMon, 29 Jun 2020 20:48:04 +0000
reviewersmkmelin, wsmwk
bugs1634946
Bug 1634946 - Re-instate 'Initially Show Attachment Pane' option. r=mkmelin a=wsmwk
mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js
--- a/mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js
+++ b/mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js
@@ -791,28 +791,23 @@ Enigmail.msg = {
           if (!this.findRelatedAttachment(bucketList, node)) {
             // Let's release the attachment object held by the node else it won't go away until the window is destroyed
             node.attachment = null;
             node = bucketList.removeChild(node);
           }
         }
         node = node.nextSibling;
       }
-      if (!bucketList.hasChildNodes()) {
-        try {
-          // TB only
-          UpdateAttachmentBucket(false);
-        } catch (ex) {}
-      }
     }
 
-    try {
-      // TB only
+    // If we removed all the children and the bucket wasn't meant
+    // to stay open, close it.
+    if (!Services.prefs.getBoolPref("mail.compose.show_attachment_pane")) {
       UpdateAttachmentBucket(bucketList.hasChildNodes());
-    } catch (ex) {}
+    }
 
     //this.processFinalState();
     if (selectedElement) {
       selectedElement.focus();
     }
   },
 
   // check if an signature is related to another attachment
@@ -1076,16 +1071,17 @@ Enigmail.msg = {
       keyAttachment.name = "pgpkeys.asc";
     }
     keyAttachment.temporary = true;
     keyAttachment.contentType = "application/pgp-keys";
 
     // add attachment to msg
     this.addAttachment(keyAttachment);
 
+    // XXX TODO: ChangeAttachmentBucketVisibility() doesn't exist.
     try {
       // TB only
       ChangeAttachmentBucketVisibility(false);
     } catch (ex) {}
     gContentChanged = true;
     return keyAttachment;
   },
 
@@ -1160,16 +1156,17 @@ Enigmail.msg = {
           this.attachOwnKeyObj.attachedObj = null;
           this.attachOwnKeyObj.attachedKey = null;
           node = null; // exit loop
         } else {
           node = node.nextSibling;
         }
       }
       if (!bucketList.hasChildNodes()) {
+        // XXX TODO: ChangeAttachmentBucketVisibility() doesn't exist.
         try {
           // TB only
           ChangeAttachmentBucketVisibility(true);
         } catch (ex) {}
       }
     }
   },