Skip to content

Commit

Permalink
4.21
Browse files Browse the repository at this point in the history
  • Loading branch information
RealRaven2000 committed Apr 16, 2021
1 parent 3f8332e commit edc23e9
Show file tree
Hide file tree
Showing 14 changed files with 154 additions and 137 deletions.
4 changes: 2 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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.20\"
move QuickFolders*.xpi "..\..\Release\_Test Versions\4.21\"
pwsh -Command "Start-Sleep -m 150"
rename QuickFoldersWeb.zip QuickFolders-wx-4.20pre%quickFoldersRev%.xpi
rename QuickFoldersWeb.zip QuickFolders-wx-4.21pre%quickFoldersRev%.xpi
23 changes: 19 additions & 4 deletions chrome/content/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,13 @@ QuickFolders.Options = {
QI = QuickFolders.Interface,
options = QuickFolders.Options,
licenser = util.Licenser;
let isOptionsTab = window.arguments && window.arguments.length>1;

util.logDebug("QuickFolders.Options.load()");

if (prefs.isDebugOption('options')) debugger;
// version number must be copied over first!
if (window.arguments && window.arguments[1].inn.instance) {
if (isOptionsTab && window.arguments[1].inn.instance) {
// QuickFolders = window.arguments[1].inn.instance; // avoid creating a new QuickFolders instance, reuse the one passed in!!
util.mExtensionVer = window.arguments[1].inn.instance.Util.Version;
}
Expand All @@ -265,12 +266,26 @@ QuickFolders.Options = {
if (!version) debugger;

util.logDebugOptional('options', 'QuickFolders.Options.load()');
if (window.arguments) {
let modeNum = -1;
if (isOptionsTab) {
try {
this.optionsMode = window.arguments[1].inn.mode;
// force selection of a certain pane (-1 ignores)
if (this.optionsMode >= 0)
prefs.setIntPref('lastSelectedOptionsTab', this.optionsMode);
if (this.optionsMode) {
switch (this.optionsMode) {
case "helpOnly":
modeNum = this.QF_PREF_HELP;
break;
case "supportOnly":
modeNum = this.QF_PREF_SUPPORT;
break;
case "licenseKey":
modeNum = this.QF_PREF_LICENSE;
break;
}
}
if (modeNum >= 0)
prefs.setIntPref('lastSelectedOptionsTab', modeNum);
}
catch(e) {;}
}
Expand Down
4 changes: 2 additions & 2 deletions chrome/content/qf-advancedTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ QuickFolders.AdvancedTab = {
iUnread.checked = (entry.flags & ADVANCED_FLAGS.SETMAIL_UNREAD) && true;

elem('txtColor').value = entry.cssColor || '';
elem('txtColorPicker').color = elem('txtColor').value;
elem('txtColorPicker').value = elem('txtColor').value;
elem('txtBackground').value = entry.cssBack || '';
// custom palette
let isPalette = (entry.flags & ADVANCED_FLAGS.CUSTOM_PALETTE) && true;
Expand Down Expand Up @@ -338,7 +338,7 @@ QuickFolders.AdvancedTab = {

updatePicker: function updatePicker(textbox) {
if (textbox.length) {
document.getElementById('txtColorPicker').color = textbox.value;
document.getElementById('txtColorPicker').value = textbox.value;
}
} ,

Expand Down
16 changes: 9 additions & 7 deletions chrome/content/quickfolders-advanced-tab-props.xul
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
buttonlabelextra2="&btnReset;"
buttonlabelextra1="&btnApply;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="QuickFolders.AdvancedTab.load();"
>
<script type="application/x-javascript" src="chrome://quickfolders/content/quickfolders.js" />
Expand Down Expand Up @@ -159,13 +160,14 @@
<textbox id="txtColor"
tooltiptext="&cssColor.tooltip;"
onblur="QuickFolders.AdvancedTab.sanitizeCSS(this);QuickFolders.AdvancedTab.updatePicker(this);"/>
<colorpicker id="txtColorPicker"
type="button"
onchange="return QuickFolders.AdvancedTab.pickColor(this.color);"/>
<spacer flex="1"/>
<label id="cssPreview"
value="Preview"
tooltiptext="Current selected folder colors will always override this."/>
<html:input
id="txtColorPicker"
type="color"
onchange="return QuickFolders.AdvancedTab.pickColor(this.value);"/>
<spacer flex="1"/>
<label id="cssPreview"
value="Preview"
tooltiptext="Current selected folder colors will always override this."/>
</hbox>
</row>
</rows>
Expand Down
122 changes: 57 additions & 65 deletions chrome/content/quickfolders-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,6 @@ QuickFolders.Interface = {
// Start iterating at the top of the hierarchy, that is, with the root
// folders for every account.
acctMgr = Cc["@mozilla.org/messenger/account-manager;1"].getService(Ci.nsIMsgAccountManager);
// Postbox only:
if (util.isLegacyIterator) {
for (let acct in fixIterator(acctMgr.accounts, Ci.nsIMsgAccount)) {
addIfRecent(acct.incomingServer.rootFolder);
checkSubFolders(acct.incomingServer.rootFolder);
}
}

recentFolders.sort(sorter);
return recentFolders;
Expand Down Expand Up @@ -1229,7 +1222,7 @@ QuickFolders.Interface = {
const separator = "==============================\n";
let f = 0, affected = 0;
util.logDebug(separator + "loading Dictionary…");
//let allFolders = util.allFoldersIterator(false);

util.logDebug(separator + "Iterating all folders…");
for (let folder of util.allFoldersIterator(false)) {
//let folder = allFolders[i];
Expand Down Expand Up @@ -1340,7 +1333,8 @@ QuickFolders.Interface = {
return this._selectedCategories;
} ,
set currentActiveCategories(v) {
const util = QuickFolders.Util;
const util = QuickFolders.Util,
prefs = QuickFolders.Preferences;
this._selectedCategories = v; // set menuitem value?
let menulist = this.CategoryMenu,
cats = v.split('|'),
Expand All @@ -1350,8 +1344,9 @@ QuickFolders.Interface = {
menulist.value = v;
// if multiple select, check all boxes
for (let i=0; i<menulist.itemCount; i++) {
let it = menulist.getItemAtIndex(i),
isSelected = (cats.includes(it.value));
let it = menulist.getItemAtIndex(i);
if (it.tagName!='menuitem') continue;
let isSelected = (cats.includes(it.value));
if (isSelected) {
txtDebug += 'Check menuitem: ' + it.value + '\n';
it.setAttribute('checked', isSelected); // check selected value
Expand Down Expand Up @@ -5011,7 +5006,10 @@ QuickFolders.Interface = {
maxLevel--;
f = f.parent;

if (f.prettyName.toLowerCase().indexOf(ancestors[maxLevel])==0) {
// [issue 135] allow in-string search for parents using delimiters: - _ . and space!
let folderNameMatches = f.prettyName.toLowerCase().split(/[_ ]/);
// ignore 1-character matches
if (folderNameMatches.some(a => a.startsWith(ancestors[maxLevel]) && a.length>1)) {
// 1st (top level) match
if (!directParent) directParent = f;

Expand All @@ -5034,7 +5032,9 @@ QuickFolders.Interface = {
directParent = null;
while (f && maxLevel) {
maxLevel--;
if (f.prettyName.toLowerCase().indexOf(ancestors[maxLevel])==0) {
// [issue 135] allow in-string search for children using delimiters: - _ . and space!
let folderNameMatches = f.prettyName.toLowerCase().split(/[-_. ]/);
if (folderNameMatches.some(a => a.startsWith(search))) {
if (!directParent) directParent = folder;
if (maxLevel == 0) {
if (parentList.indexOf(directParent)<0) {
Expand Down Expand Up @@ -5108,62 +5108,23 @@ QuickFolders.Interface = {
parentCount = parentString.split("/").length + 1; // original entry for parent
}
let isFiling = QuickFolders.quickMove.isActive;
/********* old jump point *********/
/*
// [Bug 26565] if 1 unique full match is found - without children!, we can automatically jump there
if ( (matches.length == 1)
&& (!isFiling) && (matches[0].folder && !matches[0].folder.hasSubFolders)
&& (matches[0].lname == searchString) // one exact FULL match
|| (wordStartMatch(matches[0].lname) && forceFind)) // match starts with search string + [Enter] key was pressed
) {
// go to folder
isSelected = QuickFolders_MySelectFolder(matches[0].uri);
if (matches[0].parentString)
QuickFolders.quickMove.rememberLastFolder(matches[0].uri, matches[0].parentString);
setTimeout(function() {
QuickFolders.Interface.tearDownSearchBox();
}, 400);
return; // ????
}
*/


// if quickMove is active we need to suppress matches from newsgroups (as we can't move mail to them)
// "parent/" no name given, only lists the direct children
// "parent/X" can it list grandchildren? It does, but shouldn't - test with "Addons/Qu"
let maxParentLevel = searchString.length ? prefs.getIntPref('premium.findFolder.maxParentLevel') : 1;
if (parentPos>0) maxParentLevel = 1; // no subfolders when SLASH is entered

// multiple slashes?
let isLegacyIterator = util.isLegacyIterator;
if (isLegacyIterator) {
util.logDebugOptional("interface.findFolder", "Using old folder iterator for Platform=" + util.PlatformVersion);
let AF = util.allFoldersIterator(isFiling);
util.logDebugOptional("Assigned AllFolders = " + AF);
for (let fi=0; fi<AF.length; fi++) {
let folder = AF.queryElementAt(fi, Ci.nsIMsgFolder);
if (!isParentMatch(folder, parentString, maxParentLevel, parents)) continue;
addMatchingFolder(matches, folder);
}
}
else {
util.logDebugOptional("interface.findFolder", "Calling allFoldersMatch(" + isFiling + ", isParentMatch(), parent='" + parentString + "', " + maxParentLevel + ",...)");
util.allFoldersMatch(isFiling, isParentMatch, parentString, maxParentLevel, parents, addMatchingFolder, matches);
util.logDebugOptional("interface.findFolder", "Got " + matches.length + " matches");
}
util.logDebugOptional("interface.findFolder", "Calling allFoldersMatch(" + isFiling + ", isParentMatch(), parent='" + parentString + "', " + maxParentLevel + ",...)");
util.allFoldersMatch(isFiling, isParentMatch, parentString, maxParentLevel, parents, addMatchingFolder, matches);
util.logDebugOptional("interface.findFolder", "Got " + matches.length + " matches");

// no parent matches - Add one for a folder without children.
if (!matches.length && parentPos>0) {
if (isLegacyIterator) { // util.Application == 'Postbox'
let AF = util.allFoldersIterator(isFiling);
for (let fi=0; fi<AF.length; fi++) {
let folder = AF.queryElementAt(fi, Ci.nsIMsgFolder);
addIfMatch(folder, matches.parentString || parentString, parents);
}
}
else
for (let folder of util.allFoldersIterator(isFiling)) {
addIfMatch(folder, matches.parentString || parentString, parents);
}
for (let folder of util.allFoldersIterator(isFiling, true)) {
addIfMatch(folder, matches.parentString || parentString, parents);
}
}
util.logDebugOptional("interface.findFolder", "built list: " + matches.length + " matches found. Building menu…");

Expand Down Expand Up @@ -6456,30 +6417,34 @@ QuickFolders.Interface = {
const util = QuickFolders.Util,
prefs = QuickFolders.Preferences;
try {
util.logDebugOptional ("interface","updateUserStyles()");
util.logDebugOptional ("interface.userStyles","updateUserStyles()");
// get MAIN STYLE SHEET
let styleEngine = QuickFolders.Styles,
ss = this.getStyleSheet(styleEngine, 'quickfolders-layout.css', 'QuickFolderStyles');

if (!ss) return false;


util.logDebugOptional ("interface.userStyles","Palette sheet");
// get PALETTE STYLE SHEET
let ssPalettes = this.getStyleSheet(styleEngine, QuickFolders.Interface.PaletteStyleSheet, 'QuickFolderPalettes');
ssPalettes = ssPalettes ? ssPalettes : ss; // if this fails, use main style sheet.
let theme = prefs.CurrentTheme,
tabStyle = prefs.ColoredTabStyle;

if (prefs.isCssTransitions) {
util.logDebugOptional ("interface.userStyles","Css transitions");
styleEngine.setElementStyle(ss, '.quickfolders-flat toolbarbutton', 'transition-duration', '1s, 1s, 2s, 1s');
styleEngine.setElementStyle(ss, '.quickfolders-flat toolbarbutton', 'transition-property', 'color, background-color, border-radius, box-shadow');
}
else {
util.logDebugOptional ("interface.userStyles","Remove Css transitions");
styleEngine.removeElementStyle(ss, '.quickfolders-flat toolbarbutton', 'transition-duration');
styleEngine.removeElementStyle(ss, '.quickfolders-flat toolbarbutton', 'transition-property');
}

// =================
// FONT COLORS
util.logDebugOptional ("interface.userStyles","Font Colors");
let theColorString = prefs.getUserStyle("InactiveTab","color","black"),
colActiveBG = prefs.getUserStyle("ActiveTab","background-color","Highlight"),
btnSelector = '.quickfolders-flat toolbarbutton';
Expand All @@ -6493,6 +6458,7 @@ QuickFolders.Interface = {

// =================
// CUSTOM RADIUS
util.logDebugOptional ("interface.userStyles","Custom Radius");
let topRadius = "4px",
bottomRadius = "0px";
if (prefs.getBoolPref("style.corners.customizedRadius")) {
Expand All @@ -6509,6 +6475,7 @@ QuickFolders.Interface = {
styleEngine.setElementStyle(ss, btnSelector, legacyRadius ? '-moz-border-radius-bottomright' : 'border-bottom-right-radius', bottomRadius, true);

// QuickFolders Toolbar only
util.logDebugOptional ("interface.userStyles","main toolbar buttons");
let btnInToolbarSelector = '.quickfolders-flat .folderBarContainer toolbarbutton',
buttonHeight = prefs.getIntPref('style.button.minHeight') + "px",
topPadding = prefs.getIntPref('style.button.paddingTop') + "px";
Expand All @@ -6520,6 +6487,7 @@ QuickFolders.Interface = {
// BORDERS & SHADOWS
// for full colored tabs color the border as well!
// but should only apply if background image is set!!
util.logDebugOptional ("interface.userStyles","shadow");
let SHADOW = util.isCSSShadow ? 'box-shadow' : '-moz-box-shadow';
if (prefs.getBoolPref("buttonShadows")) {
styleEngine.setElementStyle(ss, '.quickfolders-flat .folderBarContainer toolbarbutton', SHADOW,'1px -1px 3px -1px rgba(0,0,0,0.3)', true);
Expand All @@ -6536,6 +6504,7 @@ QuickFolders.Interface = {
styleEngine.setElementStyle(ss, '#QuickFolders-Toolbar.quickfolders-flat #QuickFolders-Folders-Pane','border-bottom-color', colActiveBG, true); // only in main toolbar!

let theInit = '';
util.logDebugOptional ("interface.userStyles","folder styles");
try {
theInit = 'SelectedFolderStyle';
this.initSelectedFolderStyle(ss, ssPalettes, tabStyle);
Expand All @@ -6551,6 +6520,7 @@ QuickFolders.Interface = {
}

// TOOLBAR
util.logDebugOptional ("interface.userStyles","toolbar colors");
theColorString = prefs.getUserStyle("Toolbar","background-color","ButtonFace");
if (prefs.getBoolPref("transparentToolbar"))
theColorString = "transparent";
Expand All @@ -6571,6 +6541,7 @@ QuickFolders.Interface = {
}

// main toolbar position
util.logDebugOptional ("interface.userStyles","toolbar position");
let ordinalGroup = prefs.getIntPref('toolbar.ordinalPosition') || 0;
styleEngine.setElementStyle(ss,'#QuickFolders-Toolbar', '-moz-box-ordinal-group', ordinalGroup.toString());

Expand Down Expand Up @@ -7303,13 +7274,27 @@ QuickFolders.Interface = {
storedObj.userStyle.push(node);
}
}

// [issue 115] store selection for background dropdown
const bgKey = 'currentFolderBar.background.selection';
let backgroundSelection = prefs.getStringPref(bgKey);
storedObj.layout.push({
key: 'extensions.quickfolders.' + bgKey,
val: backgroundSelection,
originalId: 'qfpa-CurrentFolder-Selection'}
);

}

let prettifiedJson = JSON.stringify(storedObj, null, ' ');
this.fileConfig('save', prettifiedJson, 'QuickFolders-Config');
util.logDebug("Configuration stored.");
} ,

loadConfig: function qf_loadConfig(preferences) {
const util = QuickFolders.Util,
prefs = QuickFolders.Preferences,
options = QuickFolders.Options;
function changePref(pref) {
let p = preferences.get(pref.key);
if (p) {
Expand Down Expand Up @@ -7349,14 +7334,21 @@ QuickFolders.Interface = {
}
}
}
else {
switch(pref.key) {
case 'extensions.quickfolders.currentFolderBar.background.selection':
if (pref.val && prefs.getStringPref(pref.key) != pref.val) {
options.setCurrentToolbarBackground(pref.val, true);
}
break;
default:
util.logDebug("loadConfig - unhandled preference: " + pref.key);
}
}
}
function readData(dataString) {
const Cc = Components.classes,
Ci = Components.interfaces,
service = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch),
util = QuickFolders.Util,
prefs = QuickFolders.Preferences,
options = QuickFolders.Options,
QI = QuickFolders.Interface;

try {
Expand Down
Loading

0 comments on commit edc23e9

Please sign in to comment.