Last Comment Bug 700899 - Port |Bug 193281 - Ability to import/save e-mail messages from .eml text files to folders (Message|Copy)|
: Port |Bug 193281 - Ability to import/save e-mail messages from .eml text file...
Product: SeaMonkey
Classification: Client Software
Component: MailNews: Message Display (show other bugs)
: Trunk
: All All
: -- enhancement (vote)
: seamonkey2.8
Assigned To: Jens Hatlak (:InvisibleSmiley)
Depends on: 193281
Blocks: 241213 269826 738163
  Show dependency treegraph
Reported: 2011-11-08 18:52 PST by Jim Porter (:squib)
Modified: 2012-03-22 01:28 PDT (History)
32 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---

patch [Checkin: comment 7] (4.76 KB, patch)
2011-11-11 14:15 PST, Jens Hatlak (:InvisibleSmiley)
mnyromyr: review+
mnyromyr: superreview+
Details | Diff | Splinter Review

Description Jim Porter (:squib) 2011-11-08 18:52:33 PST
+++ This bug was initially created as a clone of Bug #193281 +++

Mozilla can easily save selected messages to .eml text file. But there is no way
to perform opposite operation, i.e. import e-mail messages from .eml file. 
Such operation would be especially useful for transporting e-mail messages from
different Mozilla installations...

This bug is about porting the patch from bug 193281 to Seamonkey.
Comment 1 Philip Chee 2011-11-08 20:37:18 PST
Hmm. First we need to port .isDummy. Which bug is this from?
Comment 2 Jim Porter (:squib) 2011-11-08 20:53:38 PST
That's from bug 474701, specifically attachment 382997 [details] [diff] [review]. I doubt you'll want that exact code, but you can probably look at the places where isDummy was added and figure out a good way to detect when you have a dummy message header.
Comment 3 Jens Hatlak (:InvisibleSmiley) 2011-11-11 09:59:33 PST
I think we can add something like this to folderDisplay.js in accordance with messageWindow.js's MessageWindowController.supportsCommand:

get isDummy()
  return gDBView && gDBView.keyForFirstSelectedMessage == nsMsgKey_None;

[I just found that the above mentioned supportsCommand method is the reason why View Source is disabled for .eml messages and that TB uses gFolderDisplay.isDummy in the equivalent method, that's why.]

Philip, will you do this or shall I give it a try?
Comment 4 Philip Chee 2011-11-11 11:42:17 PST
> Philip, will you do this or shall I give it a try?
By all means give it a go. I have other bugs I am currently looking into.
Comment 5 Jens Hatlak (:InvisibleSmiley) 2011-11-11 14:15:42 PST
Created attachment 573916 [details] [diff] [review]
patch [Checkin: comment 7]
Comment 6 Karsten Düsterloh 2011-11-24 14:49:59 PST
Comment on attachment 573916 [details] [diff] [review]
patch [Checkin: comment 7]

Cool feature work!

Just the usual nits. ;-)

>   if(copyMenu)
>-      copyMenu.setAttribute("disabled", !aMessage);
>+      copyMenu.setAttribute("disabled", !canCopy);

Good opportunity to fixup the if as well.

>+    if (gMessageDisplay.isDummy) {
>+      let file = window.arguments[0].QueryInterface(Components.interfaces
>+                                                              .nsIFileURL).file;

No need for an artifical wrap here, imo.

>+    } else {
>+      gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, destMsgFolder);
>+    }
>   }

Please format the new stuff as brace-on-its-own-line (despite the rest of the function still being broken).

r/moa=me with that.
Comment 7 Jens Hatlak (:InvisibleSmiley) 2011-11-25 16:46:13 PST
Comment on attachment 573916 [details] [diff] [review]
patch [Checkin: comment 7]
with nits addressed

Note You need to log in before you can comment on or make changes to this bug.