Untitled diff

Créé Le diff n'expire jamais
2 suppressions
165 lignes
66 ajouts
225 lignes
var gpoFox = {
var gpoFox = {
basePath : "",
basePath : "",
//basePathLocked : "",
//basePathLocked : "",
defaultPath : "",
defaultPath : "",
lockedPath : "",
lockedPath : "",
reg : "",
reg : "",
prefService : "",
prefService : "",
updateDisabled : false,
updateDisabled : false,
//Disable Update button in Help menu
//Disable Update button in Help menu
disableUpdates : function(){
disableUpdates : function(){
if(gpoFox.updateDisabled){
if(gpoFox.updateDisabled){
var name = document.getElementById("checkForUpdates");
var name = document.getElementById("checkForUpdates");
name.disabled = true;
name.disabled = true;
}
}
},
},
//Read value from registry
//Read value from registry
readRegistryValue : function(value){
readRegistryValue : function(value){
switch (gpoFox.reg.getValueType(value)) {
switch (gpoFox.reg.getValueType(value)) {
case gpoFox.reg.TYPE_STRING:
case gpoFox.reg.TYPE_STRING:
return gpoFox.reg.readStringValue(value);
return gpoFox.reg.readStringValue(value);
case gpoFox.reg.TYPE_BINARY:
case gpoFox.reg.TYPE_BINARY:
return gpoFox.reg.readBinaryValue(value);
return gpoFox.reg.readBinaryValue(value);
case gpoFox.reg.TYPE_INT:
case gpoFox.reg.TYPE_INT:
return gpoFox.reg.readIntValue(value);
return gpoFox.reg.readIntValue(value);
case gpoFox.reg.TYPE_INT64:
case gpoFox.reg.TYPE_INT64:
return gpoFox.reg.readInt64Value(value);
return gpoFox.reg.readInt64Value(value);
}
}
// unknown type
// unknown type
return null;
return null;
},
},
//write value to FF preferences
//write value to FF preferences
writePrefValue : function(name,value,locked){
writePrefValue : function(name,value,locked){
if(locked){
if(locked){
return gpoFox.writeLockedPrefValue(name,value);
return gpoFox.writeLockedPrefValue(name,value);
}else{
}else{
return gpoFox.writeUserPrefValue(name,value);
return gpoFox.writeUserPrefValue(name,value);
}
}
return null;
return null;
},
},
//for writing a locked pref
//for writing a locked pref
writeLockedPrefValue : function(name,value){
writeLockedPrefValue : function(name,value){
var prefBranch = gpoFox.prefService.getDefaultBranch(name);
var prefBranch = gpoFox.prefService.getDefaultBranch(name);
switch (prefBranch.getPrefType("")) {
switch (prefBranch.getPrefType("")) {
case prefBranch.PREF_STRING:
case prefBranch.PREF_STRING:
prefBranch.setCharPref("", value);
prefBranch.setCharPref("", value);
prefBranch.lockPref("");
prefBranch.lockPref("");
return true;
return true;
case prefBranch.PREF_INT:
case prefBranch.PREF_INT:
prefBranch.setIntPref("", value);
prefBranch.setIntPref("", value);
prefBranch.lockPref("");
prefBranch.lockPref("");
return true;
return true;
case prefBranch.PREF_BOOL:
case prefBranch.PREF_BOOL:
if(name=="app.update.enabled" && value==false){
if(name=="app.update.enabled" && value==false){
gpoFox.updateDisabled=true;
gpoFox.updateDisabled=true;
}
}
if ( value == "false" ){
prefBranch.setBoolPref("", value);
prefBranch.setBoolPref("", false);
}else{
prefBranch.setBoolPref("", true);
}
prefBranch.lockPref("");
prefBranch.lockPref("");
return true;
return true;
default:
switch(gpoFox.getLocalType(value))
{
case "string":
if ( value == "false" ){
prefBranch.setBoolPref("", false);
}else{
prefBranch.setBoolPref("", true);
}
return true;
case "int":
prefBranch.setIntPref("", value);
return true;
case "bool":
prefBranch.setBoolPref("", false);
return true;
default:
return false;
}
}
}
return null;
return null;
},
},
//for writing a user pref
//for writing a user pref
writeUserPrefValue : function(name,value){
writeUserPrefValue : function(name,value){
var prefBranch = gpoFox.prefService.getBranch(name);
var prefBranch = gpoFox.prefService.getBranch(name);
switch (prefBranch.getPrefType("")) {
switch (prefBranch.getPrefType("")) {
case prefBranch.PREF_STRING:
case prefBranch.PREF_STRING:
prefBranch.setCharPref("", value);
prefBranch.setCharPref("", value);
return true;
return true;
case prefBranch.PREF_INT:
case prefBranch.PREF_INT:
prefBranch.setIntPref("", value);
prefBranch.setIntPref("", value);
return true;
return true;