[IMP]: More optimized solution
bzr revid: atp@tinyerp.com-20110616065849-7wn217nura6xzbmk
This commit is contained in:
parent
5fea7ec991
commit
1aaff7c466
Binary file not shown.
Binary file not shown.
|
@ -151,16 +151,10 @@ function getPredefinedFolder(type) {
|
||||||
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
|
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
|
||||||
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
|
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
|
||||||
var homeDir = dirService.path;
|
var homeDir = dirService.path;
|
||||||
var dir_path="";
|
var dir_path = ((homeDir.search(/\\/) != -1) ? homeDir + "\\" : homeDir + "/")
|
||||||
if(navigator.userAgent.indexOf('Linux')!= -1){
|
if(navigator.userAgent.indexOf('Mac OS X')!= -1){
|
||||||
dir_path =homeDir+"/"
|
dir_path ="/tmp/"
|
||||||
}
|
}
|
||||||
else if(navigator.userAgent.indexOf('Win')!= -1){
|
|
||||||
dir_path =homeDir+"\\"
|
|
||||||
}
|
|
||||||
else if(navigator.userAgent.indexOf('Mac OS X')!= -1){
|
|
||||||
dir_path ="/tmp"
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
var localFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var localFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
localFile.initWithPath(dir_path);
|
localFile.initWithPath(dir_path);
|
||||||
|
|
|
@ -41,6 +41,7 @@ function searchmail()
|
||||||
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
|
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
|
||||||
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
|
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
|
||||||
var homeDir = dirService.path;
|
var homeDir = dirService.path;
|
||||||
|
var path = ((homeDir.search(/\\/) != -1) ? homeDir + "\\" : homeDir + "/")
|
||||||
var version_obj = prefService.getBranch("extensions.");
|
var version_obj = prefService.getBranch("extensions.");
|
||||||
version_obj.QueryInterface(Components.interfaces.nsIPrefBranch2);
|
version_obj.QueryInterface(Components.interfaces.nsIPrefBranch2);
|
||||||
version = version_obj.getCharPref("lastAppVersion");
|
version = version_obj.getCharPref("lastAppVersion");
|
||||||
|
@ -151,13 +152,8 @@ function searchmail()
|
||||||
url[i] = currentAttachments[i].url;
|
url[i] = currentAttachments[i].url;
|
||||||
name[i] = currentAttachments[i].displayName;
|
name[i] = currentAttachments[i].displayName;
|
||||||
var obj = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
var obj = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
|
||||||
if(navigator.userAgent.indexOf('Linux')!= -1){
|
obj.initWithPath(path)
|
||||||
obj.initWithPath(homeDir+"/");
|
if(navigator.userAgent.indexOf('Mac OS X')!= -1){
|
||||||
}
|
|
||||||
else if(navigator.userAgent.indexOf('Win')!= -1){
|
|
||||||
obj.initWithPath(homeDir+"\\");
|
|
||||||
}
|
|
||||||
else if(navigator.userAgent.indexOf('Mac OS X')!= -1){
|
|
||||||
obj.initWithPath("/tmp/");
|
obj.initWithPath("/tmp/");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -341,13 +337,8 @@ function parse_eml(){
|
||||||
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
|
var dirService = Components.classes["@mozilla.org/file/directory_service;1"].
|
||||||
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
|
getService(Components.interfaces.nsIProperties).get("Home", Components.interfaces.nsIFile);
|
||||||
var homeDir = dirService.path;
|
var homeDir = dirService.path;
|
||||||
if(navigator.userAgent.indexOf('Linux')!= -1){
|
fpath = ((homeDir.search(/\\/) != -1) ? homeDir + "\\" : homeDir + "/")
|
||||||
fpath =homeDir+"/"
|
if(navigator.userAgent.indexOf('Mac OS X')!= -1){
|
||||||
}
|
|
||||||
else if(navigator.userAgent.indexOf('Win')!= -1){
|
|
||||||
fpath =homeDir+"\\"
|
|
||||||
}
|
|
||||||
else if(navigator.userAgent.indexOf('Mac OS X')!= -1){
|
|
||||||
fpath ="/tmp/"
|
fpath ="/tmp/"
|
||||||
}
|
}
|
||||||
name = fpath + getPref().getCharPref('fname') +".eml"
|
name = fpath + getPref().getCharPref('fname') +".eml"
|
||||||
|
|
Loading…
Reference in New Issue