Last Comment Bug 499878 - drag & drop an .eml file into a mailbox folder
: drag & drop an .eml file into a mailbox folder
Status: RESOLVED FIXED
:
Product: SeaMonkey
Classification: Client Software
Component: MailNews: Message Display (show other bugs)
: unspecified
: All All
: -- enhancement (vote)
: seamonkey2.0b2
Assigned To: Phil Lacy
:
Mentors:
Depends on: 171907
Blocks: 500917
  Show dependency treegraph
 
Reported: 2009-06-22 21:50 PDT by Phil Lacy
Modified: 2009-09-01 14:36 PDT (History)
10 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
drag and drop external files to a folder in mail part of seamonkey (4.65 KB, patch)
2009-06-22 22:01 PDT, Phil Lacy
mnyromyr: review-
Details | Diff | Review
per review comments + changed to more appropriate, nsIFile (3.98 KB, patch)
2009-07-07 21:00 PDT, Phil Lacy
mnyromyr: review+
Details | Diff | Review
forbid drop on rss feed folders (4.59 KB, patch)
2009-07-19 22:16 PDT, Phil Lacy
mnyromyr: review+
Details | Diff | Review
drop on rss folder is ok (4.54 KB, patch)
2009-08-06 19:41 PDT, Phil Lacy
mozilla: superreview+
Details | Diff | Review

Description Phil Lacy 2009-06-22 21:50:56 PDT
+++ This bug was initially created as a clone of Bug #171907 +++

Once I saved an email as eml-file and deleted it from my mail folders, I cannot
get it into a mail folder again.
This could be useful e.g. to create a reply, or to "edit message as new".

Workaround: drag & drop it to Outlook Express, then Tools->Import... from there.

I am using 1.1 on Windows 2000. Does this work on Linux?
Comment 1 Phil Lacy 2009-06-22 22:01:59 PDT
Created attachment 384570 [details] [diff] [review]
drag and drop external files to a folder in mail part of seamonkey

Seamonkey is a little different.
this worked for my quick install of seamonkey but I'm not that familiar with it.
It works with copying local store and didn't break multiple messages dnd. But not tested to see if it broke rss feeds dnd and dnd to imap or dnd of folders.
Comment 2 Magnus Melin 2009-06-22 22:16:12 PDT
Comment on attachment 384570 [details] [diff] [review]
drag and drop external files to a folder in mail part of seamonkey

Passing this to Karsten (i'm not a mailnews/ reviewer)
Comment 3 Karsten Düsterloh 2009-07-07 15:07:33 PDT
Comment on attachment 384570 [details] [diff] [review]
drag and drop external files to a folder in mail part of seamonkey

Works even under Linux. ;-)

Just some nits:

>diff --git a/mailnews/base/resources/content/messengerdnd.js b/mailnews/base/resources/content/messengerdnd.js
>     trans.addDataFlavor("text/x-moz-newsfolder");
>+    trans.addDataFlavor("application/x-moz-file");

This MIME type looks odd. It does neither an official one nor does it follow the internal Mozilla scheme of text/x-moz-*, so where do you get it?
You should use the official "message/rfc822" type.

>@@ -83,16 +84,28 @@ function CanDropOnFolderTree(index, orie
>+          dataObj = dataObj.value.QueryInterface(Components.interfaces.nsILocalFile);
>+          if (!dataObj)
>+            return false;
>+          return dataObj.isFile();

You can just use

if (dataObj && dataObj.value instanceof Components.interfaces.nsILocalFile)
  return dataObj.isFile();
return false;

here.

>+    var dropFile = false;

What's the use of this variable? It's only set twice and never used.

>+        // shortcircuit external files and get out
>+        if (flavor.value == "application/x-moz-file") {

You should put the { (here and below) on their own lines for consistency reasons.

>+          dropFile = true;
>+          if (dataObj)
>+            dataObj = dataObj.value.QueryInterface(Components.interfaces.nsILocalFile);
>+          if (!dataObj)
>+            return false; // don't know how this would ever happen
>+          if (dataObj.isFile()) {
>+            let len = dataObj.leafName.length;
>+            if (len > 4 && dataObj.leafName.substr(len-4).toLowerCase() == ".eml")

Need spaces around the subtraction operator.

>+            }

Wrong indent.

>     }
>-
>+    

Don't add superfluous whitespace.
Comment 4 Phil Lacy 2009-07-07 21:00:37 PDT
Created attachment 387371 [details] [diff] [review]
per review comments + changed to more appropriate, nsIFile

http://mxr.mozilla.org/comm-central/source/mozilla/widget/public/nsITransferable.idl#57

the lost var dropFile was holdover from different approach.

above link shows our transfer flavor for files. Although it's a local file the transferable indicates nsIFile so I changed to that interface.
Comment 5 Karsten Düsterloh 2009-07-08 16:08:35 PDT
Comment on attachment 387371 [details] [diff] [review]
per review comments + changed to more appropriate, nsIFile

> above link shows our transfer flavor for files.

Yeah, sorry, I only realized after commenting. :-|
Comment 6 Karsten Düsterloh 2009-07-08 22:53:06 PDT
Comment on attachment 387371 [details] [diff] [review]
per review comments + changed to more appropriate, nsIFile

You need SR on shared code in /mailnews.
Comment 7 Phil Lacy 2009-07-19 22:16:38 PDT
Created attachment 389419 [details] [diff] [review]
forbid drop on rss feed folders

added a 'no drop' if on rss feed folder.
Also, var cs was moved but I copied it to its new location instead of moving.
Comment 8 David :Bienvenu 2009-07-24 12:55:43 PDT
Why would we disable drop on rss feed folders? They're just local folders, and they can have messages added to them if the user wants...or does drag drop not work onto them?
Comment 9 Phil Lacy 2009-07-24 16:09:47 PDT
bug 505116 Thunderbird, Magnus was thinking the same thing.

This patch needs to have file drop to rss reenabled.
Comment 10 Phil Lacy 2009-08-06 09:39:06 PDT
Comment on attachment 389419 [details] [diff] [review]
forbid drop on rss feed folders

I'll revise it to allow drop in rss folders
Comment 11 Phil Lacy 2009-08-06 19:41:05 PDT
Created attachment 393111 [details] [diff] [review]
drop on rss folder is ok
Comment 12 Frank Wein [:mcsmurf] 2009-09-01 14:36:24 PDT
Pushed: http://hg.mozilla.org/comm-central/rev/7cd1d18a9c46

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