Fix bug 279270: when copying images, put only the image data on the clipboard so that applications that prefer text over image data don't just get the image location.

This commit is contained in:
smfr%smfr.org 2005-03-21 02:54:56 +00:00
Родитель 68c673e895
Коммит 5153cd8596
1 изменённых файлов: 16 добавлений и 3 удалений

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

@ -85,6 +85,9 @@
#include "nsNetUtil.h"
#include "nsIClipboardCommands.h"
#include "nsICommandManager.h"
#include "nsICommandParams.h"
#include "nsIContentViewerEdit.h"
#include "nsIWebBrowser.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIPrefBranch.h"
@ -2907,9 +2910,19 @@ enum BWCOpenDest {
- (IBAction)copyImage:(id)sender
{
nsCOMPtr<nsIWebBrowser> webBrowser = getter_AddRefs([[[self getBrowserWrapper] getBrowserView] getWebBrowser]);
nsCOMPtr<nsIClipboardCommands> clipboard(do_GetInterface(webBrowser));
if (clipboard)
clipboard->CopyImageContents();
// nsIClipboardCommands::CopyImageContents() copies both the location and the image
// by default, which we don't want. Thus se need to go directly to the command manger
// to send the command with params to just copy the image.
nsCOMPtr<nsICommandManager> commandMgr(do_GetInterface(webBrowser));
if (!commandMgr)
return;
nsCOMPtr<nsICommandParams> params = do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID);
if (params)
params->SetLongValue("imageCopy", nsIContentViewerEdit::COPY_IMAGE_DATA);
(void)commandMgr->DoCommand("cmd_copyImageContents", params, nsnull);
}
- (IBAction)copyImageLocation:(id)sender