Bug 1660296 - Implement Get/SetNumCopies in the macOS print settings backend. r=jwatt

Differential Revision: https://phabricator.services.mozilla.com/D87880
This commit is contained in:
Jonathan Kew 2020-08-21 15:47:04 +00:00
parent a37d79921f
commit e58849d935
2 changed files with 38 additions and 0 deletions

View File

@ -73,6 +73,9 @@ class nsPrintSettingsX : public nsPrintSettings {
NS_IMETHOD GetOrientation(int32_t* aOrientation) override;
NS_IMETHOD SetOrientation(int32_t aOrientation) override;
NS_IMETHOD GetNumCopies(int32_t* aCopies) override;
NS_IMETHOD SetNumCopies(int32_t aCopies) override;
NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop) override;
NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft) override;
NS_IMETHOD SetUnwriteableMarginBottom(

View File

@ -495,6 +495,41 @@ nsPrintSettingsX::SetOrientation(int32_t aOrientation) {
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP
nsPrintSettingsX::GetNumCopies(int32_t* aCopies) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
// Only use NSPrintInfo data in the parent process. The
// child process' instance is not needed or used.
if (XRE_IsParentProcess()) {
NSDictionary* dict = [mPrintInfo dictionary];
*aCopies = [[dict objectForKey:NSPrintCopies] intValue];
} else {
nsPrintSettings::GetNumCopies(aCopies);
}
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP
nsPrintSettingsX::SetNumCopies(int32_t aCopies) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
// Only use NSPrintInfo data in the parent process. The
// child process' instance is not needed or used.
if (XRE_IsParentProcess()) {
NSMutableDictionary* dict = [mPrintInfo dictionary];
[dict setObject:[NSNumber numberWithInt:aCopies] forKey:NSPrintCopies];
} else {
nsPrintSettings::SetNumCopies(aCopies);
}
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP
nsPrintSettingsX::SetUnwriteableMarginTop(double aUnwriteableMarginTop) {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;