From ac43360490014290c638ad08da66f5dae481c224 Mon Sep 17 00:00:00 2001 From: RealRaven2000 Date: Wed, 20 Jan 2021 22:15:00 +0000 Subject: [PATCH] 4.19.1 - released 20/01/2021 --- build-minimal.bat | 14 --- build.bat | 4 +- chrome/content/filterTemplate.xul | 2 +- chrome/content/options.js | 4 +- chrome/content/options.xul | 8 +- chrome/content/qf-styles.js | 2 +- chrome/content/quickfolders-filterList.js | 33 +---- chrome/content/quickfolders-interface.js | 126 +++++++++++++------ chrome/content/quickfolders-quickMove.js | 89 ++++++++++---- chrome/content/quickfolders-register.js | 12 +- chrome/content/quickfolders-util.js | 79 +++++++++--- chrome/content/quickfolders.js | 142 ++++++++++++---------- install.rdf | 4 +- manifest.json | 4 +- release-notes.html | 19 ++- 15 files changed, 324 insertions(+), 218 deletions(-) delete mode 100644 build-minimal.bat diff --git a/build-minimal.bat b/build-minimal.bat deleted file mode 100644 index 1a310ba45..000000000 --- a/build-minimal.bat +++ /dev/null @@ -1,14 +0,0 @@ -REM create a new build for QuickFolders -set /P quickFoldersRev= revision.txt -move QuickFolders*.xpi "..\..\Release\_Test Versions\4.18\" -pwsh -Command "Start-Sleep -m 150" -rename QuickFoldersWeb.zip QuickFolders-min-4.18pre%quickFoldersRev%.xpi \ No newline at end of file diff --git a/build.bat b/build.bat index 735a7ca1f..904b4f19d 100644 --- a/build.bat +++ b/build.bat @@ -8,6 +8,6 @@ pwsh -Command "(gc -en UTF8NoBOM manifest.json) -replace 'pre%oldRev%', 'pre%qui rem "C:\Program Files\7-Zip\7z" a -xr!.svn quickFolders.zip install.rdf chrome.manifest chrome defaults license.txt "C:\Program Files\7-Zip\7z" a -xr!.svn QuickFoldersWeb.zip manifest.json install.rdf chrome.manifest chrome defaults license.txt echo %quickFoldersRev% > revision.txt -move QuickFolders*.xpi "..\..\Release\_Test Versions\4.18\" +move QuickFolders*.xpi "..\..\Release\_Test Versions\4.19\" pwsh -Command "Start-Sleep -m 150" -rename QuickFoldersWeb.zip QuickFolders-wx-4.18.2pre%quickFoldersRev%.xpi \ No newline at end of file +rename QuickFoldersWeb.zip QuickFolders-wx-4.19.1pre%quickFoldersRev%.xpi \ No newline at end of file diff --git a/chrome/content/filterTemplate.xul b/chrome/content/filterTemplate.xul index 2599dcc2b..68ce843cf 100644 --- a/chrome/content/filterTemplate.xul +++ b/chrome/content/filterTemplate.xul @@ -18,7 +18,7 @@ buttonlabelextra1="&qf.continueFilter.label;" buttonaccesskeyextra1="&qf.continueFilter.shortcut;" buttonlabelextra2="&qf.label.donate;" - ondialogextra2="QuickFolders.Util.openLinkInBrowser(event,'http://quickfolders.org/donate.html')" + ondialogextra2="QuickFolders.Util.openLinkInBrowser(event,'https://quickfolders.org/donate.html')" ondialogcancel="return QuickFolders.FilterWorker.cancelTemplate();" ondialogextra1="return QuickFolders.FilterWorker.acceptTemplate();" onload="QuickFolders.FilterWorker.loadTemplate();" diff --git a/chrome/content/options.js b/chrome/content/options.js index 222b81fda..a86d33be9 100644 --- a/chrome/content/options.js +++ b/chrome/content/options.js @@ -17,7 +17,7 @@ else var QuickFolders_TabURIregexp = { get _thunderbirdRegExp() { delete this._thunderbirdRegExp; - return this._thunderbirdRegExp = new RegExp("^http://quickfolders.org/"); + return this._thunderbirdRegExp = new RegExp("^https://quickfolders.org/"); } }; @@ -1561,7 +1561,7 @@ QuickFolders.Options = { sPrompt = util.getBundleString("qfConfirmVersionLink", "Display version history for QuickFolders"); if (!ask || confirm(sPrompt + " " + pureVersion + "?")) { util.openURL(null, - util.makeUriPremium("http://quickfolders.org/version.html") + util.makeUriPremium("https://quickfolders.org/version.html") + "#" + pureVersion); return true; } diff --git a/chrome/content/options.xul b/chrome/content/options.xul index 2b95081d8..1b8d737ae 100644 --- a/chrome/content/options.xul +++ b/chrome/content/options.xul @@ -990,9 +990,9 @@ @@ -1032,7 +1032,7 @@
+ onclick="util.openURL(event,'https://quickfolders.org/bugs.html')">
@@ -1044,7 +1044,7 @@
diff --git a/chrome/content/qf-styles.js b/chrome/content/qf-styles.js index 5ffc66289..016da85f1 100644 --- a/chrome/content/qf-styles.js +++ b/chrome/content/qf-styles.js @@ -190,7 +190,7 @@ QuickFolders.Styles = { st.setProperty(attribute, value, ((important) ? "important" : "")); } else { - if (origProperty==""); + // if (origProperty==""); st.setProperty(attribute, value, ((important) ? "important" : "")); foundRule = true; } diff --git a/chrome/content/quickfolders-filterList.js b/chrome/content/quickfolders-filterList.js index b2cbf0205..d5a2465e5 100644 --- a/chrome/content/quickfolders-filterList.js +++ b/chrome/content/quickfolders-filterList.js @@ -444,38 +444,7 @@ QuickFolders.FilterList = { if (focusSearchBox) searchBox.focus(); - } , - - validateFilterTargets: function(sourceURI, targetURI) { - // fix any filters that might still point to the moved folder. - // 1. nsIMsgAccountManager loop through list of servers - try { - const Ci = Components.interfaces, - util = QuickFolders.Util; - let Accounts = util.Accounts, - acctMgr = Components.classes["@mozilla.org/messenger/account-manager;1"] - .getService(Ci.nsIMsgAccountManager); - for (let a=0; a 0 && menuList && menuPopup) { let activeCatsList = this.currentActiveCategories, - cats = activeCatsList ? activeCatsList.split('|') : []; + cats = activeCatsList ? activeCatsList.split('|') : [], + isMultiCategories = prefs.getBoolPref('premium.categories.multiSelect'); util.clearChildren(menuPopup,true); menuPopup.appendChild(this.createMenuItem( @@ -964,12 +971,13 @@ QuickFolders.Interface = { if (category!=FCat.ALWAYS && category!=FCat.NEVER) { let menuItem = this.createMenuItem(category, category, 'menuitem-iconic'); // add checkbox for multiple category selection - if (prefs.getBoolPref('premium.categories.multiSelect')) { + if (isMultiCategories) { // multi selection - if (cats.includes(category)) + if (cats.includes(category)) { menuItem.setAttribute("checked", true); - if (isPostbox) - menuItem.setAttribute("type","checkbox"); + if (isPostbox) + menuItem.setAttribute("type","checkbox"); + } } menuPopup.appendChild(menuItem); } @@ -991,8 +999,14 @@ QuickFolders.Interface = { menuPopup.appendChild(this.createIconicElement('menuseparator','*')); } if (isUncat) { - let s = this.getUIstring("qfUncategorized","(Uncategorized)"); - menuPopup.appendChild(this.createMenuItem(FCat.UNCATEGORIZED , s, 'menuitem-iconic')); + let s = this.getUIstring("qfUncategorized","(Uncategorized)"), + itemUncat = this.createMenuItem(FCat.UNCATEGORIZED , s, 'menuitem-iconic'); + menuPopup.appendChild(itemUncat); + if (cats.includes(FCat.UNCATEGORIZED) && isMultiCategories) { + itemUncat.setAttribute("checked", true); + if (isPostbox) + menuItem.setAttribute("type","checkbox"); + } } if (isNever) { let s = this.getUIstring("qfShowNever","Never Show (Folder Alias)"); @@ -1636,13 +1650,24 @@ QuickFolders.Interface = { // first let's reset anything in the quickMove if we are in single message mode: QuickMove.resetList(); } - let messageUris = util.getSelectedMsgUris(); - if (messageUris) { - let currentFolder = util.CurrentFolder; - while (messageUris.length) { - QuickMove.add(messageUris.pop(), currentFolder, iscopy); + // is the folder tree highlighted? + // [issue 75] support moving folders through quickMove + if (eventTarget && eventTarget.getAttribute("id") == "folderTree") { + let folders = gFolderTreeView.getSelectedFolders(); + if (folders.length) { + QuickMove.addFolders(folders, iscopy); + QuickMove.update(); } - QuickMove.update(); + } + else { + let messageUris = util.getSelectedMsgUris(); + if (messageUris) { + let currentFolder = util.CurrentFolder; + while (messageUris.length) { + QuickMove.add(messageUris.pop(), currentFolder, iscopy); + } + QuickMove.update(); + } } isHandled = true; } @@ -3106,8 +3131,12 @@ QuickFolders.Interface = { } folder.updateFolder(msgWindow); if (isCurrent) { - if (typeof(gFolderDisplay.show) != 'undefined') - gFolderDisplay.show(folder); + if (typeof(gFolderDisplay.show) != 'undefined') { + setTimeout( + function() {gFolderDisplay.show(folder);}, + 100 + ); + } } } else { // Postbox / SeaMonkey @@ -5522,7 +5551,7 @@ QuickFolders.Interface = { viewChangeOrder: function viewChangeOrder() { window.openDialog('chrome://quickfolders/content/change-order.xul','quickfolders-change-order', - 'chrome,titlebar,toolbar,centerscreen,resizable,dependent', QuickFolders); // dependent = modeless + 'chrome,titlebar,centerscreen,resizable,dependent', QuickFolders); // dependent = modeless } , lastTabSelected: null, @@ -6903,16 +6932,37 @@ QuickFolders.Interface = { QuickFolders.FilterWorker.toggle_FilterMode(active); } , - moveFolder: function moveFolder(fromFolder, targetFolder, arrCount) { - // [Bug 26517] support multiple folder moves - addeed "count" and transmitting URIs + moveFolders: function moveFolders(fromFolders, targetFolder) { + // [Bug 26517] support multiple folder moves - added "count" and transmitting URIs const Cc = Components.classes, Ci = Components.interfaces, util = QuickFolders.Util; - + let arrCount = fromFolders.length; + + function isChildFolder(f) { + for (let i=0; i 0) }, + get hasFolders() { + return (this.folders.length > 0) + }, + onClick: function onClick(button, evt, forceDisplay) { // we need to display a popup menu with a "cancel" item (this will delete the list of mails to be moved. // this.QuickMoveButton ... @@ -147,21 +152,27 @@ QuickFolders.quickMove = { util.logDebugOptional('quickMove', 'quickMove.execute() , tabMode = ' + tabMode); try { - // split mails to copy / move: - let uriCopy=[], uriMove=[], - originCopy=[], originMove=[]; - for (let j=this.Uris.length-1; j>=0; j--) { - if (this.IsCopy[j]) { - uriCopy.push(this.Uris[j]); - originCopy.push(this.Origins[j]); - } - else { - uriMove.push(this.Uris[j]); - originMove.push(this.Origins[j]); + if (this.folders.length) { // [issue 75] move folders instead + let count = this.folders.length; + QI.moveFolders(this.folders, fld); + } + else { + // split mails to copy / move: + let uriCopy=[], uriMove=[], + originCopy=[], originMove=[]; + for (let j=this.Uris.length-1; j>=0; j--) { + if (this.IsCopy[j]) { + uriCopy.push(this.Uris[j]); + originCopy.push(this.Origins[j]); + } + else { + uriMove.push(this.Uris[j]); + originMove.push(this.Origins[j]); + } } - } - copyList(uriCopy, originCopy, true); - copyList(uriMove, originMove, false); + copyList(uriCopy, originCopy, true); + copyList(uriMove, originMove, false); + } this.resetList(); this.update(); @@ -174,22 +185,29 @@ QuickFolders.quickMove = { } }, + resetMenu: function resetMenu() { + let menu = QuickFolders.Util.$('QuickFolders-quickMoveMenu'); + for (let i = menu.children.length-1; i>0; i--) { + let item = menu.children[i]; + if (item.className.indexOf('msgUri')>=0 || item.tagName=='menuseparator') + menu.removeChild(item); + } + }, + resetList: function resetList() { while (this.Uris.length) { this.Uris.pop(); } + while (this.folders.length) { + this.folders.pop(); + } while (this.Origins.length) { this.Origins.pop(); } while (this.IsCopy.length) { this.IsCopy.pop(); } - let menu = QuickFolders.Util.$('QuickFolders-quickMoveMenu'); - for (let i = menu.childNodes.length-1; i>0; i--) { - let item = menu.childNodes[i]; - if (item.className.indexOf('msgUri')>=0 || item.tagName=='menuseparator') - menu.removeChild(item); - } + this.resetMenu(); this.update(); }, @@ -221,6 +239,23 @@ QuickFolders.quickMove = { } }, + addFolders: function addFolders(foldersArray, isCopy) { + // [issue 75] support moving folders through quickMove + for (let f of foldersArray) { + if (!this.folders.includes(f)) + this.folders.push(f); + } + if (this.Uris.length) { + this.resetMenu(); + // clear uris for moving mails + while (this.Uris.length) this.Uris.pop(); + } + if (this.hasFolders) { + this.isMoveActive = true; + QuickFolders.Interface.toggleMoveModeSearchBox(true); + } + } , + add: function add(newUri, sourceFolder, isCopy) { if (this.Uris.indexOf(newUri) == -1) { // avoid duplicates! let chevron = ' ' + "\u00BB".toString() + ' ', @@ -271,16 +306,16 @@ QuickFolders.quickMove = { }, update: function update() { - let isActive = this.hasMails, // ? true : false; - QI = QuickFolders.Interface; + let isActive = this.hasMails || this.hasFolders, // ? true : false; + QI = QuickFolders.Interface, + util = QuickFolders.Util; this.isMoveActive = isActive; - QuickFolders.Util.logDebug('QuickFolders.quickMove.update()\n' + 'isActive = ' + isActive); + util.logDebug('QuickFolders.quickMove.update()\n' + 'isActive = ' + isActive); // indicate number of messages on the button? - QI.QuickMoveButton.label = - isActive ? - this.Uris.length.toString() : ''; + let moveItems = isActive ? (this.Uris.length + this.folders.length) : 0; + QI.QuickMoveButton.label = isActive ? moveItems.toString() : ''; // toggle quickMove searchbox visible - QuickFolders.Util.$('QuickFolders-quickMove-cancel').collapsed = !isActive; + util.$('QuickFolders-quickMove-cancel').collapsed = !isActive; QI.updateFindBoxMenus(isActive); QI.toggleMoveModeSearchBox(isActive); QI.findFolder(isActive, isActive ? 'quickMove' : null); diff --git a/chrome/content/quickfolders-register.js b/chrome/content/quickfolders-register.js index 86eb23ad2..5da492db8 100644 --- a/chrome/content/quickfolders-register.js +++ b/chrome/content/quickfolders-register.js @@ -276,7 +276,7 @@ QuickFolders.Licenser = { } , goPro: function goPro(license_type) { - const productDetail = "http://sites.fastspring.com/quickfolders/product/quickfolders", + const productDetail = "https://sites.fastspring.com/quickfolders/product/quickfolders", prefs = QuickFolders.Preferences, util = QuickFolders.Util; // redirect to registration site; pass in the feature that brought user here @@ -290,14 +290,14 @@ QuickFolders.Licenser = { shortOrder = "https://sites.fastspring.com/quickfolders/instant/quickfolders"; break; case 1: // domain license - shortOrder = "http://sites.fastspring.com/quickfolders/instant/quickfoldersdomain"; + shortOrder = "https://sites.fastspring.com/quickfolders/instant/quickfoldersdomain"; break; case 2: // license renewal if (QuickFolders.Crypto.key_type==1) { // domain license! - shortOrder = "http://sites.fastspring.com/quickfolders/instant/quickfoldersdomainrenewal"; + shortOrder = "https://sites.fastspring.com/quickfolders/instant/quickfoldersdomainrenewal"; } else - shortOrder = "http://sites.fastspring.com/quickfolders/instant/quickfoldersrenew"; + shortOrder = "https://sites.fastspring.com/quickfolders/instant/quickfoldersrenew"; // addQuery = "&renewal=" + encodeURI(prefs.getStringPref('LicenseKey')); featureName = encodeURI(prefs.getStringPref('LicenseKey')); // should we autoselect the correct email address? @@ -324,7 +324,7 @@ QuickFolders.Licenser = { /* obsolete form submission from code */ postForm : function postForm_obsolete(util) { - let url ="http://sites.fastspring.com/quickfolders/product/quickfolders?action=order", + let url ="https://sites.fastspring.com/quickfolders/product/quickfolders?action=order", oReq; if (util.PlatformVersion >=16.0) { @@ -345,7 +345,7 @@ QuickFolders.Licenser = { } , premiumInfo: function premiumInfo(event) { - QuickFolders.Util.openURL(event,'http://quickfolders.org/premium.html'); + QuickFolders.Util.openURL(event,'https://quickfolders.org/premium.html'); }, // format QF-EMAIL:DATE;CRYPTO diff --git a/chrome/content/quickfolders-util.js b/chrome/content/quickfolders-util.js index 692e895ca..c94a88315 100644 --- a/chrome/content/quickfolders-util.js +++ b/chrome/content/quickfolders-util.js @@ -66,7 +66,7 @@ QuickFolders.Util = { _isCSSGradients: -1, _isCSSRadius: -1, _isCSSShadow: true, - HARDCODED_CURRENTVERSION : "4.18.2", // will later be overriden call to AddonManager + HARDCODED_CURRENTVERSION : "4.19.1", // will later be overriden call to AddonManager HARDCODED_EXTENSION_TOKEN : ".hc", ADDON_ID: "quickfolders@curious.be", FolderFlags : { // nsMsgFolderFlags @@ -863,8 +863,7 @@ QuickFolders.Util = { step = 1; let messageList, - ap = util.Application, - hostsystem = util.HostSystem; + ap = util.Application; //nsISupportsArray is deprecated in TB3 as it's a hog :-) if (ap=='Thunderbird' || ap=='SeaMonkey') messageList = Components.classes["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); @@ -875,7 +874,9 @@ QuickFolders.Util = { // copy what we need... let messageIdList = [], isMarkAsRead = QuickFolders.Preferences.getBoolPref('markAsReadOnMove'), - bookmarks = QuickFolders.bookmarks; + bookmarks = QuickFolders.bookmarks, + isTargetDifferent = false, + sourceFolder; for (let i = 0; i < messageUris.length; i++) { let messageUri = messageUris[i], Message = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri), @@ -883,6 +884,7 @@ QuickFolders.Util = { if(isMarkAsRead) { Message.markRead(true); } + step = 3; // if we move, check our reading list! if (!makeCopy && bookmarked>=0) { let entry = bookmarks.Entries[bookmarked]; @@ -901,16 +903,17 @@ QuickFolders.Util = { messageList.appendElement(Message , false); else messageList.AppendElement(Message); + // [issue 23] quick move from search list fails if first mail is already in target folder + // What to do if we have "various" source folders? + if (Message.folder.QueryInterface(Ci.nsIMsgFolder) != targetFolder) { + sourceFolder = Message.folder.QueryInterface(Ci.nsIMsgFolder); // force nsIMsgFolder interface for postbox 2.1 + isTargetDifferent = true; + } } - step = 3; - let sourceMsgHdr = (ap=='Thunderbird' || ap=='SeaMonkey') ? - messageList.queryElementAt(0, Ci.nsIMsgDBHdr) : - messageList.GetElementAt(0).QueryInterface(Ci.nsIMsgDBHdr); step = 4; - let sourceFolder = sourceMsgHdr.folder.QueryInterface(Ci.nsIMsgFolder); // force nsIMsgFolder interface for postbox 2.1 - if (sourceFolder == targetFolder) { + if (!isTargetDifferent) { util.slideAlert("QuickFolders", 'Nothing to do: Message is already in folder: ' + targetFolder.prettyName); return null; } @@ -921,9 +924,9 @@ QuickFolders.Util = { step = 7; let isMove = (!makeCopy); // mixed! util.logDebugOptional('dnd,quickMove,dragToNew', 'calling CopyMessages (\n' + - 'sourceFolder = ' + sourceFolder + '\n'+ + 'sourceFolder = ' + sourceFolder.prettyName + '\n'+ 'messages = ' + messageList + '\n' + - 'destinationFolder = ' + targetFolder + '\n' + + 'destinationFolder = ' + targetFolder.prettyName + '\n' + 'isMove = (various)\n' + 'listener = QuickFolders.CopyListener\n' + 'msgWindow = ' + msgWindow + '\n' + @@ -1341,7 +1344,11 @@ QuickFolders.Util = { findMailTab: function findMailTab(tabmail, URL) { const util = QuickFolders.Util; - // mail: tabmail.tabInfo[n].browser + if (typeof ChromeUtils.import == "undefined") + Components.utils.import('resource://gre/modules/Services.jsm'); + else + var {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm'); + let baseURL = util.getBaseURI(URL), numTabs = util.getTabInfoLength(tabmail); @@ -1351,7 +1358,15 @@ QuickFolders.Util = { let tabUri = util.getBaseURI(info.browser.currentURI.spec); if (tabUri == baseURL) { tabmail.switchToTab(i); - info.browser.loadURI(URL); + try { + let params = { + triggeringPrincipal: Services.scriptSecurityManager.getSystemPrincipal() + } + info.browser.loadURI(URL, params); + } + catch(ex) { + util.logException(ex); + } return true; } } @@ -1875,9 +1890,39 @@ QuickFolders.Util = { const ellipsis = "\u2026".toString(); let slash = uri.lastIndexOf("/"); return slash>0 ? ellipsis + uri.substr(slash) : ellipsis + uri.substr(-16); + }, + + // moved from FilterList! + validateFilterTargets: function(sourceURI, targetURI) { + // fix any filters that might still point to the moved folder. + // 1. nsIMsgAccountManager loop through list of servers + try { + const Ci = Components.interfaces, + util = QuickFolders.Util; + let Accounts = util.Accounts, + acctMgr = Components.classes["@mozilla.org/messenger/account-manager;1"] + .getService(Ci.nsIMsgAccountManager); + for (let a=0; a