-/* ***** BEGIN LICENSE BLOCK *****
- * Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.
- * ximfmail is under the triple license MPL 1.1/GPL 2.0/LGPL 2.1.
- *
- *
- * Redistribution and use, in source and binary forms, with or without modification,
- * are permitted provided that the following conditons are met :
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * 2. MPL 1.1/GPL 2.0/LGPL 2.1. license agreements must be attached
- * in the redistribution of the source code.
- * 3. Neither the names of the copyright holders nor the names of any contributors
- * may be used to endorse or promote products derived from this software without specific
- * prior written permission from EADS Defence and Security.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * REMINDER :
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * EADS Defence and Security - 1 Boulevard Jean Moulin -
- * ZAC de la Clef Saint Pierre - 78990 Elancourt - FRANCE (IDDN.FR.001.480012.002.S.P.2008.000.10000)
- * ***** END LICENSE BLOCK ***** */
-
-/*
- * global variables
- */
-var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
-var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);
-gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");
-
-
-/*
- *
- */
- function IsXimfailActivated(identity){
- //alert(identity + "(ximfmail_on) = " + GetXimfmailPref(identity,"ximfmail_on"));
- //if(GetXimfmailPref(identity,"ximfmail_on") == "true")
- if(identity.getBoolAttribute("ximfmail_on"))
- return true;
- else
- return false;
- }
-
-/*
- * get value of ximfmail user preference
- */
-function GetXimfmailPref(idIdentity,key){
- var prefValue = "";
- var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");
- if(ximfmailPrefBranch.prefHasUserValue(key))
- prefValue = ximfmailPrefBranch.getCharPref(key);
- return prefValue;
-}
-
-/*
- * set value of ximfmail user preference
- */
-function SetXimfmailPref(idIdentity,key,value){
- try{
- gConsole.logStringMessage("[ximfmail - SetXimfmailPref] key "+key+" : "+value);
-
- var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
- var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");
- ximfmailPrefBranch.setCharPref(key,value);
- prefSvc.savePrefFile(null);
- }catch(e){
- gConsole.logStringMessage("[ximfmail - SetXimfmailPref] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);
- }
-}
-
-function ResetXimfmailPref(idIdentity,key){
- var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
- var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");
- ximfmailPrefBranch.ClearUserPref(key);
- prefSvc.savePrefFile(null);
-}
-
-
-/*
- * set value to reference attribute of xul element
- * used for RDF resource
- * idElement : id of xul element
- * refValue : value of ref attribute
- */
-function ChangeRefAttrRdfElement(idElement,refValue){
- //$("#"+idElement).attr("ref",refValue);
-
- var list = document.getElementById(idElement);
- list.database.AddDataSource(gXimfCatalog.getDSCatalog());
- list.setAttribute("ref",refValue);
- list.builder.rebuild();
-
-}
-
-/*
- * init default menulist xul element with first menuitem
- * idMenuList : id of menulist xul element
- */
-function InitRDFMenuList(idMenuList){
- var itemlist = $("#"+ idMenuList +" > menupopup > menuitem");
- $("#"+idMenuList).attr("value",$(itemlist[0]).attr("value"));
- $("#"+idMenuList).attr("label",$(itemlist[0]).attr("label"));
-}
-
-/*
- * display user pref value in menulist if exists
- * manage RDF Catalog list in accountWizard, accountManager
- * identity : user identity key
- * idPref : user preference key
- * idList : id of menulist xul element
- */
-function UpdateRDFListWithPref(identity, idPref,idList){
- var pref = GetXimfmailPref(identity,idPref);
- if(pref){
- var themeList = $("#"+idList+" > menupopup > menuitem");
- for(var i=0; i<themeList.length; i++){
- if( pref == $(themeList[i]).attr("value")){
- $("#"+idList).attr("value",$(themeList[i]).attr("value"));
- $("#"+idList).attr("label",$(themeList[i]).attr("label"));
- }
- }
- }
+/* ***** BEGIN LICENSE BLOCK *****\r
+ * Copyright (c) 2008-2009 EADS DEFENCE AND SECURITY - All rights reserved.\r
+ * ximfmail is under the triple license MPL 1.1/GPL 2.0/LGPL 2.1.\r
+ * \r
+ *\r
+ * Redistribution and use, in source and binary forms, with or without modification, \r
+ * are permitted provided that the following conditons are met :\r
+ *\r
+ * 1. Redistributions of source code must retain the above copyright notice, \r
+ * 2. MPL 1.1/GPL 2.0/LGPL 2.1. license agreements must be attached \r
+ * in the redistribution of the source code.\r
+ * 3. Neither the names of the copyright holders nor the names of any contributors \r
+ * may be used to endorse or promote products derived from this software without specific \r
+ * prior written permission from EADS Defence and Security.\r
+ * \r
+ * Alternatively, the contents of this file may be used under the terms of\r
+ * either of the GNU General Public License Version 2 or later (the "GPL"),\r
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),\r
+ * in which case the provisions of the GPL or the LGPL are applicable instead\r
+ * of those above. If you wish to allow use of your version of this file only\r
+ * under the terms of either the GPL or the LGPL, and not to allow others to\r
+ * use your version of this file under the terms of the MPL, indicate your\r
+ * decision by deleting the provisions above and replace them with the notice\r
+ * and other provisions required by the GPL or the LGPL. If you do not delete\r
+ * the provisions above, a recipient may use your version of this file under\r
+ * the terms of any one of the MPL, the GPL or the LGPL.\r
+ * \r
+ * REMINDER :\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND \r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \r
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \r
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \r
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES \r
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; \r
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \r
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING \r
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * \r
+ * EADS Defence and Security - 1 Boulevard Jean Moulin - \r
+ * ZAC de la Clef Saint Pierre - 78990 Elancourt - FRANCE (IDDN.FR.001.480012.002.S.P.2008.000.10000) \r
+ * ***** END LICENSE BLOCK ***** */\r
+ \r
+/* \r
+ * global variables\r
+ */\r
+var gConsole = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);\r
+var gJSLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].createInstance(Components.interfaces.mozIJSSubScriptLoader);\r
+gJSLoader.loadSubScript("chrome://ximfmail/content/jquery.js");\r
+\r
+\r
+/*\r
+ * \r
+ */ \r
+ function IsXimfailActivated(identity){\r
+ //alert(identity + "(ximfmail_on) = " + GetXimfmailPref(identity,"ximfmail_on"));\r
+ //if(GetXimfmailPref(identity,"ximfmail_on") == "true")\r
+ if(identity.getBoolAttribute("ximfmail_on"))\r
+ return true;\r
+ else\r
+ return false;\r
+ }\r
+ \r
+/*\r
+ * get value of ximfmail user preference \r
+ */\r
+function GetXimfmailPref(idIdentity,key){\r
+ var prefValue = ""; \r
+ var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");\r
+ if(ximfmailPrefBranch.prefHasUserValue(key)) \r
+ prefValue = ximfmailPrefBranch.getCharPref(key); \r
+ return prefValue;\r
+}\r
+\r
+/*\r
+ * set value of ximfmail user preference\r
+ */\r
+function SetXimfmailPref(idIdentity,key,value){ \r
+ try{\r
+ gConsole.logStringMessage("[ximfmail - SetXimfmailPref] key "+key+" : "+value);\r
+ \r
+ var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);\r
+ var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");\r
+ ximfmailPrefBranch.setCharPref(key,value);\r
+ prefSvc.savePrefFile(null);\r
+ }catch(e){\r
+ gConsole.logStringMessage("[ximfmail - SetXimfmailPref] \n " + e + "\nfile : " + Error().fileName+"\nline : "+e.lineNumber);\r
+ }\r
+}\r
+\r
+function ResetXimfmailPref(idIdentity,key){ \r
+ var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);\r
+ var ximfmailPrefBranch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("mail.identity." + idIdentity + ".");\r
+ ximfmailPrefBranch.ClearUserPref(key);\r
+ prefSvc.savePrefFile(null);\r
+}\r
+\r
+\r
+/*\r
+ * set value to reference attribute of xul element\r
+ * used for RDF resource\r
+ * idElement : id of xul element\r
+ * refValue : value of ref attribute\r
+ */\r
+function ChangeRefAttrRdfElement(idElement,refValue){\r
+ //$("#"+idElement).attr("ref",refValue);\r
+ \r
+ var list = document.getElementById(idElement); \r
+ list.database.AddDataSource(gXimfCatalog.getDSCatalog()); \r
+ list.setAttribute("ref",refValue);\r
+ list.builder.rebuild();\r
+ \r
+}\r
+\r
+/*\r
+ * init default menulist xul element with first menuitem \r
+ * idMenuList : id of menulist xul element\r
+ */\r
+function InitRDFMenuList(idMenuList){\r
+ var itemlist = $("#"+ idMenuList +" > menupopup > menuitem"); \r
+ $("#"+idMenuList).attr("value",$(itemlist[0]).attr("value"));\r
+ $("#"+idMenuList).attr("label",$(itemlist[0]).attr("label"));\r
+}\r
+\r
+/*\r
+ * display user pref value in menulist if exists\r
+ * manage RDF Catalog list in accountWizard, accountManager\r
+ * identity : user identity key\r
+ * idPref : user preference key\r
+ * idList : id of menulist xul element\r
+ */\r
+function UpdateRDFListWithPref(identity, idPref,idList){\r
+ var pref = GetXimfmailPref(identity,idPref);\r
+ if(pref){\r
+ var themeList = $("#"+idList+" > menupopup > menuitem");\r
+ for(var i=0; i<themeList.length; i++){ \r
+ if( pref == $(themeList[i]).attr("value")){\r
+ $("#"+idList).attr("value",$(themeList[i]).attr("value"));\r
+ $("#"+idList).attr("label",$(themeList[i]).attr("label")); \r
+ }\r
+ }\r
+ }\r
}
\ No newline at end of file