"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "comm/suite/mailnews/content/threadPane.js" between
seamonkey-2.53.8.source.tar.xz and seamonkey-2.53.8.1.source.tar.xz

About: SeaMonkey is an all-in-one internet application suite. Using much of the Mozilla source code it contains a Web-browser, email & newsgroup and feed client, IRC chat, and an included HTML editor.

threadPane.js  (seamonkey-2.53.8.source.tar.xz):threadPane.js  (seamonkey-2.53.8.1.source.tar.xz)
/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var gLastMessageUriToLoad = null; var gLastMessageUriToLoad = null;
var gThreadPaneCommandUpdater = null; var gThreadPaneCommandUpdater = null;
function ThreadPaneOnClick(event) function ThreadPaneOnClick(event)
{ {
// usually, we're only interested in tree content clicks, not scrollbars etc. // usually, we're only interested in tree content clicks, not scrollbars etc.
let t = event.originalTarget; let t = event.originalTarget;
// we may want to open the message in a new tab on middle click // we may want to open the message in a new tab on middle click
if (event.button == kMouseButtonMiddle) if (event.button == kMouseButtonMiddle)
skipping to change at line 465 skipping to change at line 467
document.getElementById("threadTree")._selectDelay = delay; document.getElementById("threadTree")._selectDelay = delay;
} }
function ThreadPaneSelectionChanged() function ThreadPaneSelectionChanged()
{ {
UpdateStatusMessageCounts(gMsgFolderSelected); UpdateStatusMessageCounts(gMsgFolderSelected);
if (!gRightMouseButtonDown) if (!gRightMouseButtonDown)
GetThreadTree().view.selectionChanged(); GetThreadTree().view.selectionChanged();
} }
var ThreadPaneDND = {
onDragStart(aEvent) {
if (aEvent.originalTarget.localName != "treechildren")
return;
let messageUris = gFolderDisplay.selectedMessageUris;
if (!messageUris)
return;
// A message can be dragged from one window and dropped on another window.
// Therefore we setNextMessageAfterDelete() here since there is no major
// disadvantage, even if it is a copy operation.
SetNextMessageAfterDelete();
let messengerBundle = document.getElementById("bundle_messenger");
let noSubject = messengerBundle.getString("defaultSaveMessageAsFileName");
if (noSubject.endsWith(".eml")) {
noSubject = noSubject.slice(0, -4);
}
let fileNames = [];
let dataTransfer = aEvent.dataTransfer;
for (let [index, msgUri] of messageUris.entries()) {
let msgService = messenger.messageServiceFromURI(msgUri);
let msgHdr = msgService.messageURIToMsgHdr(msgUri);
let subject = msgHdr.mime2DecodedSubject || noSubject;
if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe) {
subject = "Re: " + subject;
}
let uniqueFileName = suggestUniqueFileName(subject.substr(0, 120), ".eml",
fileNames);
fileNames[index] = uniqueFileName;
let msgUrl = {};
msgService.GetUrlForUri(msgUri, msgUrl, null);
dataTransfer.mozSetDataAt("text/x-moz-message", msgUri, index);
dataTransfer.mozSetDataAt("text/x-moz-url", msgUrl.value.spec, index);
dataTransfer.mozSetDataAt("application/x-moz-file-promise-url",
msgUrl.value.spec + "?fileName=" +
encodeURIComponent(uniqueFileName),
index);
dataTransfer.mozSetDataAt("application/x-moz-file-promise",
new messageFlavorDataProvider(), index);
}
dataTransfer.effectAllowed = "copyMove";
dataTransfer.addElement(aEvent.originalTarget);
},
onDragOver(aEvent) {
if (!gMsgFolderSelected.canFileMessages ||
gMsgFolderSelected.server.type == "rss")
return;
let dt = aEvent.dataTransfer;
dt.effectAllowed = "copy";
for (let i = 0; i < dt.mozItemCount; i++) {
if (Array.from(dt.mozTypesAt(i)).includes("application/x-moz-file")) {
let extFile = dt.mozGetDataAt("application/x-moz-file", i);
if (!extFile) {
return;
}
extFile = extFile.QueryInterface(Ci.nsIFile);
if (extFile.isFile() && /\.eml$/i.test(extFile.leafName)) {
aEvent.preventDefault();
return;
}
}
}
},
onDrop(aEvent) {
let dt = aEvent.dataTransfer;
for (let i = 0; i < dt.mozItemCount; i++) {
let extFile = dt.mozGetDataAt("application/x-moz-file", i);
if (!extFile) {
continue;
}
extFile = extFile.QueryInterface(Ci.nsIFile);
if (extFile.isFile() && /\.eml$/i.test(extFile.leafName))
MailServices.copy.CopyFileMessage(extFile, gMsgFolderSelected, null,
false, 1, "", null, msgWindow);
}
},
}
function messageFlavorDataProvider() {}
messageFlavorDataProvider.prototype = {
QueryInterface: XPCOMUtils.generateQI(["nsIFlavorDataProvider"]),
getFlavorData(aTransferable, aFlavor, aData, aDataLen) {
if (aFlavor !== "application/x-moz-file-promise") {
return;
}
let fileUriPrimitive = {};
let dataSize = {};
aTransferable.getTransferData("application/x-moz-file-promise-url",
fileUriPrimitive, dataSize);
let fileUriStr = fileUriPrimitive.value
.QueryInterface(Ci.nsISupportsString);
let fileUri = Services.io.newURI(fileUriStr.data);
let fileUrl = fileUri.QueryInterface(Ci.nsIURL);
let fileName = fileUrl.fileName;
let destDirPrimitive = {};
aTransferable.getTransferData("application/x-moz-file-promise-dir",
destDirPrimitive, dataSize);
let destDirectory = destDirPrimitive.value.QueryInterface(Ci.nsIFile);
let file = destDirectory.clone();
file.append(fileName);
let messageUriPrimitive = {};
aTransferable.getTransferData("text/x-moz-message", messageUriPrimitive,
dataSize);
let messageUri = messageUriPrimitive.value
.QueryInterface(Ci.nsISupportsString);
messenger.saveAs(messageUri.data, true, null, decodeURIComponent(file.path),
true);
},
};
addEventListener("load",ThreadPaneOnLoad,true); addEventListener("load",ThreadPaneOnLoad,true);
 End of changes. 2 change blocks. 
0 lines changed or deleted 124 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)