Hide account name folder (s) from the folder pane

User Help for Mozilla Thunderbird
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

This is all i have in error console, & there's no change by adding a 0 to: }, 1000);
>>

Timestamp: Fri 29 6:02:09 PM
Error: TypeError: tab is undefined
Source File: chrome://messenger/content/tabmail.xml
Line: 1072

Timestamp: Fri 29 6:02:10 PM
Error: TypeError: accounts.QueryElementAt is not a function
Source File: chrome://com.chiaramail.dc/content/prefs.js
Line: 363

Timestamp: Fri 29 6:02:10 PM
Error: ReferenceError: gBrowser is not defined
Source File: chrome://stylish/content/overlay.js
Line: 519

Timestamp: Fri 29 6:02:12 PM
Error: ReferenceError: XPCOMUtils is not defined
Source File: chrome://messenger/content/msgMail3PaneWindow.js
Line: 1464

Timestamp: Fri 29 6:02:18 PM
Error: A promise chain failed to handle a rejection. Did you forget to '.catch', or did you forget to 'return'?
See https://developer.mozilla.org/Mozilla/J ... sm/Promise

Date: Fri Apr 29 2016 18:02:14 GMT+0200 (W. Europe Standard Time)
Full Message: Win error 3 during operation remove (The system cannot find the path specified.
)
Full Stack: JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: PendingErrors.register :: line 191
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.completePromise :: line 714
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: Handler.prototype.process :: line 969
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.walkerLoop :: line 812
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.scheduleWalkerLoop/< :: line 746
Source File: (unknown module)
Line: 0
Source Code:
0

Timestamp: Fri 29 6:02:18 PM
Error: A promise chain failed to handle a rejection. Did you forget to '.catch', or did you forget to 'return'?
See https://developer.mozilla.org/Mozilla/J ... sm/Promise

Date: Fri Apr 29 2016 18:02:15 GMT+0200 (W. Europe Standard Time)
Full Message: Win error 3 during operation remove (The system cannot find the path specified.
)
Full Stack: JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: PendingErrors.register :: line 191
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.completePromise :: line 714
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: Handler.prototype.process :: line 969
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.walkerLoop :: line 812
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.scheduleWalkerLoop/< :: line 746
JS frame :: resource://gre/components/nsPrompter.js :: openModalWindow :: line 360
JS frame :: resource://gre/components/nsPrompter.js :: ModalPrompter.prototype.openPrompt :: line 550
JS frame :: resource://gre/components/nsPrompter.js :: ModalPrompter.prototype.nsIPrompt_promptPassword :: line 771
JS frame :: resource://gre/components/nsPrompter.js :: Prompter.prototype.promptPassword :: line 94
JS frame :: resource://gre/components/nsLoginManagerPrompter.js :: LoginManagerPrompter.prototype.promptPassword :: line 455
JS frame :: resource://gre/components/msgAsyncPrompter.js :: runnablePrompter.prototype.run< :: line 28
JS frame :: resource://gre/modules/Task.jsm :: TaskImpl_run :: line 315
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: Handler.prototype.process :: line 933
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.walkerLoop :: line 812
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.scheduleWalkerLoop/< :: line 746
Source File: (unknown module)
Line: 0
Source Code:
0
morat
Posts: 6426
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

Sorry, I don't see the problem.

Here is the most basic example in the README file on the FAQ page.

Code: Select all

/* Thunderbird 45 userChrome.js */

/* Change the title in the titlebar */

/* Set the mail.tabs.drawInTitlebar pref to false to show the titlebar */

setTimeout(function() {
  document.title = "A new title for every window";
}, 2000);
If that doesn't work, then I give up...
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

No, no changes, & i feel like you haven't tested your code on tb 45 or your code doesn't work as intended.

1) I disabled "hide local folders" add-on, and if i use your code below:

/* Thunderbird 45 userChrome.js */

(function() {

if (location == "chrome://messenger/content/messenger.xul") {

/* Remove account name folders in unified folders mode
http://forums.mozillazine.org/viewtopic ... &t=3001721
*/

setTimeout(function() {
var hideAccountNameFolders = {
accountNameFolders: [
"invalid@gmail.com",
"Local Folders",
],
hideAccountNameFolders: function() {
for (var i = 0; i < gFolderTreeView._modeNames.length; i++) {
var viewName = gFolderTreeView._modeNames;
if (viewName == "smart") {
var view = gFolderTreeView.getFolderTreeMode(viewName);
view.hideAccountNameFolders_oldFunction = view.generateMap;
view.generateMap = function(ftv) {
var ftvItems = this.hideAccountNameFolders_oldFunction.call(view, ftv);
for (var j = 0; j < ftvItems.length; j++) {
for (var k = 0; k < hideAccountNameFolders.accountNameFolders.length; k++) {
if (ftvItems[j].text == hideAccountNameFolders.accountNameFolders[k]) {
ftvItems.splice(j, 1);
}
}
}
return ftvItems;
};
}
}
},
};
hideAccountNameFolders.hideAccountNameFolders();
gFolderTreeView.toggleMode(gFolderTreeView.mode);
var box = document.getElementById("folderTree").boxObject;
box.QueryInterface(Components.interfaces.nsITreeBoxObject);
box.invalidate();
}, 1000);

}



Then, with that code, local folder visually disappears when i restart tb.

2) Same problem with a clean tb profile.

3) as you told me, you used the code snippet to remove the "Local Folders" & tweaked it for account name folders,
but unfortunately, the code, even tweaked, only affects the local folder.
morat
Posts: 6426
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

I tested all the code in the thread.

http://tinypic.com/r/2urpbgn/9

It works for me.

userChromeJS 2.0
Thunderbird 45.0
Windows 7 SP1 32-bit

Edit:

I added the "Local Folders" string to the accountNameFolders array because the "Local Folders" folder is an isServer.
delicacy wrote:isServer is what needs to be taken care of
Last edited by morat on April 30th, 2016, 3:32 pm, edited 1 time in total.
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

Well well morat...

I finally got it to work, since you were about to give up, i emailed the code to another addons contributor
in mozilla & he explained me an information you hadn't given me & i couldn't guess it myself, cause i don't
know the purpose of adding an email to the code & why you wanted me to edit it & how.. a point where i was lost.
& his response that i was missing from you was:

Here you must specify which folders you need to hide:

accountNameFolders: [
"invalid@gmail.com",
"Local Folders",
],


So this is an approach, but could you modify the code so it hides any account name folders by default without having to provide account names to the code ?
(set & forget)

+

make sure those accounts i hide don't come bugging me again by appearing in the trash folder, cause that's what happens actually.. & if i delete many emails

& if possible, make the trash folder unselectable through the mini arrow on its left to avoid the possibility to view the trash submenu folders (useless in unified view)
& to avoid clicks by mistake
morat
Posts: 6426
Joined: February 3rd, 2009, 6:29 pm

Re: Hide account name folder (s) from the folder pane

Post by morat »

delicacy wrote:information you hadn't given me
You said you couldn't get any of the basic examples to work.

http://forums.mozillazine.org/viewtopic ... #p14588237
http://forums.mozillazine.org/viewtopic ... #p14589101
delicacy wrote:nothing works
delicacy wrote:no changes
I was going to better explain the hide account name folders code after you got the extension working...
delicacy wrote:could you modify the code so it hides any account name folders by default without having to provide account names
Yes, I could modify the code but I'm not going to. You can add all the account name folders to the accountNameFolders array.

Code: Select all

accountNameFolders: [
  "alpha@gmail.com",
  "beta@gmail.com",
  "gamma@gmail.com",
  "delta@gmail.com",
  "epsilon@gmail.com",
  "Local Folders",
],
delicacy
Posts: 400
Joined: February 3rd, 2013, 4:09 pm

Re: Hide account name folder (s) from the folder pane

Post by delicacy »

Everything you stated before "could you modify" & that is totally inconsistent since i assume my declarations, makes no sense.
because once again, you hadn't explained me what the other coder explained to me about the invalid account & its purpose..

Anyways, your code makes me lose the unified view, sends me to all view when i change accounts in the code, now i can't even see an email that's supposed to be in my inbox,
the message window is empty & near inbox, it reads "1"
i'm not going any further with you either, since adding accounts one by one is not my game nor expectation from a script.

this script needs to be updated by someone else.

good continuation.
User avatar
Frank Lion
Posts: 21177
Joined: April 23rd, 2004, 6:59 pm
Location: ... The Exorcist....United Kingdom
Contact:

Re: Hide account name folder (s) from the folder pane

Post by Frank Lion »

delicacy wrote:Everything you stated before "could you modify" & that is totally inconsistent since i assume my declarations, makes no sense. .
I've just read this thread. That's quite some attitude problem you have there, slick.
"The only thing necessary for the triumph of evil, is for good men to do nothing." - Edmund Burke (attrib.)
.
Locked