Closed Bug 811117 Opened 9 years ago Closed 9 years ago

Remove GetSelectedMessages from mail window and refactor some mail window code

Categories

(SeaMonkey :: MailNews: Message Display, defect)

defect
Not set
normal

Tracking

(seamonkey2.17 fixed)

RESOLVED FIXED
seamonkey2.17
Tracking Status
seamonkey2.17 --- fixed

People

(Reporter: iann_bugzilla, Assigned: iann_bugzilla)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(1 file)

This ports parts of:
* Bug 462681 - mailWindowOverlay.js style/whitespace/indention/comment/linewrap cleanup
* Bug 474701 - gloda global search on toolbar, folder display refactoring mega-bug

It also includes a refactoring of the ComposeMsgByType function so that some code duplication can be removed.
Attachment #680818 - Flags: review?(mnyromyr)
Comment on attachment 680818 [details] [diff] [review]
Remove GSM and refactor other code [Checked in: Comment 2]

> function GetSelectedMessages()
>+  var mailWindow = gMsgCompose && Services.wm.getMostRecentWindow("mail:3pane");
>+  return mailWindow ? mailWindow.gFolderDisplay.selectedMessageUris : null;

You could just "return mailWindow && mailWindow.gFolderDisplay.selectedMessageUris;".

> function RemoveAllMessageTags()
>-  for (j = 0; j < tagArray.length; ++j)
>+  for (var j = 0; j < tagArray.length; ++j)

No need to put j into the global scope here.

>+  for (var i = 0; i < selectedMessages.length; ++i)

Nor needs i here.

>+  for (var i = 0; i < selectedMessages.length; ++i)

And here.

>+function PrintEnginePrintInternal(aDoPrintPreview, aMsgType)
>+  if (!messageList) {

Brace on its own line, please.

>+    dump("PrintEnginePrint(): No messages selected.\n");
>+    return false;
>+  }

Also, is the dump really useful? 

> function PrintEnginePrint()
>+  return PrintEnginePrintInternal(false,
>+    Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_MSG);

No need to wrap, imo.

> function PrintEnginePrintPreview()
>+  return PrintEnginePrintInternal(true,
>+    Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_MSG);

And here.

r/moa=me with that.
Attachment #680818 - Flags: superreview+
Attachment #680818 - Flags: review?(mnyromyr)
Attachment #680818 - Flags: review+
Comment on attachment 680818 [details] [diff] [review]
Remove GSM and refactor other code [Checked in: Comment 2]

https://hg.mozilla.org/comm-central/rev/388b6c8b6ea3
Attachment #680818 - Attachment description: Remove GSM and refactor other code → Remove GSM and refactor other code [Checked in: Comment 2]
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.17
Wed Nov 28 2012 12:56:56
Error: An error occurred updating the cmd_delete command: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIMsgDBView.hdrForFirstSelectedMessage]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://messenger/content/folderDisplay.js :: gFolderDisplay.selectedMessage :: line 18"  data: no]
Source file: chrome://global/content/globalOverlay.js
Line: 81
 ----------
Wed Nov 28 2012 12:56:56
Error: An error occurred updating the button_junk command: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIMsgDBView.hdrForFirstSelectedMessage]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://messenger/content/folderDisplay.js :: gFolderDisplay.selectedMessage :: line 18"  data: no]
Source file: chrome://global/content/globalOverlay.js
Line: 81
 ----------
Wed Nov 28 2012 12:56:56
Error: An error occurred updating the button_delete command: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIMsgDBView.hdrForFirstSelectedMessage]"  nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame :: chrome://messenger/content/folderDisplay.js :: gFolderDisplay.selectedMessage :: line 18"  data: no]
Source file: chrome://global/content/globalOverlay.js
Line: 81
 ----------
Wed Nov 28 2012 12:50:57
Error: ReferenceError: ILPrefs is not defined
Source file: chrome://infolister/content/overlay.js
Line: 37
Depends on: 1038081
You need to log in before you can comment on or make changes to this bug.