Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Commit

Permalink
Display pref values Fixes #4
Browse files Browse the repository at this point in the history
Storing the values after you change them still does not work
  • Loading branch information
mikehardy committed Nov 9, 2018
1 parent 564f61a commit 81d9bfa
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
4 changes: 3 additions & 1 deletion chrome/thunderlink/content/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var ThunderLinkPrefNS = {
tTextbox.setAttribute("id", "prefCustomTlString" + cstrnum + "-title");
tTextbox.setAttribute("preference", "prefs_customTlString" + cstrnum + "title");
tTextbox.setAttribute("size", 51);
tTextbox.setAttribute("value", ThunderLinkPrefNS.GetPreferenceValue("custom-tl-string-" + cstrnum + "-title", "string"));
var tLabel = window.document.createElementNS(XUL_NS, "label");
tLabel.setAttribute("label", "Custom String title:");
tLabel.setAttribute("control", tTextbox.id);
Expand All @@ -36,6 +37,7 @@ var ThunderLinkPrefNS = {
csTextbox.setAttribute("multiline", "true");
csTextbox.setAttribute("cols", "50");
csTextbox.setAttribute("rows", "5");
csTextbox.setAttribute("value", ThunderLinkPrefNS.GetPreferenceValue("custom-tl-string-" + cstrnum, "string"));
var csLabel = window.document.createElementNS(XUL_NS, "label");
csLabel.setAttribute("label", "Custom String:");
csLabel.setAttribute("control", csTextbox.id);
Expand Down Expand Up @@ -124,7 +126,7 @@ var ThunderLinkPrefNS = {
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch("extensions.thunderlink.");
prefService.QueryInterface(Components.interfaces.nsIPrefBranch);
// prefService.QueryInterface(Components.interfaces.nsIPrefBranch);

console.log("Looking for pref " + prefname + " / is it bool? " + bool);
var prefValue = "";
Expand Down
11 changes: 6 additions & 5 deletions chrome/thunderlink/content/thunderlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ var ThunderLinkChromeNS = {
var keywords = hdr.getStringProperty("keywords");
console.log("TagEmail: cur keywords: " + keywords);

function addKeywordToList(keywords, keywordIx) {
var keyword = "$label" + keywordIx;
if (keywords.contains(keyword)) return keywords;
keywords += " " + keyword;
return keywords;
function addKeywordToList(addKeywords, addKeywordIx) {
var keyword = "$label" + addKeywordIx;
if (addKeywords.contains(keyword)) return addKeywords;
// eslint-disable-next-line no-param-reassign
addKeywords += " " + keyword;
return addKeywords;
}
var msg = Components.classes["@mozilla.org/array;1"]
.createInstance(Components.interfaces.nsIMutableArray);
Expand Down
9 changes: 5 additions & 4 deletions components/thunderlinkCommandLineHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var thunderlinkCommandLineHandler = {
if (messageIDIndex !== -1) {
// messageID parameter
// Convert the message URI into a folder URI
const folderURI = mailURL.slice(0, messageIDIndex).replace("thunderlink", "mailbox");
// const folderURI = mailURL.slice(0, messageIDIndex).replace("thunderlink", "mailbox");
// console.log("folderURI is " + folderURI);
// Get the message ID
messageID = mailURL.slice(messageIDIndex + MESSAGE_ID_PARAM.length);
Expand All @@ -69,7 +69,7 @@ var thunderlinkCommandLineHandler = {
// Make sure the folder tree is initialized
MailUtils.discoverFolders();

let folder = MailUtils.getFolderForURI(folderURI, true);
// let folder = MailUtils.getFolderForURI(folderURI, true);
// The folder might not exist, so guard against that
// if (folder && messageID.length > 0)
// msgHdr = folder.msgDatabase.getMsgHdrForMessageID(messageID);
Expand All @@ -92,7 +92,8 @@ var thunderlinkCommandLineHandler = {
// console.log("null msgHdr but messageID exists");
const accountManager = Cc["@mozilla.org/messenger/account-manager;1"].getService(Ci.nsIMsgAccountManager);
const folders = accountManager.allFolders;
for (let msgFolder of fixIterator(folders.enumerate(), Ci.nsIMsgFolder)) {
// eslint-disable-next-line no-restricted-syntax
for (const msgFolder of fixIterator(folders.enumerate(), Ci.nsIMsgFolder)) {
try {
msgHdr = msgFolder.msgDatabase.getMsgHdrForMessageID(messageID);
if (msgHdr !== null) {
Expand Down Expand Up @@ -150,7 +151,7 @@ var thunderlinkCommandLineHandler = {
flags: Ci.nsIClassInfo.SINGLETON,
getHelperForLanguage: function getHelperForLanguage(languageIgnored) { },
getInterfaces: function getInterfaces(count) {
let interfaces = [Ci.nsICommandLineHandler];
const interfaces = [Ci.nsICommandLineHandler];
count.value = interfaces.length;
return interfaces;
},
Expand Down
3 changes: 2 additions & 1 deletion defaults/preferences/thunderlink.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
/*
ThunderLink.
Link from your browser to your email messages!
Expand All @@ -6,7 +7,7 @@
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
file, You can obtain one at http://mozilla.org/MPL/2.0/.
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
pref("extensions.thunderlink.custom-tl-string-1-title", "thunderlink");
pref("extensions.thunderlink.custom-tl-string-1", "<thunderlink>");
Expand Down
4 changes: 2 additions & 2 deletions install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<em:name>ThunderLink</em:name>
<em:version>1.2.2-beta3</em:version>
<em:creator>Christoph Zwirello and others</em:creator>
<em:description>Link from your browser to your email messages!</em:description>
<em:description>Create and use links to specific email messages!</em:description>
<em:optionsURL>chrome://thunderlink/content/preferences.xul</em:optionsURL>
<em:targetApplication>
<Description>
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> <!-- Thunderbird -->
<em:minVersion>5.0</em:minVersion>
<em:minVersion>60.0</em:minVersion>
<em:maxVersion>60.*</em:maxVersion>
</Description>
</em:targetApplication>
Expand Down

0 comments on commit 81d9bfa

Please sign in to comment.