Fixing bug 170351, adding in UTF-8 support for pref stored strings (from AJB)

This commit is contained in:
mikep%oeone.com 2002-09-23 18:30:27 +00:00
parent fa677b84d9
commit d6dc38ca57
3 changed files with 24 additions and 2 deletions

View File

@ -915,3 +915,25 @@ function getBoolPref (prefObj, prefName, defaultValue)
return defaultValue;
}
}
function GetUnicharPref(prefObj, prefName, defaultValue)
{
try {
return prefObj.getComplexValue(prefName, Components.interfaces.nsISupportsString).data;
}
catch(e)
{
return defaultValue;
}
}
function SetUnicharPref(aPrefObj, aPrefName, aPrefValue)
{
try {
var str = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
str.data = aPrefValue;
aPrefObj.setComplexValue(aPrefName, Components.interfaces.nsISupportsString, str);
}
catch(e) {}
}

View File

@ -237,7 +237,7 @@ function loadCalendarEventDialog()
/* Categories stuff */
// Load categories
var categoriesString = opener.getCharPref(opener.gCalendarWindow.calendarPreferences.calendarPref, "categories.names", getDefaultCategories() );
var categoriesString = opener.GetUnicharPref(opener.gCalendarWindow.calendarPreferences.calendarPref, "categories.names", getDefaultCategories() );
var categoriesList = categoriesString.split( "," );

View File

@ -237,7 +237,7 @@ function loadCalendarEventDialog()
/* Categories stuff */
// Load categories
var categoriesString = opener.getCharPref(opener.gCalendarWindow.calendarPreferences.calendarPref, "categories.names", getDefaultCategories() );
var categoriesString = opener.GetUnicharPref(opener.gCalendarWindow.calendarPreferences.calendarPref, "categories.names", getDefaultCategories() );
var categoriesList = categoriesString.split( "," );