aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPPrintAccessory.m
diff options
context:
space:
mode:
authorbamse16 <marius@marius.me.uk>2009-06-04 12:44:22 +0000
committerbamse16 <marius@marius.me.uk>2009-06-04 12:44:22 +0000
commitf3e421d2e4ba9ec54878968c34044dce89dc6f09 (patch)
tree9aef4cc69ef64799984fbc6c27ee2a1bab86078d /Source/SPPrintAccessory.m
parentc9ca5d2a18f7dcbe1915d8602c399f83259a7850 (diff)
downloadsequelpro-f3e421d2e4ba9ec54878968c34044dce89dc6f09.tar.gz
sequelpro-f3e421d2e4ba9ec54878968c34044dce89dc6f09.tar.bz2
sequelpro-f3e421d2e4ba9ec54878968c34044dce89dc6f09.zip
Added print accesory view with option to Print Backgrounds
Diffstat (limited to 'Source/SPPrintAccessory.m')
-rw-r--r--Source/SPPrintAccessory.m46
1 files changed, 46 insertions, 0 deletions
diff --git a/Source/SPPrintAccessory.m b/Source/SPPrintAccessory.m
new file mode 100644
index 00000000..4128e8ad
--- /dev/null
+++ b/Source/SPPrintAccessory.m
@@ -0,0 +1,46 @@
+#import "SPPrintAccessory.h"
+#import <WebKit/WebKit.h>
+
+@implementation SPPrintAccessory
+
+- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
+{
+ defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
+ return [super initWithNibName:@"printAccessory" bundle:nibBundleOrNil];
+}
+
+- (void)awakeFromNib
+{
+ [self setView:printAccessoryView];
+ [defaultsController addObserver:self forKeyPath:@"values.PrintBackground" options:NSKeyValueObservingOptionNew context:@"PrinterSettingsChanged"];
+}
+
+- (NSArray *)localizedSummaryItems
+{
+ return [NSArray arrayWithObject:[NSDictionary dictionary]];
+}
+
+- (NSSet *)keyPathsForValuesAffectingPreview
+{
+ return [NSSet setWithObjects:
+ @"defaultsController.values.PrintBackground",
+// @"defaultsController.values.PrintGrid",
+ nil];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ if ([(NSString *)context isEqualToString:@"PrinterSettingsChanged"]) {
+ [[WebPreferences standardPreferences] setShouldPrintBackgrounds:[[defaultsController valueForKeyPath:@"values.PrintBackground"] boolValue] ];
+ } else {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ }
+}
+
+- (void)dealloc
+{
+ [defaultsController removeObserver:self forKeyPath:@"values.PrintBackground"];
+ [super dealloc];
+}
+
+@end \ No newline at end of file