Last Comment Bug 636104 - Redirect Lightning Preferences to the Suite Preferences window.
: Redirect Lightning Preferences to the Suite Preferences window.
Status: RESOLVED FIXED
:
Product: Calendar
Classification: Client Software
Component: Lightning: SeaMonkey Integration (show other bugs)
: Trunk
: All All
: -- normal (vote)
: 3.1
Assigned To: Philip Chee
:
Mentors:
: 683347 994249 (view as bug list)
Depends on: 518736
Blocks: 1267666
  Show dependency treegraph
 
Reported: 2011-02-23 00:38 PST by Philip Chee
Modified: 2016-04-29 10:56 PDT (History)
16 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Stub messenger preferences.xul for Lightning [SM2.1] from Bug 518736. (4.96 KB, patch)
2011-02-23 01:44 PST, Philip Chee
no flags Details | Diff | Splinter Review
Patch v1.0 Redirect Options button to the SeaMonkey Preference Window. (6.03 KB, patch)
2014-01-11 08:54 PST, Philip Chee
no flags Details | Diff | Splinter Review
Patch v1.1 Redirect Options button to the SeaMonkey Preference Window. (5.94 KB, patch)
2014-01-16 08:52 PST, Philip Chee
philipp: review+
Details | Diff | Splinter Review

Description Philip Chee 2011-02-23 00:38:09 PST
From Bug 518736 Comment 48:
> I can make a trunk patch to do this (I have the code running locally) but I'm
> holding back until the UI (and API) stabilizes since I don't want to do useless
> work.

Forward port the patch from Bug 518736 to SeaMonkey 2.1.
Comment 1 Philip Chee 2011-02-23 01:44:30 PST
Created attachment 514443 [details] [diff] [review]
Stub messenger preferences.xul for Lightning [SM2.1] from Bug 518736.

Original patch in Bug 518736 has r=IanN sr=Neil. Attaching this patch for pro-forma reviews.
Comment 2 Robert Kaiser 2011-02-23 09:06:58 PST
I will not approve this because I'm still opposed to fixing a Lightning bug in SeaMonkey permanently, a fix really belongs in Lightning IMHO and that's why I vetoed this going onto trunk in the first place. But as I'm fading out of the project, I'm not vetoing at this stage but only stating my opinion.
Comment 3 Philip Chee 2011-02-23 19:34:13 PST
How about attachment 404243 [details] [diff] [review] from Bug 518736 ?
A one line patch using Javascript in the <optionsURL>:
> -    <em:optionsURL>chrome://messenger/content/preferences/preferences.xul</em:optionsURL>
> +    <em:optionsURL>javascript:var url=Application.id=='{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}'?'chrome://communicator/content/pref/preferences.xul':'chrome://messenger/content/preferences/preferences.xul';opener.openDialog(url,'','chrome,titlebar,toolbar,centerscreen,modal,resizable','paneLightning');window.close();</em:optionsURL>

It was previously rejected as too hacky. Perhaps the Lightning devs might reconsider?
Comment 4 Philip Chee 2011-03-09 01:11:22 PST
Comment on attachment 514443 [details] [diff] [review]
Stub messenger preferences.xul for Lightning [SM2.1] from Bug 518736.

I guess this version of the bug is WONTFIX.
Comment 5 Justin Wood (:Callek) 2011-03-17 23:20:24 PDT
Comment on attachment 514443 [details] [diff] [review]
Stub messenger preferences.xul for Lightning [SM2.1] from Bug 518736.

If and only if you get review+ will I consider the hackery-stub in our code for lightning.
Comment 6 Philip Chee 2014-01-11 08:54:26 PST
Created attachment 8358812 [details] [diff] [review]
Patch v1.0 Redirect Options button to the SeaMonkey Preference Window.

New approach: Redirect Lightning Preferences to the Suite Preferences window.

> +        var item;
> +        try {
> +          item = gListView.getListItemForID(this.guid);
Get the richlistitem that corresponds to Lightning.

> +        } catch (ex) {
> +        };
> +
> +        if (!item || !item.showPreferences) {
> +          Services.console
> +                  .logStringMessage("Lighting: Unknown showPreferences API");
> +          return;
> +        }
If something changed incompatibly we bail early so we are no worse off than without this patch.

> +% overlay about:addons chrome://lightning/content/suite-overlay-addons.xul ...
> +% overlay chrome://mozapps/content/extensions/extensions.xul chrome://lightning/content/suite-overlay-addons.xul ...
Overlay both because it's possible for extensions to call the addons manager with either URL.
Comment 7 neil@parkwaycc.co.uk 2014-01-12 04:07:30 PST
Comment on attachment 8358812 [details] [diff] [review]
Patch v1.0 Redirect Options button to the SeaMonkey Preference Window.

>+        try {
>+          item = gListView.getListItemForID(this.guid);
Don't need this, it can't throw.

>+        } catch (ex) {
>+        };
Spurious semicolon after block.

>+        if (!item || !item.showPreferences) {
>+          Services.console
>+                  .logStringMessage("Lighting: Unknown showPreferences API");
Item might legitimately not exist (wrong view selected).
showPreferences might not exist, in which case writing to it can hardly make things worse.

>+        if (win)
>+          win.focus();
[Perhaps use syncTreeWithPane to switch to the Lightning pane? See bug 798147.]

>+    window.addEventListener("load", lightningPrefs.init.bind(lightningPrefs), false);
If you use handleEvent instead then you can just add the object itself as the listener.
Listening to the load event is incorrect, you need to watch the ViewChanged event instead.
Comment 8 Philip Chee 2014-01-16 08:48:38 PST
Moving to Lightning component.
Comment 9 Philip Chee 2014-01-16 08:52:32 PST
Created attachment 8361151 [details] [diff] [review]
Patch v1.1 Redirect Options button to the SeaMonkey Preference Window.

Changes since the last patch:

1. Remove try/catch block.
2. override showPreferences method unconditionally.
2a. "showPreferences might not exist, in which case writing to it can hardly
    make things worse."
3. Use syncTreeWithPane to switch to the Lightning pane if the Preferences
   window is already open.
4. Use handleEvent instead and add the object itself as the listener.
5. Listen to the "ViewChanged" event instead of "load".
Comment 10 Philipp Kewisch [:Fallen] 2014-01-20 06:19:11 PST
Comment on attachment 8361151 [details] [diff] [review]
Patch v1.1 Redirect Options button to the SeaMonkey Preference Window.

Review of attachment 8361151 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, r=philipp. Only a minor nit:

::: calendar/lightning/content/suite-overlay-addons.xul
@@ +25,5 @@
> +          var pane = doc.getElementById("paneLightning");
> +          doc.documentElement.syncTreeWithPane(pane, true);
> +        }
> +        else
> +          openDialog("chrome://communicator/content/pref/preferences.xul",

brackets in one line with the else and also brackets for single-line else blocks.
Comment 11 Philip Chee 2014-01-20 07:53:28 PST
Pushed to comm-central:
remote:   https://hg.mozilla.org/comm-central/rev/576245902b22
Comment 12 Philip Chee 2014-04-10 10:48:09 PDT
*** Bug 994249 has been marked as a duplicate of this bug. ***
Comment 13 Philip Chee 2016-03-06 10:35:56 PST
*** Bug 683347 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.