mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 843536 - Ctrl-o doesn't open file picker. r=sfoster
This commit is contained in:
parent
d99977b373
commit
01089c0b84
@ -758,6 +758,28 @@ var BrowserUI = {
|
||||
}
|
||||
},
|
||||
|
||||
openFile: function() {
|
||||
try {
|
||||
const nsIFilePicker = Ci.nsIFilePicker;
|
||||
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
let self = this;
|
||||
let fpCallback = function fpCallback_done(aResult) {
|
||||
if (aResult == nsIFilePicker.returnOK) {
|
||||
self.goToURI(fp.fileURL.spec);
|
||||
}
|
||||
};
|
||||
|
||||
let windowTitle = Strings.browser.GetStringFromName("browserForOpenLocation");
|
||||
fp.init(window, windowTitle, nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText |
|
||||
nsIFilePicker.filterImages | nsIFilePicker.filterXML |
|
||||
nsIFilePicker.filterHTML);
|
||||
fp.open(fpCallback);
|
||||
} catch (ex) {
|
||||
dump ('BrowserUI openFile exception: ' + ex + '\n');
|
||||
}
|
||||
},
|
||||
|
||||
receiveMessage: function receiveMessage(aMessage) {
|
||||
let browser = aMessage.target;
|
||||
let json = aMessage.json;
|
||||
@ -812,6 +834,7 @@ var BrowserUI = {
|
||||
case "cmd_zoomout":
|
||||
case "cmd_volumeLeft":
|
||||
case "cmd_volumeRight":
|
||||
case "cmd_openFile":
|
||||
isSupported = true;
|
||||
break;
|
||||
default:
|
||||
@ -935,6 +958,9 @@ var BrowserUI = {
|
||||
// Zoom out (portrait) or in (landscape)
|
||||
Browser.zoom(Util.isPortrait() ? 1 : -1);
|
||||
break;
|
||||
case "cmd_openFile":
|
||||
this.openFile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -67,6 +67,7 @@
|
||||
<command id="cmd_go" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
<command id="cmd_openLocation" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
<command id="cmd_home" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
<command id="cmd_openFile" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
|
||||
<!-- tabs -->
|
||||
<command id="cmd_newTab" oncommand="CommandUpdater.doCommand(this.id);"/>
|
||||
@ -133,6 +134,7 @@
|
||||
<key id="key_focusURL" key="l" modifiers="accel" command="cmd_openLocation"/>
|
||||
<key id="key_focusURL2" key="&urlbar.accesskey;" modifiers="alt" command="cmd_openLocation"/>
|
||||
<key id="key_home" keycode="VK_HOME" modifiers="accel" command="cmd_home"/>
|
||||
<key id="key_open" key="o" modifiers="accel" command="cmd_openFile"/>
|
||||
|
||||
<!-- misc -->
|
||||
<key id="key_zoomin" key="+" modifiers="accel" command="cmd_zoomin"/>
|
||||
|
@ -21,6 +21,7 @@ helpOnlineCharm=Help (online)
|
||||
|
||||
# General
|
||||
browserForSaveLocation=Save Location
|
||||
browserForOpenLocation=Open Location
|
||||
|
||||
# Download Manager
|
||||
downloadsUnknownSize=Unknown size
|
||||
|
Loading…
Reference in New Issue
Block a user