Bug 106159. Switch remaining js and xul files from nsIPref interface to nsIPrefService/nsIPrefBranch interfaces to eliminate conflicts. r=jag, sr=alecf

This commit is contained in:
bnesse%netscape.com 2001-10-27 05:39:25 +00:00
Родитель 5e2395c335
Коммит faf03ce445
68 изменённых файлов: 477 добавлений и 476 удалений

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

@ -886,7 +886,7 @@ var nsHLineCommand =
if (gPrefs) {
try {
var align = gPrefs.GetIntPref("editor.hrule.align");
var align = gPrefs.getIntPref("editor.hrule.align");
if (align == 0 ) {
hLine.setAttribute("align", "left");
} else if (align == 2) {
@ -895,17 +895,17 @@ var nsHLineCommand =
//Note: Default is center (don't write attribute)
var width = gPrefs.GetIntPref("editor.hrule.width");
var percent = gPrefs.GetBoolPref("editor.hrule.width_percent");
var width = gPrefs.getIntPref("editor.hrule.width");
var percent = gPrefs.getBoolPref("editor.hrule.width_percent");
if (percent)
width = width +"%";
hLine.setAttribute("width", width);
var height = gPrefs.GetIntPref("editor.hrule.height");
var height = gPrefs.getIntPref("editor.hrule.height");
hLine.setAttribute("size", String(height));
var shading = gPrefs.GetBoolPref("editor.hrule.shading");
var shading = gPrefs.getBoolPref("editor.hrule.shading");
if (shading) {
hLine.removeAttribute("noshade");
} else {

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

@ -342,13 +342,13 @@ function GetDefaultBrowserColors()
colors.BackgroundColor = "";
var useSysColors = false;
try { useSysColors = gPrefs.GetBoolPref("browser.display.use_system_colors"); } catch (e) {}
try { useSysColors = gPrefs.getBoolPref("browser.display.use_system_colors"); } catch (e) {}
if (!useSysColors)
{
try { colors.TextColor = gPrefs.CopyCharPref("browser.display.foreground_color"); } catch (e) {}
try { colors.TextColor = gPrefs.getCharPref("browser.display.foreground_color"); } catch (e) {}
try { colors.BackgroundColor = gPrefs.CopyCharPref("browser.display.background_color"); } catch (e) {}
try { colors.BackgroundColor = gPrefs.getCharPref("browser.display.background_color"); } catch (e) {}
}
// Use OS colors for text and background if explicitly asked or pref is not set
if (!colors.TextColor)
@ -357,8 +357,8 @@ function GetDefaultBrowserColors()
if (!colors.BackgroundColor)
colors.BackgroundColor = "window";
try { colors.LinkColor = gPrefs.CopyCharPref("browser.anchor_color"); } catch (e) {}
try { colors.VisitedLinkColor = gPrefs.CopyCharPref("browser.visited_color"); } catch (e) {}
try { colors.LinkColor = gPrefs.getCharPref("browser.anchor_color"); } catch (e) {}
try { colors.VisitedLinkColor = gPrefs.getCharPref("browser.visited_color"); } catch (e) {}
return colors;
}
@ -1189,7 +1189,7 @@ function SetEditMode(mode)
var flags = gOutputEncodeEntities;
try {
var prettyPrint = gPrefs.GetBoolPref("editor.prettyprint");
var prettyPrint = gPrefs.getBoolPref("editor.prettyprint");
if (prettyPrint)
flags |= gOutputFormatted;
@ -1471,7 +1471,7 @@ function BuildRecentMenu(savePrefs)
var curUrl = window.editorShell.editorDocument.location;
var newDoc = (curUrl == "about:blank");
var historyCount = 10;
try { historyCount = gPrefs.GetIntPref("editor.history.url_maximum"); } catch(e) {}
try { historyCount = gPrefs.getIntPref("editor.history.url_maximum"); } catch(e) {}
var titleArray = new Array(historyCount);
var urlArray = new Array(historyCount);
var menuIndex = 1;
@ -1528,8 +1528,11 @@ function BuildRecentMenu(savePrefs)
}
}
// Force saving to file so next file opened finds these values
if (savePrefs)
gPrefs.savePrefFile(null);
if (savePrefs) {
var prefsService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
prefsService.savePrefFile(null);
}
// Disable menu item if no entries
DisableItem("menu_RecentFiles", disableMenu);
@ -1577,7 +1580,10 @@ function setUnicharPref(aPrefName, aPrefValue)
if (!gPrefs) return;
try
{
gPrefs.SetUnicharPref(aPrefName, aPrefValue);
var str = Components.classes["@mozilla.org/supports-wstring;1"]
.createInstance(Components.interfaces.nsISupportsWString);
str.data = aPrefValue;
gPrefs.setComplexValue(aPrefName, Components.interfaces.nsISupportsWString, str);
}
catch(e)
{
@ -1589,7 +1595,7 @@ function getUnicharPref(aPrefName, aDefVal)
if (!gPrefs) return "";
try
{
return gPrefs.CopyUnicharPref(aPrefName);
return gPrefs.getComplexValue(aPrefName, Components.interfaces.nsISupportsWString);
}
catch(e)
{
@ -1831,7 +1837,8 @@ function EditorSetDefaultPrefsAndDoctype()
var prefCharsetString = 0;
try
{
prefCharsetString = gPrefs.getLocalizedUnicharPref("intl.charset.default");
prefCharsetString = gPrefs.getComplexValue("intl.charset.default",
Components.interfaces.nsIPrefLocalizedString);
}
catch (ex) {}
if ( prefCharsetString && prefCharsetString != 0)
@ -1866,7 +1873,8 @@ function EditorSetDefaultPrefsAndDoctype()
var prefAuthorString = 0;
try
{
prefAuthorString = gPrefs.CopyUnicharPref("editor.author");
prefAuthorString = gPrefs.getComplexValue("editor.author",
Components.interfaces.nsISupportsWString);
}
catch (ex) {}
if ( prefAuthorString && prefAuthorString != 0)
@ -1888,7 +1896,7 @@ function EditorSetDefaultPrefsAndDoctype()
// Get editor color prefs
var use_custom_colors = false;
try {
use_custom_colors = gPrefs.GetBoolPref("editor.use_custom_colors");
use_custom_colors = gPrefs.getBoolPref("editor.use_custom_colors");
}
catch (ex) {}
@ -1905,11 +1913,11 @@ function EditorSetDefaultPrefsAndDoctype()
var followed_link_color;
var background_color;
try { text_color = gPrefs.CopyCharPref("editor.text_color"); } catch (e) {}
try { link_color = gPrefs.CopyCharPref("editor.link_color"); } catch (e) {}
try { active_link_color = gPrefs.CopyCharPref("editor.active_link_color"); } catch (e) {}
try { followed_link_color = gPrefs.CopyCharPref("editor.followed_link_color"); } catch (e) {}
try { background_color = gPrefs.CopyCharPref("editor.background_color"); } catch(e) {}
try { text_color = gPrefs.getCharPref("editor.text_color"); } catch (e) {}
try { link_color = gPrefs.getCharPref("editor.link_color"); } catch (e) {}
try { active_link_color = gPrefs.getCharPref("editor.active_link_color"); } catch (e) {}
try { followed_link_color = gPrefs.getCharPref("editor.followed_link_color"); } catch (e) {}
try { background_color = gPrefs.getCharPref("editor.background_color"); } catch(e) {}
// add the color attributes to the body tag.
// and use them for the default text and background colors if not empty
@ -1933,7 +1941,7 @@ function EditorSetDefaultPrefsAndDoctype()
}
// Default image is independent of Custom colors???
var background_image;
try { background_image = gPrefs.CopyCharPref("editor.default_background_image"); } catch(e) {}
try { background_image = gPrefs.getCharPref("editor.default_background_image"); } catch(e) {}
if (background_image)
bodyelement.setAttribute("background", background_image);
@ -2154,12 +2162,9 @@ function GetPrefsService()
{
// Store the prefs object
try {
var prefsService = Components.classes["@mozilla.org/preferences;1"];
if (prefsService)
prefsService = prefsService.getService();
if (prefsService)
gPrefs = prefsService.QueryInterface(Components.interfaces.nsIPref);
var prefsService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
gPrefs = prefsService.getBranch(null);
if (!gPrefs)
dump("failed to get prefs service!\n");
}

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

@ -304,7 +304,7 @@ function onOK()
// Fixup table only if pref is set
var prefs = GetPrefs();
try {
if (prefs && prefs.GetBoolPref("editor.table.maintain_structure") )
if (prefs && prefs.getBoolPref("editor.table.maintain_structure") )
editorShell.NormalizeTable(table);
} catch(ex) {
dump(ex);

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

@ -930,11 +930,10 @@ function SwitchToValidatePanel()
function GetPrefs()
{
var prefs;
try {
prefs = Components.classes['@mozilla.org/preferences;1'];
if (prefs) prefs = prefs.getService();
if (prefs) prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var prefs = prefService.getBranch(null);
if (prefs)
return prefs;
else
@ -1159,13 +1158,13 @@ function GetDefaultBrowserColors()
var useSysColors = false;
colors.TextColor = 0;
colors.BackgroundColor = 0;
try { useSysColors = prefs.GetBoolPref("browser.display.use_system_colors"); } catch (e) {}
try { useSysColors = prefs.getBoolPref("browser.display.use_system_colors"); } catch (e) {}
if (!useSysColors)
{
try { colors.TextColor = prefs.CopyCharPref("browser.display.foreground_color"); } catch (e) {}
try { colors.TextColor = prefs.getCharPref("browser.display.foreground_color"); } catch (e) {}
try { colors.BackgroundColor = prefs.CopyCharPref("browser.display.background_color"); } catch (e) {}
try { colors.BackgroundColor = prefs.getCharPref("browser.display.background_color"); } catch (e) {}
}
// Use OS colors for text and background if explicitly asked or pref is not set
if (!colors.TextColor)
@ -1174,8 +1173,8 @@ function GetDefaultBrowserColors()
if (!colors.BackgroundColor)
colors.BackgroundColor = "window";
colors.LinkColor = prefs.CopyCharPref("browser.anchor_color");
colors.VisitedLinkColor = prefs.CopyCharPref("browser.visited_color");
colors.LinkColor = prefs.getCharPref("browser.anchor_color");
colors.VisitedLinkColor = prefs.getCharPref("browser.visited_color");
return colors;
}

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

@ -118,7 +118,7 @@ function onSaveDefault()
} else {
alignInt = 1;
}
prefs.SetIntPref("editor.hrule.align", alignInt);
prefs.setIntPref("editor.hrule.align", alignInt);
var percentIndex = width.search(/%/);
var percent;
@ -143,13 +143,15 @@ function onSaveDefault()
heightInt = height ? Number(height) : 2;
prefs.SetIntPref("editor.hrule.width", widthInt);
prefs.SetBoolPref("editor.hrule.width_percent", percent);
prefs.SetIntPref("editor.hrule.height", heightInt);
prefs.SetBoolPref("editor.hrule.shading", shading);
prefs.setIntPref("editor.hrule.width", widthInt);
prefs.setBoolPref("editor.hrule.width_percent", percent);
prefs.setIntPref("editor.hrule.height", heightInt);
prefs.setBoolPref("editor.hrule.shading", shading);
// Write the prefs out NOW!
prefs.savePrefFile(null);
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
prefService.savePrefFile(null);
}
}
}

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

@ -101,7 +101,7 @@ function InitDialog()
// Fill in with value from editor prefs
var prefs = GetPrefs();
if (prefs)
author = prefs.CopyCharPref("editor.author");
author = prefs.getCharPref("editor.author");
}
gDialog.AuthorInput.value = author;
gDialog.DescriptionInput.value = descriptionElement.getAttribute("content");

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

@ -135,10 +135,11 @@ nsHelperAppDialog.prototype = {
picker.appendFilters( nsIFilePicker.filterAll );
// Pull in the user's preferences and get the default download directory.
var prefs = Components.classes[ "@mozilla.org/preferences;1" ]
.getService( Components.interfaces.nsIPref );
var prefs = Components.classes[ "@mozilla.org/preferences-service;1" ]
.getService( Components.interfaces.nsIPrefBranch );
try {
var startDir = prefs.getFileXPref( "browser.download.dir" );
var startDir = prefs.getComplexValue("browser.download.dir",
Components.interfaces.nsILocalFile);
if ( startDir.exists() ) {
picker.displayDirectory = startDir;
}
@ -157,7 +158,8 @@ nsHelperAppDialog.prototype = {
if ( result ) {
var newDir = result.parent;
prefs.setFileXPref( "browser.download.dir", newDir );
prefs.setComplexValue("browser.download.dir",
Components.interfaces.nsILocalFile, newDir);
}
return result;
},

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

@ -127,7 +127,7 @@ function getComponentList()
"@mozilla.org/helperapplauncherdialog;1",
"@mozilla.org/file/local;1",
"@mozilla.org/xpcom/observer;1",
"@mozilla.org/preferences;1",
"@mozilla.org/preferences-service;1",
"@mozilla.org/gfx/fontlist;1");
var interfacelist = new Array("nsIURI",
@ -136,7 +136,7 @@ function getComponentList()
"nsIHelperAppLauncherDialog",
"nsILocalFile",
"nsIObserver",
"nsIPref",
"nsIPrefBranch",
"nsIFontList");
for (var m=0; m<serviceinterfacelist.length; m++)

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

@ -71,10 +71,10 @@
// Determine if "imageBlocker.enabled" pref is set
isPrefSet: function () {
var pref = gContextMenu.getService('@mozilla.org/preferences;1', 'nsIPref');
var pref = gContextMenu.getService('@mozilla.org/preferences-service;1', 'nsIPrefBranch');
var result = false;
try {
result = pref.GetBoolPref( "imageblocker.enabled" );
result = pref.getBoolPref( "imageblocker.enabled" );
} catch(e) {
}
return result;

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

@ -55,7 +55,7 @@
alreadyCheckedForImage = true;
// remove image functions (unless overruled by the "imageblocker.enabled" pref)
var pref;
pref = Components.classes['@mozilla.org/preferences;1'];
pref = Components.classes['@mozilla.org/preferences-service;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
try {

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

@ -68,7 +68,7 @@
doSetOKCancel(onOK, null);
// get pref service
pref = Components.classes['@mozilla.org/preferences;1'];
pref = Components.classes['@mozilla.org/preferences-service;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);

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

@ -310,10 +310,9 @@ function onToggleSaveOnExit()
var m = document.getElementById ("menu-settings-autosave");
m.setAttribute ("checked", String(client.SAVE_SETTINGS));
var pref =
Components.classes["@mozilla.org/preferences;1"].createInstance(Components.interfaces.nsIPref);
pref.SetBoolPref ("extensions.irc.settings.autoSave",
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
pref.setBoolPref ("extensions.irc.settings.autoSave",
client.SAVE_SETTINGS);
}

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

@ -66,8 +66,8 @@
function readIRCPrefs (rootNode)
{
var pref =
Components.classes["@mozilla.org/preferences;1"].createInstance();
pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if(!pref)
throw ("Can't find pref component.");
@ -77,8 +77,6 @@ function readIRCPrefs (rootNode)
if (!rootNode.match(/\.$/))
rootNode += ".";
pref = pref.QueryInterface(Components.interfaces.nsIPref);
CIRCNetwork.prototype.INITIAL_NICK =
getCharPref (pref, rootNode + "nickname",
CIRCNetwork.prototype.INITIAL_NICK);
@ -144,8 +142,8 @@ function readIRCPrefs (rootNode)
function writeIRCPrefs (rootNode)
{
var pref =
Components.classes["@mozilla.org/preferences;1"].createInstance();
pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if(!pref)
throw ("Can't find pref component.");
@ -155,26 +153,24 @@ function writeIRCPrefs (rootNode)
if (!rootNode.match(/\.$/))
rootNode += ".";
pref = pref.QueryInterface(Components.interfaces.nsIPref);
pref.SetCharPref (rootNode + "nickname",
pref.setCharPref (rootNode + "nickname",
CIRCNetwork.prototype.INITIAL_NICK);
pref.SetCharPref (rootNode + "username",
pref.setCharPref (rootNode + "username",
CIRCNetwork.prototype.INITIAL_NAME);
pref.SetCharPref (rootNode + "desc", CIRCNetwork.prototype.INITIAL_DESC);
pref.SetCharPref (rootNode + "nickCompleteStr", client.ADDRESSED_NICK_SEP);
pref.SetCharPref (rootNode + "style.default", client.DEFAULT_STYLE);
pref.SetCharPref (rootNode + "stalkWords",
pref.setCharPref (rootNode + "desc", CIRCNetwork.prototype.INITIAL_DESC);
pref.setCharPref (rootNode + "nickCompleteStr", client.ADDRESSED_NICK_SEP);
pref.setCharPref (rootNode + "style.default", client.DEFAULT_STYLE);
pref.setCharPref (rootNode + "stalkWords",
client.stalkingVictims.join ("; "));
pref.SetBoolPref (rootNode + "munger", client.munger.enabled);
pref.SetBoolPref (rootNode + "munger.smileyText", client.smileyText);
pref.setBoolPref (rootNode + "munger", client.munger.enabled);
pref.setBoolPref (rootNode + "munger.smileyText", client.smileyText);
for (var entry in client.munger.entries)
pref.SetBoolPref (rootNode + "munger." + entry,
pref.setBoolPref (rootNode + "munger." + entry,
client.munger.entries[entry].enabled);
pref.SetBoolPref (rootNode + "notify.aggressive", client.FLASH_WINDOW);
pref.setBoolPref (rootNode + "notify.aggressive", client.FLASH_WINDOW);
var h = client.eventPump.getHook ("event-tracer");
pref.SetBoolPref (rootNode + "debug.tracer", h.enabled);
pref.setBoolPref (rootNode + "debug.tracer", h.enabled);
}
@ -184,7 +180,7 @@ function getCharPref (prefObj, prefName, defaultValue)
try
{
rv = prefObj.CopyCharPref (prefName);
rv = prefObj.getCharPref (prefName);
}
catch (e)
{
@ -202,7 +198,7 @@ function getIntPref (prefObj, prefName, defaultValue)
try
{
return prefObj.GetIntPref (prefName);
return prefObj.getIntPref (prefName);
}
catch (e)
{
@ -217,7 +213,7 @@ function getBoolPref (prefObj, prefName, defaultValue)
try
{
return prefObj.GetBoolPref (prefName);
return prefObj.getBoolPref (prefName);
}
catch (e)
{

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

@ -29,10 +29,8 @@ function readIRCPrefs (rootNode)
if (!getPriv("UniversalXPConnect"))
return false;
var pref =
Components.classes["@mozilla.org/preferences;1"].createInstance();
if(!pref)
throw ("Can't find pref component.");
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (!rootNode)
rootNode = "extensions.irc.";
@ -40,8 +38,6 @@ function readIRCPrefs (rootNode)
if (!rootNode.match(/\.$/))
rootNode += ".";
pref = pref.QueryInterface(Components.interfaces.nsIPref);
CIRCNetwork.prototype.INITIAL_NICK =
getCharPref (pref, rootNode + "nickname",
CIRCNetwork.prototype.INITIAL_NICK);
@ -79,7 +75,7 @@ function getCharPref (prefObj, prefName, defaultValue)
try
{
return prefObj.CopyCharPref (prefName);
return prefObj.getCharPref (prefName);
}
catch (e)
{
@ -93,7 +89,7 @@ function getIntPref (prefObj, prefName, defaultValue)
try
{
return prefObj.GetIntPref (prefName);
return prefObj.getIntPref (prefName);
}
catch (e)
{
@ -108,7 +104,7 @@ function getBoolPref (prefObj, prefName, defaultValue)
try
{
return prefObj.GetBoolPref (prefName);
return prefObj.getBoolPref (prefName);
}
catch (e)
{

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

@ -34,8 +34,8 @@ function DoEnableService() {
var warn3_setting = document.getElementById( "P3PWarningPostToBrokenPolicy" );
var warn4_setting = document.getElementById( "P3PWarningPostToNoPolicy" );
var pref = Components.classes["@mozilla.org/preferences;1"].getService();
pref = pref.QueryInterface( Components.interfaces.nsIPref );
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (enable_setting.checked) {
warn0_setting.removeAttribute( "disabled" );
@ -47,35 +47,35 @@ function DoEnableService() {
// Look for the warning settings. If not defined then an exception will occur.
// If exception occurs then set the checkbox.
try {
pref.GetBoolPref( "P3P.warningnotprivate" );
pref.getBoolPref( "P3P.warningnotprivate" );
}
catch (ex) {
warn0_setting.setAttribute("checked", "true");
}
try {
pref.GetBoolPref( "P3P.warningpartialprivacy" );
pref.getBoolPref( "P3P.warningpartialprivacy" );
}
catch (ex) {
warn1_setting.setAttribute("checked", "true");
}
try {
pref.GetBoolPref( "P3P.warningposttonotprivate" );
pref.getBoolPref( "P3P.warningposttonotprivate" );
}
catch (ex) {
warn2_setting.setAttribute("checked", "true");
}
try {
pref.GetBoolPref( "P3P.warningposttobrokenpolicy" );
pref.getBoolPref( "P3P.warningposttobrokenpolicy" );
}
catch (ex) {
warn3_setting.setAttribute("checked", "true");
}
try {
pref.GetBoolPref( "P3P.warningposttonopolicy" );
pref.getBoolPref( "P3P.warningposttonopolicy" );
}
catch (ex) {
warn4_setting.setAttribute("checked", "true");
@ -103,10 +103,10 @@ function DoEnableSettings() {
EnableTree(level_setting);
try {
var pref = Components.classes["@mozilla.org/preferences;1"].getService();
pref = pref.QueryInterface( Components.interfaces.nsIPref );
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var level = pref.GetIntPref( "P3P.level" );
var level = pref.getIntPref( "P3P.level" );
}
catch (ex) {
level_setting.setAttribute( "data", "0" );

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

@ -71,12 +71,10 @@ function Startup()
// install imageblocker tab if instructed to do so by the "imageblocker.enabled" pref
try {
var pref;
pref = Components.classes['@mozilla.org/preferences;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
try {
if (pref.GetBoolPref("imageblocker.enabled")) {
if (pref.getBoolPref("imageblocker.enabled")) {
var element;
element = document.getElementById("imagesTab");
element.setAttribute("hidden","false" );

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

@ -73,13 +73,11 @@ nsWalletViewer.prototype =
doSetOKCancel(this.onOK, this.onCancel);
// allow l10n to hide certain panels
var pref;
pref = Components.classes['@mozilla.org/preferences;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var panel;
try {
if (pref.GetBoolPref("wallet.namePanel.hide")) {
if (pref.getBoolPref("wallet.namePanel.hide")) {
panel = document.getElementById("pnameID");
panel.setAttribute("style", "display:none;");
panel = document.getElementById("snameID");
@ -87,7 +85,7 @@ nsWalletViewer.prototype =
panel = document.getElementById("bnameID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.addressPanel.hide")) {
if (pref.getBoolPref("wallet.addressPanel.hide")) {
panel = document.getElementById("paddressID");
panel.setAttribute("style", "display:none;");
panel = document.getElementById("saddressID");
@ -95,7 +93,7 @@ nsWalletViewer.prototype =
panel = document.getElementById("baddressID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.phonePanel.hide")) {
if (pref.getBoolPref("wallet.phonePanel.hide")) {
panel = document.getElementById("pphoneID");
panel.setAttribute("style", "display:none;");
panel = document.getElementById("sphoneID");
@ -103,15 +101,15 @@ nsWalletViewer.prototype =
panel = document.getElementById("bphoneID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.creditPanel.hide")) {
if (pref.getBoolPref("wallet.creditPanel.hide")) {
panel = document.getElementById("pcreditID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.employPanel.hide")) {
if (pref.getBoolPref("wallet.employPanel.hide")) {
panel = document.getElementById("pemployID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.miscPanel.hide")) {
if (pref.getBoolPref("wallet.miscPanel.hide")) {
panel = document.getElementById("pmiscID");
panel.setAttribute("style", "display:none;");
}

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

@ -44,11 +44,12 @@
{
var tutorialURL = "chrome://communicator/locale/wallet/privacy.html";
try {
var pref = Components.classes["@mozilla.org/preferences;1"].getService();
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService();
if(pref) {
pref = pref.QueryInterface( Components.interfaces.nsIPref );
pref = pref.QueryInterface( Components.interfaces.nsIPrefBranch );
if(pref) {
tutorialURL = pref.getLocalizedUnicharPref("wallet.TutorialFromMenu");
tutorialURL = pref.getComplexValue("wallet.TutorialFromMenu",
Components.interfaces.nsIPrefLocalizedString);
}
}
}

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

@ -73,13 +73,11 @@ nsWalletViewer.prototype =
doSetOKCancel(this.onOK, this.onCancel);
// allow l10n to hide certain panels
var pref;
pref = Components.classes['@mozilla.org/preferences;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var panel;
try {
if (pref.GetBoolPref("wallet.namePanel.hide")) {
if (pref.getBoolPref("wallet.namePanel.hide")) {
panel = document.getElementById("pnameID");
panel.setAttribute("style", "display:none;");
panel = document.getElementById("snameID");
@ -87,7 +85,7 @@ nsWalletViewer.prototype =
panel = document.getElementById("bnameID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.addressPanel.hide")) {
if (pref.getBoolPref("wallet.addressPanel.hide")) {
panel = document.getElementById("paddressID");
panel.setAttribute("style", "display:none;");
panel = document.getElementById("saddressID");
@ -95,7 +93,7 @@ nsWalletViewer.prototype =
panel = document.getElementById("baddressID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.phonePanel.hide")) {
if (pref.getBoolPref("wallet.phonePanel.hide")) {
panel = document.getElementById("pphoneID");
panel.setAttribute("style", "display:none;");
panel = document.getElementById("sphoneID");
@ -103,15 +101,15 @@ nsWalletViewer.prototype =
panel = document.getElementById("bphoneID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.creditPanel.hide")) {
if (pref.getBoolPref("wallet.creditPanel.hide")) {
panel = document.getElementById("pcreditID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.employPanel.hide")) {
if (pref.getBoolPref("wallet.employPanel.hide")) {
panel = document.getElementById("pemployID");
panel.setAttribute("style", "display:none;");
}
if (pref.GetBoolPref("wallet.miscPanel.hide")) {
if (pref.getBoolPref("wallet.miscPanel.hide")) {
panel = document.getElementById("pmiscID");
panel.setAttribute("style", "display:none;");
}

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

@ -187,7 +187,7 @@
*/
try {
if (gIsEncrypted == -1)
gIsEncrypted = this.pref.GetBoolPref("wallet.crypto");
gIsEncrypted = this.pref.getBoolPref("wallet.crypto");
if (gIsEncrypted) {
// database is encrypted, see if it is still locked
// if (locked) { -- there's currently no way to make such a test

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

@ -36,7 +36,7 @@
// remove either encrypt or obscure depending on pref setting
var elementOn, elementOff;
var pref;
pref = Components.classes['@mozilla.org/preferences;1'];
pref = Components.classes['@mozilla.org/preferences-service;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
try {
@ -70,7 +70,7 @@
var strings = document.getElementById("personalManagers");
var pref;
pref = Components.classes['@mozilla.org/preferences;1'];
pref = Components.classes['@mozilla.org/preferences-service;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);

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

@ -58,11 +58,10 @@ function Startup()
// remove wallet functions (unless overruled by the "wallet.enabled" pref)
try {
pref = Components.classes['@mozilla.org/preferences;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
try {
if (!pref.GetBoolPref("wallet.enabled")) {
if (!pref.getBoolPref("wallet.enabled")) {
var element;
element = document.getElementById("nopreview");
element.setAttribute("hidden", "true");
@ -74,7 +73,7 @@ function Startup()
}
try {
encrypted = pref.GetBoolPref("wallet.crypto");
encrypted = pref.getBoolPref("wallet.crypto");
} catch(e) {
dump("wallet.crypto pref is missing from all.js");
}

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

@ -23,8 +23,8 @@ function Startup()
function fillSettings()
{
try {
gPrefInt = Components.classes["@mozilla.org/preferences;1"];
gPrefInt = gPrefInt.getService(Components.interfaces.nsIPref);
gPrefInt = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
}
catch (ex) {
dump("failed to get prefs service!\n");
@ -40,7 +40,8 @@ function fillSettings()
ldapUrl = null;
}
try{
var prefValue = gPrefInt.CopyUnicharPref(gCurrentDirectoryString +".description");
var prefValue = gPrefInt.getComplexValue(gCurrentDirectoryString +".description",
Components.interfaces.nsISupportsWString);
}
catch(ex){
prefValue="";
@ -50,7 +51,7 @@ function fillSettings()
{
document.getElementById("description").value = prefValue;
try{
prefValue = gPrefInt.CopyCharPref(gCurrentDirectoryString +".uri");
prefValue = gPrefInt.getCharPref(gCurrentDirectoryString +".uri");
}
catch(ex){
prefValue="";
@ -85,7 +86,7 @@ function fillSettings()
}
}
try {
prefValue = gPrefInt.GetIntPref(gCurrentDirectoryString+ ".maxHits");
prefValue = gPrefInt.getIntPref(gCurrentDirectoryString+ ".maxHits");
}
catch(ex) {
prefValue = gMaxHits;
@ -115,7 +116,7 @@ function createUniqueServername()
if (!str) {
try {
user_Id = gPrefInt.GetIntPref("ldap_2.user_id");
user_Id = gPrefInt.getIntPref("ldap_2.user_id");
}
catch(ex){
user_Id = 0;
@ -124,7 +125,7 @@ function createUniqueServername()
temp = "user_directory_" + user_Id;
str = temp;
try {
gPrefInt.SetIntPref("ldap_2.user_id", user_Id);
gPrefInt.setIntPref("ldap_2.user_id", user_Id);
}
catch(ex) {}
}
@ -141,7 +142,8 @@ function createUniqueServername()
while (temp) {
temp = "";
try{
temp = gPrefInt.CopyUnicharPref(gPrefstring+gPref_string_desc+".description");
temp = gPrefInt.getComplexValue(gPrefstring+gPref_string_desc+".description",
Components.interfaces.nsISupportsWString);
} catch(e){}
if (temp)
gPref_string_desc += str[0];
@ -178,8 +180,8 @@ function onOK()
if (!gPrefInt) {
try {
gPrefInt = Components.classes["@mozilla.org/preferences;1"];
gPrefInt = gPrefInt.getService(Components.interfaces.nsIPref);
gPrefInt = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
}
catch (ex) {
dump("failed to get prefs service!\n");
@ -224,7 +226,10 @@ function onOK()
}
pref_string_title = gPref_string_desc +"." + "description";
gPrefInt.SetUnicharPref(pref_string_title, pref_string_content);
var str = Components.classes["@mozilla.org/supports-wstring;1"]
.createInstance(Components.interfaces.nsISupportsWString);
str.data = pref_string_content;
gPrefInt.setComplexValue(pref_string_title, Components.interfaces.nsISupportsWString, str);
ldapUrl.host = hostname;
if(!gLdapService) {
@ -259,22 +264,22 @@ function onOK()
ldapUrl.scope = 2;
}
pref_string_title = gPref_string_desc + ".uri";
gPrefInt.SetCharPref(pref_string_title, ldapUrl.spec);
gPrefInt.setCharPref(pref_string_title, ldapUrl.spec);
pref_string_content = results;
pref_string_title = gPref_string_desc + ".maxHits";
if (pref_string_content != gMaxHits) {
gPrefInt.SetIntPref(pref_string_title, pref_string_content);
gPrefInt.setIntPref(pref_string_title, pref_string_content);
}
else
{
try {
gPrefInt.ClearUserPref(pref_string_title);
gPrefInt.clearUserPref(pref_string_title);
}
catch(ex) {}
}
pref_string_title = gPref_string_desc + ".auth.enabled";
try{
pref_string_content = gPrefInt.GetBoolPref(pref_string_title);
pref_string_content = gPrefInt.getBoolPref(pref_string_title);
}
catch(ex) {
pref_string_content = false;

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

@ -80,7 +80,8 @@ function setupDirectoriesList()
var directoryServer =
document.getElementById("identity.directoryServer").getAttribute('value');
try {
var directoryServerString = gPrefInt.CopyUnicharPref(directoryServer + ".description");
var directoryServerString = gPrefInt.getComplexValue(directoryServer + ".description",
Components.interfaces.nsISupportsWString);
}
catch(ex) {}
if (directoryServerFlag || !directoryServerString) {
@ -106,47 +107,52 @@ function createDirectoriesList(flag)
function LoadDirectories(popup)
{
var children;
var prefCount = {value:0};
var enabled = false;
var description = "";
var item;
var formElement;
var j=0;
var arrayOfDirectories = null;
var arrayOfDirectories;
var position = 0;
var dirType = 1;
if (!gPrefInt) {
try {
gPrefInt = Components.classes["@mozilla.org/preferences;1"];
gPrefInt = gPrefInt.getService(Components.interfaces.nsIPref);
gPrefInt = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
}
catch (ex) {
gPrefInt = null;
}
}
children = gPrefInt.CreateChildList("ldap_2.servers");
if (children && !gAvailDirectories) {
arrayOfDirectories = children.split(';');
try {
arrayOfDirectories = gPrefInt.getChildList("ldap_2.servers", prefCount);
}
catch (ex) {
arrayOfDirectories = null;
}
if (arrayOfDirectories && !gAvailDirectories) {
gAvailDirectories = new Array();
for (var i=0; i<arrayOfDirectories.length; i++)
for (var i = 0; i < prefCount.value; i++)
{
if ((arrayOfDirectories[i] != "ldap_2.servers.pab") &&
(arrayOfDirectories[i] != "ldap_2.servers.history")) {
try{
position = gPrefInt.GetIntPref(arrayOfDirectories[i]+".position");
position = gPrefInt.getIntPref(arrayOfDirectories[i]+".position");
}
catch(ex){
position = 1;
}
try{
dirType = gPrefInt.GetIntPref(arrayOfDirectories[i]+".dirType");
dirType = gPrefInt.getIntPref(arrayOfDirectories[i]+".dirType");
}
catch(ex){
dirType = 1;
}
if ((position != 0) && (dirType == 1)) {
try{
description = gPrefInt.CopyUnicharPref(arrayOfDirectories[i]+".description");
description = gPrefInt.getComplexValue(arrayOfDirectories[i]+".description",
Components.interfaces.nsISupportsWString);
}
catch(ex){
description="";
@ -183,7 +189,8 @@ function LoadDirectories(popup)
// make sure the selected directory still exists
try {
directoryDescription = gPrefInt.
CopyUnicharPref(directoriesList.value + ".description");
getComplexValue(directoriesList.value + ".description",
Components.interfaces.nsISupportsWString);
}
catch (ex) {}
}
@ -210,7 +217,8 @@ function LoadDirectories(popup)
// make sure the selected directory still exists
try {
directoryDescription = gPrefInt.
CopyUnicharPref(directoriesList.value + ".description");
getComplexValue(directoriesList.value + ".description",
Components.interfaces.nsISupportsWString);
}
catch (ex) {}
}
@ -238,7 +246,7 @@ function LoadDirectories(popup)
}
var pref_string_title = "ldap_2.autoComplete.directoryServer";
try {
var directoryServer = gPrefInt.CopyCharPref(pref_string_title);
var directoryServer = gPrefInt.getCharPref(pref_string_title);
}
catch (ex)
{
@ -248,7 +256,8 @@ function LoadDirectories(popup)
{
pref_string_title = directoryServer + ".description";
try {
description = gPrefInt.CopyUnicharPref(pref_string_title);
description = gPrefInt.getComplexValue(pref_string_title,
Components.interfaces.nsISupportsWString);
}
catch (ex) {
description = "";
@ -262,13 +271,13 @@ function LoadDirectories(popup)
else if(gAvailDirectories.length >= 1) {
directoriesList.label = gAvailDirectories[0][1];
directoriesList.value = gAvailDirectories[0][0];
gPrefInt.SetCharPref("ldap_2.autoComplete.directoryServer",
gPrefInt.setCharPref("ldap_2.autoComplete.directoryServer",
gAvailDirectories[0][0]);
}
else {
directoriesList.label = "";
directoriesList.value = null;
gPrefInt.SetCharPref("ldap_2.autoComplete.directoryServer", "");
gPrefInt.setCharPref("ldap_2.autoComplete.directoryServer", "");
}
}
}
@ -424,7 +433,7 @@ function onOK()
var len = gDeletedDirectories.length;
if (len) {
try {
var directoryServer = gPrefInt.CopyCharPref("ldap_2.autoComplete.directoryServer");
var directoryServer = gPrefInt.getCharPref("ldap_2.autoComplete.directoryServer");
}
catch(ex) {
directoryServer = null;
@ -444,7 +453,7 @@ function onOK()
var deletedGlobal = false;
for (var i=0; i< len; i++){
if (!deletedGlobal && directoryServer && (gDeletedDirectories[i] == directoryServer)) {
gPrefInt.SetCharPref("ldap_2.autoComplete.directoryServer", "");
gPrefInt.setCharPref("ldap_2.autoComplete.directoryServer", "");
deletedGlobal = true;
}
for (j=0; j<identitiesCount; j++){
@ -453,9 +462,11 @@ function onOK()
identityServer[j].deleted = true;
}
}
gPrefInt.DeleteBranch(gDeletedDirectories[i]);
gPrefInt.deleteBranch(gDeletedDirectories[i]);
}
gPrefInt.savePrefFile(null);
var svc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
svc.savePrefFile(null);
}
}
window.opener.gRefresh = true;

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

@ -162,13 +162,13 @@ function InitEditCard()
editCard = new Object;
// get pointer to nsIPref object
var prefs = Components.classes["@mozilla.org/preferences;1"];
var prefs = Components.classes["@mozilla.org/preferences-service;1"];
if ( prefs )
{
prefs = prefs.getService();
if ( prefs )
{
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
prefs = prefs.QueryInterface(Components.interfaces.nsIPrefBranch);
editCard.prefs = prefs;
}
}
@ -177,8 +177,8 @@ function InitEditCard()
if ( prefs )
{
try {
editCard.displayLastNameFirst = prefs.GetBoolPref("mail.addr_book.displayName.lastnamefirst");
editCard.generateDisplayName = prefs.GetBoolPref("mail.addr_book.displayName.autoGeneration");
editCard.displayLastNameFirst = prefs.getBoolPref("mail.addr_book.displayName.lastnamefirst");
editCard.generateDisplayName = prefs.getBoolPref("mail.addr_book.displayName.autoGeneration");
editCard.lastFirstSeparator = ", ";
editCard.firstLastSeparator = " ";
}

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

@ -93,20 +93,20 @@ function GetCurrentPrefs()
if ( cvPrefs == 0 )
cvPrefs = new Object;
var prefs = Components.classes["@mozilla.org/preferences;1"];
var prefs = Components.classes["@mozilla.org/preferences-service;1"];
if ( prefs )
{
prefs = prefs.getService();
if ( prefs )
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
prefs = prefs.QueryInterface(Components.interfaces.nsIPrefBranch);
}
if ( prefs )
{
try {
cvPrefs.prefs = prefs;
cvPrefs.displayLastNameFirst = prefs.GetBoolPref("mail.addr_book.displayName.lastnamefirst");
cvPrefs.nameColumn = prefs.GetIntPref("mail.addr_book.lastnamefirst");
cvPrefs.displayLastNameFirst = prefs.getBoolPref("mail.addr_book.displayName.lastnamefirst");
cvPrefs.nameColumn = prefs.getIntPref("mail.addr_book.lastnamefirst");
cvPrefs.lastFirstSeparator = ", ";
cvPrefs.firstLastSeparator = " ";
}
@ -154,7 +154,7 @@ function SetNameColumn(cmd)
}
// set pref in file and locally
cvPrefs.prefs.SetIntPref("mail.addr_book.lastnamefirst", prefValue);
cvPrefs.prefs.setIntPref("mail.addr_book.lastnamefirst", prefValue);
cvPrefs.nameColumn = prefValue;
var selectionArray = RememberResultsTreeSelection();

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

@ -30,48 +30,54 @@ const NS_LDAPPREFSSERVICE_IID = Components.interfaces.nsILDAPPrefsService;
/* interfaces used in this file */
const nsISupports = Components.interfaces.nsISupports;
const nsIPref = Components.interfaces.nsIPref;
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
const nsILDAPURL = Components.interfaces.nsILDAPURL;
const nsILDAPService = Components.interfaces.nsILDAPService;
/* nsLDAPPrefs service */
function nsLDAPPrefsService() {
var arrayOfDirectories = null;
var arrayOfDirectories;
var j = 0;
try {
gPrefInt = Components.classes["@mozilla.org/preferences;1"];
gPrefInt = gPrefInt.getService(nsIPref);
gPrefInt = Components.classes["@mozilla.org/preferences-service;1"];
gPrefInt = gPrefInt.getService(nsIPrefBranch);
}
catch (ex) {
dump("failed to get prefs service!\n");
return;
}
/* generate the list of directory servers from preferences */
var children = gPrefInt.CreateChildList("ldap_2.servers");
if(children) {
arrayOfDirectories = children.split(';');
var prefCount = {value:0};
try {
arrayOfDirectories = gPrefInt.getChildList("ldap_2.servers", prefCount);
}
catch (ex) {
arrayOfDirectories = null;
}
if (arrayOfDirectories) {
this.availDirectories = new Array();
var position;
var description;
for (var i=0; i<arrayOfDirectories.length; i++)
for (var i = 0; i < prefCount.value; i++)
{
if ((arrayOfDirectories[i] != "ldap_2.servers.pab") &&
(arrayOfDirectories[i] != "ldap_2.servers.history")) {
try{
position = gPrefInt.GetIntPref(arrayOfDirectories[i]+".position");
position = gPrefInt.getIntPref(arrayOfDirectories[i]+".position");
}
catch(ex){
position = 1;
}
try{
dirType = gPrefInt.GetIntPref(arrayOfDirectories[i]+".dirType");
dirType = gPrefInt.getIntPref(arrayOfDirectories[i]+".dirType");
}
catch(ex){
dirType = 1;
}
if ((position != 0) && (dirType == 1)) {
try{
description = gPrefInt.CopyUnicharPref(arrayOfDirectories[i]+".description");
description = gPrefInt.getComplexValue(arrayOfDirectories[i]+".description",
Components.interfaces.nsISupportsWString);
}
catch(ex){
description = null;
@ -114,8 +120,8 @@ function () {
var host;
var dn;
try {
gPrefInt = Components.classes["@mozilla.org/preferences;1"];
gPrefInt = gPrefInt.getService(Components.interfaces.nsIPref);
gPrefInt = Components.classes["@mozilla.org/preferences-service;1"];
gPrefInt = gPrefInt.getService(Components.interfaces.nsIPrefBranch);
}
catch (ex) {
dump("failed to get prefs service!\n");
@ -123,7 +129,7 @@ function () {
}
var migrated = false;
try{
migrated = gPrefInt.GetBoolPref("ldap_2.prefs_migrated");
migrated = gPrefInt.getBoolPref("ldap_2.prefs_migrated");
}
catch(ex){}
if (migrated){
@ -131,7 +137,7 @@ function () {
return;
}
try{
var useDirectory = gPrefInt.GetBoolPref("ldap_2.servers.useDirectory");
var useDirectory = gPrefInt.getBoolPref("ldap_2.servers.useDirectory");
}
catch(ex) {}
try {
@ -147,7 +153,7 @@ function () {
for (var i=0; i < this.availDirectories.length; i++) {
pref_string = this.availDirectories[i][0];
try{
host = gPrefInt.CopyCharPref(pref_string + ".serverName");
host = gPrefInt.getCharPref(pref_string + ".serverName");
}
catch (ex) {
host = null;
@ -163,7 +169,8 @@ function () {
}
ldapUrl.host = host;
try{
dn = gPrefInt.CopyUnicharPref(pref_string + ".searchBase");
dn = gPrefInt.getComplexValue(pref_string + ".searchBase",
Components.interfaces.nsISupportsWString);
}
catch (ex) {
dn = null;
@ -171,32 +178,34 @@ function () {
if (dn && ldapService)
ldapUrl.dn = ldapService.UCS2toUTF8(dn);
try {
var port = gPrefInt.GetIntPref(pref_string + ".port");
var port = gPrefInt.getIntPref(pref_string + ".port");
}
catch(ex) {
port = 389;
}
ldapUrl.port = port;
ldapUrl.scope = 2;
gPrefInt.SetCharPref(pref_string + ".uri", ldapUrl.spec);
gPrefInt.setCharPref(pref_string + ".uri", ldapUrl.spec);
/* is this server selected for autocompletion?
if yes, convert the preference to mozilla format.
Atmost one server is selected for autocompletion.
*/
if (useDirectory && !enable){
try {
enable = gPrefInt.GetBoolPref(pref_string + ".autocomplete.enabled");
enable = gPrefInt.getBoolPref(pref_string + ".autocomplete.enabled");
}
catch(ex) {}
if (enable) {
gPrefInt.SetCharPref("ldap_2.servers.directoryServer", pref_string);
gPrefInt.setCharPref("ldap_2.servers.directoryServer", pref_string);
}
}
}
}
try {
gPrefInt.SetBoolPref("ldap_2.prefs_migrated", true);
gPrefInt.savePrefFile(null);
gPrefInt.setBoolPref("ldap_2.prefs_migrated", true);
var svc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
svc.savePrefFile(null);
}
catch (ex) {dump ("ERROR:" + ex + "\n");}

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

@ -208,7 +208,8 @@ function onOk() {
onSave();
// hack hack - save the prefs file NOW in case we crash
try {
var prefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
prefs.savePrefFile(null);
} catch (ex) {
dump("Error saving prefs!\n");

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

@ -75,7 +75,7 @@ var contentWindow;
var smtpService;
var am;
var accountm = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
var gPrefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
var gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var accounts = accountm.accounts;
@ -484,11 +484,11 @@ function finishAccount(account, accountData) {
if (accountData.addGlobalHtmlDomains) {
// Check to see if we have already added the
// domain list on a previous account creation process
var isDomainListAdded = gPrefs.GetBoolPref("mailnews.global_html_domains.added");
var isDomainListAdded = gPrefs.getBoolPref("mailnews.global_html_domains.added");
if (!isDomainListAdded) {
var globalHtmlDomainList = gPrefs.CopyCharPref("mailnews.global_html_domains");
var currentHtmlDomainList = gPrefs.CopyCharPref("mailnews.html_domains");
var currentPlaintextDomainList = gPrefs.CopyCharPref("mailnews.plaintext_domains");
var globalHtmlDomainList = gPrefs.getCharPref("mailnews.global_html_domains");
var currentHtmlDomainList = gPrefs.getCharPref("mailnews.html_domains");
var currentPlaintextDomainList = gPrefs.getCharPref("mailnews.plaintext_domains");
// If there is a list already, we need to preserve that
if (currentHtmlDomainList || currentPlaintextDomainList) {
// Avoid duplication in adding domains. Check both HTML and PlainText domains
@ -502,8 +502,8 @@ function finishAccount(account, accountData) {
else
currentHtmlDomainList = globalHtmlDomainList;
gPrefs.SetCharPref("mailnews.html_domains", currentHtmlDomainList);
gPrefs.SetBoolPref("mailnews.global_html_domains.added", true);
gPrefs.setCharPref("mailnews.html_domains", currentHtmlDomainList);
gPrefs.setBoolPref("mailnews.global_html_domains.added", true);
}
}
@ -902,8 +902,8 @@ function getInterfaceForType(type) {
// flush the XUL cache - just for debugging purposes - not called
function onFlush() {
gPrefs.SetBoolPref("nglayout.debug.disable_xul_cache", true);
gPrefs.SetBoolPref("nglayout.debug.disable_xul_cache", false);
gPrefs.setBoolPref("nglayout.debug.disable_xul_cache", true);
gPrefs.setBoolPref("nglayout.debug.disable_xul_cache", false);
}

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

@ -26,8 +26,11 @@ function setColorWell(menu)
function setHomePageToDefaultPage(folderFieldId)
{
var homePageField = document.getElementById(folderFieldId);
var prefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
var url = prefs.getDefaultLocalizedUnicharPref("mailnews.start_page.url");
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var prefs = prefService.getDefaultBranch(null);
var url = prefs.getComplexValue("mailnews.start_page.url",
Components.interfaces.nsIPrefLocalizedString);
homePageField.value = url;
}

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

@ -40,11 +40,11 @@ function GetPrefsService()
{
// Store the prefs object
try {
var prefsService = Components.classes["@mozilla.org/preferences;1"];
var prefsService = Components.classes["@mozilla.org/preferences-service;1"];
if (prefsService)
prefsService = prefsService.getService();
if (prefsService)
gPrefs = prefsService.QueryInterface(Components.interfaces.nsIPref);
gPrefs = prefsService.QueryInterface(Components.interfaces.nsIPrefBranch);
if (!gPrefs)
dump("failed to get prefs service!\n");
@ -113,9 +113,9 @@ function PromptSendMessages()
if(buttonPressed) {
if(buttonPressed.value == 0) {
if(checkValue.value)
gPrefs.SetIntPref("offline.send.unsent_messages", 0);
gPrefs.setIntPref("offline.send.unsent_messages", 0);
else
gPrefs.SetIntPref("offline.send.unsent_messages", 1);
gPrefs.setIntPref("offline.send.unsent_messages", 1);
gOfflineManager.goOnline(true /* sendUnsentMessages */,
true /* playbackOfflineImapOperations */,
@ -127,9 +127,9 @@ function PromptSendMessages()
}
else if(buttonPressed.value == 2) {
if(checkValue.value)
gPrefs.SetIntPref("offline.send.unsent_messages", 0);
gPrefs.setIntPref("offline.send.unsent_messages", 0);
else
gPrefs.SetIntPref("offline.send.unsent_messages", 2);
gPrefs.setIntPref("offline.send.unsent_messages", 2);
gOfflineManager.goOnline(false /* sendUnsentMessages */,
true /* playbackOfflineImapOperations */,
msgWindow);
@ -162,9 +162,9 @@ function PromptDownloadMessages()
if(buttonPressed) {
if(buttonPressed.value == 0) {
if(checkValue.value)
gPrefs.SetIntPref("offline.download.download_messages", 0);
gPrefs.setIntPref("offline.download.download_messages", 0);
else
gPrefs.SetIntPref("offline.download.download_messages", 1);
gPrefs.setIntPref("offline.download.download_messages", 1);
// download news, download mail, send unsent messages, go offline when done, msg window
gOfflineManager.synchronizeForOffline(false, true, false, true, msgWindow);
return true;
@ -174,9 +174,9 @@ function PromptDownloadMessages()
}
else if(buttonPressed.value == 2) {
if(checkValue.value)
gPrefs.SetIntPref("offline.download.download_messages", 0);
gPrefs.setIntPref("offline.download.download_messages", 0);
else
gPrefs.SetIntPref("offline.download.download_messages", 2);
gPrefs.setIntPref("offline.download.download_messages", 2);
// download news, download mail, send unsent messages, go offline when done, msg window
gOfflineManager.synchronizeForOffline(false, false, false, true, msgWindow);
return true;
@ -225,8 +225,8 @@ function MailCheckBeforeOfflineChange()
InitServices();
var prefSendUnsentMessages = gPrefs.GetIntPref("offline.send.unsent_messages");
var prefDownloadMessages = gPrefs.GetIntPref("offline.download.download_messages");
var prefSendUnsentMessages = gPrefs.getIntPref("offline.send.unsent_messages");
var prefDownloadMessages = gPrefs.getIntPref("offline.download.download_messages");
if(goingOnline) {
switch(prefSendUnsentMessages) {

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

@ -16,11 +16,12 @@
// which is included by most clients.
function toMessengerWindow()
{
var pref = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var windowDoc = "chrome://messenger/content/messenger.xul";
try
{
var layoutType = pref.GetIntPref("mail.pane_config");
var layoutType = pref.getIntPref("mail.pane_config");
windowDoc = !layoutType ? "chrome://messenger/content/messenger.xul" :
"chrome://messenger/content/mail3PaneWindowVertLayout.xul";
}

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

@ -234,11 +234,11 @@
<![CDATA[
var strings = new Array;
var ids = this.valueIds;
var pref = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var hdrs;
try
{
hdrs = pref.GetCharPref("mailnews.customHeaders");
hdrs = pref.getCharPref("mailnews.customHeaders");
}
catch(ex)
{

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

@ -29,7 +29,7 @@ var mailSessionContractID = "@mozilla.org/messenger/services/session;1";
var secureUIContractID = "@mozilla.org/secure_browser_ui;1";
var prefContractID = "@mozilla.org/preferences;1";
var prefContractID = "@mozilla.org/preferences-service;1";
var msgWindowContractID = "@mozilla.org/messenger/msgwindow;1";
var messenger;
@ -111,7 +111,7 @@ function CreateMailWindowGlobals()
messenger = Components.classes[messengerContractID].createInstance();
messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
pref = Components.classes[prefContractID].getService(Components.interfaces.nsIPref);
pref = Components.classes[prefContractID].getService(Components.interfaces.nsIPrefBranch);
//Create windows status feedback
// set the JS implementation of status feedback before creating the c++ one..
@ -170,7 +170,7 @@ function CreateMailWindowGlobals()
messagesBox = document.getElementById("messagesBox");
accountCentralBox = document.getElementById("accountCentralBox");
gSearchBox = document.getElementById("searchBox");
gPaneConfig = pref.GetIntPref("mail.pane_config");
gPaneConfig = pref.getIntPref("mail.pane_config");
}
function InitMsgWindow()
@ -430,10 +430,11 @@ function StopUrls()
function loadStartPage() {
try {
var startpageenabled= pref.GetBoolPref("mailnews.start_page.enabled");
var startpageenabled = pref.getBoolPref("mailnews.start_page.enabled");
if (startpageenabled) {
var startpage = pref.getLocalizedUnicharPref("mailnews.start_page.url");
if (startpageenabled) {
var startpage = pref.getComplexValue("mailnews.start_page.url",
Components.interfaces.nsIPrefLocalizedString);
if (startpage != "") {
// first, clear out the charset setting.
messenger.setDisplayCharset("");
@ -443,7 +444,7 @@ function loadStartPage() {
ClearMessageSelection();
}
}
}
}
catch (ex) {
dump("Error loading start page.\n");
return;
@ -458,7 +459,8 @@ function ShowAccountCentral()
{
try
{
var acctCentralPage = pref.getLocalizedUnicharPref("mailnews.account_central_page.url");
var acctCentralPage = pref.getComplexValue("mailnews.account_central_page.url",
Components.interfaces.nsIPrefLocalizedString);
switch (gPaneConfig)
{
case 0:

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

@ -31,7 +31,7 @@ var nsPrefBranch = null;
var gOfflineManager;
var gWindowManagerInterface;
var gPrefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
var gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
// Disable the new account menu item if the account preference is locked.
// Two other affected areas are the account central and the account manager
@ -615,7 +615,7 @@ function MsgForwardMessage(event)
{
var forwardType = 0;
try {
forwardType = gPrefs.GetIntPref("mail.forward_message_mode");
forwardType = gPrefs.getIntPref("mail.forward_message_mode");
} catch (e) {dump ("failed to retrieve pref mail.forward_message_mode");}
// mail.forward_message_mode could be 1, if the user migrated from 4.x
@ -818,7 +818,7 @@ function MsgOpenNewWindowForFolder(uri, key)
}
if (uriToOpen) {
var layoutType = gPrefs.GetIntPref("mail.pane_config");
var layoutType = gPrefs.getIntPref("mail.pane_config");
if(layoutType == 0)
window.openDialog("chrome://messenger/content/messenger.xul", "_blank", "chrome,all,dialog=no", {uri: uriToOpen, key: keyToSelect});
@ -992,21 +992,21 @@ function MsgFilters(emailAddress)
function MsgViewAllHeaders()
{
gPrefs.SetIntPref("mail.show_headers",2);
gPrefs.setIntPref("mail.show_headers",2);
MsgReload();
return true;
}
function MsgViewNormalHeaders()
{
gPrefs.SetIntPref("mail.show_headers",1);
gPrefs.setIntPref("mail.show_headers",1);
MsgReload();
return true;
}
function MsgViewBriefHeaders()
{
gPrefs.SetIntPref("mail.show_headers",0);
gPrefs.setIntPref("mail.show_headers",0);
MsgReload();
return true;
}

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

@ -189,10 +189,10 @@ function OnLoadMsgHeaderPane()
// load any preferences that at are global with regards to
// displaying a message...
gNumAddressesToShow = pref.GetIntPref("mailnews.max_header_display_length");
gCollectIncoming = pref.GetBoolPref("mail.collect_email_address_incoming");
gCollectNewsgroup = pref.GetBoolPref("mail.collect_email_address_newsgroup");
gShowUserAgent = pref.GetBoolPref("mailnews.headers.showUserAgent");
gNumAddressesToShow = pref.getIntPref("mailnews.max_header_display_length");
gCollectIncoming = pref.getBoolPref("mail.collect_email_address_incoming");
gCollectNewsgroup = pref.getBoolPref("mail.collect_email_address_newsgroup");
gShowUserAgent = pref.getBoolPref("mailnews.headers.showUserAgent");
initializeHeaderViewTables();
var toggleHeaderView = document.getElementById("msgHeaderView");
@ -208,7 +208,7 @@ var messageHeaderSink = {
onStartHeaders: function()
{
// every time we start to redisplay a message, check the view all headers pref....
var showAllHeadersPref = pref.GetIntPref("mail.show_headers");
var showAllHeadersPref = pref.getIntPref("mail.show_headers");
if (showAllHeadersPref == 2)
{
gViewAllHeaders = true;

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

@ -435,7 +435,7 @@ function OnLoadMessenger()
var headerchoice = null;
try {
headerchoice = pref.GetIntPref("mail.show_headers");
headerchoice = pref.getIntPref("mail.show_headers");
}
catch (ex) {
dump("failed to get the header pref\n");
@ -533,14 +533,14 @@ function loadStartFolder(initialUri)
startFolderResource = rootMsgFolder.QueryInterface(Components.interfaces.nsIRDFResource);
enabledNewMailCheckOnce = pref.GetBoolPref(mailCheckOncePref);
enabledNewMailCheckOnce = pref.getBoolPref(mailCheckOncePref);
// Enable checknew mail once by turning checkmail pref 'on' to bring
// all users to one plane. This allows all users to go to Inbox. User can
// always go to server settings panel and turn off "Check for new mail at startup"
if (!enabledNewMailCheckOnce)
{
pref.SetBoolPref(mailCheckOncePref, true);
pref.setBoolPref(mailCheckOncePref, true);
defaultServer.loginAtStartUp = true;
}
@ -666,14 +666,14 @@ function OnFolderUnreadColAttrModified(event)
// "mail.ui.folderpane.version" pref.
function UpgradeFolderPaneUI()
{
var folderPaneUIVersion = pref.GetIntPref("mail.ui.folderpane.version");
var folderPaneUIVersion = pref.getIntPref("mail.ui.folderpane.version");
if (folderPaneUIVersion == 1) {
var folderUnreadCol = document.getElementById("folderUnreadCol");
folderUnreadCol.setAttribute("hidden", "true");
var folderTotalCol = document.getElementById("folderTotalCol");
folderTotalCol.setAttribute("hidden", "true");
pref.SetIntPref("mail.ui.folderpane.version", 2);
pref.setIntPref("mail.ui.folderpane.version", 2);
}
}

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

@ -42,11 +42,11 @@ function OnLoad()
}
doSetOKCancel(syncOkButton, syncCancelButton);
var prefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
gSyncMail = prefs.GetBoolPref("mailnews.offline_sync_mail");
gSyncNews = prefs.GetBoolPref("mailnews.offline_sync_news");
gSendMessage = prefs.GetBoolPref("mailnews.offline_sync_send_unsent");
gWorkOffline = prefs.GetBoolPref("mailnews.offline_sync_work_offline");
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
gSyncMail = prefs.getBoolPref("mailnews.offline_sync_mail");
gSyncNews = prefs.getBoolPref("mailnews.offline_sync_news");
gSendMessage = prefs.getBoolPref("mailnews.offline_sync_send_unsent");
gWorkOffline = prefs.getBoolPref("mailnews.offline_sync_work_offline");
document.getElementById("syncMail").checked = gSyncMail;
document.getElementById("syncNews").checked = gSyncNews;
document.getElementById("sendMessage").checked = gSendMessage;
@ -63,11 +63,11 @@ function syncOkButton()
gSendMessage = document.getElementById("sendMessage").checked;
gWorkOffline = document.getElementById("workOffline").checked;
var prefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
prefs.SetBoolPref("mailnews.offline_sync_mail", gSyncMail);
prefs.SetBoolPref("mailnews.offline_sync_news", gSyncNews);
prefs.SetBoolPref("mailnews.offline_sync_send_unsent", gSendMessage);
prefs.SetBoolPref("mailnews.offline_sync_work_offline", gWorkOffline);
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("mailnews.offline_sync_mail", gSyncMail);
prefs.setBoolPref("mailnews.offline_sync_news", gSyncNews);
prefs.setBoolPref("mailnews.offline_sync_send_unsent", gSendMessage);
prefs.setBoolPref("mailnews.offline_sync_work_offline", gWorkOffline);
if( gSyncMail || gSyncNews || gSendMessage || gWorkOffline) {

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

@ -224,7 +224,7 @@ function CrossFolderNavigation(type, supportsFolderPane )
return null;
}
var nextMode = pref.GetIntPref("mailnews.nav_crosses_folders");
var nextMode = pref.getIntPref("mailnews.nav_crosses_folders");
// 0: "next" goes to the next folder, without prompting
// 1: "next" goes to the next folder, and prompts (the default)
// 2: "next" does nothing when there are no unread messages

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

@ -30,11 +30,11 @@ var gContainer;
function onLoad()
{
gPrefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var hdrs;
try
{
hdrs = gPrefs.GetCharPref("mailnews.customHeaders");
hdrs = gPrefs.getCharPref("mailnews.customHeaders");
}
catch(ex)
{
@ -75,7 +75,7 @@ function onOk()
if (gArrayHdrs.length)
{
var hdrs = gArrayHdrs.join(": ");
gPrefs.SetCharPref("mailnews.customHeaders", hdrs);
gPrefs.setCharPref("mailnews.customHeaders", hdrs);
}
window.close();
}

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

@ -44,7 +44,7 @@ var gPromptService = null;
var test_addresses_sequence = false;
if (prefs)
try {
test_addresses_sequence = prefs.GetBoolPref("mail.debug.test_addresses_sequence");
test_addresses_sequence = prefs.getBoolPref("mail.debug.test_addresses_sequence");
}
catch (ex) {}

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

@ -26,19 +26,19 @@ var recommended_as_default = true;
var display_recommendation = true;
var useDefault =false;
var prefs = Components.classes["@mozilla.org/preferences;1"].getService();
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService();
if (prefs) {
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
prefs = prefs.QueryInterface(Components.interfaces.nsIPrefBranch);
if (prefs) {
try {
defaultAction = prefs.GetIntPref("mail.asksendformat.default");
defaultAction = prefs.getIntPref("mail.asksendformat.default");
useDefault = true;
} catch (ex) {}
try {
recommended_as_default = prefs.GetBoolPref("mail.asksendformat.recommended_as_default");
recommended_as_default = prefs.getBoolPref("mail.asksendformat.recommended_as_default");
} catch (ex) {}
try {
display_recommendation = prefs.GetBoolPref("mail.asksendformat.display_recommendation");
display_recommendation = prefs.getBoolPref("mail.asksendformat.display_recommendation");
} catch (ex) {}
}
}

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

@ -40,8 +40,8 @@
var newmessages = "";
var newsgroupname = "";
var gNewsBundle;
var prefs = Components.classes['@mozilla.org/preferences;1'].getService();
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService();
prefs = prefs.QueryInterface(Components.interfaces.nsIPrefBranch);
var serverid = null;
var markreadElement = null;

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

@ -15,18 +15,13 @@ function init_sidebar(name, uri, width) {
// Open/close sidebar based on saved pref.
// This may be replaced by another system by hyatt.
prefs = Components.classes['@mozilla.org/preferences;1'];
if (prefs) {
prefs = prefs.getService();
}
if (prefs) {
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
}
prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (prefs) {
// The sidebar is closed by default, so open it only if the
// preference is set to true.
try {
if (prefs.GetBoolPref(sidebar_pref + '.open')) {
if (prefs.getBoolPref(sidebar_pref + '.open')) {
toggle_open_close();
}
}
@ -66,7 +61,7 @@ function toggle_open_close() {
try {
// Save new open/close state in prefs
if (prefs) {
prefs.SetBoolPref(sidebar_pref + '.open', is_sidebar_open);
prefs.setBoolPref(sidebar_pref + '.open', is_sidebar_open);
}
}
catch (ex) {

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

@ -204,8 +204,7 @@ function nsButtonPrefListener()
{
try {
var pbi = pref.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
if (pbi)
pbi.addObserver(this.domain, this, false);
pbi.addObserver(this.domain, this, false);
} catch(ex) {
dump("Failed to observe prefs: " + ex + "\n");
}
@ -403,8 +402,7 @@ function Shutdown()
// unregister us as a pref listener
var pbi = pref.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
if (pbi)
pbi.removeObserver(window.buttonPrefListener.domain,
pbi.removeObserver(window.buttonPrefListener.domain,
window.buttonPrefListener);
window.browserContentListener.close();
@ -575,7 +573,8 @@ function readRDFString(aDS,aRes,aProp) {
function ensureDefaultEnginePrefs(aRDF,aDS)
{
mPrefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPrefBranch);
mPrefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var defaultName = mPrefs.getComplexValue("browser.search.defaultenginename" , Components.interfaces.nsIPrefLocalizedString);
kNC_Root = aRDF.GetResource("NC:SearchEngineRoot");
kNC_child = aRDF.GetResource("http://home.netscape.com/NC-rdf#child");

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

@ -46,7 +46,7 @@
function SetTurboPref() {
var showDialog = document.getElementById("showAgain").checked;
try {
var prefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPrefBranch);
var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
if (prefs)
prefs.setBoolPref("browser.turbo.showDialog", !showDialog);
}

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

@ -25,11 +25,9 @@ var appCore = null;
var gPrefs = null;
try {
var prefsService = Components.classes["@mozilla.org/preferences;1"];
if (prefsService)
prefsService = prefsService.getService();
if (prefsService)
gPrefs = prefsService.QueryInterface(Components.interfaces.nsIPref);
var prefsService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
gPrefs = prefService.getBranch(null);
} catch (ex) {
}
@ -80,9 +78,9 @@ function viewSource(url)
getBrowser().webNavigation.loadURI(viewSrcUrl, loadFlags);
//check the view_source.wrap_long_lines pref and set the menuitem's checked attribute accordingly
if (gPrefs){
if (gPrefs) {
try {
var wraplonglinesPrefValue = gPrefs.GetBoolPref("view_source.wrap_long_lines");
var wraplonglinesPrefValue = gPrefs.getBoolPref("view_source.wrap_long_lines");
if (wraplonglinesPrefValue)
document.getElementById('menu_wrapLongLines').setAttribute("checked", "true");
@ -123,11 +121,11 @@ function wrapLongLines()
//pref value, we use myWrap.className
if (gPrefs){
try {
if (myWrap.className == ''){
gPrefs.SetBoolPref("view_source.wrap_long_lines", false);
if (myWrap.className == '') {
gPrefs.setBoolPref("view_source.wrap_long_lines", false);
}
else {
gPrefs.SetBoolPref("view_source.wrap_long_lines", true);
gPrefs.setBoolPref("view_source.wrap_long_lines", true);
}
} catch (ex) {
}

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

@ -40,9 +40,8 @@
* ***** END LICENSE BLOCK ***** */
var pref = null;
pref = Components.classes["@mozilla.org/preferences;1"];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
// Prefill a single text field
function prefillTextBox(target) {
@ -156,14 +155,15 @@
function handleLinkClick(event, href)
{
var theTab;
switch (event.button) {
case 0: // if left button clicked
if (event.metaKey || event.ctrlKey) { // and meta or ctrl are down
if (pref && pref.getBoolPref("browser.tabs.opentabfor.middleclick") && getBrowser &&
getBrowser() && getBrowser().localName == "tabbrowser") {
var t = getBrowser().addTab(href); // open link in new tab
theTab = getBrowser().addTab(href); // open link in new tab
if (!event.shiftKey && !pref.getBoolPref("browser.tabs.loadInBackground"))
getBrowser().selectedTab = t;
getBrowser().selectedTab = theTab;
event.preventBubble();
return true;
}
@ -194,9 +194,9 @@
case 1: // if middle button clicked
if (pref && pref.getBoolPref("browser.tabs.opentabfor.middleclick") && getBrowser &&
getBrowser() && getBrowser().localName == "tabbrowser") {
var t = getBrowser().addTab(href); // open link in new tab
theTab = getBrowser().addTab(href); // open link in new tab
if (!event.shiftKey && !pref.getBoolPref("browser.tabs.loadInBackground"))
getBrowser().selectedTab = t;
getBrowser().selectedTab = theTab;
event.preventBubble();
return true;
}

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

@ -101,7 +101,7 @@
if (window && (wintype == "navigator:browser")) {
var browser=getBrowser();
var t = browser.addTab(url); // open link in new tab
if (pref && !pref.GetBoolPref("browser.tabs.loadInBackground"))
if (pref && !pref.getBoolPref("browser.tabs.loadInBackground"))
browser.selectedTab = t;
}

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

@ -26,8 +26,8 @@ var browser;
var dialog = {};
var pref = null;
try {
pref = Components.classes["@mozilla.org/preferences;1"]
.getService(Components.interfaces.nsIPref);
pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
} catch (ex) {
// not critical, remain silent
}
@ -73,11 +73,12 @@ function onLoad()
dialog.input.focus();
if (pref) {
try {
var value = pref.GetIntPref("general.open_location.last_window_choice");
var value = pref.getIntPref("general.open_location.last_window_choice");
var element = dialog.openAppList.getElementsByAttribute("value", value)[0];
if (element)
dialog.openAppList.selectedItem = element;
dialog.input.value = pref.CopyUnicharPref("general.open_location.last_url");
dialog.input.value = pref.getComplexValue("general.open_location.last_url",
Components.interfaces.nsISupportsWString);
}
catch(ex) {
}
@ -126,8 +127,12 @@ function open()
}
if (pref) {
pref.SetUnicharPref("general.open_location.last_url", dialog.input.value);
pref.SetIntPref("general.open_location.last_window_choice", dialog.openAppList.value);
var str = Components.classes["@mozilla.org/supports-wstring;1"]
.createInstance(Components.interfaces.nsISupportsWString);
str.data = dialog.input.value;
pref.setComplexValue("general.open_location.last_url",
Components.interfaces.nsISupportsWString, str);
pref.setIntPref("general.open_location.last_window_choice", dialog.openAppList.value);
}
// Delay closing slightly to avoid timing bug on Linux.

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

@ -109,17 +109,11 @@ var goPrefWindow = 0;
function getBrowserURL() {
try {
var prefs = Components.classes["@mozilla.org/preferences;1"];
if (prefs) {
prefs = prefs.getService();
if (prefs)
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
}
if (prefs) {
var url = prefs.CopyCharPref("browser.chromeURL");
if (url)
return url;
}
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var url = prefs.getCharPref("browser.chromeURL");
if (url)
return url;
} catch(e) {
}
return "chrome://navigator/content/navigator.xul";
@ -147,12 +141,13 @@ function goEditCardDialog(abURI, card, okCallback, abCardURI)
function goPreferences(containerID, paneURL, itemID)
{
var resizable;
var pref = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPref);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
try {
// We are resizable ONLY if in box debugging mode, because in
// this special debug mode it is often impossible to see the
// content of the debug panel in order to disable debug mode.
resizable = pref.GetBoolPref("xul.debug.box");
resizable = pref.getBoolPref("xul.debug.box");
}
catch (e) {
resizable = false;
@ -203,10 +198,9 @@ function goClickThrobber( urlPref )
{
var url;
try {
var pref = Components.classes["@mozilla.org/preferences;1"].getService();
if( pref )
pref = pref.QueryInterface( Components.interfaces.nsIPref );
url = pref.getLocalizedUnicharPref(urlPref);
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
url = pref.getComplexValue(urlPref, Components.interfaces.nsIPrefLocalizedString);
}
catch(e) {
@ -265,10 +259,9 @@ function goAboutDialog()
{
var defaultAboutState = false;
try {
var pref = Components.classes["@mozilla.org/preferences;1"].getService();
if( pref )
pref = pref.QueryInterface( Components.interfaces.nsIPref );
defaultAboutState = pref.GetBoolPref("browser.show_about_as_stupid_modal_window");
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
defaultAboutState = pref.getBoolPref("browser.show_about_as_stupid_modal_window");
}
catch(e) {
defaultAboutState = false;

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

@ -604,10 +604,10 @@ BookmarksUIElement.prototype = {
// extra work to do - set the pref |browser.bookmarks.import_system_favorites|
// to ensure that we don't re-import next time.
if (aSelection[count].getAttribute("type") == (NC_NS + "IEFavoriteFolder")) {
const kPrefSvcContractID = "@mozilla.org/preferences;1";
const kPrefSvcIID = Components.interfaces.nsIPref;
const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
const kPrefSvcIID = Components.interfaces.nsIPrefBranch;
const kPrefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
kPrefSvc.SetBoolPref("browser.bookmarks.import_system_favorites", false);
kPrefSvc.setBoolPref("browser.bookmarks.import_system_favorites", false);
}
const krParent = this.RDF.GetResource(NODE_ID(currParent));

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

@ -73,10 +73,10 @@ function HistoryInit()
document.getElementById("groupingMenu").setAttribute("hidden", "true");
}
else {
gPrefService = Components.classes["@mozilla.org/preferences;1"]
.getService(Components.interfaces.nsIPref);
gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
try {
var grouping = gPrefService.GetCharPref("browser.history.grouping");
var grouping = gPrefService.getCharPref("browser.history.grouping");
}
catch(e) {
grouping = "";
@ -281,7 +281,7 @@ function GroupBy(groupingType)
outlinerBody.setAttribute("ref", "NC:HistoryRoot");
break;
}
gPrefService.SetCharPref("browser.history.grouping", groupingType);
gPrefService.setCharPref("browser.history.grouping", groupingType);
}
function historyAddBookmarks()

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

@ -68,7 +68,7 @@
doSetOKCancel(onOK, null);
// get pref service
pref = Components.classes['@mozilla.org/preferences;1'];
pref = Components.classes['@mozilla.org/preferences-service;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);

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

@ -55,7 +55,7 @@
alreadyCheckedForImage = true;
// remove image functions (unless overruled by the "imageblocker.enabled" pref)
var pref;
pref = Components.classes['@mozilla.org/preferences;1'];
pref = Components.classes['@mozilla.org/preferences-service;1'];
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
try {

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

@ -71,10 +71,10 @@
// Determine if "imageBlocker.enabled" pref is set
isPrefSet: function () {
var pref = gContextMenu.getService('@mozilla.org/preferences;1', 'nsIPref');
var pref = gContextMenu.getService('@mozilla.org/preferences-service;1', 'nsIPrefBranch');
var result = false;
try {
result = pref.GetBoolPref( "imageblocker.enabled" );
result = pref.getBoolPref( "imageblocker.enabled" );
} catch(e) {
}
return result;

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

@ -146,36 +146,34 @@ function DomainInSkipList(sDomain)
}
try {
var pref = Components.classes["@mozilla.org/preferences;1"];
if (pref) pref = pref.getService();
if (pref) pref = pref.QueryInterface(Components.interfaces.nsIPref);
if (pref) {
var sDomainList = pref.CopyCharPref("browser.related.disabledForDomains");
if ((sDomainList) && (sDomainList != "")) {
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var aDomains = sDomainList.split(",");
var sDomainList = pref.getCharPref("browser.related.disabledForDomains");
if ((sDomainList) && (sDomainList != "")) {
// split on commas
for (var x=0; x < aDomains.length; x++) {
var sDomainCopy = sDomain;
var aDomains = sDomainList.split(",");
var sTestDomain = aDomains[x];
// split on commas
for (var x=0; x < aDomains.length; x++) {
var sDomainCopy = sDomain;
if ('*' == sTestDomain[0]) { // wildcard match
var sTestDomain = aDomains[x];
// strip off the asterisk
sTestDomain = sTestDomain.substring(1);
if (sDomainCopy.length > sTestDomain.length) {
var sDomainIndex = sDomain.length - sTestDomain.length;
sDomainCopy = sDomainCopy.substring(sDomainIndex);
}
if ('*' == sTestDomain[0]) { // wildcard match
// strip off the asterisk
sTestDomain = sTestDomain.substring(1);
if (sDomainCopy.length > sTestDomain.length) {
var sDomainIndex = sDomain.length - sTestDomain.length;
sDomainCopy = sDomainCopy.substring(sDomainIndex);
}
}
if (0 == sDomainCopy.lastIndexOf(sTestDomain)) {
if (0 == sDomainCopy.lastIndexOf(sTestDomain)) {
bSkipDomainFlag = true;
break;
}
bSkipDomainFlag = true;
break;
}
}
}

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

@ -52,8 +52,8 @@ var internetSearchDS = null;
try
{
pref = Components.classes["@mozilla.org/preferences;1"].getService();
if (pref) pref = pref.QueryInterface( Components.interfaces.nsIPref );
pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
if (RDF) RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
@ -116,9 +116,9 @@ function doLoad()
var lastCategoryName = "";
try
{
var pref = Components.classes["@mozilla.org/preferences;1"].getService();
if (pref) pref = pref.QueryInterface( Components.interfaces.nsIPref );
if (pref) lastCategoryName = pref.CopyCharPref( "browser.search.last_search_category" );
var pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
lastCategoryName = pref.getCharPref( "browser.search.last_search_category" );
if (lastCategoryName != "")
{

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

@ -290,7 +290,7 @@ function readRDFString(aDS,aRes,aProp) {
function ensureDefaultEnginePrefs(aRDF,aDS)
{
mPrefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPrefBranch);
mPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var defaultName = mPrefs.getComplexValue("browser.search.defaultenginename" , Components.interfaces.nsIPrefLocalizedString);
var kNC_Root = aRDF.GetResource("NC:SearchEngineRoot");
var kNC_child = aRDF.GetResource("http://home.netscape.com/NC-rdf#child");
@ -310,7 +310,7 @@ function ensureSearchPref() {
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
mPrefs = Components.classes["@mozilla.org/preferences;1"].getService(Components.interfaces.nsIPrefBranch);
mPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
var ds = rdf.GetDataSource("rdf:internetsearch");
kNC_Name = rdf.GetResource("http://home.netscape.com/NC-rdf#Name");
try {

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

@ -165,7 +165,7 @@ function fillContextMenu(name, treeName)
}
var searchMode = 0;
if (pref) searchMode = pref.GetIntPref("browser.search.mode");
if (pref) searchMode = pref.getIntPref("browser.search.mode");
if (pref && bundle)
{
// then add a menu separator (if necessary)
@ -195,10 +195,10 @@ function fillContextMenu(name, treeName)
function setSearchMode()
{
var searchMode = 0;
if (pref) searchMode = pref.GetIntPref("browser.search.mode");
if (pref) searchMode = pref.getIntPref("browser.search.mode");
if (searchMode == 0) searchMode = 1;
else searchMode = 0;
if (pref) pref.SetIntPref("browser.search.mode", searchMode);
if (pref) pref.setIntPref("browser.search.mode", searchMode);
return(true);
}

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

@ -476,22 +476,15 @@ function BrowseMorePanels()
{
var url = '';
var browser_url = "chrome://navigator/content/navigator.xul";
var prefs = Components.classes['@mozilla.org/preferences;1'];
if (prefs) {
prefs = prefs.getService();
}
if (prefs) {
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
}
if (prefs) {
var locale;
try {
url = prefs.CopyCharPref("sidebar.customize.more_panels.url");
var temp = prefs.CopyCharPref("browser.chromeURL");
if (temp) browser_url = temp;
} catch(ex) {
debug("Unable to get prefs: "+ex);
}
var locale;
try {
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
url = prefs.getCharPref("sidebar.customize.more_panels.url");
var temp = prefs.getCharPref("browser.chromeURL");
if (temp) browser_url = temp;
} catch(ex) {
debug("Unable to get prefs: "+ex);
}
window.openDialog(browser_url, "_blank", "chrome,all,dialog=no", url);
}

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

@ -672,38 +672,33 @@ function get_sidebar_datasource_uri() {
// %VERSION% --> Sidebar file format version (e.g. 0.0).
function get_remote_datasource_url() {
var url = '';
var prefs = Components.classes['@mozilla.org/preferences;1'];
if (prefs) {
prefs = prefs.getService();
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var locale;
try {
url = prefs.getCharPref("sidebar.customize.all_panels.url");
url = url.replace(/%SIDEBAR_VERSION%/g, SIDEBAR_VERSION);
} catch(ex) {
debug("Unable to get remote url pref. What now? "+ex);
}
if (prefs) {
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
}
if (prefs) {
var locale;
try {
locale = prefs.getComplexValue("intl.content.langcode",
Components.interfaces.nsIPrefLocalizedString);
} catch(ex) {
try {
url = prefs.CopyCharPref("sidebar.customize.all_panels.url");
url = url.replace(/%SIDEBAR_VERSION%/g, SIDEBAR_VERSION);
} catch(ex) {
debug("Unable to get remote url pref. What now? "+ex);
}
try {
locale = prefs.getLocalizedUnicharPref("intl.content.langcode");
} catch(ex) {
try {
debug("No lang code pref, intl.content.langcode.");
debug("Use locale from user agent string instead");
debug("No lang code pref, intl.content.langcode.");
debug("Use locale from user agent string instead");
locale = prefs.getLocalizedUnicharPref("general.useragent.locale");
} catch(ex) {
debug("Unable to get system locale. What now? "+ex);
}
locale = prefs.getComplexValue("general.useragent.locale",
Components.interfaces.nsIPrefLocalizedString);
} catch(ex) {
debug("Unable to get system locale. What now? "+ex);
}
locale = locale.toLowerCase();
url = url.replace(/%LOCALE%/g, locale);
debug("Remote url is " + url);
}
locale = locale.toLowerCase();
url = url.replace(/%LOCALE%/g, locale);
debug("Remote url is " + url);
return url;
}
@ -821,22 +816,15 @@ function BrowseMorePanels()
{
var url = '';
var browser_url = "chrome://navigator/content/navigator.xul";
var prefs = Components.classes['@mozilla.org/preferences;1'];
if (prefs) {
prefs = prefs.getService();
}
if (prefs) {
prefs = prefs.QueryInterface(Components.interfaces.nsIPref);
}
if (prefs) {
var locale;
try {
url = prefs.CopyCharPref("sidebar.customize.directory.url");
var temp = prefs.CopyCharPref("browser.chromeURL");
if (temp) browser_url = temp;
} catch(ex) {
debug("Unable to get prefs: "+ex);
}
var locale;
try {
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
url = prefs.getCharPref("sidebar.customize.directory.url");
var temp = prefs.getCharPref("browser.chromeURL");
if (temp) browser_url = temp;
} catch(ex) {
debug("Unable to get prefs: "+ex);
}
window.openDialog(browser_url, "_blank", "chrome,all,dialog=no", url);
}

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

@ -23,7 +23,7 @@
* Scott MacGregor <mscott@netscape.com>
*/
var prefContractID = "@mozilla.org/preferences;1";
var prefContractID = "@mozilla.org/preferences-service;1";
var externalProtocolServiceID = "@mozilla.org/uriloader/external-protocol-service;1";
// dialog is just an array we'll use to store various properties from the dialog document...
@ -298,9 +298,9 @@ function loadDialog()
dialog.location.setAttribute("value", sourceUrl.spec );
dialog.fileName.setAttribute( "value", targetFile.unicodePath );
var prefs = Components.classes[prefContractID].getService(Components.interfaces.nsIPref);
var prefs = Components.classes[prefContractID].getService(Components.interfaces.nsIPrefBranch);
if (prefs)
keepProgressWindowUpBox.checked = prefs.GetBoolPref("browser.download.progressDnldDialog.keepAlive");
keepProgressWindowUpBox.checked = prefs.getBoolPref("browser.download.progressDnldDialog.keepAlive");
}
function replaceInsert( text, index, value ) {
@ -366,9 +366,9 @@ function onUnload()
// remember the user's decision for the checkbox.
var prefs = Components.classes[prefContractID].getService(Components.interfaces.nsIPref);
var prefs = Components.classes[prefContractID].getService(Components.interfaces.nsIPrefBranch);
if (prefs)
prefs.SetBoolPref("browser.download.progressDnldDialog.keepAlive", keepProgressWindowUpBox.checked);
prefs.setBoolPref("browser.download.progressDnldDialog.keepAlive", keepProgressWindowUpBox.checked);
// Cancel app launcher.
if (helperAppLoader)

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

@ -171,7 +171,7 @@
readonly="true"/>
<property name="preferences"
onget="return Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPref);"
onget="return Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService);"
readonly="true"/>
<property name="docShell"

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

@ -471,7 +471,7 @@
return; // Don't allow the last tab to close.
if (l == 2) {
var pref = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefService).getBranch(null);
var pref = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch(null);
var autohide = pref.getBoolPref("browser.tabs.autoHide");
if (autohide)
this.setStripVisibilityTo(false);
@ -555,7 +555,7 @@
<![CDATA[
if (!this.mProgressListeners) {
this.mProgressListeners = new Array();
var pref = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefService).getBranch(null);
var pref = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch(null);
var autohide = pref.getBoolPref("browser.tabs.autoHide");
if (!autohide) {
this.setStripVisibilityTo(true);
@ -661,7 +661,7 @@
if (!url || !url.length || url.indexOf(" ", 0) != -1)
return;
var pref = Components.classes['@mozilla.org/preferences;1'].getService(Components.interfaces.nsIPrefService).getBranch(null);
var pref = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefService).getBranch(null);
var bgLoad = pref.getBoolPref("browser.tabs.loadInBackground");
if (aEvent.target.localName == "tabs") {

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

@ -58,7 +58,7 @@ function SelectDetectors( event )
{
uri = event.target.getAttribute("id");
debug(uri + "\n");
pref = Components.classes['@mozilla.org/preferences;1'];
pref = Components.classes['@mozilla.org/preferences-service;1'];
prefvalue = uri.substring(
'urn:mozilla-registry:key:/software/netscape/intl/charsetdetector/'.length
,uri.length);
@ -71,13 +71,13 @@ function SelectDetectors( event )
if (pref) {
debug("get pref\n");
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
}
if (pref) {
debug("get pref 2\n");
pref.SetCharPref("intl.charset.detector", prefvalue);
pref.setCharPref("intl.charset.detector", prefvalue);
window._content.location.reload();
}
}

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

@ -74,14 +74,14 @@ function SelectDetector(event, doReload)
prefvalue = "";
}
var pref = Components.classes['@mozilla.org/preferences;1'];
var pref = Components.classes['@mozilla.org/preferences-service;1'];
if (pref) {
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
}
if (pref) {
pref.SetCharPref("intl.charset.detector", prefvalue);
pref.setCharPref("intl.charset.detector", prefvalue);
if (doReload) window._content.location.reload();
}
}
@ -96,14 +96,14 @@ function ComposerSelectDetector(event)
prefvalue = "";
}
var pref = Components.classes['@mozilla.org/preferences;1'];
var pref = Components.classes['@mozilla.org/preferences-service;1'];
if (pref) {
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
}
if (pref) {
pref.SetCharPref("intl.charset.detector", prefvalue);
pref.setCharPref("intl.charset.detector", prefvalue);
editorShell.LoadUrl(editorShell.editorDocument.location);
}
}
@ -145,16 +145,17 @@ function UpdateCurrentMailCharset()
function UpdateCharsetDetector()
{
var pref = Components.classes['@mozilla.org/preferences;1'];
var pref = Components.classes['@mozilla.org/preferences-service;1'];
if (pref) {
pref = pref.getService();
pref = pref.QueryInterface(Components.interfaces.nsIPref);
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
}
if (pref) {
prefvalue = pref.getLocalizedUnicharPref("intl.charset.detector");
prefvalue = pref.getComplexValue("intl.charset.detector",
Components.interfaces.nsIPrefLocalizedString);
if (prefvalue == "") prefvalue = "off";
dump("intl.charset.detector = "+ prefvalue + "\n");
dump("intl.charset.detector = "+ prefvalue + "\n");
}
var prefvalue = 'chardet.' + prefvalue;

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

@ -1,20 +1,20 @@
/**
* nsPreferences - a wrapper around nsIPref. Provides built in
* nsPreferences - a wrapper around nsIPrefService. Provides built in
* exception handling to make preferences access simpler.
**/
var nsPreferences = {
get mPrefService()
{
return Components.classes["@mozilla.org/preferences;1"]
.getService(Components.interfaces.nsIPref);
return Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
},
setBoolPref: function (aPrefName, aPrefValue)
{
try
{
this.mPrefService.SetBoolPref(aPrefName, aPrefValue);
this.mPrefService.setBoolPref(aPrefName, aPrefValue);
}
catch(e)
{
@ -25,7 +25,7 @@ var nsPreferences = {
{
try
{
return this.mPrefService.GetBoolPref(aPrefName);
return this.mPrefService.getBoolPref(aPrefName);
}
catch(e)
{
@ -38,7 +38,11 @@ var nsPreferences = {
{
try
{
this.mPrefService.SetUnicharPref(aPrefName, aPrefValue);
var str = Components.classes["@mozilla.org/supports-wstring;1"]
.createInstance(Components.interfaces.nsISupportsWString);
str.data = aPrefValue;
this.mPrefService.setComplexValue(aPrefName,
Components.interfaces.nsISupportsWString, str);
}
catch(e)
{
@ -49,7 +53,8 @@ var nsPreferences = {
{
try
{
return this.mPrefService.CopyUnicharPref(aPrefName);
return this.mPrefService.getComplexValue(aPrefName,
Components.interfaces.nsISupportsWString);
}
catch(e)
{
@ -62,7 +67,7 @@ var nsPreferences = {
{
try
{
this.mPrefService.SetIntPref(aPrefName, aPrefValue);
this.mPrefService.setIntPref(aPrefName, aPrefValue);
}
catch(e)
{
@ -73,7 +78,7 @@ var nsPreferences = {
{
try
{
return this.mPrefService.GetIntPref(aPrefName);
return this.mPrefService.getIntPref(aPrefName);
}
catch(e)
{
@ -86,7 +91,8 @@ var nsPreferences = {
{
try
{
return this.mPrefService.getLocalizedUnicharPref(aPrefName);
return this.mPrefService.getComplexValue(aPrefName,
Components.interfaces.nsIPrefLocalizedString);
}
catch(e)
{