Uses the ComplexValue ( <- pref ) approach again.

git-svn-id: svn://10.0.0.236/trunk@189988 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mgalli%geckonnection.com
2006-02-14 20:48:48 +00:00
parent 588387679c
commit 2dd715e497

View File

@@ -23,30 +23,34 @@ HelperAppDlg.prototype = {
},
promptForSaveToFile: function(aLauncher, aContext, aDefaultFile, aSuggestedFileExtension) {
var result = "";
const prefSvcContractID = "@mozilla.org/preferences-service;1";
const prefSvcIID = Components.interfaces.nsIPrefService;
const nsIFile = Components.interfaces.nsIFile;
const nsILocalFile = Components.interfaces.nsILocalFile;
var folderDirFile = Components.classes["@mozilla.org/file/local;1"].createInstance(nsIFile);
var branch = Components.classes[prefSvcContractID].getService(prefSvcIID)
.getBranch("browser.download.");
var dir = null;
const nsILocalFile = Components.interfaces.nsILocalFile;
var consoleService = Components.classes['@mozilla.org/consoleservice;1']
.getService(Components.interfaces.nsIConsoleService);
const kDownloadDirPref = "dir";
// Try and pull in download directory pref
try {
var dirStringPath=branch.getCharPref(kDownloadDirPref);
var localFileDir = folderDirFile.QueryInterface(nsILocalFile);
dir = localFileDir.initWithPath(dirStringPath);
//dir = branch.getComplexValue(kDownloadDirPref, nsILocalFile);
//var dirStringPath=branch.getCharPref(kDownloadDirPref);
consoleService.logStringMessage("hi");
dir = branch.getComplexValue(kDownloadDirPref, nsILocalFile);
consoleService.logStringMessage(dir);
} catch (e) { }
} catch (e) { consoleService.logStringMessage(e)}
if (dir && dir.exists())
{
@@ -54,7 +58,9 @@ HelperAppDlg.prototype = {
aDefaultFile = "download";
dir.append(aDefaultFile);
return uniqueFile(dir);
return dir;
}
// Use file picker to show dialog.