|
@@ -274,6 +274,10 @@ static KMPDFEditAppendWindow *windowController = nil;
|
|
|
|
|
|
[super windowDidLoad];
|
|
[super windowDidLoad];
|
|
|
|
|
|
|
|
+ if ([self mergeCountIsReach]) {
|
|
|
|
+ NSLog(@"合并次数已达到限制. count: %ld", [self getMergeCount]);
|
|
|
|
+ }
|
|
|
|
+
|
|
self.window.contentView.wantsLayer = YES;
|
|
self.window.contentView.wantsLayer = YES;
|
|
self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
|
self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
|
|
|
|
|
|
@@ -1316,6 +1320,7 @@ static KMPDFEditAppendWindow *windowController = nil;
|
|
|
|
|
|
if (self->_isSuccessfully) {
|
|
if (self->_isSuccessfully) {
|
|
[self _clearData];
|
|
[self _clearData];
|
|
|
|
+ [self recordMergeCount];
|
|
|
|
|
|
[NSApp endSheet:[self window] returnCode:[(NSView *)sender tag]];
|
|
[NSApp endSheet:[self window] returnCode:[(NSView *)sender tag]];
|
|
[[self window] orderOut:self];
|
|
[[self window] orderOut:self];
|
|
@@ -1407,6 +1412,7 @@ static KMPDFEditAppendWindow *windowController = nil;
|
|
|
|
|
|
if (self->_isSuccessfully) {
|
|
if (self->_isSuccessfully) {
|
|
[self _clearData];
|
|
[self _clearData];
|
|
|
|
+ [self recordMergeCount];
|
|
|
|
|
|
[NSApp endSheet:[self window] returnCode:[(NSView *)sender tag]];
|
|
[NSApp endSheet:[self window] returnCode:[(NSView *)sender tag]];
|
|
[[self window] orderOut:self];
|
|
[[self window] orderOut:self];
|
|
@@ -1693,3 +1699,33 @@ static KMPDFEditAppendWindow *windowController = nil;
|
|
}
|
|
}
|
|
|
|
|
|
@end
|
|
@end
|
|
|
|
+
|
|
|
|
+static NSString *kKMMergeCountKey = @"KMMergeCountKey";
|
|
|
|
+static NSInteger kKMMergeCountMax = 2;
|
|
|
|
+
|
|
|
|
+@implementation KMPDFEditAppendWindow (KMExtension)
|
|
|
|
+
|
|
|
|
+- (BOOL)mergeCountIsReach {
|
|
|
|
+ NSInteger cnt = [self getMergeCount];
|
|
|
|
+ if (cnt >= kKMMergeCountMax) {
|
|
|
|
+ return YES;
|
|
|
|
+ }
|
|
|
|
+ return NO;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)recordMergeCount {
|
|
|
|
+ NSInteger cnt = [self getMergeCount];
|
|
|
|
+ [[NSUserDefaults standardUserDefaults] setInteger:cnt+1 forKey:kKMMergeCountKey];
|
|
|
|
+ [[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)clearMergeCount {
|
|
|
|
+ [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:kKMMergeCountKey];
|
|
|
|
+ [[NSUserDefaults standardUserDefaults] synchronize];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (NSInteger)getMergeCount {
|
|
|
|
+ return [[NSUserDefaults standardUserDefaults] integerForKey:kKMMergeCountKey];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@end
|