@@ -342,13 +342,6 @@ QuickFolders.Interface = {
342342 // Start iterating at the top of the hierarchy, that is, with the root
343343 // folders for every account.
344344 acctMgr = Cc [ "@mozilla.org/messenger/account-manager;1" ] . getService ( Ci . nsIMsgAccountManager ) ;
345- // Postbox only:
346- if ( util . isLegacyIterator ) {
347- for ( let acct in fixIterator ( acctMgr . accounts , Ci . nsIMsgAccount ) ) {
348- addIfRecent ( acct . incomingServer . rootFolder ) ;
349- checkSubFolders ( acct . incomingServer . rootFolder ) ;
350- }
351- }
352345
353346 recentFolders . sort ( sorter ) ;
354347 return recentFolders ;
@@ -1229,7 +1222,7 @@ QuickFolders.Interface = {
12291222 const separator = "==============================\n" ;
12301223 let f = 0 , affected = 0 ;
12311224 util . logDebug ( separator + "loading Dictionary…" ) ;
1232- //let allFolders = util.allFoldersIterator(false);
1225+
12331226 util . logDebug ( separator + "Iterating all folders…" ) ;
12341227 for ( let folder of util . allFoldersIterator ( false ) ) {
12351228 //let folder = allFolders[i];
@@ -1340,7 +1333,8 @@ QuickFolders.Interface = {
13401333 return this . _selectedCategories ;
13411334 } ,
13421335 set currentActiveCategories ( v ) {
1343- const util = QuickFolders . Util ;
1336+ const util = QuickFolders . Util ,
1337+ prefs = QuickFolders . Preferences ;
13441338 this . _selectedCategories = v ; // set menuitem value?
13451339 let menulist = this . CategoryMenu ,
13461340 cats = v . split ( '|' ) ,
@@ -1350,8 +1344,9 @@ QuickFolders.Interface = {
13501344 menulist . value = v ;
13511345 // if multiple select, check all boxes
13521346 for ( let i = 0 ; i < menulist . itemCount ; i ++ ) {
1353- let it = menulist . getItemAtIndex ( i ) ,
1354- isSelected = ( cats . includes ( it . value ) ) ;
1347+ let it = menulist . getItemAtIndex ( i ) ;
1348+ if ( it . tagName != 'menuitem' ) continue ;
1349+ let isSelected = ( cats . includes ( it . value ) ) ;
13551350 if ( isSelected ) {
13561351 txtDebug += 'Check menuitem: ' + it . value + '\n' ;
13571352 it . setAttribute ( 'checked' , isSelected ) ; // check selected value
@@ -5011,7 +5006,10 @@ QuickFolders.Interface = {
50115006 maxLevel -- ;
50125007 f = f . parent ;
50135008
5014- if ( f . prettyName . toLowerCase ( ) . indexOf ( ancestors [ maxLevel ] ) == 0 ) {
5009+ // [issue 135] allow in-string search for parents using delimiters: - _ . and space!
5010+ let folderNameMatches = f . prettyName . toLowerCase ( ) . split ( / [ _ ] / ) ;
5011+ // ignore 1-character matches
5012+ if ( folderNameMatches . some ( a => a . startsWith ( ancestors [ maxLevel ] ) && a . length > 1 ) ) {
50155013 // 1st (top level) match
50165014 if ( ! directParent ) directParent = f ;
50175015
@@ -5034,7 +5032,9 @@ QuickFolders.Interface = {
50345032 directParent = null ;
50355033 while ( f && maxLevel ) {
50365034 maxLevel -- ;
5037- if ( f . prettyName . toLowerCase ( ) . indexOf ( ancestors [ maxLevel ] ) == 0 ) {
5035+ // [issue 135] allow in-string search for children using delimiters: - _ . and space!
5036+ let folderNameMatches = f . prettyName . toLowerCase ( ) . split ( / [ - _ . ] / ) ;
5037+ if ( folderNameMatches . some ( a => a . startsWith ( search ) ) ) {
50385038 if ( ! directParent ) directParent = folder ;
50395039 if ( maxLevel == 0 ) {
50405040 if ( parentList . indexOf ( directParent ) < 0 ) {
@@ -5108,62 +5108,23 @@ QuickFolders.Interface = {
51085108 parentCount = parentString . split ( "/" ) . length + 1 ; // original entry for parent
51095109 }
51105110 let isFiling = QuickFolders . quickMove . isActive ;
5111- /********* old jump point *********/
5112- /*
5113- // [Bug 26565] if 1 unique full match is found - without children!, we can automatically jump there
5114- if ( (matches.length == 1)
5115- && (!isFiling) && (matches[0].folder && !matches[0].folder.hasSubFolders)
5116- && (matches[0].lname == searchString) // one exact FULL match
5117- || (wordStartMatch(matches[0].lname) && forceFind)) // match starts with search string + [Enter] key was pressed
5118- ) {
5119- // go to folder
5120- isSelected = QuickFolders_MySelectFolder(matches[0].uri);
5121- if (matches[0].parentString)
5122- QuickFolders.quickMove.rememberLastFolder(matches[0].uri, matches[0].parentString);
5123- setTimeout(function() {
5124- QuickFolders.Interface.tearDownSearchBox();
5125- }, 400);
5126- return; // ????
5127- }
5128- */
5129-
5111+
51305112 // if quickMove is active we need to suppress matches from newsgroups (as we can't move mail to them)
51315113 // "parent/" no name given, only lists the direct children
51325114 // "parent/X" can it list grandchildren? It does, but shouldn't - test with "Addons/Qu"
51335115 let maxParentLevel = searchString . length ? prefs . getIntPref ( 'premium.findFolder.maxParentLevel' ) : 1 ;
51345116 if ( parentPos > 0 ) maxParentLevel = 1 ; // no subfolders when SLASH is entered
51355117
51365118 // multiple slashes?
5137- let isLegacyIterator = util . isLegacyIterator ;
5138- if ( isLegacyIterator ) {
5139- util . logDebugOptional ( "interface.findFolder" , "Using old folder iterator for Platform=" + util . PlatformVersion ) ;
5140- let AF = util . allFoldersIterator ( isFiling ) ;
5141- util . logDebugOptional ( "Assigned AllFolders = " + AF ) ;
5142- for ( let fi = 0 ; fi < AF . length ; fi ++ ) {
5143- let folder = AF . queryElementAt ( fi , Ci . nsIMsgFolder ) ;
5144- if ( ! isParentMatch ( folder , parentString , maxParentLevel , parents ) ) continue ;
5145- addMatchingFolder ( matches , folder ) ;
5146- }
5147- }
5148- else {
5149- util . logDebugOptional ( "interface.findFolder" , "Calling allFoldersMatch(" + isFiling + ", isParentMatch(), parent='" + parentString + "', " + maxParentLevel + ",...)" ) ;
5150- util . allFoldersMatch ( isFiling , isParentMatch , parentString , maxParentLevel , parents , addMatchingFolder , matches ) ;
5151- util . logDebugOptional ( "interface.findFolder" , "Got " + matches . length + " matches" ) ;
5152- }
5119+ util . logDebugOptional ( "interface.findFolder" , "Calling allFoldersMatch(" + isFiling + ", isParentMatch(), parent='" + parentString + "', " + maxParentLevel + ",...)" ) ;
5120+ util . allFoldersMatch ( isFiling , isParentMatch , parentString , maxParentLevel , parents , addMatchingFolder , matches ) ;
5121+ util . logDebugOptional ( "interface.findFolder" , "Got " + matches . length + " matches" ) ;
51535122
51545123 // no parent matches - Add one for a folder without children.
51555124 if ( ! matches . length && parentPos > 0 ) {
5156- if ( isLegacyIterator ) { // util.Application == 'Postbox'
5157- let AF = util . allFoldersIterator ( isFiling ) ;
5158- for ( let fi = 0 ; fi < AF . length ; fi ++ ) {
5159- let folder = AF . queryElementAt ( fi , Ci . nsIMsgFolder ) ;
5160- addIfMatch ( folder , matches . parentString || parentString , parents ) ;
5161- }
5162- }
5163- else
5164- for ( let folder of util . allFoldersIterator ( isFiling ) ) {
5165- addIfMatch ( folder , matches . parentString || parentString , parents ) ;
5166- }
5125+ for ( let folder of util . allFoldersIterator ( isFiling , true ) ) {
5126+ addIfMatch ( folder , matches . parentString || parentString , parents ) ;
5127+ }
51675128 }
51685129 util . logDebugOptional ( "interface.findFolder" , "built list: " + matches . length + " matches found. Building menu…" ) ;
51695130
@@ -6456,30 +6417,34 @@ QuickFolders.Interface = {
64566417 const util = QuickFolders . Util ,
64576418 prefs = QuickFolders . Preferences ;
64586419 try {
6459- util . logDebugOptional ( "interface" , "updateUserStyles()" ) ;
6420+ util . logDebugOptional ( "interface.userStyles " , "updateUserStyles()" ) ;
64606421 // get MAIN STYLE SHEET
64616422 let styleEngine = QuickFolders . Styles ,
64626423 ss = this . getStyleSheet ( styleEngine , 'quickfolders-layout.css' , 'QuickFolderStyles' ) ;
64636424
64646425 if ( ! ss ) return false ;
6465-
6426+
6427+ util . logDebugOptional ( "interface.userStyles" , "Palette sheet" ) ;
64666428 // get PALETTE STYLE SHEET
64676429 let ssPalettes = this . getStyleSheet ( styleEngine , QuickFolders . Interface . PaletteStyleSheet , 'QuickFolderPalettes' ) ;
64686430 ssPalettes = ssPalettes ? ssPalettes : ss ; // if this fails, use main style sheet.
64696431 let theme = prefs . CurrentTheme ,
64706432 tabStyle = prefs . ColoredTabStyle ;
64716433
64726434 if ( prefs . isCssTransitions ) {
6435+ util . logDebugOptional ( "interface.userStyles" , "Css transitions" ) ;
64736436 styleEngine . setElementStyle ( ss , '.quickfolders-flat toolbarbutton' , 'transition-duration' , '1s, 1s, 2s, 1s' ) ;
64746437 styleEngine . setElementStyle ( ss , '.quickfolders-flat toolbarbutton' , 'transition-property' , 'color, background-color, border-radius, box-shadow' ) ;
64756438 }
64766439 else {
6440+ util . logDebugOptional ( "interface.userStyles" , "Remove Css transitions" ) ;
64776441 styleEngine . removeElementStyle ( ss , '.quickfolders-flat toolbarbutton' , 'transition-duration' ) ;
64786442 styleEngine . removeElementStyle ( ss , '.quickfolders-flat toolbarbutton' , 'transition-property' ) ;
64796443 }
64806444
64816445 // =================
64826446 // FONT COLORS
6447+ util . logDebugOptional ( "interface.userStyles" , "Font Colors" ) ;
64836448 let theColorString = prefs . getUserStyle ( "InactiveTab" , "color" , "black" ) ,
64846449 colActiveBG = prefs . getUserStyle ( "ActiveTab" , "background-color" , "Highlight" ) ,
64856450 btnSelector = '.quickfolders-flat toolbarbutton' ;
@@ -6493,6 +6458,7 @@ QuickFolders.Interface = {
64936458
64946459 // =================
64956460 // CUSTOM RADIUS
6461+ util . logDebugOptional ( "interface.userStyles" , "Custom Radius" ) ;
64966462 let topRadius = "4px" ,
64976463 bottomRadius = "0px" ;
64986464 if ( prefs . getBoolPref ( "style.corners.customizedRadius" ) ) {
@@ -6509,6 +6475,7 @@ QuickFolders.Interface = {
65096475 styleEngine . setElementStyle ( ss , btnSelector , legacyRadius ? '-moz-border-radius-bottomright' : 'border-bottom-right-radius' , bottomRadius , true ) ;
65106476
65116477 // QuickFolders Toolbar only
6478+ util . logDebugOptional ( "interface.userStyles" , "main toolbar buttons" ) ;
65126479 let btnInToolbarSelector = '.quickfolders-flat .folderBarContainer toolbarbutton' ,
65136480 buttonHeight = prefs . getIntPref ( 'style.button.minHeight' ) + "px" ,
65146481 topPadding = prefs . getIntPref ( 'style.button.paddingTop' ) + "px" ;
@@ -6520,6 +6487,7 @@ QuickFolders.Interface = {
65206487 // BORDERS & SHADOWS
65216488 // for full colored tabs color the border as well!
65226489 // but should only apply if background image is set!!
6490+ util . logDebugOptional ( "interface.userStyles" , "shadow" ) ;
65236491 let SHADOW = util . isCSSShadow ? 'box-shadow' : '-moz-box-shadow' ;
65246492 if ( prefs . getBoolPref ( "buttonShadows" ) ) {
65256493 styleEngine . setElementStyle ( ss , '.quickfolders-flat .folderBarContainer toolbarbutton' , SHADOW , '1px -1px 3px -1px rgba(0,0,0,0.3)' , true ) ;
@@ -6536,6 +6504,7 @@ QuickFolders.Interface = {
65366504 styleEngine . setElementStyle ( ss , '#QuickFolders-Toolbar.quickfolders-flat #QuickFolders-Folders-Pane' , 'border-bottom-color' , colActiveBG , true ) ; // only in main toolbar!
65376505
65386506 let theInit = '' ;
6507+ util . logDebugOptional ( "interface.userStyles" , "folder styles" ) ;
65396508 try {
65406509 theInit = 'SelectedFolderStyle' ;
65416510 this . initSelectedFolderStyle ( ss , ssPalettes , tabStyle ) ;
@@ -6551,6 +6520,7 @@ QuickFolders.Interface = {
65516520 }
65526521
65536522 // TOOLBAR
6523+ util . logDebugOptional ( "interface.userStyles" , "toolbar colors" ) ;
65546524 theColorString = prefs . getUserStyle ( "Toolbar" , "background-color" , "ButtonFace" ) ;
65556525 if ( prefs . getBoolPref ( "transparentToolbar" ) )
65566526 theColorString = "transparent" ;
@@ -6571,6 +6541,7 @@ QuickFolders.Interface = {
65716541 }
65726542
65736543 // main toolbar position
6544+ util . logDebugOptional ( "interface.userStyles" , "toolbar position" ) ;
65746545 let ordinalGroup = prefs . getIntPref ( 'toolbar.ordinalPosition' ) || 0 ;
65756546 styleEngine . setElementStyle ( ss , '#QuickFolders-Toolbar' , '-moz-box-ordinal-group' , ordinalGroup . toString ( ) ) ;
65766547
@@ -7303,13 +7274,27 @@ QuickFolders.Interface = {
73037274 storedObj . userStyle . push ( node ) ;
73047275 }
73057276 }
7277+
7278+ // [issue 115] store selection for background dropdown
7279+ const bgKey = 'currentFolderBar.background.selection' ;
7280+ let backgroundSelection = prefs . getStringPref ( bgKey ) ;
7281+ storedObj . layout . push ( {
7282+ key : 'extensions.quickfolders.' + bgKey ,
7283+ val : backgroundSelection ,
7284+ originalId : 'qfpa-CurrentFolder-Selection' }
7285+ ) ;
7286+
73067287 }
73077288
73087289 let prettifiedJson = JSON . stringify ( storedObj , null , ' ' ) ;
73097290 this . fileConfig ( 'save' , prettifiedJson , 'QuickFolders-Config' ) ;
7291+ util . logDebug ( "Configuration stored." ) ;
73107292 } ,
73117293
73127294 loadConfig : function qf_loadConfig ( preferences ) {
7295+ const util = QuickFolders . Util ,
7296+ prefs = QuickFolders . Preferences ,
7297+ options = QuickFolders . Options ;
73137298 function changePref ( pref ) {
73147299 let p = preferences . get ( pref . key ) ;
73157300 if ( p ) {
@@ -7349,14 +7334,21 @@ QuickFolders.Interface = {
73497334 }
73507335 }
73517336 }
7337+ else {
7338+ switch ( pref . key ) {
7339+ case 'extensions.quickfolders.currentFolderBar.background.selection' :
7340+ if ( pref . val && prefs . getStringPref ( pref . key ) != pref . val ) {
7341+ options . setCurrentToolbarBackground ( pref . val , true ) ;
7342+ }
7343+ break ;
7344+ default :
7345+ util . logDebug ( "loadConfig - unhandled preference: " + pref . key ) ;
7346+ }
7347+ }
73527348 }
73537349 function readData ( dataString ) {
73547350 const Cc = Components . classes ,
73557351 Ci = Components . interfaces ,
7356- service = Cc [ "@mozilla.org/preferences-service;1" ] . getService ( Ci . nsIPrefBranch ) ,
7357- util = QuickFolders . Util ,
7358- prefs = QuickFolders . Preferences ,
7359- options = QuickFolders . Options ,
73607352 QI = QuickFolders . Interface ;
73617353
73627354 try {
0 commit comments