Closed
Bug 353812
Opened 18 years ago
Closed 7 years ago
Add GetStringPref function to nsIPrefBranch
Categories
(Core :: Preferences: Backend, defect)
Core
Preferences: Backend
Tracking
()
RESOLVED
DUPLICATE
of bug 1345294
People
(Reporter: jshin1987, Unassigned)
Details
(Keywords: intl)
We don't have |uniCharPref| in nsIPrefBranch. Instead, to retrieve/set a non-ASCII string pref. value, we need to use {Get|Set}ComplexValue with nsISupportsString (for localized string pref, nsIPrefLocalized), but that's quite roundabout way. As a result, there are at least three utility functions for getting a string pref-value in UTF-16
http://lxr.mozilla.org/seamonkey/source/mailnews/base/util/nsMsgIdentity.cpp#166
http://lxr.mozilla.org/seamonkey/source/mailnews/base/util/nsMsgUtils.cpp#1074
http://lxr.mozilla.org/seamonkey/source/editor/ui/composer/content/editorUtilities.js#545
For javascript, this doesn't help much...
In addition, there are many misuses of |GetCharPref| where |GetUnicharPref|-equivalent (with GetComplexValue) should be used. (especially in javascript code). Below is an example. Editor for view-source can have a path with non-ascii characters.
http://lxr.mozilla.org/seamonkey/source/toolkit/components/viewsource/content/viewSourceUtils.js#154
152 var prefs = Components.classes["@mozilla.org/preferences-service;1"]
153 .getService(Components.interfaces.nsIPrefBranch);
154 var prefPath = prefs.getCharPref("view_source.editor.path");
Comment 1•18 years ago
|
||
well the editor should actually be stored as a complex nsIFile...
OS: Linux → All
Hardware: PC → All
Comment 2•18 years ago
|
||
nsMsgTagService also has its own complex->unichar routines:
http://lxr.mozilla.org/mozilla/source/mailnews/base/src/nsMsgTagService.cpp#425
Updated•15 years ago
|
QA Contact: preferences-backend
Comment 3•12 years ago
|
||
The editor is now stored as nsIFile, see bug 789852.
Comment 4•12 years ago
|
||
I think that nsIPrefBranch.getUnicharPref() should work as nsIPrefBranch.getComplexValue() with nsIPrefLocalizedString. If we would separate getUnicharPref() and getLocalizedUnicharPref(), it would cause similar bug in the future. If we would have performance issue, we could improve it with checking whether the pref value indicated proeprties file or not.
nsIPrefBranch.getFilePref() must also be useful. However, I think that we don't need nsIPrefBranch.getRelativeFile() or something for nsIRelativeFilePref since there is no user of this.
http://mxr.mozilla.org/mozilla-central/search?string=nsIRelativeFilePref&filter=[Nn]sIRelativeFilePref
Comment 5•12 years ago
|
||
comm-central uses nsIRelativeFilePref, fyi.
http://mxr.mozilla.org/comm-central/search?string=nsIRelativeFilePref
Comment 6•11 years ago
|
||
GetStringPref seems like a better name.
Assignee: jshin1987 → nobody
Summary: Add a helper function (GetUnicharPref) and fix misuse of |GetCharPref| → Add GetStringPref function to nsIPrefBranch
Updated•7 years ago
|
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•