Fix for bug 37592. Implement about:config. Checking in for chipc. r=darin, hewitt, mstoltz,srilatha. sr=waterson. a=brendan.

This commit is contained in:
bnesse%netscape.com 2001-09-01 06:01:25 +00:00
Родитель f489a29bc9
Коммит db539cd196
12 изменённых файлов: 397 добавлений и 0 удалений

Просмотреть файл

@ -222,6 +222,7 @@ UnregisterBasicAuth(nsIComponentManager *aCompMgr, nsIFile *aPath,
#include "nsAboutBlank.h"
#include "nsAboutBloat.h"
#include "nsAboutCache.h"
#include "nsAboutConfig.h"
#include "nsAboutRedirector.h"
#include "nsKeywordProtocolHandler.h"
@ -952,6 +953,11 @@ static nsModuleComponentInfo gNetModuleInfo[] = {
NS_ABOUT_MODULE_CONTRACTID_PREFIX "bloat",
nsAboutBloat::Create
},
{ "about:config",
NS_ABOUT_CONFIG_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "config",
nsAboutConfig::Create
},
{ "about:credits",
NS_ABOUT_REDIRECTOR_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits",

Двоичные данные
netwerk/macbuild/netwerk.mcp

Двоичный файл не отображается.

Просмотреть файл

@ -36,6 +36,7 @@ CPPSRCS = \
nsAboutBloat.cpp \
nsAboutCache.cpp \
nsAboutCacheEntry.cpp \
nsAboutConfig.cpp \
nsAboutRedirector.cpp \
$(NULL)

Просмотреть файл

@ -35,6 +35,7 @@ CPP_OBJS= \
.\$(OBJDIR)\nsAboutRedirector.obj \
.\$(OBJDIR)\nsAboutCache.obj \
.\$(OBJDIR)\nsAboutCacheEntry.obj \
.\$(OBJDIR)\nsAboutConfig.obj \
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s): Chip Clark <chipc@netscape.com>
*
*/
#include "nsAboutConfig.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
#include "nsCOMPtr.h"
#include "nsIURI.h"
#include "nsNetCID.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
NS_IMPL_ISUPPORTS1(nsAboutConfig, nsIAboutModule)
static const char kPrefPage[] = "chrome://global/content/config.xul";
NS_IMETHODIMP
nsAboutConfig::NewChannel(nsIURI *aURI, nsIChannel **result)
{
nsresult rv;
nsCOMPtr<nsIIOService> ioService(do_GetService(kIOServiceCID, &rv));
if (NS_FAILED(rv))
return rv;
rv = ioService->NewChannel(kPrefPage, nsnull, result);
return rv;
}
NS_METHOD
nsAboutConfig::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsAboutConfig* about = new nsAboutConfig();
if (about == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(about);
nsresult rv = about->QueryInterface(aIID, aResult);
NS_RELEASE(about);
return rv;
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s): Sammy Ford <sford@swbell.com>
* Dawn Endico <endico@mozilla.org>
*
*/
#ifndef nsAboutConfig_h__
#define nsAboutConfig_h__
#include "nsIAboutModule.h"
class nsAboutConfig : public nsIAboutModule
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIABOUTMODULE
nsAboutConfig() { NS_INIT_REFCNT(); }
virtual ~nsAboutConfig() {}
static NS_METHOD
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
protected:
};
#define NS_ABOUT_CONFIG_MODULE_CID \
{ /* 5b9cd4b2-1dd2-11b2-85a8-f86404a6cff3 */ \
0x5b9cd4b2, \
0x1dd2, \
0x11b2, \
{0x85, 0xa8, 0xf8, 0x64, 0x04, 0xa6, 0xcf, 0xf3} \
}
#endif // nsAboutConfig_h__

Просмотреть файл

@ -49,6 +49,12 @@ static nsModuleComponentInfo components[] =
nsAboutBloat::Create
},
{ "about:config",
NS_ABOUT_CONFIG_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "config",
nsAboutConfig::Create
},
{ "about:credits",
NS_ABOUT_CREDITS_MODULE_CID,
NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits",

Просмотреть файл

@ -12,6 +12,9 @@ toolkit.jar:
content/global/strres.js (resources/content/strres.js)
content/global/logo.gif (resources/content/logo.gif)
content/global/about.xul (resources/content/about.xul)
content/global/config.xul (resources/content/config.xul)
content/global/config.css (resources/content/config.css)
content/global/config.js (resources/content/config.js)
content/global/mozilla.html (resources/content/mozilla.html)
content/global/plugins.html (resources/content/plugins.html)
content/global/charsetOverlay.xul (resources/content/charsetOverlay.xul)
@ -80,6 +83,7 @@ en-US.jar:
locale/en-US/global/wizardManager.properties (resources/locale/en-US/wizardManager.properties)
locale/en-US/global/wizardOverlay.dtd (resources/locale/en-US/wizardOverlay.dtd)
locale/en-US/global/keys.properties (resources/locale/en-US/keys.properties)
locale/en-US/global/config.dtd (resources/locale/en-US/config.dtd)
locale/en-US/global/about.dtd (resources/locale/en-US/about.dtd)
locale/en-US/global/accept2locale.properties (resources/locale/en-US/accept2locale.properties)
locale/en-US/global/languageNames.properties (resources/locale/en-US/languageNames.properties)

Просмотреть файл

@ -0,0 +1,45 @@
/*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-2001 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Chip Clark (chipc@netscape.com)
*/
/* ===== aboutconfig.css ==============================================
== Styles for about:config
======================================================================= */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/* ::::: outliner rows ::::: */
outliner:focus > .outliner-bodybox
{
border: 1px solid black;
}
outliner > .outliner-bodybox
{
border: 1px solid transparent;
}
outlinerbody:-moz-outliner-cell-text(prefCol)
{
font-weight: bold;
}

Просмотреть файл

@ -0,0 +1,129 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*/
var arr = new Array();
var view = ({
rowCount : 0,
getCellText : function(k, col)
{
if ( !arr[k] )
return;
return arr[k][col];
},
getRowProperties : function(index, prop) {},
getCellProperties : function(index, col, prop) {},
getColumnProperties : function(col, elt, prop) {},
outlinerbox : null,
selection : null,
isContainer : function(index) { return false; },
isContainerOpen : function(index) { return false; },
isContainerEmpty : function(index) { return false; },
isSorted : function() { },
canDropOn : function(index) { return false; },
canDropBeforeAfter : function(index,before) { return false; },
drop : function(row,orientation) {},
setOutliner : function(out) { this.outlinerbox = out; },
getParentIndex: function(rowIndex) { return -1 },
hasNextSibling: function(rowIndex, afterIndex) { return false },
getLevel: function(index) { return 1},
toggleOpenState : function(index) {},
cycleHeader: function(colID, elt) {},
selectionChanged : function() {},
cycleCell: function(row, colID) {},
isEditable: function(row, valueCol) {return true},
isEditable: function(row, colID) {return false},
setCellText: function(row, colID, value) {},
performAction: function(action) {},
performActionOnRow: function(action, row) {},
performActionOnCell: function(action, row, colID) {},
});
function onConfigLoad()
{
var prefCount = {value:0};
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
var prefBranch = prefService.getBranch(null);
var prefArray = prefBranch.getChildList("" , prefCount);
var prefName, prefType, prefTypeName, prefValue, prefIndex, prefLockState;
var i = 0;
var j = 0; // This is used to avoid counting the "capability" preferences
var k = 0; // This is to maintain a count of prefs (not including the "capability" prefs);
prefArray.sort();
for (i = 0; i < prefCount.value; i++)
{
if((prefArray[i].indexOf("capability", 0) + 1) > 0) // avoid displaying "private" preferences
{
j++;
continue;
}
k = (i - j); // avoid numbering "capability" prefs
prefIndex = k + 1;
prefLockState = "default";
if(prefBranch.prefIsLocked(prefArray[i])) // 0 = false
prefLockState = "locked";
else if(prefBranch.prefHasUserValue(prefArray[i])) // 0 = false
prefLockState = "user set";
prefType = prefBranch.getPrefType(prefArray[i]);
switch(prefType)
{
case 32:
prefTypeName = "string";
prefValue = prefBranch.getCharPref(prefArray[i]);
prefValue = htmlEscape(prefValue);
break;
case 64:
prefTypeName = "int";
prefValue = prefBranch.getIntPref(prefArray[i]);
break;
case 128:
prefTypeName = "bool";
prefValue = prefBranch.getBoolPref(prefArray[i]);
break;
default:
prefTypeName = "unknown";
break;
}
arr[k] = {indexCol:prefIndex, prefCol:prefArray[i], lockCol:prefLockState, typeCol:prefTypeName, valueCol:prefValue};
}
view.rowCount = k + 1;
var outliner = document.getElementById("out");
outliner.outlinerBoxObject.view = view;
}
function htmlEscape(s)
{
s = s.replace(/\&/g, "&amp;");
s = s.replace(/\>/g, "&gt;");
s = s.replace(/\</g, "&lt;");
return s;
}

Просмотреть файл

@ -0,0 +1,58 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/content/config.css" type="text/css"?>
<!--
The contents of this file are subject to the Netscape 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/NPL/
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 Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!DOCTYPE window SYSTEM "chrome://global/locale/config.dtd">
<window id="config"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:web="http://home.netscape.com/WEB-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
orient="vertical"
width="750"
height="500"
onload="onConfigLoad();">
<script src="chrome://global/content/config.js"/>
<outliner id="out" flex="1" >
<outlinercol id="indexCol" label="Index" flex="1"/>
<splitter class="tree-splitter" />
<outlinercol id="prefCol" label="Prefs" flex="7"/>
<splitter class="tree-splitter" />
<outlinercol id="lockCol" label="Lock State" flex="1"/>
<splitter class="tree-splitter" />
<outlinercol id="typeCol" label="Type" flex="1"/>
<splitter class="tree-splitter" />
<outlinercol id="valueCol" label="Value" flex="10"/>
<outlinerbody id="configOutlinerBody" flex="1" />
</outliner>
</window>

Просмотреть файл

@ -0,0 +1,33 @@
<!--
The contents of this file are subject to the Netscape 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/NPL/
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 Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
-->
<!ENTITY idxColumn.label "Index">
<!ENTITY prefColumn.label "Preference">
<!ENTITY lockColumn.label "Lock Status">
<!ENTITY typeColumn.label "Type">
<!ENTITY valueColumn.label "Value">
<!--Tooltips-->
<!ENTITY prefColumnHeader.tooltip "Click to sort">
<!ENTITY columnChooser.tooltip "Click to select columns to display">