Bug 312018: Set the print job name before showing the print dialog. r=josh sr=bsmedberg a1.9=schrep

This commit is contained in:
stuart.morgan@alumni.case.edu 2008-01-10 15:44:06 -08:00
Родитель a4ae7e057e
Коммит 6397bdfbe0
1 изменённых файлов: 19 добавлений и 0 удалений

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

@ -53,6 +53,7 @@
#include "nsIDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsTArray.h"
#include "nsCRT.h"
#include "nsPDECommon.h"
@ -233,6 +234,24 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin
rv = ::LoadPDEPlugIn();
NS_ASSERTION(NS_SUCCEEDED(rv), "LoadPDEPlugIn() failed");
// Set the print job title
PRUnichar** docTitles;
PRUint32 titleCount;
rv = webBrowserPrint->EnumerateDocumentNames(&titleCount, &docTitles);
if (NS_SUCCEEDED(rv) && titleCount > 0) {
CFStringRef cfTitleString = CFStringCreateWithCharacters(NULL, docTitles[0], nsCRT::strlen(docTitles[0]));
if (cfTitleString) {
::PMPrintSettingsSetJobName(nativePrintSettings, cfTitleString);
CFRelease(cfTitleString);
}
for (PRInt32 i = titleCount - 1; i >= 0; i--) {
NS_Free(docTitles[i]);
}
NS_Free(docTitles);
docTitles = NULL;
titleCount = 0;
}
// Create a dictionary and store our settings into it
CFMutableDictionaryRef dictToPDE = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
(const CFDictionaryKeyCallBacks *)&kCFTypeDictionaryKeyCallBacks,