Closed Bug 387232 Opened 13 years ago Closed 13 years ago

Collapsed folder pane disappears after restart, not possible to get it back

Categories

(Calendar :: Lightning Only, defect)

defect
Not set
major

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: ssitter, Assigned: michael.buettner)

Details

Attachments

(2 files)

Thunderbird 2.0.0.5pre (20070706) with Lightning 0.7pre (2007070604)

Collapsed folder pane disappears after restart, not possible to get it back

Steps to Reproduce:
1. Create new profile in Thunderbird
2. Install Lightning and restart Thunderbird
3. Either in mail or calendar mode collapse left sidebar to the left
4. Restart Thunderbird

Actual Results:
After the restart the sidebar is visible but the folder pane is not displayed. Switching between mail mode and calendar mode and collapsing / un-collapsing the sidebar doesn't make the folder pane reappear.

Expected Results:
After the restart the sidebar is still collapsed. Un-collapsing the sidebar shows either folder pane in mail mode or the minimonth and agenda in calendar mode.

Additional Information:
The only way to get the folder pane back is by deactivating Lightning. Once Lightning is deactivated it's possible to un-collapse the folder pane.
That's probably my turn ;-)
Assignee: nobody → michael.buettner
Flags: blocking-calendar0.7+
The new mode toolbar dynamically tweaks the DOM tree in order to get itself injected into Thunderbird. Without Lightning we just have a more or less top-level element named 'folderPaneBox' that holds the folder pane. The modified version looks like this:

<mailContent>
  <deck id="ltnModeBox">
    <folderPaneBox/>
    <ltnSideBar/>
  </deck>
</mailContent>

Obviously this is not correct xul, but it should make clear that the folderPaneBox gets moved into a deck. Fact is that collapsing the ltnModeBox also collapses the folderPaneBox. This information will be stored in the localstore.rdf but never gets turned off when the ltnModeBox will be shown again. That's the story I can tell so far...
Further investigation shows that the 'folderPaneBox' receives its 'collapsed' attribute during the initial layout. The evidence that this is indeed the problem is the following line in the localstore.rdf

<RDF:Description
RDF:about="chrome://messenger/content/messenger.xul#folderPaneBox"
collapsed="true"/>

Un-collapsing the panel, closing Thunderbird, deleting the offending line from localstore.rdf and restarting Thunderbird brings the panel back to life. It totally makes sense that the folderPaneBox receives its own collapsed attribute as it clearly states it wants to persist this attribute and probably this attribute is propagates from parents to their children. Since the ltnModeBox gets collapsed this information gets also stored at children that asking for it, just as the folderPaneBox does.

Problem has been understood, patch is coming up...
Attached patch patch v1Splinter Review
The solution to the problem could probably also have been solved by manipulating the 'persist' attribute of the folderPaneBox, but I find it cleaner to manually listen for the offending attribute and inject the necessary change.
Attachment #276782 - Flags: review?(philipp)
Whiteboard: [patch in hand]
Comment on attachment 276782 [details] [diff] [review]
patch v1

Only minor style nits, r+ with these points considered.

>+    window.addEventListener(
>+        "DOMAttrModified",
>+        function DOMAttrModified_Listener(event) {
>+            if (event.target.id == "ltnModeBox" &&
>+                event.attrName == "collapsed") {
>+                document.getElementById(
>+                    "folderPaneBox")
>+                        .removeAttribute("collapsed");
>+            }
>+        },
>+        false);
>+
* Any reason you are adding the event listener on the window and not on the ltnModeBox? 
* Shouln't |true| be used as the third argument for DOM event listeners? I'm not too sure about that, I never quite understood that parameter, I just saw it being set to true on many DOM events. 
* I'd prefer separating the addEventListener call from the function.
* Regarding wrapping, please wrap as late as possible on the dot. 
* A comment about the listener would also be nice.

Complete example, feel free to modify or adopt:
------------------------------------------------------------------------------
    // To make sure the folder pane doesn't disappear without any possibility
    // to get it back, we need to reveal it when the mode box is collapsed.
    function modeBoxAttrModified(event) {
        if (event.attrName == "collapsed") {
            document.getElementById("folderPaneBox")
                    .removeAttribute("collapsed");
        }
    }

    document.getElementById("ltnModeBox").addEventListener("DOMAttrModified",
                                                           modeBoxAttrModified,
                                                           true);
------------------------------------------------------------------------------
Attachment #276782 - Flags: review?(philipp) → review+
Status: NEW → ASSIGNED
Keywords: checkin-needed
OS: Windows 2000 → All
Hardware: PC → All
patch checked in on trunk and MOZILLA_1_8_BRANCH

-> FIXED
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Keywords: checkin-needed
Target Milestone: --- → 0.7
Verified on Windows 2000 using 
Thunderbird 1.5.0.14pre (20070907) with Lightning 0.7pre (2007090704)
Thunderbird 2.0.0.7pre (20070907) with Lightning 0.7pre (2007090704)
Thunderbird 3.0a1pre (2007090704) with Lightning 0.6a1 (2007090704)
Status: RESOLVED → VERIFIED
Whiteboard: [patch in hand]
You need to log in before you can comment on or make changes to this bug.