Revision: 5685
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5685&view=rev
Author:   hofman
Date:     2009-09-05 19:08:25 +0000 (Sat, 05 Sep 2009)

Log Message:
-----------
Reopen last open files when relaunching after an update through Sparkle

Modified Paths:
--------------
    trunk/SKApplicationController.m

Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m     2009-09-05 18:27:47 UTC (rev 5684)
+++ trunk/SKApplicationController.m     2009-09-05 19:08:25 UTC (rev 5685)
@@ -85,6 +85,7 @@
 
 #define CURRENTDOCUMENTSETUP_KEY @"currentDocumentSetup"
 
+#define SKIsRelaunchKey                     @"SKIsRelaunch"
 #define SKSpotlightVersionInfoKey           @"SKSpotlightVersionInfo"
 #define SKSpotlightLastImporterVersionKey   @"lastImporterVersion"
 #define SKSpotlightLastSysVersionKey        @"lastSysVersion"
@@ -144,7 +145,7 @@
 
 - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender{
     
-    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKReopenLastOpenFilesKey]) {
+    if ([[NSUserDefaults standardUserDefaults] 
boolForKey:SKReopenLastOpenFilesKey] || [[NSUserDefaults standardUserDefaults] 
boolForKey:SKIsRelaunchKey]) {
         NSArray *files = [[NSUserDefaults standardUserDefaults] 
objectForKey:SKLastOpenFileNamesKey];
         NSEnumerator *fileEnum = [files reverseObjectEnumerator];
         NSDictionary *dict;
@@ -155,6 +156,7 @@
             if (nil == [[NSDocumentController sharedDocumentController] 
openDocumentWithSetup:dict error:&error] && error)
                 [NSApp presentError:error];
         }
+        [[NSUserDefaults standardUserDefaults] 
removeObjectForKey:SKIsRelaunchKey];
     }
     
     return NO;
@@ -241,6 +243,10 @@
     return YES;
 }
 
+- (void)updaterWillRelaunchApplication:(SUUpdater *)updater {
+    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:SKIsRelaunchKey];
+}
+
 #pragma mark Services Support
 
 - (void)openDocumentFromURLOnPboard:(NSPasteboard *)pboard userData:(NSString 
*)userData error:(NSString **)errorString {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to