Skip to content
Browse files

Hidden default to disable automatically opening Sequential for suppor…

…ted MIME types.
  • Loading branch information...
1 parent e5ccf8c commit 0f8674e4f7a4e1b44cd6e3de8582499d38a1ddea @btrask committed
Showing with 10 additions and 3 deletions.
  1. +10 −3 SBPController.m
View
13 SBPController.m
@@ -33,6 +33,8 @@
#import "NSObjectAdditions.h"
#import "NSViewAdditions.h"
+static NSString *const SBPAutomaticallyOpenForSupportedMIMETypesKey = @"SBPAutomaticallyOpenForSupportedMIMETypes";
+
static Class SBPUIDelegateClass;
static NSArray *(*SBPUIDelegateClass_webView_contextMenuItemsForElement_defaultMenuItems)(id, SEL, WebView *, NSDictionary *, NSArray *);
@@ -107,9 +109,14 @@ + (void)load
[menu insertItem:backgroundItem atIndex:index + 1];
}
- NSString *MIMEType;
- NSEnumerator *const MIMETypeEnum = [[self supportedMIMETypes] objectEnumerator];
- while((MIMEType = [MIMETypeEnum nextObject])) [WebView registerViewClass:[SBPDocumentView class] representationClass:[SBPDocumentRepresentation class] forMIMEType:MIMEType];
+ NSUserDefaults *const defaults = [[[NSUserDefaults alloc] init] autorelease];
+ [defaults addSuiteNamed:[[NSBundle bundleForClass:self] bundleIdentifier]];
+ [defaults registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], SBPAutomaticallyOpenForSupportedMIMETypesKey, nil]];
+ if([defaults boolForKey:SBPAutomaticallyOpenForSupportedMIMETypesKey]) {
+ NSString *MIMEType;
+ NSEnumerator *const MIMETypeEnum = [[self supportedMIMETypes] objectEnumerator];
+ while((MIMEType = [MIMETypeEnum nextObject])) [WebView registerViewClass:[SBPDocumentView class] representationClass:[SBPDocumentRepresentation class] forMIMEType:MIMEType];
+ }
SBPUIDelegateClass_webView_contextMenuItemsForElement_defaultMenuItems = (NSArray *(*)(id, SEL, WebView *, NSDictionary *, NSArray *))[SBPUIDelegateClass SBP_useImplementationFromClass:self forSelector:@selector(webView:contextMenuItemsForElement:defaultMenuItems:)];
}

0 comments on commit 0f8674e

Please sign in to comment.
Something went wrong with that request. Please try again.