mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 573982 - make 'open' the default action for click on links/documents [r=mfinkle]
This commit is contained in:
parent
7f94f613bd
commit
154fc3e25a
@ -2410,6 +2410,11 @@ var ContextCommands = {
|
||||
Browser.addTab(ContextHelper.popupState.linkURL, false, Browser.selectedTab);
|
||||
},
|
||||
|
||||
saveLink: function cc_saveLink() {
|
||||
let browser = ContextHelper.popupState.target;
|
||||
saveURL(ContextHelper.popupState.linkURL, null, "SaveLinkTitle", false, false, browser.documentURI);
|
||||
},
|
||||
|
||||
saveImage: function cc_saveImage() {
|
||||
let browser = ContextHelper.popupState.target;
|
||||
saveImageURL(ContextHelper.popupState.mediaURL, null, "SaveImageTitle", false, false, browser.documentURI);
|
||||
|
@ -547,6 +547,9 @@
|
||||
<richlistitem class="context-command" id="context-openinnewtab" type="link-saveable" onclick="ContextCommands.openInNewTab();">
|
||||
<label value="&contextOpenInNewTab.label;"/>
|
||||
</richlistitem>
|
||||
<richlistitem class="context-command" id="context-savelink" type="link-saveable" onclick="ContextCommands.saveLink();">
|
||||
<label value="&contextSaveLink.label;"/>
|
||||
</richlistitem>
|
||||
<richlistitem class="context-command" id="context-saveimage" type="image-loaded" onclick="ContextCommands.saveImage();">
|
||||
<label value="&contextSaveImage.label;"/>
|
||||
</richlistitem>
|
||||
|
@ -54,69 +54,12 @@ HelperAppLauncherDialog.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIHelperAppLauncherDialog]),
|
||||
|
||||
show: function hald_show(aLauncher, aContext, aReason) {
|
||||
const NS_BINDING_ABORTED = 0x804b0002;
|
||||
|
||||
let window = aContext.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowInternal);
|
||||
|
||||
let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
|
||||
|
||||
let flags = (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_0) +
|
||||
(Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_1);
|
||||
|
||||
let title = bundle.GetStringFromName("helperApp.title");
|
||||
let message = bundle.GetStringFromName("helperApp.prompt");
|
||||
message += "\n " + aLauncher.suggestedFileName;
|
||||
|
||||
let type = aLauncher.MIMEInfo.description;
|
||||
if (type == "") {
|
||||
try {
|
||||
type = aLauncher.MIMEInfo.primaryExtension.toUpperCase();
|
||||
} catch (e) {
|
||||
type = aLauncher.MIMEInfo.MIMEType;
|
||||
}
|
||||
}
|
||||
message += "\n " + type;
|
||||
|
||||
let open = bundle.GetStringFromName("helperApp.open");
|
||||
let save = bundle.GetStringFromName("helperApp.save");
|
||||
let nothing = bundle.GetStringFromName("helperApp.nothing");
|
||||
|
||||
// Check to see if we can open this file or not
|
||||
if (aLauncher.MIMEInfo.hasDefaultHandler) {
|
||||
flags += (Ci.nsIPrompt.BUTTON_TITLE_IS_STRING * Ci.nsIPrompt.BUTTON_POS_2);
|
||||
|
||||
let choice = Services.prompt.confirmEx(window,
|
||||
title, message,
|
||||
flags, save, open, nothing,
|
||||
null, {});
|
||||
|
||||
if (choice == 0) {
|
||||
aLauncher.saveToDisk(null, false);
|
||||
}
|
||||
else if (choice == 1) {
|
||||
aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.useSystemDefault;
|
||||
aLauncher.launchWithApplication(null, false);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
aLauncher.cancel(NS_BINDING_ABORTED);
|
||||
} catch(e) {}
|
||||
}
|
||||
aLauncher.MIMEInfo.preferredAction = Ci.nsIMIMEInfo.useSystemDefault;
|
||||
aLauncher.launchWithApplication(null, false);
|
||||
} else {
|
||||
let choice = Services.prompt.confirmEx(window,
|
||||
title, message,
|
||||
flags, save, nothing, null,
|
||||
null, {});
|
||||
|
||||
if (choice == 0) {
|
||||
aLauncher.saveToDisk(null, false);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
aLauncher.cancel(NS_BINDING_ABORTED);
|
||||
} catch(e) {}
|
||||
}
|
||||
aLauncher.saveToDisk(null, false);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -87,6 +87,7 @@
|
||||
<!ENTITY consoleErrColumn.label "Column:">
|
||||
|
||||
<!ENTITY contextOpenInNewTab.label "Open Link in New Tab">
|
||||
<!ENTITY contextSaveLink.label "Save Link">
|
||||
<!ENTITY contextSaveImage.label "Save Image">
|
||||
<!ENTITY contextShareLink.label "Share Link">
|
||||
<!ENTITY contextShareImage.label "Share Image">
|
||||
|
@ -147,12 +147,5 @@ pageactions.popup=Popups
|
||||
pageactions.offline-app=Offline Storage
|
||||
pageactions.password=Password
|
||||
|
||||
# Helper App Dialog (Save/Open)
|
||||
helperApp.title=Opening File
|
||||
helperApp.prompt=What would you like to do with:
|
||||
helperApp.open=Open
|
||||
helperApp.save=Save
|
||||
helperApp.nothing=Nothing
|
||||
|
||||
# Open Search
|
||||
opensearch.searchWith=Search With:
|
||||
|
Loading…
Reference in New Issue
Block a user