41526 - implement 'Set As Wallpaper' on windows, r=pavlov, sr=blake

git-svn-id: svn://10.0.0.236/trunk@205574 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
hewitt%netscape.com 2006-07-29 05:39:30 +00:00
parent 45f3861c66
commit ca40e4502e
3 changed files with 13 additions and 0 deletions

View File

@ -141,6 +141,9 @@
<menuitem id="context-saveimage"
accesskey="&saveImageCmd.accesskey;"
oncommand="gContextMenu.saveImage();"/>
<menuitem id="context-setWallpaper"
label="&setWallpaperCmd.label;"
oncommand="gContextMenu.setWallpaper();"/>
<menuseparator id="context-sep-save"/>
<!-- Application Integration ================= -->
<menuseparator id="context-sep-apps"/>

View File

@ -145,6 +145,9 @@ nsContextMenu.prototype = {
// View Frame Info depends on whether we're in a frame
this.showItem( "context-viewframeinfo", this.inFrame );
// Set As Wallpaper depends on whether an image was clicked on, and only works on Windows.
this.showItem( "context-setWallpaper", this.onImage && navigator.appVersion.indexOf("Windows") != -1);
// View Image depends on whether an image was clicked on.
this.showItem( "context-viewimage", this.onImage );
@ -483,6 +486,12 @@ nsContextMenu.prototype = {
viewBGImage : function () {
openTopWin( this.bgImageURL );
},
setWallpaper: function() {
var winhooks = Components.classes[ "@mozilla.org/winhooks;1" ].
getService(Components.interfaces.nsIWindowsHooks);
winhooks.setImageAsWallpaper(this.target, false);
},
// Save URL of clicked-on frame.
saveFrame : function () {
saveDocument( this.target.ownerDocument );

View File

@ -34,6 +34,7 @@
<!ENTITY viewImageCmd.accesskey "w">
<!ENTITY viewBGImageCmd.label "View Background Image">
<!ENTITY viewBGImageCmd.accesskey "w">
<!ENTITY setWallpaperCmd.label "Set As Wallpaper">
<!ENTITY bookmarkPageCmd.label "Bookmark this Page">
<!ENTITY bookmarkPageCmd.accesskey "b">
<!ENTITY bookmarkLinkCmd.label "File Bookmark for Link...">