Open Bug 798147 Opened 12 years ago Updated 21 days ago

Switch to correct pref pane if pref window already open

Categories

(SeaMonkey :: Preferences, defect)

defect
Not set
normal

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: iannbugzilla, Assigned: iannbugzilla)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

Attached patch Show the correct pane (obsolete) — Splinter Review
If a preference window is already open and the user tries to open a particular pref pane from another part of SeaMonkey then all that happens in the pref window is brought to the front, the correct pref pane is not selected.

STR
1/ From browser window open preferences window
2/ navigator_pane is shown
3/ From mail window try and open preferences window

Expected result
1/ preference window is focused and mailnews_pane is shown

Actual result
1/ preference window is focused but navigator_pane is still shown

Further Information
If instead of open preferences from mail window, the account settings window is opened and then an account's junk settings page is opened and the Global Junk Settings button is clicked, the preference window is focused but navigator_pane is still showing instead of the junk_pane
Attachment #668246 - Flags: review?(neil)
Comment on attachment 668246 [details] [diff] [review]
Show the correct pane

>+    var prefDialog = lastPrefWindow.document.getElementById("prefDialog");
Too late to try this tonight but you should probably use lastPrefWindow.document.documentElement.showPane(pane);

>+    try
>+    {
>+      prefDialog.showPane(pane);
>+    }
>+    catch(e) {}
Why the try/catch?
Attached patch Less try and catch (obsolete) — Splinter Review
Fixed up as suggested.
Attachment #668246 - Attachment is obsolete: true
Attachment #668246 - Flags: review?(neil)
Attachment #669262 - Flags: review?(neil)
Comment on attachment 669262 [details] [diff] [review]
Less try and catch

Extra brownie points if you can make the browser/mail/composer categories auto-expand as well as get selected.
Attachment #669262 - Flags: review?(neil) → review+
It seems that calling syncTreeWithPane(pane, true) selects and expands the pane.
Changes since last patch:
* Now unexpands the part of the tree for the previous pane and expands the part of the tree for the new pane.

Potentially there is some duplicate code between this and prefwindow.xml
Attachment #669262 - Attachment is obsolete: true
Attachment #682953 - Flags: review?(neil)
Comment on attachment 682953 [details] [diff] [review]
With some opening and closing

>+    var currentPane = prefWindow.currentPane;
>+    if (currentPane.id != paneID)
>+    {
>+      var container = currentPane.preftreeitem;
>+      while (container != prefWindow._navigationTree)
>+      {
>+        container.setAttribute("open", false);
I'm not 100% convinced it's necessary to close the previous item (although I don't object to it), but removeAttribute("open") should work, I think.

>+      var pane = lastPrefWindow.document.getElementById(paneID);
>+      prefWindow.showPane(pane);
>+      prefWindow.currentPane = pane;
>+      prefWindow.syncTreeWithPane(pane, true);
Hmm, do you really need all three of these?
Blocks: 740240
Attachment #9385248 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.