From b67303df0a605a5d7cbff2f470bf7521060e0dcf Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Sun, 18 Feb 2007 06:32:48 +0000 Subject: [PATCH] Bug #223340 --> redesign mail attachments UI to fix the problem where multiple attachments cause the attachment pane to hide the contents of the message pane. thanks to Wayne Woods for putting this patch together. sr=mscott CVS: ---------------------------------------------------------------------- git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@220503 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mail/base/content/messageWindow.xul | 1 + mozilla/mail/base/content/messenger.xul | 1 + .../mail/base/content/msgHdrViewOverlay.js | 35 ++++++++++++++++--- .../mail/base/content/msgHdrViewOverlay.xul | 6 ++-- .../themes/pinstripe/mail/messageHeader.css | 31 ++++++++-------- .../mail/themes/qute/mail/messageHeader.css | 20 ++++------- 6 files changed, 59 insertions(+), 35 deletions(-) diff --git a/mozilla/mail/base/content/messageWindow.xul b/mozilla/mail/base/content/messageWindow.xul index ec8c5b4de6d..fa9b6e39377 100644 --- a/mozilla/mail/base/content/messageWindow.xul +++ b/mozilla/mail/base/content/messageWindow.xul @@ -162,6 +162,7 @@ style="height: 0px; min-height: 1px" flex="1" name="messagepane" disablesecurity="true" disablehistory="true" type="content-primary" src="about:blank" onclick="return contentAreaClick(event);" autofind="false"/> + diff --git a/mozilla/mail/base/content/messenger.xul b/mozilla/mail/base/content/messenger.xul index 32386789af7..0659ac0a7de 100644 --- a/mozilla/mail/base/content/messenger.xul +++ b/mozilla/mail/base/content/messenger.xul @@ -401,6 +401,7 @@ minheight="1" flex="1" name="messagepane" disablehistory="true" type="content-primary" src="about:blank" disablesecurity="true" onclick="return contentAreaClick(event);"/> + diff --git a/mozilla/mail/base/content/msgHdrViewOverlay.js b/mozilla/mail/base/content/msgHdrViewOverlay.js index b535a4306c9..be1d5cfe2c7 100644 --- a/mozilla/mail/base/content/msgHdrViewOverlay.js +++ b/mozilla/mail/base/content/msgHdrViewOverlay.js @@ -775,6 +775,11 @@ function UpdateMessageHeaders() // header view table... var headerName; + + // Remove the height attr so that it redraws correctly. Works around a problem that + // attachment-splitter causes if it's moved high enough to affect the header box: + document.getElementById('msgHeaderView').removeAttribute('height'); + for (headerName in currentHeaderData) { var headerField = currentHeaderData[headerName]; @@ -858,6 +863,7 @@ function HideMessageHeaderPane() document.getElementById("fileAttachmentMenu").setAttribute("disabled", "true"); // disable the attachment box document.getElementById("attachmentView").collapsed = true; + document.getElementById("attachment-splitter").collapsed = true; } function OutputNewsgroups(headerEntry, headerValue) @@ -1224,16 +1230,25 @@ function cloneAttachment(aAttachment) function displayAttachmentsForExpandedView() { var numAttachments = currentAttachments.length; + var expandedAttachmentBox = document.getElementById('attachmentView'); + var attachmentSplitter = document.getElementById('attachment-splitter'); + if (numAttachments <= 0) + { + expandedAttachmentBox.collapsed = true; + attachmentSplitter.collapsed = true; + } + else if (!gBuildAttachmentsForCurrentMsg) + { // IMPORTANT: make sure we uncollapse the attachment box BEFORE we start adding // our attachments to the view. Otherwise, layout doesn't calculate the correct height for // the attachment view and we end up with a box that is too tall. + expandedAttachmentBox.collapsed = false; + attachmentSplitter.collapsed = false; - var expandedAttachmentBox = document.getElementById('attachmentView'); - expandedAttachmentBox.collapsed = numAttachments <= 0; + // Remove height attribute, or the attachments box could be drawn badly: + expandedAttachmentBox.removeAttribute("height"); - if (numAttachments > 0 && !gBuildAttachmentsForCurrentMsg) - { var attachmentList = document.getElementById('attachmentList'); for (index in currentAttachments) { @@ -1262,6 +1277,18 @@ function displayAttachmentsForExpandedView() var item = attachmentList.appendChild(attachmentView); } // for each attachment gBuildAttachmentsForCurrentMsg = true; + + // Switch overflow off (via css attribute selector) temporarily to get the preferred window height: + var attachmentContainer = document.getElementById('attachmentView'); + attachmentContainer.setAttribute("attachmentOverflow", "false"); + var attachmentHeight = expandedAttachmentBox.boxObject.height; + attachmentContainer.setAttribute("attachmentOverflow", "true"); + + // If the attachments box takes up too much of the message pane, downsize: + var maxAttachmentHeight = document.getElementById('messagepanebox').boxObject.height / 4; + if (attachmentHeight > maxAttachmentHeight) + attachmentHeight = maxAttachmentHeight; + expandedAttachmentBox.setAttribute("height", attachmentHeight); } } diff --git a/mozilla/mail/base/content/msgHdrViewOverlay.xul b/mozilla/mail/base/content/msgHdrViewOverlay.xul index 335cf6fa17b..5c61d25061d 100644 --- a/mozilla/mail/base/content/msgHdrViewOverlay.xul +++ b/mozilla/mail/base/content/msgHdrViewOverlay.xul @@ -163,10 +163,10 @@ - -