From 2dd715e497aede6e4763d2e892c4bc14e4aec074 Mon Sep 17 00:00:00 2001 From: "mgalli%geckonnection.com" Date: Tue, 14 Feb 2006 20:48:48 +0000 Subject: [PATCH] Uses the ComplexValue ( <- pref ) approach again. git-svn-id: svn://10.0.0.236/trunk@189988 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/minimo/customization/HelperAppDlg.js | 24 ++++++++++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/mozilla/minimo/customization/HelperAppDlg.js b/mozilla/minimo/customization/HelperAppDlg.js index 6e02eef71c3..9e57dadff96 100755 --- a/mozilla/minimo/customization/HelperAppDlg.js +++ b/mozilla/minimo/customization/HelperAppDlg.js @@ -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.