зеркало из https://github.com/mozilla/pjs.git
More 170006 Extension Manager Front End - not used yet
This commit is contained in:
Родитель
4f7945028c
Коммит
c9e795b0f0
|
@ -45,14 +45,14 @@ interface nsIRDFDataSource;
|
|||
interface nsIExtensionManager : nsISupports
|
||||
{
|
||||
void installExtensionFromStream(in nsIInputStream aStream, in boolean aUseProfile);
|
||||
void uninstallExtension(in wstring aExtensionID);
|
||||
void enableExtension(in wstring aExtensionID);
|
||||
void disableExtension(in wstring aExtensionID);
|
||||
void uninstallExtension(in string aExtensionID);
|
||||
void enableExtension(in string aExtensionID);
|
||||
void disableExtension(in string aExtensionID);
|
||||
|
||||
void installTheme(in wstring aThemeID);
|
||||
void uninstallTheme(in wstring aThemeID);
|
||||
void enableTheme(in wstring aThemeID);
|
||||
void disableTheme(in wstring aThemeID);
|
||||
void installTheme(in string aThemeID);
|
||||
void uninstallTheme(in string aThemeID);
|
||||
void enableTheme(in string aThemeID);
|
||||
void disableTheme(in string aThemeID);
|
||||
|
||||
readonly attribute nsIRDFDataSource datasource;
|
||||
};
|
||||
|
|
|
@ -86,43 +86,43 @@ nsExtensionManager::InstallExtensionFromStream(nsIInputStream* aStream,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtensionManager::UninstallExtension(const PRUnichar* aExtensionID)
|
||||
nsExtensionManager::UninstallExtension(const char* aExtensionID)
|
||||
{
|
||||
return mDataSource->SetToBeUninstalled(aExtensionID);
|
||||
return mDataSource->UninstallExtension(aExtensionID);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtensionManager::EnableExtension(const PRUnichar* aExtensionID)
|
||||
nsExtensionManager::EnableExtension(const char* aExtensionID)
|
||||
{
|
||||
return mDataSource->SetToBeEnabled(aExtensionID);
|
||||
return mDataSource->EnableExtension(aExtensionID);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtensionManager::DisableExtension(const PRUnichar* aExtensionID)
|
||||
nsExtensionManager::DisableExtension(const char* aExtensionID)
|
||||
{
|
||||
return mDataSource->SetToBeDisabled(aExtensionID);
|
||||
return mDataSource->DisableExtension(aExtensionID);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtensionManager::InstallTheme(const PRUnichar* aThemeID)
|
||||
nsExtensionManager::InstallTheme(const char* aThemeID)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtensionManager::UninstallTheme(const PRUnichar* aThemeID)
|
||||
nsExtensionManager::UninstallTheme(const char* aThemeID)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtensionManager::EnableTheme(const PRUnichar* aThemeID)
|
||||
nsExtensionManager::EnableTheme(const char* aThemeID)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExtensionManager::DisableTheme(const PRUnichar* aThemeID)
|
||||
nsExtensionManager::DisableTheme(const char* aThemeID)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ static nsIRDFResource* gNameArc = nsnull;
|
|||
static nsIRDFResource* gDescriptionArc = nsnull;
|
||||
static nsIRDFResource* gCreatorArc = nsnull;
|
||||
static nsIRDFResource* gContributorArc = nsnull;
|
||||
static nsIRDFResource* gDisabledArc = nsnull;
|
||||
static nsIRDFResource* gHomepageURLArc = nsnull;
|
||||
static nsIRDFResource* gUpdateURLArc = nsnull;
|
||||
static nsIRDFResource* gVersionArc = nsnull;
|
||||
|
@ -88,7 +89,19 @@ nsExtensionManagerDataSource::nsExtensionManagerDataSource()
|
|||
if (!gRDFService)
|
||||
CallGetService("@mozilla.org/rdf/rdf-service;1", &gRDFService);
|
||||
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(EM_RDF_URI "name"), &gNameArc);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(EM_RDF_URI "version"), &gVersionArc);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(EM_RDF_URI "iconURL"), &gIconURLArc);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(EM_RDF_URI "toBeEnabled"), &gToBeEnabledArc);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(EM_RDF_URI "toBeDisabled"), &gToBeDisabledArc);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(EM_RDF_URI "toBeUninstalled"), &gToBeUninstalledArc);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(EM_RDF_URI "disabled"), &gDisabledArc);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(EM_RDF_URI "installLocation"), &gInstallLocationArc);
|
||||
|
||||
gRDFService->GetLiteral(NS_LITERAL_STRING("profile").get(), &gInstallProfile);
|
||||
gRDFService->GetLiteral(NS_LITERAL_STRING("global").get(), &gInstallGlobal);
|
||||
gRDFService->GetLiteral(NS_LITERAL_STRING("true").get(), &gTrueValue);
|
||||
gRDFService->GetLiteral(NS_LITERAL_STRING("false").get(), &gFalseValue);
|
||||
}
|
||||
|
||||
nsExtensionManagerDataSource::~nsExtensionManagerDataSource()
|
||||
|
@ -99,6 +112,7 @@ nsExtensionManagerDataSource::~nsExtensionManagerDataSource()
|
|||
NS_IF_RELEASE(gDescriptionArc);
|
||||
NS_IF_RELEASE(gCreatorArc);
|
||||
NS_IF_RELEASE(gContributorArc);
|
||||
NS_IF_RELEASE(gDisabledArc);
|
||||
NS_IF_RELEASE(gHomepageURLArc);
|
||||
NS_IF_RELEASE(gUpdateURLArc);
|
||||
NS_IF_RELEASE(gVersionArc);
|
||||
|
@ -269,15 +283,17 @@ nsExtensionManagerDataSource::InstallExtension(nsIRDFDataSource* aSourceDataSour
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsExtensionManagerDataSource::SetExtensionProperty(const PRUnichar* aExtensionID,
|
||||
nsExtensionManagerDataSource::SetExtensionProperty(const char* aExtensionID,
|
||||
nsIRDFResource* aPropertyArc,
|
||||
nsIRDFNode* aPropertyValue)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCString resourceURI = NS_LITERAL_CSTRING("urn:mozilla:extension:");
|
||||
resourceURI += aExtensionID;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> extension;
|
||||
gRDFService->GetUnicodeResource(nsDependentString(aExtensionID),
|
||||
getter_AddRefs(extension));
|
||||
gRDFService->GetResource(resourceURI, getter_AddRefs(extension));
|
||||
|
||||
nsCOMPtr<nsIRDFNode> installLocation;
|
||||
rv |= GetTarget(extension, gInstallLocationArc, PR_TRUE,
|
||||
|
@ -288,7 +304,11 @@ nsExtensionManagerDataSource::SetExtensionProperty(const PRUnichar* aExtensionID
|
|||
nsCOMPtr<nsIRDFDataSource> ds = isProfile ? mProfileExtensions : mAppExtensions;
|
||||
|
||||
nsCOMPtr<nsIRDFNode> oldNode;
|
||||
SET_PROPERTY(ds, extension, aPropertyArc, aPropertyValue)
|
||||
rv |= ds->GetTarget(extension, aPropertyArc, PR_FALSE, getter_AddRefs(oldNode));
|
||||
if (oldNode)
|
||||
rv |= ds->Change(extension, aPropertyArc, oldNode, aPropertyValue);
|
||||
else
|
||||
rv |= ds->Assert(extension, aPropertyArc, aPropertyValue, PR_FALSE);
|
||||
|
||||
// Write out the extensions datasource
|
||||
nsCOMPtr<nsIRDFRemoteDataSource> rds(do_QueryInterface(ds));
|
||||
|
@ -299,19 +319,23 @@ nsExtensionManagerDataSource::SetExtensionProperty(const PRUnichar* aExtensionID
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsExtensionManagerDataSource::SetToBeEnabled(const PRUnichar* aExtensionID)
|
||||
nsExtensionManagerDataSource::EnableExtension(const char* aExtensionID)
|
||||
{
|
||||
return SetExtensionProperty(aExtensionID, gToBeEnabledArc, gTrueValue);
|
||||
nsresult rv = SetExtensionProperty(aExtensionID, gToBeEnabledArc, gTrueValue);
|
||||
rv |= SetExtensionProperty(aExtensionID, gDisabledArc, gFalseValue);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsExtensionManagerDataSource::SetToBeDisabled(const PRUnichar* aExtensionID)
|
||||
nsExtensionManagerDataSource::DisableExtension(const char* aExtensionID)
|
||||
{
|
||||
return SetExtensionProperty(aExtensionID, gToBeDisabledArc, gTrueValue);
|
||||
nsresult rv = SetExtensionProperty(aExtensionID, gToBeDisabledArc, gTrueValue);
|
||||
rv |= SetExtensionProperty(aExtensionID, gDisabledArc, gTrueValue);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsExtensionManagerDataSource::SetToBeUninstalled(const PRUnichar* aExtensionID)
|
||||
nsExtensionManagerDataSource::UninstallExtension(const char* aExtensionID)
|
||||
{
|
||||
return SetExtensionProperty(aExtensionID, gToBeUninstalledArc, gTrueValue);
|
||||
}
|
||||
|
@ -353,8 +377,7 @@ nsExtensionManagerDataSource::GetTarget(nsIRDFResource* aSource,
|
|||
PRBool aTruthValue,
|
||||
nsIRDFNode** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFNode> result;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (aProperty == gIconURLArc) {
|
||||
PRBool hasIconURLArc;
|
||||
|
@ -367,15 +390,22 @@ nsExtensionManagerDataSource::GetTarget(nsIRDFResource* aSource,
|
|||
nsCOMPtr<nsIRDFResource> res;
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING("chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png"),
|
||||
getter_AddRefs(res));
|
||||
result = do_QueryInterface(res);
|
||||
|
||||
*aResult = result;
|
||||
*aResult = res;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
}
|
||||
}
|
||||
else if (aProperty == gInstallLocationArc) {
|
||||
PRBool hasNameArc, hasVersionArc;
|
||||
rv |= mProfileExtensions->HasArcOut(aSource, gNameArc, &hasNameArc);
|
||||
rv |= mProfileExtensions->HasArcOut(aSource, gVersionArc, &hasVersionArc);
|
||||
|
||||
if (!result)
|
||||
rv = mComposite->GetTarget(aSource, aProperty, aTruthValue, aResult);
|
||||
*aResult = (hasNameArc && hasVersionArc) ? gInstallProfile : gInstallGlobal;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
}
|
||||
|
||||
if (!*aResult)
|
||||
rv |= mComposite->GetTarget(aSource, aProperty, aTruthValue, aResult);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -57,14 +57,14 @@ public:
|
|||
nsresult InstallExtension(nsIRDFDataSource* aSourceDataSource,
|
||||
PRBool aProfile);
|
||||
|
||||
nsresult SetToBeEnabled(const PRUnichar* aExtensionID);
|
||||
nsresult SetToBeDisabled(const PRUnichar* aExtensionID);
|
||||
nsresult SetToBeUninstalled(const PRUnichar* aExtensionID);
|
||||
nsresult EnableExtension(const char* aExtensionID);
|
||||
nsresult DisableExtension(const char* aExtensionID);
|
||||
nsresult UninstallExtension(const char* aExtensionID);
|
||||
|
||||
nsresult LoadExtensions(PRBool aProfile);
|
||||
|
||||
protected:
|
||||
nsresult SetExtensionProperty(const PRUnichar* aExtensionID,
|
||||
nsresult SetExtensionProperty(const char* aExtensionID,
|
||||
nsIRDFResource* aPropertyArc,
|
||||
nsIRDFNode* aPropertyValue);
|
||||
void InitLexicalResources();
|
||||
|
|
|
@ -1,40 +1,3 @@
|
|||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Globals
|
||||
|
||||
|
@ -45,6 +8,11 @@ var gDownloadListener = null;
|
|||
var gExtensionssView = null;
|
||||
var gWindowState = "";
|
||||
|
||||
function stripPrefix(aResourceURI)
|
||||
{
|
||||
return aResourceURI.substr("urn:mozilla:extension:".length, aResourceURI.length);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Utility Functions
|
||||
function setRDFProperty(aID, aProperty, aValue)
|
||||
|
@ -203,7 +171,44 @@ function onExtensionUpdate(aEvent)
|
|||
|
||||
function onExtensionEnableDisable(aEvent)
|
||||
{
|
||||
var titleKey = null;
|
||||
var disabling;
|
||||
if (aEvent.target.getAttribute("disabled") == "true") {
|
||||
disabling = false;
|
||||
if (gWindowState == "extensions") {
|
||||
gExtensionManager.enableExtension(stripPrefix(aEvent.target.id));
|
||||
titleKey = "restartBeforeEnableExtensionTitle";
|
||||
}
|
||||
else if (gWindowState == "themes") {
|
||||
gExtensionManager.enableTheme(stripPrefix(aEvent.target.id));
|
||||
titleKey = "restartBeforeEnableThemeTitle";
|
||||
}
|
||||
}
|
||||
else {
|
||||
disabling = true;
|
||||
if (gWindowState == "extensions") {
|
||||
gExtensionManager.disableExtension(stripPrefix(aEvent.target.id));
|
||||
titleKey = "restartBeforeDisableExtensionTitle";
|
||||
}
|
||||
else if (gWindowState == "themes") {
|
||||
gExtensionManager.disableTheme(stripPrefix(aEvent.target.id));
|
||||
titleKey = "restartBeforeDisableThemeTitle";
|
||||
}
|
||||
}
|
||||
|
||||
if (titleKey) {
|
||||
var promptSvc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
|
||||
var extensionsStrings = document.getElementById("extensionsStrings");
|
||||
|
||||
var messageKey = disabling ? "restartBeforeDisableMessage" : "restartBeforeEnableMessage";
|
||||
var brandStrings = document.getElementById("brandStrings");
|
||||
var message = extensionsStrings.getFormattedString(messageKey,
|
||||
[aEvent.target.getAttribute("name"),
|
||||
brandStrings.getString("brandShortName")]);
|
||||
promptSvc.alert(window, extensionsStrings.getString(titleKey), message);
|
||||
}
|
||||
}
|
||||
|
||||
function onExtensionUninstall(aEvent)
|
||||
|
@ -331,29 +336,103 @@ var gExtensionsDNDObserver =
|
|||
var gExtensionsViewController = {
|
||||
supportsCommand: function (aCommand)
|
||||
{
|
||||
return aCommand == "cmd_cleanUp";
|
||||
var commandNode = document.getElementById(aCommand);
|
||||
return commandNode && (commandNode.parentNode == document.getElementById("extensionsCommands"));
|
||||
},
|
||||
|
||||
isCommandEnabled: function (aCommand)
|
||||
{
|
||||
if (aCommand == "cmd_cleanUp")
|
||||
return gDownloadManager.canCleanUp;
|
||||
var selectedItem = gExtensionsView.selected;
|
||||
var i;
|
||||
switch (aCommand) {
|
||||
case "cmd_close":
|
||||
return true;
|
||||
case "cmd_options":
|
||||
dump("*** ice = " + selectedItem.disabled + "\n");
|
||||
return !selectedItem.disabled;
|
||||
case "cmd_about":
|
||||
return !selectedItem || selectedItem.disabled ? selectedItem.getAttribute("aboutURL") == "" : true;
|
||||
case "cmd_homepage":
|
||||
return (selectedItem && selectedItem.getAttribute("homepageURL") != "");
|
||||
case "cmd_uninstall":
|
||||
return selectedItem.getAttribute("blockUninstall") != "true";
|
||||
case "cmd_update":
|
||||
return true;
|
||||
case "cmd_disable":
|
||||
return !selectedItem.disabled;
|
||||
case "cmd_movetop":
|
||||
return (gExtensionsView.children[0] != selectedItem);
|
||||
case "cmd_moveup":
|
||||
return (gExtensionsView.children[0] != selectedItem);
|
||||
case "cmd_movedn":
|
||||
var children = gExtensionsView.children;
|
||||
return (children[children.length-1] != selectedItem);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
doCommand: function (aCommand)
|
||||
{
|
||||
if (aCommand == "cmd_cleanUp" && this.isCommandEnabled(aCommand)) {
|
||||
gDownloadManager.cleanUp();
|
||||
this.onCommandUpdate();
|
||||
dump("*** doCommand = " + aCommand + "\n");
|
||||
switch (aCommand) {
|
||||
case "cmd_close":
|
||||
case "cmd_options":
|
||||
case "cmd_about":
|
||||
case "cmd_homepage":
|
||||
case "cmd_uninstall":
|
||||
case "cmd_update":
|
||||
case "cmd_disable":
|
||||
case "cmd_movetop":
|
||||
case "cmd_moveup":
|
||||
case "cmd_movedn":
|
||||
}
|
||||
},
|
||||
|
||||
onCommandUpdate: function ()
|
||||
{
|
||||
var command = "cmd_cleanUp";
|
||||
var enabled = this.isCommandEnabled(command);
|
||||
goSetCommandEnabled(command, enabled);
|
||||
var extensionsCommands = document.getElementById("extensionsCommands");
|
||||
for (var i = 0; i < extensionsCommands.childNodes.length; ++i) {
|
||||
var command = extensionsCommands.childNodes[i];
|
||||
if (this.isCommandEnabled(command.id))
|
||||
command.removeAttribute("disabled");
|
||||
else
|
||||
command.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is The Extension Manager.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Ben Goodger.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2004
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ben Goodger <ben@bengoodger.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="extension">
|
||||
<binding id="extension" extends="chrome://mozapps/content/shared/richview.xml#richview-item">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/skin/extensions/extensions.css"/>
|
||||
</resources>
|
||||
|
@ -79,17 +79,7 @@
|
|||
</xul:hbox>
|
||||
</content>
|
||||
<implementation>
|
||||
<method name="fireEvent">
|
||||
<parameter name="aEventType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var e = document.createEvent("Events");
|
||||
e.initEvent("extension-" + aEventType, false, true);
|
||||
|
||||
this.dispatchEvent(e);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<field name="eventPrefix">"extension-"</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
|
|
@ -63,41 +63,48 @@
|
|||
</stringbundleset>
|
||||
|
||||
<keyset id="extensionsKeys">
|
||||
<key id="key_close" key="&cmd.close.commandKey;" oncommand="closeWindow(true);" modifiers="accel"/>
|
||||
<key id="key_info" key="&cmd.info.commandKey;" oncommand="onExtensionViewAbout();" modifiers="accel"/>
|
||||
<key id="key_options" key="&cmd.options.commandKey;" oncommand="onExtensionViewOptions();" modifiers="accel"/>
|
||||
<key id="key_close" key="&cmd.close.commandKey;" modifiers="accel" command="cmd_close"/>
|
||||
<key id="key_about" key="&cmd.info.commandKey;" modifiers="accel" command="cmd_about"/>
|
||||
<key id="key_options" key="&cmd.options.commandKey;" modifiers="accel" command="cmd_options"/>
|
||||
</keyset>
|
||||
|
||||
<commandset id="extensionsCommands"
|
||||
events="richview-select"
|
||||
commandupdater="true"
|
||||
oncommandupdate="gExtensionsViewController.onCommandUpdate();">
|
||||
<command id="cmd_close" oncommand="closeWindow(true);"/>
|
||||
<command id="cmd_options" oncommand="onExtensionViewOptions();"/>
|
||||
<command id="cmd_about" oncommand="onExtensionViewAbout();"/>
|
||||
<command id="cmd_homepage" oncommand="onExtensionViewHomepage();"/>
|
||||
<command id="cmd_uninstall" oncommand="onExtensionUninstall();"/>
|
||||
<command id="cmd_update" oncommand="onExtensionUpdate();"/>
|
||||
<command id="cmd_disable" oncommand="onExtensionEnableDisable();"/>
|
||||
<command id="cmd_movetop" oncommand="onExtensionMoveTop();"/>
|
||||
<command id="cmd_moveup" oncommand="onExtensionMoveUp();"/>
|
||||
<command id="cmd_movedn" oncommand="onExtensionMoveDn();"/>
|
||||
</commandset>
|
||||
|
||||
<vbox id="contextMenuPalette" hidden="true">
|
||||
<menuitem id="menuitem_options" default="true"
|
||||
label="&cmd.options.label;" accesskey="&cmd.options.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'show-options');"/>
|
||||
<menuitem id="menuitem_homepage"
|
||||
label="&cmd.homepage.label;" accesskey="&cmd.homepage.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'show-homepage');"/>
|
||||
<menuitem id="menuitem_about"
|
||||
label="&cmd.about.label;" accesskey="&cmd.about.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'show-info');"/>
|
||||
<menuitem id="menuitem_options" default="true" command="cmd_options"
|
||||
label="&cmd.options.label;" accesskey="&cmd.options.accesskey;"/>
|
||||
<menuitem id="menuitem_homepage" command="cmd_homepage"
|
||||
label="&cmd.homepage.label;" accesskey="&cmd.homepage.accesskey;"/>
|
||||
<menuitem id="menuitem_about" command="cmd_about"
|
||||
label="&cmd.about.label;" accesskey="&cmd.about.accesskey;"/>
|
||||
<menuseparator id="menuseparator_1"/>
|
||||
<menuitem id="menuitem_uninstall"
|
||||
label="&cmd.uninstall.label;" accesskey="&cmd.uninstall.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'uninstall');"/>
|
||||
<menuitem id="menuitem_update"
|
||||
label="&cmd.update.label;" accesskey="&cmd.update.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'update');"/>
|
||||
<menuitem id="menuitem_disable"
|
||||
label="&cmd.disable.label;" accesskey="&cmd.disable.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'disable');"/>
|
||||
<menuitem id="menuitem_uninstall" command="cmd_uninstall"
|
||||
label="&cmd.uninstall.label;" accesskey="&cmd.uninstall.accesskey;"/>
|
||||
<menuitem id="menuitem_update" command="cmd_update"
|
||||
label="&cmd.update.label;" accesskey="&cmd.update.accesskey;"/>
|
||||
<menuitem id="menuitem_disable" command="cmd_disable"
|
||||
label="&cmd.disable.label;" accesskey="&cmd.disable.accesskey;"/>
|
||||
<menuseparator id="menuseparator_2"/>
|
||||
<menuitem id="menuitem_moveTop"
|
||||
label="&cmd.moveToTop.label;" accesskey="&cmd.moveToTop.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'move-top');"/>
|
||||
<menuitem id="menuitem_moveUp"
|
||||
label="&cmd.moveUp.label;" accesskey="&cmd.moveUp.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'move-up');"/>
|
||||
<menuitem id="menuitem_moveDn"
|
||||
label="&cmd.moveDn.label;" accesskey="&cmd.moveDn.accesskey;"
|
||||
oncommand="fireEventForElement(gExtensionsView.selected, 'move-dn');"/>
|
||||
<menuitem id="menuitem_moveTop" command="cmd_movetop"
|
||||
label="&cmd.moveToTop.label;" accesskey="&cmd.moveToTop.accesskey;"/>
|
||||
<menuitem id="menuitem_moveUp" command="cmd_moveup"
|
||||
label="&cmd.moveUp.label;" accesskey="&cmd.moveUp.accesskey;"/>
|
||||
<menuitem id="menuitem_moveDn" command="cmd_movedn"
|
||||
label="&cmd.moveDn.label;" accesskey="&cmd.moveDn.accesskey;"/>
|
||||
</vbox>
|
||||
|
||||
<popup id="extensionContextMenu" onpopupshowing="return buildContextMenu(event);"/>
|
||||
|
@ -132,17 +139,24 @@
|
|||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#updateURL"
|
||||
object="?update-url"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#disabled"
|
||||
object="?disabled"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#homepageURL"
|
||||
object="?homepage-url"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#description"
|
||||
object="?description"/>
|
||||
<binding subject="?extension"
|
||||
predicate="http://www.mozilla.org/2004/em-rdf#blockUninstall"
|
||||
object="?block-uninstall"/>
|
||||
</bindings>
|
||||
<action>
|
||||
<extension uri="?extension" context="extensionContextMenu"
|
||||
image="?icon" name="?name" version="?version"
|
||||
description="?description" creator="?creator"
|
||||
disabled="?disabled" blockUninstall="?block-uninstall"
|
||||
optionsURL="?options-url" homepageURL="?homepage-url"
|
||||
aboutURL="?about-url" updateURL="?update-url"/>
|
||||
</action>
|
||||
|
|
|
@ -2,3 +2,10 @@ aboutWindowTitle=About %S
|
|||
aboutWindowCloseButton=Close
|
||||
aboutWindowVersionString=version %S
|
||||
aboutExtension=About %S...
|
||||
restartBeforeEnableExtensionTitle=Enable Extension
|
||||
restartBeforeDisableExtensionTitle=Disable Extension
|
||||
restartBeforeEnableThemeTitle=Enable Theme
|
||||
restartBeforeDisableThemeTitle=Disable Theme
|
||||
restartBeforeEnableMessage=%S will be enabled the next time you restart %S.
|
||||
restartBeforeDisableMessage=%S will be disabled the next time you restart %S.
|
||||
|
||||
|
|
|
@ -64,6 +64,15 @@ extension {
|
|||
|
||||
extension[disabled="true"] {
|
||||
color: GrayText;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
extension[disabled="true"][selected="true"] {
|
||||
background-image: url("chrome://mozapps/skin/shared/itemSelected.png");
|
||||
}
|
||||
|
||||
extension[disabled="true"] .extension-icon {
|
||||
opacity: 0.3;
|
||||
}
|
||||
|
||||
.extension-item-name {
|
||||
|
|
|
@ -49,17 +49,33 @@
|
|||
<body>
|
||||
<![CDATA[
|
||||
var e = document.createEvent("Events");
|
||||
e.initEvent("extension-" + aEventType, false, true);
|
||||
e.initEvent(this.eventPrefix + aEventType, false, true);
|
||||
|
||||
this.dispatchEvent(e);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="disabled" onget="return this.getAttribute('disabled') == 'true'"
|
||||
onset="this.setAttribute('disabled', val); return val;"/>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="richview">
|
||||
<implementation>
|
||||
<method name="fireEvent">
|
||||
<parameter name="aEventType"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var e = document.createEvent("Events");
|
||||
var eventType = "richview-" + aEventType;
|
||||
e.initEvent(eventType, false, true);
|
||||
this.dispatchEvent(e);
|
||||
document.commandDispatcher.updateCommands(eventType);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<field name="_selected">null</field>
|
||||
<property name="selected">
|
||||
<setter>
|
||||
|
@ -69,6 +85,8 @@
|
|||
this._selected = val;
|
||||
if (this._selected)
|
||||
this._selected.setAttribute("selected", "true");
|
||||
|
||||
this.fireEvent("select");
|
||||
]]>
|
||||
</setter>
|
||||
<getter>
|
||||
|
@ -78,17 +96,43 @@
|
|||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="selectForwardInternal">
|
||||
<parameter name="aElement"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
for (var temp = aElement; temp; temp = temp.nextSibling) {
|
||||
if ("fireEvent" in temp) {
|
||||
this.selected = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectBackwardInternal">
|
||||
<parameter name="aElement"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
for (var temp = aElement; temp; temp = temp.previousSibling) {
|
||||
if ("fireEvent" in temp) {
|
||||
this.selected = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="selectionForward">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selected) {
|
||||
if (this.selected.nextSibling)
|
||||
this.selected = this.selected.nextSibling;
|
||||
}
|
||||
if (this.selected)
|
||||
this.selectForwardInternal(this.selected.nextSibling);
|
||||
else {
|
||||
if (this.hasChildNodes())
|
||||
this.selected = this.firstChild.nextSibling;
|
||||
this.selectForwardInternal(this.firstChild);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
|
@ -98,17 +142,28 @@
|
|||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.selected) {
|
||||
if (this.selected.previousSibling)
|
||||
this.selected = this.selected.previousSibling;
|
||||
}
|
||||
if (this.selected)
|
||||
this.selectBackwardInternal(this.selected.previousSibling);
|
||||
else {
|
||||
if (this.hasChildNodes())
|
||||
this.selected = this.lastChild;
|
||||
this.selectBackwardInternal(this.lastChild);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<property name="children">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
var childNodes = [];
|
||||
for (var i = 0; i < this.childNodes.length; ++i) {
|
||||
if ("fireEvent" in this.childNodes[i])
|
||||
childNodes.push(this.childNodes[i]);
|
||||
}
|
||||
return childNodes;
|
||||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
|
|
Загрузка…
Ссылка в новой задаче