Advertisement
Guest User

amdBindings.xml

a guest
May 4th, 2017
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 16.62 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <!-- ***** BEGIN LICENSE BLOCK *****
  3.   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.   -
  5.   - The contents of this file are subject to the Mozilla Public License Version
  6.   - 1.1 (the "License"); you may not use this file except in compliance with
  7.   - the License. You may obtain a copy of the License at
  8.   - http://www.mozilla.org/MPL/
  9.   -
  10.   - Software distributed under the License is distributed on an "AS IS" basis,
  11.   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.   - for the specific language governing rights and limitations under the
  13.   - License.
  14.   -
  15.   - The Original Code is the Extension Manager UI.
  16.   -
  17.   - The Initial Developer of the Original Code is
  18.   - the Mozilla Foundation.
  19.   - Portions created by the Initial Developer are Copyright (C) 2010
  20.   - the Initial Developer. All Rights Reserved.
  21.   -
  22.   - Contributor(s):
  23.   -   Blair McBride <bmcbride@mozilla.com>
  24.   -   David Dahl <ddahl@mozilla.com>
  25.   -
  26.   - Alternatively, the contents of this file may be used under the terms of
  27.   - either the GNU General Public License Version 2 or later (the "GPL"), or
  28.   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.   - in which case the provisions of the GPL or the LGPL are applicable instead
  30.   - of those above. If you wish to allow use of your version of this file only
  31.   - under the terms of either the GPL or the LGPL, and not to allow others to
  32.   - use your version of this file under the terms of the MPL, indicate your
  33.   - decision by deleting the provisions above and replace them with the notice
  34.   - and other provisions required by the LGPL or the GPL. If you do not delete
  35.   - the provisions above, a recipient may use your version of this file under
  36.   - the terms of any one of the MPL, the GPL or the LGPL.
  37.   -
  38.   - ***** END LICENSE BLOCK ***** -->
  39.  
  40.  
  41. <!DOCTYPE page [
  42. <!ENTITY % extensionsDTD SYSTEM "chrome://mozapps/locale/extensions/extensions.dtd">
  43. %extensionsDTD;
  44. ]>
  45.  
  46. <bindings id="AMD_addonBindings_override"
  47.          xmlns="http://www.mozilla.org/xbl"
  48.          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  49.          xmlns:xbl="http://www.mozilla.org/xbl">
  50.  
  51.   <binding id="addon-generic-override"
  52.           extends="chrome://mozapps/content/extensions/extensions.xml#addon-generic">
  53.     <content>
  54.       <xul:hbox class="content-container" align="center">
  55.         <xul:vbox class="icon-container">
  56.           <xul:image anonid="icon" class="icon"/>
  57.         </xul:vbox>
  58.         <xul:vbox class="content-inner-container" flex="1">
  59.           <xul:hbox class="basicinfo-container">
  60.               <xul:hbox class="name-container">
  61.                 <xul:label anonid="name" class="name" crop="end" flex="1"
  62.                           xbl:inherits="value=name,tooltiptext=name"/>
  63.                 <xul:label anonid="version" class="version"/>
  64.                 <xul:label class="disabled-postfix" value="&addon.disabled.postfix;"/>
  65.                 <xul:label class="update-postfix" value="&addon.update.postfix;"/>
  66.                 <xul:spacer flex="5000"/> <!-- Necessary to make the name crop -->
  67.               </xul:hbox>
  68.             <xul:label anonid="date-updated" class="date-updated"
  69.                       unknown="&addon.unknownDate;"/>
  70.           </xul:hbox>
  71.  
  72.           <xul:hbox class="advancedinfo-container" flex="1">
  73.             <xul:vbox class="description-outer-container" flex="1">
  74.               <xul:hbox class="description-container">
  75.                 <xul:label anonid="description" class="description" crop="end" flex="1"/>
  76.                 <xul:button anonid="details-btn" class="details button-link"
  77.                            label="&addon.details.label;"
  78.                            tooltiptext="&addon.details.tooltip;"
  79.                            oncommand="document.getBindingParent(this).showInDetailView();"/>
  80.                 <xul:spacer flex="5000"/> <!-- Necessary to make the description crop -->
  81.               </xul:hbox>
  82.               <xul:vbox anonid="relnotes-container" class="relnotes-container">
  83.                 <xul:label class="relnotes-header" value="&addon.releaseNotes.label;"/>
  84.                 <xul:label anonid="relnotes-loading" value="&addon.loadingReleaseNotes.label;"/>
  85.                 <xul:label anonid="relnotes-error" hidden="true"
  86.                           value="&addon.errorLoadingReleaseNotes.label;"/>
  87.                 <xul:vbox anonid="relnotes" class="relnotes"/>
  88.               </xul:vbox>
  89.               <xul:hbox class="relnotes-toggle-container">
  90.                 <xul:button anonid="relnotes-toggle-btn" class="relnotes-toggle"
  91.                            hidden="true" label="&cmd.showReleaseNotes.label;"
  92.                            tooltiptext="&cmd.showReleaseNotes.tooltip;"
  93.                            showlabel="&cmd.showReleaseNotes.label;"
  94.                            showtooltip="&cmd.showReleaseNotes.tooltip;"
  95.                            hidelabel="&cmd.hideReleaseNotes.label;"
  96.                            hidetooltip="&cmd.hideReleaseNotes.tooltip;"
  97.                            oncommand="document.getBindingParent(this).toggleReleaseNotes();"/>
  98.               </xul:hbox>
  99.             </xul:vbox>
  100.           </xul:hbox>
  101.         </xul:vbox>
  102.         <!-- The "wrong" indentation here is to reduce the size of the diff against
  103.             the original extensions.xml, to make the file easier to update. -->
  104.             <xul:vbox class="status-control-wrapper">
  105.               <xul:hbox class="status-container">
  106.                 <xul:hbox anonid="checking-update" hidden="true">
  107.                   <xul:image class="spinner"/>
  108.                   <xul:label value="&addon.checkingForUpdates.label;"/>
  109.                 </xul:hbox>
  110.                 <xul:vbox anonid="update-available" class="update-available"
  111.                          hidden="true">
  112.                   <xul:checkbox anonid="include-update" class="include-update"
  113.                                label="&addon.includeUpdate.label;" checked="true"
  114.                                oncommand="document.getBindingParent(this).onIncludeUpdateChanged();"/>
  115.                   <xul:hbox class="update-info-container">
  116.                     <xul:label class="update-available-notice"
  117.                               value="&addon.updateAvailable.label;"/>
  118.                     <xul:button anonid="update-btn" class="addon-control update"
  119.                                label="&addon.updateNow.label;"
  120.                                tooltiptext="&addon.updateNow.tooltip;"
  121.                                oncommand="document.getBindingParent(this).upgrade();"/>
  122.                   </xul:hbox>
  123.                 </xul:vbox>
  124.                 <xul:hbox anonid="install-status" class="install-status"
  125.                          hidden="true"/>
  126.               </xul:hbox>
  127.               <xul:hbox anonid="control-container" class="control-container">
  128.                 <xul:button anonid="preferences-btn"
  129.                            class="addon-control preferences"
  130.                            label="&cmd.showPreferencesWin.label;"
  131.                            tooltiptext="&cmd.showPreferencesWin.tooltip;"
  132.                            oncommand="document.getBindingParent(this).showPreferences();"/>
  133.                 <xul:button anonid="enable-btn"  class="addon-control enable"
  134.                            label="&cmd.enableAddon.label;"
  135.                            oncommand="document.getBindingParent(this).userDisabled = false;"/>
  136.                 <xul:button anonid="disable-btn" class="addon-control disable"
  137.                            label="&cmd.disableAddon.label;"
  138.                            oncommand="document.getBindingParent(this).userDisabled = true;"/>
  139.                 <xul:button anonid="remove-btn" class="addon-control remove"
  140.                            label="&cmd.uninstallAddon.label;"
  141.                            oncommand="document.getBindingParent(this).uninstall();"/>
  142.           </xul:hbox>
  143.         </xul:vbox>
  144.       </xul:hbox>
  145.       <xul:hbox anonid="warning-container"
  146.                class="warning">
  147.         <xul:image class="warning-icon"/>
  148.         <xul:label anonid="warning" flex="1"/>
  149.         <xul:label anonid="warning-link" class="text-link"/>
  150.         <xul:button anonid="warning-btn" class="button-link"/>
  151.         <xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
  152.       </xul:hbox>
  153.       <xul:hbox anonid="error-container"
  154.                class="error">
  155.         <xul:image class="error-icon"/>
  156.         <xul:label anonid="error" flex="1"/>
  157.         <xul:label anonid="error-link" class="text-link"/>
  158.         <xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
  159.       </xul:hbox>
  160.      
  161.       <xul:hbox anonid="pending-container"
  162.                class="pending">
  163.         <xul:image class="pending-icon"/>
  164.         <xul:label anonid="pending" flex="1"/>
  165.         <xul:button anonid="restart-btn" class="button-link"
  166.                    label="&addon.restartNow.label;"
  167.                    oncommand="document.getBindingParent(this).restart();"/>
  168.         <xul:button anonid="undo-btn" class="button-link"
  169.                    label="&addon.undoAction.label;"
  170.                    tooltipText="&addon.undoAction.tooltip;"
  171.                    oncommand="document.getBindingParent(this).undo();"/>
  172.         <xul:spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
  173.       </xul:hbox>
  174.     </content>
  175.  
  176.     <implementation>
  177.       <method name="_updateState">
  178.         <body><![CDATA[
  179.          if (this.parentNode.selectedItem == this)
  180.            gViewController.updateCommands();
  181.  
  182.          this.removeAttribute("AMD_notification");
  183.  
  184.          var pending = this.mAddon.pendingOperations;
  185.          if (pending != AddonManager.PENDING_NONE) {
  186.            this.removeAttribute("notification");
  187.  
  188.            var pending = null;
  189.            ["enable", "disable", "install", "uninstall", "upgrade"].forEach(function(aOp) {
  190.              if (this.isPending(aOp))
  191.                pending = aOp;
  192.            }, this);
  193.  
  194.            this.setAttribute("pending", pending);
  195.            this._pending.textContent = gStrings.ext.formatStringFromName(
  196.              "notification." + pending,
  197.              [this.mAddon.name, gStrings.brandShortName], 2
  198.            );
  199.          } else {
  200.            this.removeAttribute("pending");
  201.  
  202.            var isUpgrade = this.hasAttribute("upgrade");
  203.            var install = this._installStatus.mInstall;
  204.  
  205.            if (install && install.state == AddonManager.STATE_DOWNLOAD_FAILED) {
  206.              this.setAttribute("notification", "warning");
  207.              this._warning.textContent = gStrings.ext.formatStringFromName(
  208.                "notification.downloadError",
  209.                [this.mAddon.name], 1
  210.              );
  211.              this._warningBtn.label = gStrings.ext.GetStringFromName("notification.downloadError.retry");
  212.              this._warningBtn.tooltipText = gStrings.ext.GetStringFromName("notification.downloadError.retry.tooltip");
  213.              this._warningBtn.setAttribute("oncommand", "document.getBindingParent(this).retryInstall();");
  214.              this._warningBtn.hidden = false;
  215.              this._warningLink.hidden = true;
  216.            } else if (install && install.state == AddonManager.STATE_INSTALL_FAILED) {
  217.              this.setAttribute("notification", "warning");
  218.              this._warning.textContent = gStrings.ext.formatStringFromName(
  219.                "notification.installError",
  220.                [this.mAddon.name], 1
  221.              );
  222.              this._warningBtn.label = gStrings.ext.GetStringFromName("notification.installError.retry");
  223.              this._warningBtn.tooltipText = gStrings.ext.GetStringFromName("notification.downloadError.retry.tooltip");
  224.              this._warningBtn.setAttribute("oncommand", "document.getBindingParent(this).retryInstall();");
  225.              this._warningBtn.hidden = false;
  226.              this._warningLink.hidden = true;
  227.            } else if (!isUpgrade && this.mAddon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
  228.              this.setAttribute("notification", "error");
  229.              this._error.textContent = gStrings.ext.formatStringFromName(
  230.                "notification.blocked",
  231.                [this.mAddon.name], 1
  232.              );
  233.              this._errorLink.value = gStrings.ext.GetStringFromName("notification.blocked.link");
  234.              /* Classicish Add-on Manager: Bug 406026 changed the URL used for the link. Rather
  235.                 than ship two variants of cam_binding.xml just for this change, I'm instead going
  236.                 to fix it in JavaScript. The caveat is that I don't have a blocklisted extension
  237.                 handy, so I haven't been able to test this code. */
  238.              if (this.mAddon.blocklistURL)
  239.                this._errorLink.href = this.mAddon.blocklistURL;
  240.              else
  241.                this._errorLink.href = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
  242.              this._errorLink.hidden = false;
  243.            } else if (!isUpgrade && !this.mAddon.isCompatible) {
  244.              this.setAttribute("notification", "warning");
  245.              this.setAttribute("AMD_notification", "incompatible");
  246.              this._warning.textContent = gStrings.ext.formatStringFromName(
  247.                "notification.incompatible",
  248.                [this.mAddon.name, gStrings.brandShortName, gStrings.appVersion], 3
  249.              );
  250.              this._warningLink.hidden = true;
  251.              this._warningBtn.hidden = true;
  252.            } else if (!isUpgrade && this.mAddon.blocklistState == Ci.nsIBlocklistService.STATE_SOFTBLOCKED) {
  253.              this.setAttribute("notification", "warning");
  254.              this._warning.textContent = gStrings.ext.formatStringFromName(
  255.                "notification.softblocked",
  256.                [this.mAddon.name], 1
  257.              );
  258.              this._warningLink.value = gStrings.ext.GetStringFromName("notification.softblocked.link");
  259.              /* Classicish Add-on Manager: As above. */
  260.              if (this.mAddon.blocklistURL)
  261.                this._warningLink.href = this.mAddon.blocklistURL;
  262.              else
  263.                this._warningLink.href = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
  264.              this._warningLink.hidden = false;
  265.              this._warningBtn.hidden = true;
  266.            } else if (!isUpgrade && this.mAddon.blocklistState == Ci.nsIBlocklistService.STATE_OUTDATED) {
  267.              this.setAttribute("notification", "warning");
  268.              this._warning.textContent = gStrings.ext.formatStringFromName(
  269.                "notification.outdated",
  270.                [this.mAddon.name], 1
  271.              );
  272.              this._warningLink.value = gStrings.ext.GetStringFromName("notification.outdated.link");
  273.              this._warningLink.href = Services.urlFormatter.formatURLPref("plugins.update.url");
  274.              this._warningLink.hidden = false;
  275.              this._warningBtn.hidden = true;
  276.            } else {
  277.              this.removeAttribute("notification");
  278.            }
  279.          }
  280.  
  281.          this._preferencesBtn.hidden = !this.mAddon.optionsURL;
  282.  
  283.          if (this.hasPermission("enable")) {
  284.            this._enableBtn.hidden = false;
  285.            let tooltip = gViewController.commands["cmd_enableItem"]
  286.                                         .getTooltip(this.mAddon);
  287.            this._enableBtn.setAttribute("tooltiptext", tooltip);
  288.          } else {
  289.            this._enableBtn.hidden = true;
  290.          }
  291.  
  292.          if (this.hasPermission("disable")) {
  293.            this._disableBtn.hidden = false;
  294.            let tooltip = gViewController.commands["cmd_disableItem"]
  295.                                         .getTooltip(this.mAddon);
  296.            this._disableBtn.setAttribute("tooltiptext", tooltip);
  297.          } else {
  298.            this._disableBtn.hidden = true;
  299.          }
  300.  
  301.          if (this.hasPermission("uninstall")) {
  302.            this._removeBtn.hidden = false;
  303.            let tooltip = gViewController.commands["cmd_uninstallItem"]
  304.                                         .getTooltip(this.mAddon);
  305.            this._removeBtn.setAttribute("tooltiptext", tooltip);
  306.          } else {
  307.            this._removeBtn.hidden = true;
  308.          }
  309.  
  310.          this.setAttribute("active", this.mAddon.isActive);
  311.  
  312.          var showProgress = this.mAddon.purchaseURL || (this.mAddon.install &&
  313.                             this.mAddon.install.state != AddonManager.STATE_INSTALLED);
  314.          this._showStatus(showProgress ? "progress" : "none");
  315.        ]]></body>
  316.       </method>
  317.     </implementation>
  318.   </binding>
  319. </bindings>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement