Closed Bug 539392 Opened 15 years ago Closed 15 years ago

folderPane.js: SmartFolders do not Expand correctly

Categories

(Thunderbird :: Folder and Message Lists, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 536042

People

(Reporter: realRaven, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Lightning/1.0b1 Thunderbird/3.0 When I try to select a folder that is a direct child of a collapsed Smart Folder (such as Inbox, Sent, Drafts, Junk, Trash etc.) then the toggle that ensures the folder is visible fails: selectFolder: function ftv_selectFolder(aFolder) { 274 // "this" inside the nested function refers to the function... 275 // Also note that openIfNot is recursive. B 276 let tree = this; - 277 function openIfNot(aFolderToOpen) { - 278 let index = tree.getIndexOfFolder(aFolderToOpen); - 279 if (index) { - 280 if (!tree._rowMap[index].open) - 281 tree._toggleRow(index, false); - 282 return; 283 } msgFolder.parent is not evaluated correctly for direct descendants of collapsed Smart Folders! The reason for this is that tree.getIndexOfFolder(folder.parent) will return the logical parent node (which is the account node, not the smart folder) if the Smart folder is collapsed. Due to this bug, both gFolderTreeView._treeElement.treeBoxObject.SelectFolder and gFolderTreeView._treeElement.treeBoxObject.ensureRowIsVisible fail when you pass a hidden (by parent collapsed) Sent/Inbox/Draft/Trash/Archive folder. Reproducible: Always Steps to Reproduce: 1. Install QuickFolders version 1.8 (not 1.8.1, this has a workaround) 2. Drag one of the Inboxes to the QF pane 3. Collapse the Smartfolder "Inbox" so that the Inbox from step 2 is hidden 4. Select the QuickFolder Tab labelled "Inbox" (not the hidden folder in the folder tree Actual Results: The Account Parent node of the Inbox is selected and expanded Expected Results: The "Inbox" Smartfolder should be expanded and the child Inbox is selected This is a workaround I am using in my Extension (QuickFolders 1.8.1). It determines whether the folder is one of the "special" folders that can be children of a Smart Folder. If it can not retrieve the index from the tree, then this folder is hidden; it will then try to find the matching SmartFolder by using the filtered MSG_FOLDER flag, and expand it. The only side effect is that the account folder is still expanded due to the bug. const MSG_FOLDER_FLAG_TRASH = 0x0100 const MSG_FOLDER_FLAG_SENTMAIL = 0x0200 const MSG_FOLDER_FLAG_DRAFTS = 0x0400 const MSG_FOLDER_FLAG_QUEUE = 0x0800 const MSG_FOLDER_FLAG_INBOX = 0x1000 const MSG_FOLDER_FLAG_TEMPLATES = 0x400000 const MSG_FOLDER_FLAG_JUNK = 0x40000000 const MSG_FOLDER_FLAG_SMART = 0x4000 // just a guess, as this was MSG_FOLDER_FLAG_UNUSED3 // find out if parent folder is smart and collapsed (bug in TB3!) if (msgFolder.parent) { folderIndex = gFolderTreeView.getIndexOfFolder(msgFolder); // flags from: mozilla 1.8.0 / mailnews/ base/ public/ nsMsgFolderFlags.h var specialFlags = MSG_FOLDER_FLAG_INBOX + MSG_FOLDER_FLAG_QUEUE + MSG_FOLDER_FLAG_SENTMAIL + MSG_FOLDER_FLAG_TRASH + MSG_FOLDER_FLAG_DRAFTS + MSG_FOLDER_FLAG_TEMPLATES + MSG_FOLDER_FLAG_JUNK ; if (msgFolder.flags & specialFlags) { // a special folder, its parent is a smart folder? if (null==folderIndex || gFolderTreeView.getIndexOfFolder(msgFolder.parent) > folderIndex) { // if the parent appears AFTER the folder, or index can not be determined, then the "real" parent is a smart folder. var smartIndex=0; while (0x0==(specialFlags & (gFolderTreeView._rowMap[smartIndex]._folder.flags & msgFolder.flags))) smartIndex++; if (!(gFolderTreeView._rowMap[smartIndex]).open) { gFolderTreeView._toggleRow(smartIndex, false); } } } } gFolderTreeView.selectFolder (msgFolder);
forgot to mention the code pasted in the first code example is from folderPane.js - the bug is in the selectFolder function, which obviously was written before the Introduction of Smart Folders.
Summary: SmartFolders do not Expand correctly → folderPane.js: SmartFolders do not Expand correctly
Yep, but it's already been fixed in both 3.1 and 3.0.1. :) (as a side note, you can use Components.interfaces.nsMsgFolderFlags now instead of having to define constants separately)
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.