Revision: 2631 http://skim-app.svn.sourceforge.net/skim-app/?rev=2631&view=rev Author: hofman Date: 2007-08-09 04:40:55 -0700 (Thu, 09 Aug 2007)
Log Message: ----------- Mark file as changed on disk when file is deleted, so the Revert menu item can be activated if the file is restored. Modified Paths: -------------- trunk/SKDocument.m Modified: trunk/SKDocument.m =================================================================== --- trunk/SKDocument.m 2007-08-09 09:39:08 UTC (rev 2630) +++ trunk/SKDocument.m 2007-08-09 11:40:55 UTC (rev 2631) @@ -77,6 +77,7 @@ - (void)stopCheckingFileUpdates; - (void)handleFileUpdateNotification:(NSNotification *)notification; - (void)handleFileMoveNotification:(NSNotification *)notification; +- (void)handleFileDeleteNotification:(NSNotification *)notification; - (void)handleWindowWillCloseNotification:(NSNotification *)notification; - (void)handleWindowDidEndSheetNotification:(NSNotification *)notification; @@ -822,7 +823,7 @@ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(handleFileUpdateNotification:) name:UKFileWatcherWriteNotification object:kQueue]; [nc addObserver:self selector:@selector(handleFileMoveNotification:) name:UKFileWatcherRenameNotification object:kQueue]; - [nc addObserver:self selector:@selector(handleFileMoveNotification:) name:UKFileWatcherDeleteNotification object:kQueue]; + [nc addObserver:self selector:@selector(handleFileDeleteNotification:) name:UKFileWatcherDeleteNotification object:kQueue]; } else if (nil == fileUpdateTimer) { // Let the runloop retain the timer; timer retains us. Use a fairly long delay since this is likely a network volume. fileUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:(double)2.0 target:self selector:@selector(checkForFileModification:) userInfo:nil repeats:YES]; @@ -928,6 +929,12 @@ // If the file is moved, NSDocument will notice and will call setFileURL, where we start watching again } +- (void)handleFileDeleteNotification:(NSNotification *)notification { + if ([watchedFile isEqualToString:[[notification userInfo] objectForKey:@"path"]]) + [self stopCheckingFileUpdates]; + fileChangedOnDisk = YES; +} + - (void)handleWindowWillCloseNotification:(NSNotification *)notification { NSWindow *window = [notification object]; // ignore when we're switching fullscreen/main windows This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit