Revision: 15159
http://sourceforge.net/p/skim-app/code/15159
Author: hofman
Date: 2025-05-06 15:03:40 +0000 (Tue, 06 May 2025)
Log Message:
-----------
Compare user info key of notification to check if an app was simply launched
rather than setting a flag in various delegate methods
Modified Paths:
--------------
trunk/SKApplicationController.m
trunk/SKDocumentController.h
trunk/SKDocumentController.m
Modified: trunk/SKApplicationController.m
===================================================================
--- trunk/SKApplicationController.m 2025-05-04 22:10:18 UTC (rev 15158)
+++ trunk/SKApplicationController.m 2025-05-06 15:03:40 UTC (rev 15159)
@@ -215,7 +215,7 @@
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification{
NSUserDefaults *sud = [NSUserDefaults standardUserDefaults];
- if (didCheckReopen == NO && [[NSApp windows] count] == 0 &&
[(SKDocumentController *)[NSDocumentController sharedDocumentController]
openedFile] == NO)
+ if (didCheckReopen == NO && [[[aNotification userInfo]
objectForKey:NSApplicationLaunchIsDefaultLaunchKey] boolValue])
[self applicationShouldOpenUntitledFile:NSApp];
didCheckReopen = YES;
[sud removeObjectForKey:SKIsRelaunchKey];
@@ -256,8 +256,6 @@
}
- (void)application:(NSApplication *)application openURLs:(NSArray *)urls {
- didCheckReopen = YES;
-
NSAppleEventDescriptor *errr = [[[NSAppleEventManager
sharedAppleEventManager] currentAppleEvent] descriptorForKeyword:'errr'];
BOOL errorReporting = errr ? [errr booleanValue] : YES;
@@ -292,8 +290,6 @@
}
- (NSApplicationPrintReply)application:(NSApplication *)application
printFiles:(NSArray *)fileNames withSettings:(NSDictionary *)printSettings
showPrintPanels:(BOOL)showPrintPanels {
- didCheckReopen = YES;
-
// keep track to see whether we finished before this method returns
__block NSApplicationPrintReply reply = NSNotFound;
NSMutableArray *fileURLs = [NSMutableArray array];
Modified: trunk/SKDocumentController.h
===================================================================
--- trunk/SKDocumentController.h 2025-05-04 22:10:18 UTC (rev 15158)
+++ trunk/SKDocumentController.h 2025-05-06 15:03:40 UTC (rev 15159)
@@ -68,7 +68,6 @@
@class SKBookmark;
@interface SKDocumentController : NSDocumentController {
- BOOL openedFile;
Class openDocumentClass;
}
@@ -85,8 +84,6 @@
- (nullable Class)documentClassForContentsOfURL:(NSURL *)inAbsoluteURL;
-@property (nonatomic, readonly) BOOL openedFile;
-
@end
NS_ASSUME_NONNULL_END
Modified: trunk/SKDocumentController.m
===================================================================
--- trunk/SKDocumentController.m 2025-05-04 22:10:18 UTC (rev 15158)
+++ trunk/SKDocumentController.m 2025-05-06 15:03:40 UTC (rev 15159)
@@ -93,13 +93,10 @@
@implementation SKDocumentController
-@synthesize openedFile;
-
- (instancetype)init {
self = [super init];
if (self) {
[self setAutosavingDelay:[[NSUserDefaults standardUserDefaults]
doubleForKey:SKAutosaveIntervalKey]];
- openedFile = NO;
}
return self;
}
@@ -245,8 +242,6 @@
}
- (void)openDocumentWithImageFromPasteboard:(NSPasteboard *)pboard
completionHandler:(void (^)(NSDocument *document, BOOL documentWasAlreadyOpen,
NSError *error))completionHandler {
- openedFile = YES;
-
NSData *data = nil;
NSString *type = nil;
@@ -292,8 +287,6 @@
}
- (void)openDocumentWithURLFromPasteboard:(NSPasteboard *)pboard
showNotes:(BOOL)showNotes completionHandler:(void (^)(NSDocument *document,
BOOL documentWasAlreadyOpen, NSError *error))completionHandler {
- openedFile = YES;
-
NSArray *theURLs = [NSURL readURLsFromPasteboard:pboard];
NSURL *theURL = [theURLs count] > 0 ? [theURLs objectAtIndex:0] : nil;
@@ -588,8 +581,6 @@
}
- (void)openDocumentWithContentsOfURL:(NSURL *)absoluteURL
display:(BOOL)displayDocument completionHandler:(void (^)(NSDocument *document,
BOOL documentWasAlreadyOpen, NSError *error))completionHandler {
- openedFile = YES;
-
NSString *fragment = [absoluteURL fragment];
NSDictionary *options = optionsFromFragmentAndEvent(fragment);
NSString *type = [self typeForContentsOfURL:absoluteURL error:NULL];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit