Skip to content

Commit

Permalink
Merge pull request #20 from otto802/thunderbird-68
Browse files Browse the repository at this point in the history
added Thunderbird 68 compatibility
  • Loading branch information
otto802 authored Sep 19, 2019
2 parents 8288c8f + 9a731ce commit 67982de
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 65 deletions.
2 changes: 1 addition & 1 deletion build-xpi.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

VERSION=0.2.4
VERSION=0.2.5

rm -f builds/quickarchiver-${VERSION}.xpi
cd src
Expand Down
Binary file added builds/quickarchiver-0.2.5.xpi
Binary file not shown.
2 changes: 1 addition & 1 deletion src/chrome.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ locale quickarchiver en-US chrome/locale/en-US/
locale quickarchiver de-DE chrome/locale/de-DE/

overlay chrome://messenger/content/messenger.xul chrome://quickarchiver/content/quickarchiver_messenger.xul
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://quickarchiver/content/quickarchiver_mailwindow.xul
overlay chrome://messenger/content/messenger.xul chrome://quickarchiver/content/quickarchiver_mailwindow.xul
2 changes: 1 addition & 1 deletion src/chrome/content/about.xul
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<groupbox align="center" orient="horizontal">
<vbox>
<text value="QuickArchiver" style="font-weight: bold; font-size: x-large;"/>
<text value="&version; 0.2.4"/>
<text value="&version; 0.2.5"/>
<separator class="thin"/>
<text value="&createdBy;" style="font-weight: bold;"/>
<text value="Otto Berger"/>
Expand Down
8 changes: 3 additions & 5 deletions src/chrome/content/dialog.xul
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
id="quickarchiverDialog"
buttons="accept,cancel,extra1"
title="&dialog.title;"
ondialogaccept="quickarchiver_dialog.send();"
onload="quickarchiver_dialog.onLoad()"
ondialogextra1="quickarchiver_dialog.deleteRule();"
onload="quickarchiverDialog.onLoad();"
buttonlabelextra1="&dialog.button.delete;"
buttonaccesskeyextra1="D"
persist="screenX screenY width"
Expand All @@ -27,7 +25,7 @@
</description>
<vbox style="border:1px solid #CCC;padding:5px;margin-top:5px;margin-bottom:5px;">

<radiogroup id="field" oncommand="quickarchiver_dialog.switchRadio();">
<radiogroup id="field" oncommand="quickarchiverDialog.switchRadio();">
<hbox>
<radio selected="true" id="from" value="from"
label="&dialog.field.from;"/>
Expand All @@ -40,7 +38,7 @@
<groupbox flex="1">
<caption>
<checkbox id="custom" label="&dialog.field.custom;"
onclick="quickarchiver_dialog.switchGroup();"/>
onclick="quickarchiverDialog.switchGroup()"/>
</caption>
<grid>
<columns>
Expand Down
4 changes: 2 additions & 2 deletions src/chrome/content/options.xul
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
strings = document.getElementById("quickarchiver-options-strings");
if (confirm(strings.getString("confirmResetDatabaseMessage"))) {
quickarchiver_sqlite.onLoad();
quickarchiver_sqlite.resetDatabase();
quickarchiverSqlite.onLoad();
quickarchiverSqlite.resetDatabase();
}
}
Expand Down
48 changes: 22 additions & 26 deletions src/chrome/content/quickarchiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ var quickarchiver_newMailListener = {

for (let msgHdr of fixIterator(aSrcMsgs.enumerate(), Components.interfaces.nsIMsgDBHdr)) {

let rule = quickarchiver_sqlite.dbGetRuleFromHdr(msgHdr);
let rule = quickarchiverSqlite.dbGetRuleFromHdr(msgHdr);

if (!rule.id) {

// create default rule

quickarchiver_sqlite.dbInsertRule('from',
quickarchiver_sqlite.parseEmailAddress(msgHdr.author),
quickarchiverSqlite.dbInsertRule('from',
quickarchiverSqlite.parseEmailAddress(msgHdr.author),
aDestFolder.URI,
"=");
}
Expand Down Expand Up @@ -49,7 +49,7 @@ var quickarchiverColumn = {
let key = gDBView.getKeyAt(row);
let hdr = gDBView.db.GetMsgHdrForKey(key);

let rule = quickarchiver_sqlite.dbGetRuleFromHdr(hdr);
let rule = quickarchiverSqlite.dbGetRuleFromHdr(hdr);

if (rule.folder) {

Expand All @@ -73,7 +73,7 @@ var quickarchiverColumn = {
} catch (e) {
// folder not valid

quickarchiver_sqlite.dbRemoveRule(rule.id);
quickarchiverSqlite.dbRemoveRule(rule.id);
// dump("invalid rule removed.");
}
}
Expand All @@ -82,7 +82,7 @@ var quickarchiverColumn = {
},
getSortStringForRow: function (hdr) {

let rule = quickarchiver_sqlite.dbGetRuleFromHdr(hdr);
let rule = quickarchiverSqlite.dbGetRuleFromHdr(hdr);

if (rule.folder) {
return quickarchiver.getFullPathForList(quickarchiver.getMsgFolderFromUri(rule.folder, false));
Expand All @@ -101,7 +101,7 @@ var quickarchiverColumn = {
let key = gDBView.getKeyAt(row);
let hdr = gDBView.db.GetMsgHdrForKey(key);

let rule = quickarchiver_sqlite.dbGetRuleFromHdr(hdr);
let rule = quickarchiverSqlite.dbGetRuleFromHdr(hdr);

if (rule.folder) {

Expand Down Expand Up @@ -141,7 +141,7 @@ var quickarchiver = {

this.initialized = true;
this.strings = document.getElementById("quickarchiver-strings");
quickarchiver_sqlite.onLoad();
quickarchiverSqlite.onLoad();

let ObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
ObserverService.addObserver(quickarchiverColumn.CreateDbObserver, "MsgCreateDBView", false);
Expand Down Expand Up @@ -174,13 +174,10 @@ var quickarchiver = {
},
getMsgFolderFromUri: function (uri, checkFolderAttributes) {

Components.utils.import("resource:///modules/MailUtils.js");

if (typeof MailUtils != 'undefined') {
return MailUtils.getFolderForURI(uri, checkFolderAttributes);
return MailUtils.getExistingFolder(uri, checkFolderAttributes);
} else {
GetMsgFolderFromUri(uri, checkFolderAttributes);

}

},
Expand Down Expand Up @@ -282,7 +279,7 @@ var quickarchiver = {
},
showDialog: function (hdr, folder) {

let rule = quickarchiver_sqlite.dbGetRuleFromHdr(hdr);
let rule = quickarchiverSqlite.dbGetRuleFromHdr(hdr);

if (rule.id && !folder) {
folder = rule.folder;
Expand All @@ -292,9 +289,9 @@ var quickarchiver = {

let params = {
sent: {
to: quickarchiver_sqlite.parseEmailAddress(hdr.recipients),
from: quickarchiver_sqlite.parseEmailAddress(hdr.author),
subject: quickarchiver_sqlite.parseEmailAddress(hdr.subject),
to: quickarchiverSqlite.parseEmailAddress(hdr.recipients),
from: quickarchiverSqlite.parseEmailAddress(hdr.author),
subject: quickarchiverSqlite.parseEmailAddress(hdr.subject),
folder: folder,
folderPath: this.getFullPath(this.getMsgFolderFromUri(folder)),
id: rule.id
Expand Down Expand Up @@ -338,12 +335,12 @@ var quickarchiver = {
if (rule.id) {

// update
quickarchiver_sqlite.dbUpdateRule(params.returned.field,
quickarchiverSqlite.dbUpdateRule(params.returned.field,
params.returned.value, folder, '=', rule.id);
} else {

//insert
quickarchiver_sqlite.dbInsertRule(params.returned.field,
quickarchiverSqlite.dbInsertRule(params.returned.field,
params.returned.value, folder, '=');
}
}
Expand All @@ -358,7 +355,7 @@ var quickarchiver = {
getRuleFromSelected: function () {

if (gFolderDisplay.selectedCount == 1) {
return quickarchiver_sqlite.dbGetRuleFromHdr(gFolderDisplay.selectedMessage);
return quickarchiverSqlite.dbGetRuleFromHdr(gFolderDisplay.selectedMessage);
}

return {};
Expand All @@ -370,23 +367,22 @@ var quickarchiver = {
let xpcomHdrArray = toXPCOMArray(new Array(hdr), Components.interfaces.nsIMutableArray);

quickarchiver.copyService.CopyMessages(folder_src, xpcomHdrArray, folder_dst, true, null, msgWindow, false);
quickarchiver.notify(quickarchiver.strings.getString("NotifyOnMoveHeadline"), quickarchiver_sqlite.parseEmailAddress(hdr.author) + " " + quickarchiver.strings.getString("NotifyOnMoveTo") + " " + quickarchiver.getFullPath(folder_dst));
quickarchiver.notify(quickarchiver.strings.getString("NotifyOnMoveHeadline"), quickarchiverSqlite.parseEmailAddress(hdr.author) + " " + quickarchiver.strings.getString("NotifyOnMoveTo") + " " + quickarchiver.getFullPath(folder_dst));
}
},
moveMailOnClickEvent: function (event) {

try {
let row = {}, col = {}, obj = {};
quickarchiver.tree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, obj);
let cell = quickarchiver.tree.getCellAt(event.clientX, event.clientY);

if (event && event.type == "click" && event.button == 0) {

if (obj.value == "text" && (col.value == "colQuickArchiver" || col.value.id == "colQuickArchiver")) {
if (cell.col.id == "colQuickArchiver") {

let key = gDBView.getKeyAt(row.value);
let key = gDBView.getKeyAt(cell.row);
let hdr = gDBView.db.GetMsgHdrForKey(key);

let rule = quickarchiver_sqlite.dbGetRuleFromHdr(hdr);
let rule = quickarchiverSqlite.dbGetRuleFromHdr(hdr);

if (rule.folder && hdr.folder) {
quickarchiver.moveMail(hdr.folder, quickarchiver.getMsgFolderFromUri(rule.folder), hdr);
Expand All @@ -404,7 +400,7 @@ var quickarchiver = {

for (let hdr of gFolderDisplay.selectedMessages) {

let rule = quickarchiver_sqlite.dbGetRuleFromHdr(hdr);
let rule = quickarchiverSqlite.dbGetRuleFromHdr(hdr);

if (rule.folder) {
quickarchiver.moveMail(hdr.folder, quickarchiver.getMsgFolderFromUri(rule.folder), hdr);
Expand Down
2 changes: 1 addition & 1 deletion src/chrome/content/quickarchiver_db.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let quickarchiver_sqlite = {
let quickarchiverSqlite = {

headerParser: {},
initialized: false,
Expand Down
21 changes: 15 additions & 6 deletions src/chrome/content/quickarchiver_dialog.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
var quickarchiver_dialog = {
var quickarchiverDialog = {
params: {},
onLoad: function () {
quickarchiver_sqlite.onLoad();

quickarchiverSqlite.onLoad();
this.params = window.arguments[0];

if (this.params.sent.field) {
Expand All @@ -12,9 +11,19 @@ var quickarchiver_dialog = {
document.getElementById("desc-folder").value = this.params.sent.folderPath;

this.switchRadio();

// handle events

document.addEventListener("dialogaccept", function(event) {
quickarchiverDialog.send();
});
document.addEventListener("dialogextra1", function(event) {
quickarchiverDialog.deleteRule();
});

},
deleteRule: function () {
var strings = document.getElementById("quickarchiver-dialog-strings");
let strings = document.getElementById("quickarchiver-dialog-strings");

let prompts =
Components.classes["@mozilla.org/embedcomp/prompt-service;1"].
Expand All @@ -23,7 +32,7 @@ var quickarchiver_dialog = {
if (prompts.confirm(window, strings.getString('confirmDeleteRuleTitle'), strings.getString('confirmDeleteRule'))) {

if (this.params.sent.id) {
quickarchiver_sqlite.dbRemoveRule(this.params.sent.id);
quickarchiverSqlite.dbRemoveRule(this.params.sent.id);
}
window.close();
}
Expand All @@ -40,7 +49,7 @@ var quickarchiver_dialog = {
},
switchGroup: function () {

if (!document.getElementById("custom").checked) {
if (document.getElementById("custom").checked) {
document.getElementById("value").disabled = false;
document.getElementById("value-label").disabled = false;
// document.getElementById("regex").disabled = false;
Expand Down
22 changes: 0 additions & 22 deletions src/install.rdf

This file was deleted.

20 changes: 20 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"manifest_version": 2,
"applications": {
"gecko": {
"id": "quickarchiver@bergerdata.de",
"strict_min_version": "68.0"
}
},
"name": "QuickArchiver",
"author": "Otto Berger <otto@bergerdata.de>",
"description": "moving mails into folders quickly",
"version": "0.2.5",
"legacy": {
"type": "xul",
"options": {
"page": "chrome://quickarchiver/content/options.xul",
"open_in_tab": false
}
}
}

0 comments on commit 67982de

Please sign in to comment.