Bug 781973 - Use filepicker's open() instead of the obsolete show() in /browser. r=bbondy
This commit is contained in:
@@ -2076,21 +2076,28 @@ function BrowserOpenFileWindow()
|
||||
{
|
||||
// Get filepicker component.
|
||||
try {
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, gNavigatorBundle.getString("openFile"), nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText | nsIFilePicker.filterImages |
|
||||
nsIFilePicker.filterXML | nsIFilePicker.filterHTML);
|
||||
fp.displayDirectory = gLastOpenDirectory.path;
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK) {
|
||||
const nsIFilePicker = Ci.nsIFilePicker;
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == nsIFilePicker.returnOK) {
|
||||
try {
|
||||
if (fp.file)
|
||||
gLastOpenDirectory.path = fp.file.parent.QueryInterface(Ci.nsILocalFile);
|
||||
} catch(e) {
|
||||
if (fp.file) {
|
||||
gLastOpenDirectory.path =
|
||||
fp.file.parent.QueryInterface(Ci.nsILocalFile);
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
openUILinkIn(fp.fileURL.spec, "current");
|
||||
}
|
||||
};
|
||||
|
||||
fp.init(window, gNavigatorBundle.getString("openFile"),
|
||||
nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText |
|
||||
nsIFilePicker.filterImages | nsIFilePicker.filterXML |
|
||||
nsIFilePicker.filterHTML);
|
||||
fp.displayDirectory = gLastOpenDirectory.path;
|
||||
fp.open(fpCallback);
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,15 +112,22 @@ const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
function onChooseFile()
|
||||
{
|
||||
try {
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, dialog.bundle.getString("chooseFileDialogTitle"), nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
|
||||
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0)
|
||||
let fp = Components.classes["@mozilla.org/filepicker;1"].
|
||||
createInstance(nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == nsIFilePicker.returnOK && fp.fileURL.spec &&
|
||||
fp.fileURL.spec.length > 0) {
|
||||
dialog.input.value = fp.fileURL.spec;
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
doEnabling();
|
||||
};
|
||||
|
||||
fp.init(window, dialog.bundle.getString("chooseFileDialogTitle"),
|
||||
nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText |
|
||||
nsIFilePicker.filterImages | nsIFilePicker.filterXML |
|
||||
nsIFilePicker.filterHTML);
|
||||
fp.open(fpCallback);
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,31 +761,33 @@ function getSelectedRow(tree)
|
||||
return (rows.length == 1) ? rows[0] : -1;
|
||||
}
|
||||
|
||||
function selectSaveFolder()
|
||||
function selectSaveFolder(aCallback)
|
||||
{
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||
.createInstance(nsIFilePicker);
|
||||
let titleText = gBundle.getString("mediaSelectFolder");
|
||||
let fp = Components.classes["@mozilla.org/filepicker;1"].
|
||||
createInstance(nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == nsIFilePicker.returnOK) {
|
||||
aCallback(fp.file.QueryInterface(nsILocalFile));
|
||||
} else {
|
||||
aCallback(null);
|
||||
}
|
||||
};
|
||||
|
||||
var titleText = gBundle.getString("mediaSelectFolder");
|
||||
fp.init(window, titleText, nsIFilePicker.modeGetFolder);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
try {
|
||||
var prefs = Components.classes[PREFERENCES_CONTRACTID]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
var initialDir = prefs.getComplexValue("browser.download.dir", nsILocalFile);
|
||||
if (initialDir)
|
||||
let prefs = Components.classes[PREFERENCES_CONTRACTID].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
let initialDir = prefs.getComplexValue("browser.download.dir", nsILocalFile);
|
||||
if (initialDir) {
|
||||
fp.displayDirectory = initialDir;
|
||||
}
|
||||
catch (ex) { }
|
||||
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
var ret = fp.show();
|
||||
|
||||
if (ret == nsIFilePicker.returnOK)
|
||||
return fp.file.QueryInterface(nsILocalFile);
|
||||
return null;
|
||||
} catch (ex) {
|
||||
}
|
||||
fp.open(fpCallback);
|
||||
}
|
||||
|
||||
function saveMedia()
|
||||
@@ -807,18 +809,17 @@ function saveMedia()
|
||||
|
||||
saveURL(url, null, titleKey, false, false, makeURI(item.baseURI));
|
||||
}
|
||||
}
|
||||
else {
|
||||
var odir = selectSaveFolder();
|
||||
|
||||
} else {
|
||||
selectSaveFolder(function(aDirectory) {
|
||||
if (aDirectory) {
|
||||
var saveAnImage = function(aURIString, aChosenData, aBaseURI) {
|
||||
internalSave(aURIString, null, null, null, null, false, "SaveImageTitle",
|
||||
aChosenData, aBaseURI);
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = 0; i < rowArray.length; i++) {
|
||||
var v = rowArray[i];
|
||||
var dir = odir.clone();
|
||||
var dir = aDirectory.clone();
|
||||
var item = gImageView.data[v][COL_IMAGE_NODE];
|
||||
var uriString = gImageView.data[v][COL_IMAGE_ADDRESS];
|
||||
var uri = makeURI(uriString);
|
||||
@@ -826,12 +827,13 @@ function saveMedia()
|
||||
try {
|
||||
uri.QueryInterface(Components.interfaces.nsIURL);
|
||||
dir.append(decodeURIComponent(uri.fileName));
|
||||
} catch(ex) {
|
||||
/* data: uris */
|
||||
}
|
||||
catch(ex) { /* data: uris */ }
|
||||
|
||||
if (i == 0)
|
||||
if (i == 0) {
|
||||
saveAnImage(uriString, new AutoChosen(dir, uri), makeURI(item.baseURI));
|
||||
else {
|
||||
} else {
|
||||
// This delay is a hack which prevents the download manager
|
||||
// from opening many times. See bug 377339.
|
||||
setTimeout(saveAnImage, 200, uriString, new AutoChosen(dir, uri),
|
||||
@@ -839,6 +841,8 @@ function saveMedia()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onBlockImage()
|
||||
|
||||
@@ -151,17 +151,13 @@ let gSyncUtils = {
|
||||
let dialogTitle = this.bundle.GetStringFromName("save.recoverykey.title");
|
||||
let defaultSaveName = this.bundle.GetStringFromName("save.recoverykey.defaultfilename");
|
||||
this._preparePPiframe(elid, function(iframe) {
|
||||
let filepicker = Cc["@mozilla.org/filepicker;1"]
|
||||
.createInstance(Ci.nsIFilePicker);
|
||||
filepicker.init(window, dialogTitle, Ci.nsIFilePicker.modeSave);
|
||||
filepicker.appendFilters(Ci.nsIFilePicker.filterHTML);
|
||||
filepicker.defaultString = defaultSaveName;
|
||||
let rv = filepicker.show();
|
||||
if (rv == Ci.nsIFilePicker.returnOK
|
||||
|| rv == Ci.nsIFilePicker.returnReplace) {
|
||||
let stream = Cc["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Ci.nsIFileOutputStream);
|
||||
stream.init(filepicker.file, -1, 0600, 0);
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == Ci.nsIFilePicker.returnOK ||
|
||||
aResult == Ci.nsIFilePicker.returnReplace) {
|
||||
let stream = Cc["@mozilla.org/network/file-output-stream;1"].
|
||||
createInstance(Ci.nsIFileOutputStream);
|
||||
stream.init(fp.file, -1, 0600, 0);
|
||||
|
||||
let serializer = new XMLSerializer();
|
||||
let output = serializer.serializeToString(iframe.contentDocument);
|
||||
@@ -171,6 +167,12 @@ let gSyncUtils = {
|
||||
output = Weave.Utils.encodeUTF8(output);
|
||||
stream.write(output, output.length);
|
||||
}
|
||||
};
|
||||
|
||||
fp.init(window, dialogTitle, Ci.nsIFilePicker.modeSave);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterHTML);
|
||||
fp.defaultString = defaultSaveName;
|
||||
fp.open(fpCallback);
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -708,21 +708,18 @@ FeedWriter.prototype = {
|
||||
|
||||
/**
|
||||
* Displays a prompt from which the user may choose a (client) feed reader.
|
||||
* @return - true if a feed reader was selected, false otherwise.
|
||||
* @param aCallback the callback method, passes in true if a feed reader was
|
||||
* selected, false otherwise.
|
||||
*/
|
||||
_chooseClientApp: function FW__chooseClientApp() {
|
||||
_chooseClientApp: function FW__chooseClientApp(aCallback) {
|
||||
try {
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
fp.init(this._window,
|
||||
this._getString("chooseApplicationDialogTitle"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterApps);
|
||||
|
||||
if (fp.show() == Ci.nsIFilePicker.returnOK) {
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == Ci.nsIFilePicker.returnOK) {
|
||||
this._selectedApp = fp.file;
|
||||
if (this._selectedApp) {
|
||||
// XXXben - we need to compare this with the running instance executable
|
||||
// just don't know how to do that via script...
|
||||
// XXXben - we need to compare this with the running instance
|
||||
// executable just don't know how to do that via script
|
||||
// XXXmano TBD: can probably add this to nsIShellService
|
||||
#ifdef XP_WIN
|
||||
#expand if (fp.file.leafName != "__MOZ_APP_NAME__.exe") {
|
||||
@@ -737,17 +734,27 @@ FeedWriter.prototype = {
|
||||
this._selectedApp);
|
||||
|
||||
// Show and select the selected application menuitem
|
||||
var codeStr = "selectedAppMenuItem.hidden = false;" +
|
||||
let codeStr = "selectedAppMenuItem.hidden = false;" +
|
||||
"selectedAppMenuItem.doCommand();"
|
||||
Cu.evalInSandbox(codeStr, this._contentSandbox);
|
||||
return true;
|
||||
if (aCallback) {
|
||||
aCallback(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(ex) { }
|
||||
if (aCallback) {
|
||||
aCallback(false);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
return false;
|
||||
fp.init(this._window, this._getString("chooseApplicationDialogTitle"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterApps);
|
||||
fp.open(fpCallback);
|
||||
} catch(ex) {
|
||||
}
|
||||
},
|
||||
|
||||
_setAlwaysUseCheckedState: function FW__setAlwaysUseCheckedState(feedType) {
|
||||
@@ -833,11 +840,15 @@ FeedWriter.prototype = {
|
||||
*/
|
||||
var popupbox = this._handlersMenuList.firstChild.boxObject;
|
||||
popupbox.QueryInterface(Components.interfaces.nsIPopupBoxObject);
|
||||
if (popupbox.popupState == "hiding" && !this._chooseClientApp()) {
|
||||
// Select the (per-prefs) selected handler if no application was
|
||||
// selected
|
||||
if (popupbox.popupState == "hiding") {
|
||||
this._chooseClientApp(function(aResult) {
|
||||
if (!aResult) {
|
||||
// Select the (per-prefs) selected handler if no application
|
||||
// was selected
|
||||
this._setSelectedHandler(this._getFeedType());
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this._setAlwaysUseLabel();
|
||||
@@ -1210,16 +1221,7 @@ FeedWriter.prototype = {
|
||||
var useAsDefault = this._getUIElement("alwaysUse").getAttribute("checked");
|
||||
|
||||
var selectedItem = this._getSelectedItemFromMenulist(this._handlersMenuList);
|
||||
|
||||
// Show the file picker before subscribing if the
|
||||
// choose application menuitem was chosen using the keyboard
|
||||
if (selectedItem.getAttribute("anonid") == "chooseApplicationMenuItem") {
|
||||
if (!this._chooseClientApp())
|
||||
return;
|
||||
|
||||
selectedItem = this._getSelectedItemFromMenulist(this._handlersMenuList);
|
||||
}
|
||||
|
||||
let subscribeCallback = function() {
|
||||
if (selectedItem.hasAttribute("webhandlerurl")) {
|
||||
var webURI = selectedItem.getAttribute("webhandlerurl");
|
||||
prefs.setCharPref(getPrefReaderForType(feedType), "web");
|
||||
@@ -1234,13 +1236,13 @@ FeedWriter.prototype = {
|
||||
getService(Ci.nsIWebContentConverterService);
|
||||
var handler = wccr.getWebContentHandlerByURI(this._getMimeTypeForFeedType(feedType), webURI);
|
||||
if (handler) {
|
||||
if (useAsDefault)
|
||||
if (useAsDefault) {
|
||||
wccr.setAutoHandler(this._getMimeTypeForFeedType(feedType), handler);
|
||||
}
|
||||
|
||||
this._window.location.href = handler.getHandlerURI(this._window.location.href);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
switch (selectedItem.getAttribute("anonid")) {
|
||||
case "selectedAppMenuItem":
|
||||
prefs.setComplexValue(getPrefAppForType(feedType), Ci.nsILocalFile,
|
||||
@@ -1270,10 +1272,26 @@ FeedWriter.prototype = {
|
||||
// to either "reader" (If a web reader or if an application is selected),
|
||||
// or to "bookmarks" (if the live bookmarks option is selected).
|
||||
// Otherwise, we should set it to "ask"
|
||||
if (useAsDefault)
|
||||
if (useAsDefault) {
|
||||
prefs.setCharPref(getPrefActionForType(feedType), defaultHandler);
|
||||
else
|
||||
} else {
|
||||
prefs.setCharPref(getPrefActionForType(feedType), "ask");
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
// Show the file picker before subscribing if the
|
||||
// choose application menuitem was chosen using the keyboard
|
||||
if (selectedItem.getAttribute("anonid") == "chooseApplicationMenuItem") {
|
||||
this._chooseClientApp(function(aResult) {
|
||||
if (aResult) {
|
||||
selectedItem =
|
||||
this._getSelectedItemFromMenulist(this._handlersMenuList);
|
||||
subscribeCallback();
|
||||
}
|
||||
}.bind(this));
|
||||
} else {
|
||||
subscribeCallback();
|
||||
}
|
||||
},
|
||||
|
||||
// nsIObserver
|
||||
|
||||
@@ -354,34 +354,39 @@ var PlacesOrganizer = {
|
||||
* Open a file-picker and import the selected file into the bookmarks store
|
||||
*/
|
||||
importFromFile: function PO_importFromFile() {
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].
|
||||
createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, PlacesUIUtils.getString("SelectImport"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterHTML);
|
||||
if (fp.show() != Ci.nsIFilePicker.returnCancel) {
|
||||
if (fp.fileURL) {
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult != Ci.nsIFilePicker.returnCancel && fp.fileURL) {
|
||||
Components.utils.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
|
||||
BookmarkHTMLUtils.importFromURL(fp.fileURL.spec, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fp.init(window, PlacesUIUtils.getString("SelectImport"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterHTML);
|
||||
fp.open(fpCallback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Allows simple exporting of bookmarks.
|
||||
*/
|
||||
exportBookmarks: function PO_exportBookmarks() {
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].
|
||||
createInstance(Ci.nsIFilePicker);
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||
let exporter =
|
||||
Cc["@mozilla.org/browser/places/import-export-service;1"].
|
||||
getService(Ci.nsIPlacesImportExportService);
|
||||
exporter.exportHTMLToFile(fp.file);
|
||||
}
|
||||
};
|
||||
|
||||
fp.init(window, PlacesUIUtils.getString("EnterExport"),
|
||||
Ci.nsIFilePicker.modeSave);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterHTML);
|
||||
fp.defaultString = "bookmarks.html";
|
||||
if (fp.show() != Ci.nsIFilePicker.returnCancel) {
|
||||
var exporter = Cc["@mozilla.org/browser/places/import-export-service;1"].
|
||||
getService(Ci.nsIPlacesImportExportService);
|
||||
exporter.exportHTMLToFile(fp.file);
|
||||
}
|
||||
fp.open(fpCallback);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -441,20 +446,23 @@ var PlacesOrganizer = {
|
||||
* Prompts for a file and restores bookmarks to those in the file.
|
||||
*/
|
||||
onRestoreBookmarksFromFile: function PO_onRestoreBookmarksFromFile() {
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||
this.restoreBookmarksFromFile(fp.file);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
fp.init(window, PlacesUIUtils.getString("bookmarksRestoreTitle"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(PlacesUIUtils.getString("bookmarksRestoreFilterName"),
|
||||
PlacesUIUtils.getString("bookmarksRestoreFilterExtension"));
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterAll);
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||
fp.displayDirectory = backupsDir;
|
||||
|
||||
if (fp.show() != Ci.nsIFilePicker.returnCancel)
|
||||
this.restoreBookmarksFromFile(fp.file);
|
||||
fp.open(fpCallback);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -498,21 +506,23 @@ var PlacesOrganizer = {
|
||||
* of those items.
|
||||
*/
|
||||
backupBookmarks: function PO_backupBookmarks() {
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||
PlacesUtils.backups.saveBookmarksToJSONFile(fp.file);
|
||||
}
|
||||
};
|
||||
|
||||
fp.init(window, PlacesUIUtils.getString("bookmarksBackupTitle"),
|
||||
Ci.nsIFilePicker.modeSave);
|
||||
fp.appendFilter(PlacesUIUtils.getString("bookmarksRestoreFilterName"),
|
||||
PlacesUIUtils.getString("bookmarksRestoreFilterExtension"));
|
||||
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
|
||||
fp.displayDirectory = backupsDir;
|
||||
|
||||
fp.defaultString = PlacesUtils.backups.getFilenameForDate();
|
||||
|
||||
if (fp.show() != Ci.nsIFilePicker.returnCancel)
|
||||
PlacesUtils.backups.saveBookmarksToJSONFile(fp.file);
|
||||
fp.displayDirectory = backupsDir;
|
||||
fp.open(fpCallback);
|
||||
},
|
||||
|
||||
_paneDisabled: false,
|
||||
|
||||
@@ -1715,6 +1715,28 @@ var gApplicationsPane = {
|
||||
aEvent.stopPropagation();
|
||||
|
||||
var handlerApp;
|
||||
let chooseAppCallback = function(aHandlerApp) {
|
||||
// Rebuild the actions menu whether the user picked an app or canceled.
|
||||
// If they picked an app, we want to add the app to the menu and select it.
|
||||
// If they canceled, we want to go back to their previous selection.
|
||||
this.rebuildActionsMenu();
|
||||
|
||||
// If the user picked a new app from the menu, select it.
|
||||
if (aHandlerApp) {
|
||||
let typeItem = this._list.selectedItem;
|
||||
let actionsMenu =
|
||||
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
|
||||
let menuItems = actionsMenu.menupopup.childNodes;
|
||||
for (let i = 0; i < menuItems.length; i++) {
|
||||
let menuItem = menuItems[i];
|
||||
if (menuItem.handlerApp && menuItem.handlerApp.equals(aHandlerApp)) {
|
||||
actionsMenu.selectedIndex = i;
|
||||
this.onSelectAction(menuItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
#ifdef XP_WIN
|
||||
var params = {};
|
||||
@@ -1743,15 +1765,13 @@ var gApplicationsPane = {
|
||||
// Add the app to the type's list of possible handlers.
|
||||
handlerInfo.addPossibleApplicationHandler(handlerApp);
|
||||
}
|
||||
#else
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
var winTitle = this._prefsBundle.getString("fpTitleChooseApp");
|
||||
fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterApps);
|
||||
|
||||
// Prompt the user to pick an app. If they pick one, and it's a valid
|
||||
// selection, then add it to the list of possible handlers.
|
||||
if (fp.show() == Ci.nsIFilePicker.returnOK && fp.file &&
|
||||
chooseAppCallback(handlerApp);
|
||||
#else
|
||||
let winTitle = this._prefsBundle.getString("fpTitleChooseApp");
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == Ci.nsIFilePicker.returnOK && fp.file &&
|
||||
this._isValidHandlerExecutable(fp.file)) {
|
||||
handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
|
||||
createInstance(Ci.nsILocalHandlerApp);
|
||||
@@ -1761,29 +1781,17 @@ var gApplicationsPane = {
|
||||
// Add the app to the type's list of possible handlers.
|
||||
let handlerInfo = this._handledTypes[this._list.selectedItem.type];
|
||||
handlerInfo.addPossibleApplicationHandler(handlerApp);
|
||||
|
||||
chooseAppCallback(handlerApp);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
// Prompt the user to pick an app. If they pick one, and it's a valid
|
||||
// selection, then add it to the list of possible handlers.
|
||||
fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterApps);
|
||||
fp.open(fpCallback);
|
||||
#endif
|
||||
|
||||
// Rebuild the actions menu whether the user picked an app or canceled.
|
||||
// If they picked an app, we want to add the app to the menu and select it.
|
||||
// If they canceled, we want to go back to their previous selection.
|
||||
this.rebuildActionsMenu();
|
||||
|
||||
// If the user picked a new app from the menu, select it.
|
||||
if (handlerApp) {
|
||||
let typeItem = this._list.selectedItem;
|
||||
let actionsMenu =
|
||||
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
|
||||
let menuItems = actionsMenu.menupopup.childNodes;
|
||||
for (let i = 0; i < menuItems.length; i++) {
|
||||
let menuItem = menuItems[i];
|
||||
if (menuItem.handlerApp && menuItem.handlerApp.equals(handlerApp)) {
|
||||
actionsMenu.selectedIndex = i;
|
||||
this.onSelectAction(menuItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Mark which item in the list was last selected so we can reselect it
|
||||
|
||||
@@ -1702,6 +1702,28 @@ var gApplicationsPane = {
|
||||
aEvent.stopPropagation();
|
||||
|
||||
var handlerApp;
|
||||
let chooseAppCallback = function(aHandlerApp) {
|
||||
// Rebuild the actions menu whether the user picked an app or canceled.
|
||||
// If they picked an app, we want to add the app to the menu and select it.
|
||||
// If they canceled, we want to go back to their previous selection.
|
||||
this.rebuildActionsMenu();
|
||||
|
||||
// If the user picked a new app from the menu, select it.
|
||||
if (aHandlerApp) {
|
||||
let typeItem = this._list.selectedItem;
|
||||
let actionsMenu =
|
||||
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
|
||||
let menuItems = actionsMenu.menupopup.childNodes;
|
||||
for (let i = 0; i < menuItems.length; i++) {
|
||||
let menuItem = menuItems[i];
|
||||
if (menuItem.handlerApp && menuItem.handlerApp.equals(aHandlerApp)) {
|
||||
actionsMenu.selectedIndex = i;
|
||||
this.onSelectAction(menuItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
#ifdef XP_WIN
|
||||
var params = {};
|
||||
@@ -1730,15 +1752,13 @@ var gApplicationsPane = {
|
||||
// Add the app to the type's list of possible handlers.
|
||||
handlerInfo.addPossibleApplicationHandler(handlerApp);
|
||||
}
|
||||
#else
|
||||
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
var winTitle = this._prefsBundle.getString("fpTitleChooseApp");
|
||||
fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterApps);
|
||||
|
||||
// Prompt the user to pick an app. If they pick one, and it's a valid
|
||||
// selection, then add it to the list of possible handlers.
|
||||
if (fp.show() == Ci.nsIFilePicker.returnOK && fp.file &&
|
||||
chooseAppCallback(handlerApp);
|
||||
#else
|
||||
let winTitle = this._prefsBundle.getString("fpTitleChooseApp");
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == Ci.nsIFilePicker.returnOK && fp.file &&
|
||||
this._isValidHandlerExecutable(fp.file)) {
|
||||
handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
|
||||
createInstance(Ci.nsILocalHandlerApp);
|
||||
@@ -1748,29 +1768,17 @@ var gApplicationsPane = {
|
||||
// Add the app to the type's list of possible handlers.
|
||||
let handlerInfo = this._handledTypes[this._list.selectedItem.type];
|
||||
handlerInfo.addPossibleApplicationHandler(handlerApp);
|
||||
|
||||
chooseAppCallback(handlerApp);
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
// Prompt the user to pick an app. If they pick one, and it's a valid
|
||||
// selection, then add it to the list of possible handlers.
|
||||
fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(Ci.nsIFilePicker.filterApps);
|
||||
fp.open(fpCallback);
|
||||
#endif
|
||||
|
||||
// Rebuild the actions menu whether the user picked an app or canceled.
|
||||
// If they picked an app, we want to add the app to the menu and select it.
|
||||
// If they canceled, we want to go back to their previous selection.
|
||||
this.rebuildActionsMenu();
|
||||
|
||||
// If the user picked a new app from the menu, select it.
|
||||
if (handlerApp) {
|
||||
let typeItem = this._list.selectedItem;
|
||||
let actionsMenu =
|
||||
document.getAnonymousElementByAttribute(typeItem, "class", "actionsMenu");
|
||||
let menuItems = actionsMenu.menupopup.childNodes;
|
||||
for (let i = 0; i < menuItems.length; i++) {
|
||||
let menuItem = menuItems[i];
|
||||
if (menuItem.handlerApp && menuItem.handlerApp.equals(handlerApp)) {
|
||||
actionsMenu.selectedIndex = i;
|
||||
this.onSelectAction(menuItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Mark which item in the list was last selected so we can reselect it
|
||||
|
||||
@@ -258,17 +258,29 @@ var gMainPane = {
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||
.createInstance(nsIFilePicker);
|
||||
var bundlePreferences = document.getElementById("bundlePreferences");
|
||||
var title = bundlePreferences.getString("chooseDownloadFolderTitle");
|
||||
let bundlePreferences = document.getElementById("bundlePreferences");
|
||||
let title = bundlePreferences.getString("chooseDownloadFolderTitle");
|
||||
let folderListPref = document.getElementById("browser.download.folderList");
|
||||
let currentDirPref = this._indexToFolder(folderListPref.value); // file
|
||||
let defDownloads = this._indexToFolder(1); // file
|
||||
let fp = Components.classes["@mozilla.org/filepicker;1"].
|
||||
createInstance(nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == nsIFilePicker.returnOK) {
|
||||
let file = fp.file.QueryInterface(nsILocalFile);
|
||||
let downloadDirPref = document.getElementById("browser.download.dir");
|
||||
|
||||
downloadDirPref.value = file;
|
||||
folderListPref.value = this._folderToIndex(file);
|
||||
// Note, the real prefs will not be updated yet, so dnld manager's
|
||||
// userDownloadsDirectory may not return the right folder after
|
||||
// this code executes. displayDownloadDirPref will be called on
|
||||
// the assignment above to update the UI.
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
fp.init(window, title, nsIFilePicker.modeGetFolder);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
|
||||
var folderListPref = document.getElementById("browser.download.folderList");
|
||||
var currentDirPref = this._indexToFolder(folderListPref.value); // file
|
||||
var defDownloads = this._indexToFolder(1); // file
|
||||
|
||||
// First try to open what's currently configured
|
||||
if (currentDirPref && currentDirPref.exists()) {
|
||||
fp.displayDirectory = currentDirPref;
|
||||
@@ -279,18 +291,7 @@ var gMainPane = {
|
||||
else {
|
||||
fp.displayDirectory = this._indexToFolder(0);
|
||||
}
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK) {
|
||||
var file = fp.file.QueryInterface(nsILocalFile);
|
||||
var currentDirPref = document.getElementById("browser.download.dir");
|
||||
currentDirPref.value = file;
|
||||
var folderListPref = document.getElementById("browser.download.folderList");
|
||||
folderListPref.value = this._folderToIndex(file);
|
||||
// Note, the real prefs will not be updated yet, so dnld manager's
|
||||
// userDownloadsDirectory may not return the right folder after
|
||||
// this code executes. displayDownloadDirPref will be called on
|
||||
// the assignment above to update the UI.
|
||||
}
|
||||
fp.open(fpCallback);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -255,17 +255,29 @@ var gMainPane = {
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"]
|
||||
.createInstance(nsIFilePicker);
|
||||
var bundlePreferences = document.getElementById("bundlePreferences");
|
||||
var title = bundlePreferences.getString("chooseDownloadFolderTitle");
|
||||
let bundlePreferences = document.getElementById("bundlePreferences");
|
||||
let title = bundlePreferences.getString("chooseDownloadFolderTitle");
|
||||
let folderListPref = document.getElementById("browser.download.folderList");
|
||||
let currentDirPref = this._indexToFolder(folderListPref.value); // file
|
||||
let defDownloads = this._indexToFolder(1); // file
|
||||
let fp = Components.classes["@mozilla.org/filepicker;1"].
|
||||
createInstance(nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == nsIFilePicker.returnOK) {
|
||||
let file = fp.file.QueryInterface(nsILocalFile);
|
||||
let downloadDirPref = document.getElementById("browser.download.dir");
|
||||
|
||||
downloadDirPref.value = file;
|
||||
folderListPref.value = this._folderToIndex(file);
|
||||
// Note, the real prefs will not be updated yet, so dnld manager's
|
||||
// userDownloadsDirectory may not return the right folder after
|
||||
// this code executes. displayDownloadDirPref will be called on
|
||||
// the assignment above to update the UI.
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
fp.init(window, title, nsIFilePicker.modeGetFolder);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
|
||||
var folderListPref = document.getElementById("browser.download.folderList");
|
||||
var currentDirPref = this._indexToFolder(folderListPref.value); // file
|
||||
var defDownloads = this._indexToFolder(1); // file
|
||||
|
||||
// First try to open what's currently configured
|
||||
if (currentDirPref && currentDirPref.exists()) {
|
||||
fp.displayDirectory = currentDirPref;
|
||||
@@ -276,18 +288,7 @@ var gMainPane = {
|
||||
else {
|
||||
fp.displayDirectory = this._indexToFolder(0);
|
||||
}
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK) {
|
||||
var file = fp.file.QueryInterface(nsILocalFile);
|
||||
var currentDirPref = document.getElementById("browser.download.dir");
|
||||
currentDirPref.value = file;
|
||||
var folderListPref = document.getElementById("browser.download.folderList");
|
||||
folderListPref.value = this._folderToIndex(file);
|
||||
// Note, the real prefs will not be updated yet, so dnld manager's
|
||||
// userDownloadsDirectory may not return the right folder after
|
||||
// this code executes. displayDownloadDirPref will be called on
|
||||
// the assignment above to update the UI.
|
||||
}
|
||||
fp.open(fpCallback);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -668,15 +668,7 @@ var Scratchpad = {
|
||||
*/
|
||||
openFile: function SP_openFile(aIndex)
|
||||
{
|
||||
let fp;
|
||||
if (!aIndex && aIndex !== 0) {
|
||||
fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, this.strings.GetStringFromName("openFile.title"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
fp.defaultString = "";
|
||||
}
|
||||
|
||||
if (aIndex > -1 || fp.show() != Ci.nsIFilePicker.returnCancel) {
|
||||
let promptCallback = function(aFile) {
|
||||
this.promptSave(function(aCloseFile, aSaved, aStatus) {
|
||||
let shouldOpen = aCloseFile;
|
||||
if (aSaved && !Components.isSuccessCode(aStatus)) {
|
||||
@@ -687,8 +679,8 @@ var Scratchpad = {
|
||||
this._skipClosePrompt = true;
|
||||
|
||||
let file;
|
||||
if (fp) {
|
||||
file = fp.file;
|
||||
if (aFile) {
|
||||
file = aFile;
|
||||
} else {
|
||||
file = Components.classes["@mozilla.org/file/local;1"].
|
||||
createInstance(Components.interfaces.nsILocalFile);
|
||||
@@ -701,6 +693,22 @@ var Scratchpad = {
|
||||
this.setRecentFile(file);
|
||||
}
|
||||
}.bind(this));
|
||||
}.bind(this);
|
||||
|
||||
if (aIndex > -1) {
|
||||
promptCallback();
|
||||
} else {
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||
promptCallback(fp.file);
|
||||
}
|
||||
};
|
||||
|
||||
fp.init(window, this.strings.GetStringFromName("openFile.title"),
|
||||
Ci.nsIFilePicker.modeOpen);
|
||||
fp.defaultString = "";
|
||||
fp.open(fpCallback);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -894,12 +902,9 @@ var Scratchpad = {
|
||||
saveFileAs: function SP_saveFileAs(aCallback)
|
||||
{
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
fp.init(window, this.strings.GetStringFromName("saveFileAs"),
|
||||
Ci.nsIFilePicker.modeSave);
|
||||
fp.defaultString = "scratchpad.js";
|
||||
if (fp.show() != Ci.nsIFilePicker.returnCancel) {
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult != Ci.nsIFilePicker.returnCancel) {
|
||||
this.setFilename(fp.file.path);
|
||||
|
||||
this.exportToFile(fp.file, true, false, function(aStatus) {
|
||||
if (Components.isSuccessCode(aStatus)) {
|
||||
this.editor.dirty = false;
|
||||
@@ -910,6 +915,12 @@ var Scratchpad = {
|
||||
}
|
||||
});
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
fp.init(window, this.strings.GetStringFromName("saveFileAs"),
|
||||
Ci.nsIFilePicker.modeSave);
|
||||
fp.defaultString = "scratchpad.js";
|
||||
fp.open(fpCallback);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -288,10 +288,8 @@ StyleEditor.prototype = {
|
||||
*/
|
||||
importFromFile: function SE_importFromFile(aFile, aParentWindow)
|
||||
{
|
||||
aFile = this._showFilePicker(aFile, false, aParentWindow);
|
||||
if (!aFile) {
|
||||
return;
|
||||
}
|
||||
let callback = function(aFile) {
|
||||
if (aFile) {
|
||||
this._savedFile = aFile; // remember filename for next save if any
|
||||
|
||||
NetUtil.asyncFetch(aFile, function onAsyncFetch(aStream, aStatus) {
|
||||
@@ -304,6 +302,10 @@ StyleEditor.prototype = {
|
||||
this._appendNewStyleSheet(source);
|
||||
this.clearFlag(StyleEditorFlags.ERROR);
|
||||
}.bind(this));
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
this._showFilePicker(aFile, false, aParentWindow, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -553,9 +555,8 @@ StyleEditor.prototype = {
|
||||
*/
|
||||
saveToFile: function SE_saveToFile(aFile, aCallback)
|
||||
{
|
||||
aFile = this._showFilePicker(aFile || this._styleSheetFilePath, true);
|
||||
|
||||
if (!aFile) {
|
||||
let callback = function(aReturnFile) {
|
||||
if (!aReturnFile) {
|
||||
if (aCallback) {
|
||||
aCallback(null);
|
||||
}
|
||||
@@ -566,7 +567,7 @@ StyleEditor.prototype = {
|
||||
this._state.text = this._sourceEditor.getText();
|
||||
}
|
||||
|
||||
let ostream = FileUtils.openSafeFileOutputStream(aFile);
|
||||
let ostream = FileUtils.openSafeFileOutputStream(aReturnFile);
|
||||
let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
|
||||
.createInstance(Ci.nsIScriptableUnicodeConverter);
|
||||
converter.charset = "UTF-8";
|
||||
@@ -584,15 +585,18 @@ StyleEditor.prototype = {
|
||||
|
||||
// remember filename for next save if any
|
||||
this._friendlyName = null;
|
||||
this._savedFile = aFile;
|
||||
this._savedFile = aReturnFile;
|
||||
this._persistExpando();
|
||||
|
||||
if (aCallback) {
|
||||
aCallback(aFile);
|
||||
aCallback(aReturnFile);
|
||||
}
|
||||
this.clearFlag(StyleEditorFlags.UNSAVED);
|
||||
this.clearFlag(StyleEditorFlags.ERROR);
|
||||
}.bind(this));
|
||||
}.bind(this);
|
||||
|
||||
this._showFilePicker(aFile || this._styleSheetFilePath, true, null, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -690,31 +694,36 @@ StyleEditor.prototype = {
|
||||
* @param nsIWindow aParentWindow
|
||||
* Optional parent window. If null the parent window of the file picker
|
||||
* will be the window of the attached input element.
|
||||
* @return nsIFile
|
||||
* The selected file or null if the user did not pick one.
|
||||
* @param aCallback
|
||||
* The callback method, which will be called passing in the selected
|
||||
* file or null if the user did not pick one.
|
||||
*/
|
||||
_showFilePicker: function SE__showFilePicker(aFile, aSave, aParentWindow)
|
||||
_showFilePicker: function SE__showFilePicker(aFile, aSave, aParentWindow, aCallback)
|
||||
{
|
||||
if (typeof(aFile) == "string") {
|
||||
try {
|
||||
if (Services.io.extractScheme(aFile) == "file") {
|
||||
let uri = Services.io.newURI(aFile, null, null);
|
||||
let file = uri.QueryInterface(Ci.nsIFileURL).file;
|
||||
return file;
|
||||
aCallback(file);
|
||||
return;
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
try {
|
||||
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
|
||||
file.initWithPath(aFile);
|
||||
return file;
|
||||
aCallback(file);
|
||||
return;
|
||||
} catch (ex) {
|
||||
this._signalError(aSave ? SAVE_ERROR : LOAD_ERROR);
|
||||
return null;
|
||||
aCallback(null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (aFile) {
|
||||
return aFile;
|
||||
aCallback(aFile);
|
||||
return;
|
||||
}
|
||||
|
||||
let window = aParentWindow
|
||||
@@ -723,13 +732,19 @@ StyleEditor.prototype = {
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
|
||||
let mode = aSave ? fp.modeSave : fp.modeOpen;
|
||||
let key = aSave ? "saveStyleSheet" : "importStyleSheet";
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == Ci.nsIFilePicker.returnCancel) {
|
||||
aCallback(null);
|
||||
} else {
|
||||
aCallback(fp.file);
|
||||
}
|
||||
};
|
||||
|
||||
fp.init(window, _(key + ".title"), mode);
|
||||
fp.appendFilters(_(key + ".filter"), "*.css");
|
||||
fp.appendFilters(fp.filterAll);
|
||||
|
||||
let rv = fp.show();
|
||||
return (rv == fp.returnCancel) ? null : fp.file;
|
||||
fp.open(fpCallback);
|
||||
return;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ interface nsIURI;
|
||||
interface nsIDOMWindow;
|
||||
interface nsISimpleEnumerator;
|
||||
|
||||
[scriptable, uuid(0d79adad-b244-49A5-9997-2a8cad93fc44)]
|
||||
[scriptable, function, uuid(0d79adad-b244-49A5-9997-2a8cad93fc44)]
|
||||
interface nsIFilePickerShownCallback : nsISupports
|
||||
{
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user