Benvenuto in Thunderbird Add-ons.
Aggiungi nuove funzionalità e stili per rendere Thunderbird veramente tuo.
ChiudiRecensione di piviul per Message Archive Options
Assegnate 5 su 5 stelle
Hi, the last 15th february I've send the patched overlay.js to eviljeff hoping in a fast update of the add-on. Because there are other interested in the patch I write the new overlay.js here:
--- begin overlay.js
var messagearchiveoptions = {
preferenceService: Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.messagearchiveoptions@eviljeff.com."),
get monthValue() {return this.preferenceService.getComplexValue("monthstring",Components.interfaces.nsISupportsString).toString();},
get yearValue() {return this.preferenceService.getComplexValue("yearstring", Components.interfaces.nsISupportsString).toString();},
get keyModifiers() {
var modifiers=new Array();
if (this.preferenceService.getBoolPref("key.shift")) modifiers.push("shift");
if (this.preferenceService.getBoolPref("key.alt")) modifiers.push("alt");
if (this.preferenceService.getBoolPref("key.control")) modifiers.push("accel");
return modifiers;
},
onLoad: function() {
BatchMessageMover.prototype.archiveSelectedMessages = function() {
gFolderDisplay.hintMassMoveStarting();
var selectedMessages = gFolderDisplay.selectedMessages;
if (!selectedMessages.length) {
return;
}
var messages = Components.classes['@mozilla.org/array;1'].createInstance(Components.interfaces.nsIMutableArray);
for (let i = 0; i < selectedMessages.length; ++i) {
let msgHdr = selectedMessages[i];
let server = msgHdr.folder.server;
let rootFolder = server.rootFolder;
let msgDate = new Date(msgHdr.date / 1000);
let fullPath = String(msgHdr.folder.URI).replace(server.serverURI, "").substring(1);
let rootPath = fullPath.substring(0, fullPath.indexOf('/', 1));
if (rootPath.length == 0) rootPath=fullPath;
let yearValue = messagearchiveoptions.yearValue.replace('%F', fullPath);
yearValue = yearValue.replace('%f', rootPath);
let msgYear = msgDate.toLocaleFormat(yearValue);
let monthValue = messagearchiveoptions.monthValue.replace('%F', fullPath);
monthValue = monthValue.replace('%f', rootPath);
let monthFolderName = msgDate.toLocaleFormat(monthValue);
let archiveFolderUri;
if (server.type == "rss") {
archiveFolderUri = server.serverURI + "/Archives";
} else {
let identity = getIdentityForServer(server);
if (!identity) {
identity = getIdentityForHeader(msgHdr);
}
archiveFolderUri = identity.archiveFolder;
}
let archiveFolder = GetMsgFolderFromUri(archiveFolderUri, false);
let granularity = archiveFolder.server.archiveGranularity;
let copyBatchKey = msgHdr.folder.URI + "\0";
if (granularity >= Components.interfaces.nsIMsgIncomingServer.perYearArchiveFolders) {
copyBatchKey += msgYear;
}
if (granularity >= Components.interfaces.nsIMsgIncomingServer.perMonthArchiveFolders) {
copyBatchKey += monthFolderName;
}
if (!(copyBatchKey in this._batches)) {
this._batches[copyBatchKey] = [msgHdr.folder, archiveFolderUri, granularity, msgYear, monthFolderName];
}
this._batches[copyBatchKey].push(msgHdr);
}
this.processNextBatch();
}
document.getElementById("key_archive").setAttribute("modifiers",this.keyModifiers.join(", "));
},
observe:function(subject ,topic , data) {
if (topic!="nsPref:changed") return;
document.getElementById("key_archive").setAttribute("modifiers",this.keyModifiers.join(", "));
}
};
window.addEventListener("load", function(e) { messagearchiveoptions.onLoad(e); }, false);
messagearchiveoptions.preferenceService.QueryInterface(Components.interfaces.nsIPrefBranch2).addObserver("key", messagearchiveoptions, false);
--- end
I've removed the license block so please don't delete it from the original overlay.js!
Have a grat day
Piviul
Per creare una tua raccolta devi avere un account per Mozilla Add-ons.