Bug #173954 --> Add Send Page, Send Link and Send Image support to Firebird. Turned off for unix builds.

r/sr=ben
This commit is contained in:
scott%scott-macgregor.org 2003-08-08 21:23:34 +00:00
Родитель 545f764157
Коммит 4dc8a415e1
3 изменённых файлов: 60 добавлений и 0 удалений

Просмотреть файл

@ -3015,6 +3015,7 @@ nsContextMenu.prototype = {
}, },
initSaveItems : function () { initSaveItems : function () {
this.showItem( "context-savepage", !( this.inDirList || this.isTextSelected || this.onTextInput || this.onLink )); this.showItem( "context-savepage", !( this.inDirList || this.isTextSelected || this.onTextInput || this.onLink ));
this.showItem( "context-sendpage", !( this.inDirList || this.isTextSelected || this.onTextInput || this.onLink ));
// Save link depends on whether we're in a link. // Save link depends on whether we're in a link.
this.showItem( "context-savelink", this.onSaveableLink ); this.showItem( "context-savelink", this.onSaveableLink );
@ -3023,6 +3024,9 @@ nsContextMenu.prototype = {
this.showItem( "context-saveimage", this.onImage ); this.showItem( "context-saveimage", this.onImage );
this.showItem( "context-sendimage", this.onImage ); this.showItem( "context-sendimage", this.onImage );
// Send link depends on whether we're in a link.
this.showItem( "context-sendlink", this.onSaveableLink );
}, },
initViewItems : function () { initViewItems : function () {
// View source is always OK, unless in directory listing. // View source is always OK, unless in directory listing.
@ -3449,10 +3453,16 @@ nsContextMenu.prototype = {
saveLink : function () { saveLink : function () {
saveURL( this.linkURL(), this.linkText(), null, true, true ); saveURL( this.linkURL(), this.linkText(), null, true, true );
}, },
sendLink : function () {
sendLink( this.linkURL(), "" ); // we don't know the title of the link so pass in an empty string
},
// Save URL of clicked-on image. // Save URL of clicked-on image.
saveImage : function () { saveImage : function () {
saveURL( this.imageURL, null, "SaveImageTitle", false ); saveURL( this.imageURL, null, "SaveImageTitle", false );
}, },
sendImage : function () {
sendLink(this.imageURL, "" );
},
toggleImageBlocking : function (aBlock) { toggleImageBlocking : function (aBlock) {
var nsIPermissionManager = Components.interfaces.nsIPermissionManager; var nsIPermissionManager = Components.interfaces.nsIPermissionManager;
var permissionmanager = var permissionmanager =
@ -4211,6 +4221,27 @@ function charsetLoadListener (event)
} }
} }
// a generic method which can be used to pass arbitrary urls to the operating system.
// aURL --> a nsIURI which represents the url to launch
function launchExternalUrl(aURL)
{
var extProtocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].getService(Components.interfaces.nsIExternalProtocolService);
if (extProtocolSvc)
extProtocolSvc.loadUrl(aURL);
}
function sendLink(url, title)
{
// generate a mailto url based on the url and the url's title
var mailtoUrl = url ? "mailto:?body=" + url + "&subject=" + escape(title) : "mailto:";
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI(mailtoUrl, null, null);
// now pass this url to the operating system
launchExternalUrl(uri);
}
#ifdef XP_MACOSX #ifdef XP_MACOSX
const nsIWindowDataSource = Components.interfaces.nsIWindowDataSource; const nsIWindowDataSource = Components.interfaces.nsIWindowDataSource;

Просмотреть файл

@ -109,6 +109,8 @@
<command id="cmd_newNavigatorTab" oncommand="BrowserOpenTab();"/> <command id="cmd_newNavigatorTab" oncommand="BrowserOpenTab();"/>
<command id="Browser:OpenFile" oncommand="BrowserOpenFileWindow();"/> <command id="Browser:OpenFile" oncommand="BrowserOpenFileWindow();"/>
<command id="Browser:SavePage" oncommand="saveDocument(window._content.document);"/> <command id="Browser:SavePage" oncommand="saveDocument(window._content.document);"/>
<command id="Browser:SendLink" oncommand="sendLink(Components.lookupMethod(window._content, 'location').call(window._content).href,
Components.lookupMethod(window._content.document, 'title').call(window._content.document));"/>
<command id="Browser:Print" oncommand="BrowserPrint();"/> <command id="Browser:Print" oncommand="BrowserPrint();"/>
<command id="cmd_close" oncommand="BrowserCloseTabOrWindow()"/> <command id="cmd_close" oncommand="BrowserCloseTabOrWindow()"/>
<command id="cmd_closeWindow" oncommand="BrowserCloseWindow()"/> <command id="cmd_closeWindow" oncommand="BrowserCloseWindow()"/>
@ -325,6 +327,12 @@
label="&saveLinkCmd.label;" label="&saveLinkCmd.label;"
accesskey="&saveLinkCmd.accesskey;" accesskey="&saveLinkCmd.accesskey;"
oncommand="gContextMenu.saveLink();"/> oncommand="gContextMenu.saveLink();"/>
#ifndef XP_UNIX
<menuitem id="context-sendlink"
label="&sendLinkCmd.label;"
accesskey="&sendLinkCmd.accesskey;"
oncommand="gContextMenu.sendLink();"/>
#endif
<menuitem id="context-copyemail" <menuitem id="context-copyemail"
label="&copyEmailCmd.label;" label="&copyEmailCmd.label;"
accesskey="&copyEmailCmd.accesskey;" accesskey="&copyEmailCmd.accesskey;"
@ -347,6 +355,12 @@
label="&saveImageCmd.label;" label="&saveImageCmd.label;"
accesskey="&saveImageCmd.accesskey;" accesskey="&saveImageCmd.accesskey;"
oncommand="gContextMenu.saveImage();"/> oncommand="gContextMenu.saveImage();"/>
#ifndef XP_UNIX
<menuitem id="context-sendimage"
label="&sendImageCmd.label;"
accesskey="&sendImageCmd.accesskey;"
oncommand="gContextMenu.sendImage();"/>
#endif
<menuitem id="context-setWallpaper" <menuitem id="context-setWallpaper"
label="&setWallpaperCmd.label;" label="&setWallpaperCmd.label;"
accesskey="&setWallpaperCmd.accesskey;" accesskey="&setWallpaperCmd.accesskey;"
@ -380,6 +394,12 @@
label="&savePageCmd.label;" label="&savePageCmd.label;"
accesskey="&savePageCmd.accesskey;" accesskey="&savePageCmd.accesskey;"
oncommand="saveDocument(window._content.document);"/> oncommand="saveDocument(window._content.document);"/>
#ifndef XP_UNIX
<menuitem id="context-sendpage"
label="&sendPageCmd.label;"
accesskey="&sendPageCmd.accesskey;"
command="Browser:SendLink"/>
#endif
<menuseparator id="context-sep-viewbgimage"/> <menuseparator id="context-sep-viewbgimage"/>
<menuitem id="context-viewbgimage" <menuitem id="context-viewbgimage"
label="&viewBGImageCmd.label;" label="&viewBGImageCmd.label;"
@ -606,6 +626,9 @@
<menuseparator/> <menuseparator/>
<menuitem label="&savePageCmd.label;" accesskey="&savePageCmd.accesskey;" key="key_savePage" command="Browser:SavePage"/> <menuitem label="&savePageCmd.label;" accesskey="&savePageCmd.accesskey;" key="key_savePage" command="Browser:SavePage"/>
<menuitem id="menu_saveFrame" label="&saveFrameCmd.label;" accesskey="&saveFrameCmd.accesskey;" oncommand="saveFrameDocument();" hidden="true"/> <menuitem id="menu_saveFrame" label="&saveFrameCmd.label;" accesskey="&saveFrameCmd.accesskey;" oncommand="saveFrameDocument();" hidden="true"/>
#ifndef XP_UNIX
<menuitem id="menu_sendLink" label="&sendPageCmd.label;" accesskey="&sendPageCmd.accesskey;" command="Browser:SendLink"/>
#endif
<menuseparator/> <menuseparator/>
<menuitem label="&printSetupCmd.label;" accesskey="&printSetupCmd.accesskey;" oncommand="BrowserPrintSetup();"/> <menuitem label="&printSetupCmd.label;" accesskey="&printSetupCmd.accesskey;" oncommand="BrowserPrintSetup();"/>
<menuitem label="&printPreviewCmd.label;" accesskey="&printPreviewCmd.accesskey;" oncommand="BrowserPrintPreview();"/> <menuitem label="&printPreviewCmd.label;" accesskey="&printPreviewCmd.accesskey;" oncommand="BrowserPrintPreview();"/>

Просмотреть файл

@ -212,6 +212,8 @@
<!ENTITY bookmarkLinkCmd.accesskey "L"> <!ENTITY bookmarkLinkCmd.accesskey "L">
<!ENTITY bookmarkFrameCmd.label "Bookmark This Frame..."> <!ENTITY bookmarkFrameCmd.label "Bookmark This Frame...">
<!ENTITY bookmarkFrameCmd.accesskey "F"> <!ENTITY bookmarkFrameCmd.accesskey "F">
<!ENTITY sendPageCmd.label "Send Page...">
<!ENTITY sendPageCmd.accesskey "S">
<!ENTITY savePageCmd.label "Save Page As..."> <!ENTITY savePageCmd.label "Save Page As...">
<!ENTITY savePageCmd.accesskey "A"> <!ENTITY savePageCmd.accesskey "A">
<!ENTITY savePageCmd.commandkey "s"> <!ENTITY savePageCmd.commandkey "s">
@ -219,8 +221,12 @@
<!ENTITY saveFrameCmd.accesskey "F"> <!ENTITY saveFrameCmd.accesskey "F">
<!ENTITY saveLinkCmd.label "Save Link to Disk..."> <!ENTITY saveLinkCmd.label "Save Link to Disk...">
<!ENTITY saveLinkCmd.accesskey "k"> <!ENTITY saveLinkCmd.accesskey "k">
<!ENTITY sendLinkCmd.label "Send Link...">
<!ENTITY sendLinkCmd.accesskey "d">
<!ENTITY saveImageCmd.label "Save Image As..."> <!ENTITY saveImageCmd.label "Save Image As...">
<!ENTITY saveImageCmd.accesskey "v"> <!ENTITY saveImageCmd.accesskey "v">
<!ENTITY sendImageCmd.label "Send Image...">
<!ENTITY sendImageCmd.accesskey "n">
<!ENTITY copyLinkCmd.label "Copy Link Location"> <!ENTITY copyLinkCmd.label "Copy Link Location">
<!ENTITY copyLinkCmd.accesskey "C"> <!ENTITY copyLinkCmd.accesskey "C">
<!ENTITY copyImageCmd.label "Copy Image Location"> <!ENTITY copyImageCmd.label "Copy Image Location">