зеркало из https://github.com/mozilla/pjs.git
Bug 523323 - Restore the code from bug 312018 that was removed in bug 456646. r=josh
--HG-- extra : rebase_source : bdae0d890eda26a12425937b60ec7b6617f773fb
This commit is contained in:
Родитель
1079565c3d
Коммит
9e9bf0aea6
|
@ -78,7 +78,7 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin
|
|||
nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
|
||||
NS_PRINTDIALOGSERVICE_CONTRACTID));
|
||||
if (dlgPrint)
|
||||
return dlgPrint->Show(parent, printSettings);
|
||||
return dlgPrint->Show(parent, printSettings, webBrowserPrint);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin
|
|||
nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
|
||||
NS_PRINTDIALOGSERVICE_CONTRACTID));
|
||||
if (dlgPrint)
|
||||
return dlgPrint->Show(parent, printSettings);
|
||||
return dlgPrint->Show(parent, printSettings, webBrowserPrint);
|
||||
|
||||
// Show the built-in dialog instead
|
||||
ParamBlock block;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
class nsIDOMWindow;
|
||||
class nsIPrintSettings;
|
||||
class nsIWebBrowserPrint;
|
||||
|
||||
/*
|
||||
* Interface to a print dialog accessed through the widget library.
|
||||
|
@ -73,11 +74,14 @@ public:
|
|||
* print dialog. On return, if the print operation should
|
||||
* proceed then this contains settings for the print
|
||||
* operation.
|
||||
* @param aWebBrowserPrint A nsIWebBrowserPrint object that can be used for
|
||||
* retreiving the title of the printed document.
|
||||
* @return NS_OK if the print operation should proceed
|
||||
* @return NS_ERROR_ABORT if the user indicated not to proceed
|
||||
* @return a suitable error for failures to show the print dialog.
|
||||
*/
|
||||
NS_IMETHOD Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings) = 0;
|
||||
NS_IMETHOD Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings,
|
||||
nsIWebBrowserPrint *aWebBrowserPrint) = 0;
|
||||
|
||||
/**
|
||||
* Show the page setup dialog. Note that there is no way to tell whether the
|
||||
|
|
|
@ -57,7 +57,8 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHODIMP Init();
|
||||
NS_IMETHODIMP Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings);
|
||||
NS_IMETHODIMP Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings,
|
||||
nsIWebBrowserPrint *aWebBrowserPrint);
|
||||
NS_IMETHODIMP ShowPageSetup(nsIDOMWindow *aParent,
|
||||
nsIPrintSettings *aSettings);
|
||||
};
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIWebBrowserPrint.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include "nsObjCExceptions.h"
|
||||
|
@ -64,7 +66,8 @@ nsPrintDialogServiceX::Init()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrintDialogServiceX::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings)
|
||||
nsPrintDialogServiceX::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings,
|
||||
nsIWebBrowserPrint *aWebBrowserPrint)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
|
@ -74,6 +77,24 @@ nsPrintDialogServiceX::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings)
|
|||
if (!settingsX)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Set the print job title
|
||||
PRUnichar** docTitles;
|
||||
PRUint32 titleCount;
|
||||
nsresult rv = aWebBrowserPrint->EnumerateDocumentNames(&titleCount, &docTitles);
|
||||
if (NS_SUCCEEDED(rv) && titleCount > 0) {
|
||||
CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, docTitles[0], nsCRT::strlen(docTitles[0]));
|
||||
if (cfTitleString) {
|
||||
::PMPrintSettingsSetJobName(settingsX->GetPMPrintSettings(), cfTitleString);
|
||||
CFRelease(cfTitleString);
|
||||
}
|
||||
for (PRInt32 i = titleCount - 1; i >= 0; i--) {
|
||||
NS_Free(docTitles[i]);
|
||||
}
|
||||
NS_Free(docTitles);
|
||||
docTitles = NULL;
|
||||
titleCount = 0;
|
||||
}
|
||||
|
||||
NSPrintInfo* printInfo = settingsX->GetCocoaPrintInfo();
|
||||
|
||||
// Put the print info into the current print operation, since that's where
|
||||
|
|
|
@ -568,7 +568,8 @@ nsPrintDialogServiceGTK::Init()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrintDialogServiceGTK::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings)
|
||||
nsPrintDialogServiceGTK::Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings,
|
||||
nsIWebBrowserPrint *aWebBrowserPrint)
|
||||
{
|
||||
NS_PRECONDITION(aParent, "aParent must not be null");
|
||||
NS_PRECONDITION(aSettings, "aSettings must not be null");
|
||||
|
|
|
@ -51,7 +51,8 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHODIMP Init();
|
||||
NS_IMETHODIMP Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings);
|
||||
NS_IMETHODIMP Show(nsIDOMWindow *aParent, nsIPrintSettings *aSettings,
|
||||
nsIWebBrowserPrint *aWebBrowserPrint);
|
||||
NS_IMETHODIMP ShowPageSetup(nsIDOMWindow *aParent,
|
||||
nsIPrintSettings *aSettings);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче