From 791b01b5f69e4e4cf80f6228e2fb6648be5bf0fe Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Mon, 6 Nov 2006 16:13:35 +0000 Subject: [PATCH] Bug 346599: customizeCharset.js uses deprecated nsIPref, patch by Joel Nackman , r=enndeakin git-svn-id: svn://10.0.0.236/trunk@214780 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/toolkit/content/customizeCharset.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/mozilla/toolkit/content/customizeCharset.js b/mozilla/toolkit/content/customizeCharset.js index 4b2f074b513..cbcfd90c8af 100644 --- a/mozilla/toolkit/content/customizeCharset.js +++ b/mozilla/toolkit/content/customizeCharset.js @@ -1,9 +1,10 @@ //get prefInt services var availCharsetDict = []; -var prefInt = null; //Preferences Interface +var prefBranch = null; //Preferences Interface var pref_string_title = ""; var pref_string_content = ""; +var pref_string_object = null; function Init() { @@ -12,10 +13,10 @@ function Init() if ("arguments" in window && window.arguments[0]) applicationArea = window.arguments[0]; - prefInt = Components.classes["@mozilla.org/preferences;1"]; + prefBranch = Components.classes["@mozilla.org/preferences-service;1"]; - if (prefInt) { - prefInt = prefInt.getService(Components.interfaces.nsIPref); + if (prefBranch) { + prefBranch = prefBranch.getService(Components.interfaces.nsIPrefBranch); if (applicationArea.indexOf("mail") != -1) { pref_string_title = "intl.charsetmenu.mailedit"; @@ -24,7 +25,8 @@ function Init() pref_string_title = "intl.charsetmenu.browser.static"; } - pref_string_content = prefInt.getLocalizedUnicharPref(pref_string_title); + pref_string_object = prefBranch.getComplexValue(pref_string_title, Components.interfaces.nsIPrefLocalizedString) + pref_string_content = pref_string_object.data; AddRemoveLatin1('add'); } @@ -244,8 +246,9 @@ function Save() try { - if (prefInt) { - prefInt.SetCharPref(pref_string_title, pref_string_content); + if (prefBranch) { + pref_string_object.data = pref_string_content; + prefBranch.setComplexValue(pref_string_title, Components.interfaces.nsIPrefLocalizedString, pref_string_object); window.close(); } }