mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 512882: Create new option scheme for add-ons [r=mark.finkle]
This commit is contained in:
parent
2234e22258
commit
dd84c656d2
@ -42,9 +42,8 @@
|
||||
<xul:button class="show-on-uninstall addon-cancel" label="&addonCancel.label;"
|
||||
oncommand="ExtensionsView.cancelUninstall(document.getBindingParent(this));"/>
|
||||
</xul:hbox>
|
||||
<xul:vbox anonid="options-box" collapsed="true" flex="1">
|
||||
<xul:iframe anonid="options-frame" src="" flex="1"/>
|
||||
</xul:vbox>
|
||||
<!-- options are generated dynamically from the optionsURL -->
|
||||
<xul:vbox class="options-box" anonid="options-box" collapsed="true" flex="1" />
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
@ -58,49 +57,48 @@
|
||||
let appDisabled = this.getAttribute("appDisabled");
|
||||
if (appDisabled == "true")
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "enable-button").setAttribute("disabled", "true");
|
||||
|
||||
this._optionsHandler.element = this;
|
||||
this._optionsHandler.box = document.getAnonymousElementByAttribute(this, "anonid", "options-box");
|
||||
this._optionsHandler.frame = document.getAnonymousElementByAttribute(this, "anonid", "options-frame");
|
||||
]]>
|
||||
</constructor>
|
||||
|
||||
<field name="_optionsHandler">
|
||||
<![CDATA[ ({
|
||||
element: null,
|
||||
box: null,
|
||||
frame: null,
|
||||
<method name="hideOptions">
|
||||
<body>
|
||||
<![CDATA[
|
||||
let box = document.getAnonymousElementByAttribute(this, "anonid", "options-box");
|
||||
if (!box.collapsed)
|
||||
this.toggleOptions();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
handleEvent: function op_handleEvent(aEvent) {
|
||||
if (aEvent.type == "load") {
|
||||
// Try to determine the natural height of the iframe content
|
||||
// so we can resize the iframe and all the content is visible
|
||||
let height = 0;
|
||||
let root = this.frame.contentDocument.documentElement;
|
||||
for (let i = 0; i < root.children.length; ++i) {
|
||||
height += root.children[i].clientHeight;
|
||||
}
|
||||
<method name="showOptions">
|
||||
<body>
|
||||
<![CDATA[
|
||||
let box = document.getAnonymousElementByAttribute(this, "anonid", "options-box");
|
||||
if (box.collapsed)
|
||||
this.toggleOptions();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
this.box.height = height;
|
||||
}
|
||||
}
|
||||
}) ]]>
|
||||
</field>
|
||||
<method name="toggleOptions">
|
||||
<body>
|
||||
<![CDATA[
|
||||
let optionsURL = this.getAttribute("optionsURL");
|
||||
if (optionsURL == "")
|
||||
return;
|
||||
|
||||
let box = this._optionsHandler.box;
|
||||
let box = document.getAnonymousElementByAttribute(this, "anonid", "options-box");
|
||||
box.collapsed = !box.collapsed;
|
||||
|
||||
let frame = this._optionsHandler.frame;
|
||||
if (frame.getAttribute("src") == "") {
|
||||
frame.addEventListener("load", this._optionsHandler, true);
|
||||
frame.setAttribute("src", optionsURL);
|
||||
}
|
||||
if (box.hasChildNodes())
|
||||
return;
|
||||
|
||||
// retrieve the extensions prefs
|
||||
let optionsURL = this.getAttribute("optionsURL");
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", optionsURL, false);
|
||||
xhr.send();
|
||||
|
||||
// Only allow <setting> for now
|
||||
let prefs = xhr.responseXML.querySelectorAll(":root > setting");
|
||||
for (let i = 0; i < prefs.length; i++)
|
||||
box.appendChild(prefs.item(i));
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -15,20 +15,24 @@ richlistitem[type="documenttab"] {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
richpref[type="bool"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpref-bool");
|
||||
settings {
|
||||
-moz-binding: url("chrome://browser/content/preferences/setting.xml#settings");
|
||||
}
|
||||
|
||||
richpref[type="boolint"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpref-boolint");
|
||||
setting[type="bool"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/setting.xml#setting-bool");
|
||||
}
|
||||
|
||||
richpref[type="button"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpref-button");
|
||||
setting[type="boolint"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/setting.xml#setting-boolint");
|
||||
}
|
||||
|
||||
richpref[type="string"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/richpref.xml#richpref-string");
|
||||
setting[type="button"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/setting.xml#setting-button");
|
||||
}
|
||||
|
||||
setting[type="string"] {
|
||||
-moz-binding: url("chrome://browser/content/preferences/setting.xml#setting-string");
|
||||
}
|
||||
|
||||
notificationbox {
|
||||
|
@ -323,7 +323,7 @@
|
||||
<label value="&addonsHeader.label;"/>
|
||||
</hbox>
|
||||
<notificationbox id="addons-messages" flex="1">
|
||||
<richlistbox id="addons-list" flex="1">
|
||||
<richlistbox id="addons-list" flex="1" onselect="ExtensionsView.hideOptions()">
|
||||
<richlistitem id="addons-local" class="section-header" align="center">
|
||||
<label value="&addonsLocal.label;" flex="1"/>
|
||||
</richlistitem>
|
||||
@ -360,32 +360,29 @@
|
||||
<label value="&prefsHeader.label;"/>
|
||||
</hbox>
|
||||
<richlistbox id="prefs-list" seltype="single" flex="1">
|
||||
<richpref title="&about.title;" type="button">
|
||||
<setting title="&about.title;" type="button">
|
||||
&about.description;
|
||||
<button id="prefs-about-button" label="&about.button;" oncommand="Browser.addTab('about:fennec', true);"/>
|
||||
</richpref>
|
||||
<vbox class="prefsection" id="prefs-content">
|
||||
<label value="&content.title;" crop="end" flex="1"/>
|
||||
</vbox>
|
||||
<richpref pref="permissions.default.image" title="&showImages.title;" type="boolint" on="1" off="2"/>
|
||||
<richpref pref="javascript.enabled" type="bool" title="&enableJavaScript.title;">
|
||||
&enableJavaScript.description;
|
||||
</richpref>
|
||||
<richpref pref="plugins.enabled" type="bool" title="&enablePlugins.title;" onsynctopreference="Browser.setPluginState(this.value);">
|
||||
&enablePlugins.description;
|
||||
</richpref>
|
||||
|
||||
<vbox class="prefsection" id="prefs-privacy">
|
||||
<label value="&privacy.title;" crop="end" flex="1"/>
|
||||
</vbox>
|
||||
<richpref pref="network.cookie.cookieBehavior" title="&allowCookies.title;" type="boolint" on="0" off="2">
|
||||
&allowCookies.description;
|
||||
</richpref>
|
||||
<richpref pref="signon.rememberSignons" title="&rememberPasswords.title;" type="bool"/>
|
||||
<richpref title="&clearPrivateData.title;" type="button">
|
||||
&clearPrivateData.description;
|
||||
<button id="prefs-clear-data" label="&clearPrivateData.button;" command="cmd_sanitize"/>
|
||||
</richpref>
|
||||
</setting>
|
||||
<settings id="prefs-content" label="&content.title;">
|
||||
<setting pref="permissions.default.image" title="&showImages.title;" type="boolint" on="1" off="2"/>
|
||||
<setting pref="javascript.enabled" type="bool" title="&enableJavaScript.title;">
|
||||
&enableJavaScript.description;
|
||||
</setting>
|
||||
<setting pref="plugins.enabled" type="bool" title="&enablePlugins.title;" onsynctopreference="Browser.setPluginState(this.value);">
|
||||
&enablePlugins.description;
|
||||
</setting>
|
||||
</settings>
|
||||
<settings id="prefs-privacy" label="&privacy.title;">
|
||||
<setting pref="network.cookie.cookieBehavior" title="&allowCookies.title;" type="boolint" on="0" off="2">
|
||||
&allowCookies.description;
|
||||
</setting>
|
||||
<setting pref="signon.rememberSignons" title="&rememberPasswords.title;" type="bool"/>
|
||||
<setting title="&clearPrivateData.title;" type="button">
|
||||
&clearPrivateData.description;
|
||||
<button id="prefs-clear-data" label="&clearPrivateData.button;" command="cmd_sanitize"/>
|
||||
</setting>
|
||||
</settings>
|
||||
</richlistbox>
|
||||
</vbox>
|
||||
|
||||
|
@ -185,6 +185,32 @@ var ExtensionsView = {
|
||||
}
|
||||
},
|
||||
|
||||
showOptions: function ev_showOptions(aID) {
|
||||
this.hideOptions();
|
||||
|
||||
let item = this.getElementForAddon(aID);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
// if the element is not the selected element, select it
|
||||
if (item != this._list.selectedItem)
|
||||
this._list.selectedItem = item;
|
||||
|
||||
item.showOptions();
|
||||
},
|
||||
|
||||
hideOptions: function ev_hideOptions() {
|
||||
if (!this._list)
|
||||
return;
|
||||
|
||||
let items = this._list.childNodes;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
let item = items[i];
|
||||
if (item.hideOptions)
|
||||
item.hideOptions();
|
||||
}
|
||||
},
|
||||
|
||||
get visible() {
|
||||
let panel = document.getElementById("panel-container");
|
||||
let items = document.getElementById("panel-items");
|
||||
|
@ -42,7 +42,14 @@
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding id="richpref-base">
|
||||
<binding id="settings">
|
||||
<content orient="vertical">
|
||||
<xul:label class="settings-title" xbl:inherits="value=label" crop="end" flex="1"/>
|
||||
<children />
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="setting-base">
|
||||
<implementation>
|
||||
<constructor>
|
||||
let prefValue = this.pref.valueFromPreferences;
|
||||
@ -97,7 +104,7 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="richpref-bool" extends="chrome://browser/content/preferences/richpref.xml#richpref-base">
|
||||
<binding id="setting-bool" extends="chrome://browser/content/preferences/setting.xml#setting-base">
|
||||
<content>
|
||||
<xul:box flex="1" class="prefbox">
|
||||
<xul:vbox flex="1">
|
||||
@ -120,7 +127,7 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="richpref-boolint" extends="chrome://browser/content/preferences/richpref.xml#richpref-base">
|
||||
<binding id="setting-boolint" extends="chrome://browser/content/preferences/setting.xml#setting-base">
|
||||
<content>
|
||||
<xul:box flex="1" class="prefbox">
|
||||
<xul:vbox flex="1">
|
||||
@ -157,7 +164,7 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="richpref-button" extends="chrome://browser/content/preferences/richpref.xml#richpref-base">
|
||||
<binding id="setting-button" extends="chrome://browser/content/preferences/setting.xml#setting-base">
|
||||
<content>
|
||||
<xul:box flex="1" class="prefbox">
|
||||
<xul:vbox flex="1">
|
||||
@ -177,7 +184,7 @@
|
||||
</content>
|
||||
</binding>
|
||||
|
||||
<binding id="richpref-string" extends="chrome://browser/content/preferences/richpref.xml#richpref-base">
|
||||
<binding id="setting-string" extends="chrome://browser/content/preferences/setting.xml#setting-base">
|
||||
<content>
|
||||
<xul:box flex="1" class="prefbox">
|
||||
<xul:vbox flex="1">
|
@ -20,7 +20,7 @@ chrome.jar:
|
||||
content/content.css (content/content.css)
|
||||
content/checkerboard.png (content/checkerboard.png)
|
||||
% content branding %content/branding/
|
||||
content/preferences/richpref.xml (content/preferences/richpref.xml)
|
||||
content/preferences/setting.xml (content/preferences/setting.xml)
|
||||
* content/sanitize.xul (content/sanitize.xul)
|
||||
* content/sanitize.js (content/sanitize.js)
|
||||
content/BrowserView.js (content/BrowserView.js)
|
||||
|
@ -788,16 +788,18 @@ findbar .findbar-closebutton {
|
||||
|
||||
/* Preferences window ---------------------------------------------------- */
|
||||
/* XXX should be a richlistitem */
|
||||
richpref {
|
||||
setting {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* XXX should be a richlistitem.section-header */
|
||||
.prefsection {
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
settings {
|
||||
background-color: lightgray;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
settings .settings-title {
|
||||
font-weight: bold;
|
||||
padding: 0.5mm;
|
||||
}
|
||||
|
||||
@ -809,6 +811,14 @@ richpref {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
.options-box {
|
||||
margin-left: 28px; /* sized based on the 32px addon image */
|
||||
}
|
||||
|
||||
.options-box setting:last-child .prefbox {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
/* XXX should be a richlistitem description.title */
|
||||
.preftitle {
|
||||
font-size: 80% !important;
|
||||
|
@ -343,6 +343,10 @@ findbar .findbar-closebutton {
|
||||
-moz-image-region: rect(90px 78px 108px 0px);
|
||||
}
|
||||
|
||||
.options-box {
|
||||
margin-left: 28px; /* sized based on the 32px addon image */
|
||||
}
|
||||
|
||||
/* select popup ------------------------------------------------------------ */
|
||||
#select-list > option[selected="true"] > image {
|
||||
list-style-image: url("chrome://browser/skin/images/check-30.png");
|
||||
|
@ -343,6 +343,10 @@ findbar .findbar-closebutton {
|
||||
-moz-image-region: rect(90px 78px 108px 0px);
|
||||
}
|
||||
|
||||
.options-box {
|
||||
margin-left: 28px; /* sized based on the 32px addon image */
|
||||
}
|
||||
|
||||
/* select popup ------------------------------------------------------------ */
|
||||
#select-list > option[selected="true"] > image {
|
||||
list-style-image: url("chrome://browser/skin/images/check-24.png");
|
||||
|
@ -506,16 +506,18 @@ findbar {
|
||||
|
||||
/* Preferences window ---------------------------------------------------- */
|
||||
/* XXX should be a richlistitem */
|
||||
richpref {
|
||||
setting {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
/* XXX should be a richlistitem.section-header */
|
||||
.prefsection {
|
||||
font-weight: bold;
|
||||
color: #000;
|
||||
settings {
|
||||
background-color: lightgray;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
settings .settings-title {
|
||||
font-weight: bold;
|
||||
padding: 0.25mm;
|
||||
}
|
||||
|
||||
@ -526,6 +528,10 @@ richpref {
|
||||
min-height: 7.2mm; /* row size */
|
||||
}
|
||||
|
||||
.options-box setting:last-child .prefbox {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
/* XXX should be a richlistitem description.title */
|
||||
.preftitle {
|
||||
font-size: 9pt !important;
|
||||
|
Loading…
Reference in New Issue
Block a user