Bug 425844 - restore menu state after page setup and print dialogs. r=josh

This commit is contained in:
John Daggett 2009-01-29 17:46:23 +09:00
Родитель fa15736f8e
Коммит fba6cf8cc8
3 изменённых файлов: 34 добавлений и 1 удалений

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

@ -346,6 +346,8 @@ nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrin
Boolean accepted;
status = ::PMSessionPrintDialog(printSession, nativePrintSettings, pageFormat, &accepted);
printSettingsX->CleanUpAfterCarbonDialog();
if (status == noErr && accepted) {
int pageRange = -1;
@ -484,6 +486,8 @@ nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *p
Boolean accepted = false;
status = ::PMSessionPageSetupDialog(printSession, pageFormat, &accepted);
printSettingsX->CleanUpAfterCarbonDialog();
OSStatus tempStatus = ::PMRelease(printSession);
if (status == noErr)
status = tempStatus;

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

@ -55,7 +55,7 @@ native nsPMPrintSession(PMPrintSession);
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(CD2A0A4F-0DE9-4c51-9232-42668F559F94)]
[scriptable, uuid(3D3CF688-D988-4319-9CA2-1D7D20A116D8)]
interface nsIPrintSettingsX : nsISupports
{
@ -87,4 +87,13 @@ interface nsIPrintSettingsX : nsISupports
*/
[noscript] void readPageFormatFromPrefs();
[noscript] void writePageFormatToPrefs();
/**
* cleanUpAfterDialog
*
* After bringing up Carbon print dialogs, clean up menus.
* See bug 425844 for details.
*/
[noscript] void cleanUpAfterCarbonDialog();
};

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

@ -48,6 +48,9 @@
#include "prmem.h"
#include "prnetdb.h"
#include "nsCocoaWindow.h"
#include "nsMenuBarX.h"
#include "nsMenuUtilsX.h"
// This struct should be represented identically on all architectures, and
// there shouldn't be any padding before the data field.
@ -532,3 +535,20 @@ OSStatus nsPrintSettingsX::CreateDefaultPrintSettings(PMPrintSession aSession, P
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(noErr);
}
NS_IMETHODIMP nsPrintSettingsX::CleanUpAfterCarbonDialog()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NSWindow* mainWindow = [NSApp mainWindow];
if (mainWindow) {
[WindowDelegate paintMenubarForWindow:mainWindow];
} else {
nsMenuBarX* hiddenWindowMenuBar = nsMenuUtilsX::GetHiddenWindowMenuBar();
if (hiddenWindowMenuBar)
hiddenWindowMenuBar->Paint();
}
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}