From 1daaa2075e0b0e6e90844a42b609997018306f83 Mon Sep 17 00:00:00 2001 From: michael starke Date: Mon, 25 Aug 2014 02:59:56 +0200 Subject: [PATCH] Draft for timeout --- MacPass/MPDocument.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/MacPass/MPDocument.m b/MacPass/MPDocument.m index b2ac3a6f..8ff206ac 100644 --- a/MacPass/MPDocument.m +++ b/MacPass/MPDocument.m @@ -293,6 +293,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey self.compositeKey = nil; // clear the key? } if(isUnlocked) { + self.unlockCount += 1; [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidUnlockDatabaseNotification object:self]; } @@ -679,6 +680,17 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey } [self.trash clear]; } +# pragma mark Expiration updates +- (void)_updateExpirationState { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(60*60*6* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + /* TODO: find better way to do this! Test for alle entries if expired */ + [[self.tree allEntries] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + KPKEntry *entry = obj; + [entry.timeInfo willChangeValueForKey:NSStringFromSelector(@selector(isExpired))]; + [entry.timeInfo didChangeValueForKey:NSStringFromSelector(@selector(isExpired))]; + }]; + }); +} # pragma mark File Watching - (void) _watchForFileChanges:(BOOL)watch {