Revision: 16751
http://sourceforge.net/p/skim-app/code/16751
Author: hofman
Date: 2026-10-30 16:43:19 +0000 (Fri, 30 Oct 2026)
Log Message:
-----------
guess icon from path of bookmark when url resolving fails
Modified Paths:
--------------
trunk/SKAlias.h
trunk/SKAlias.m
trunk/SKBookmark.m
Modified: trunk/SKAlias.h
===================================================================
--- trunk/SKAlias.h 2026-10-30 16:03:45 UTC (rev 16750)
+++ trunk/SKAlias.h 2026-10-30 16:43:19 UTC (rev 16751)
@@ -50,6 +50,7 @@
@property (nonatomic, nullable, readonly) NSURL *fileURL;
@property (nonatomic, nullable, readonly) NSURL *fileURLNoUI;
@property (nonatomic, nullable, readonly) NSString *name;
+@property (nonatomic, nullable, readonly) NSString *fileType;
- (nullable instancetype)initWithAliasData:(NSData *)data
NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithBookmarkData:(NSData *)data
NS_DESIGNATED_INITIALIZER;
Modified: trunk/SKAlias.m
===================================================================
--- trunk/SKAlias.m 2026-10-30 16:03:45 UTC (rev 16750)
+++ trunk/SKAlias.m 2026-10-30 16:43:19 UTC (rev 16751)
@@ -243,4 +243,17 @@
return name;
}
+- (NSString *)fileType {
+ NSString *type = nil;
+ NSURL *fileURL = [self fileURLNoUI];
+ if (fileURL) {
+ type = [[NSWorkspace sharedWorkspace] typeOfFile:[fileURL path]
error:NULL];
+ } else if (aliasHandle == nil) {
+ NSString *ext = [[[NSURL resourceValuesForKeys:@[NSURLPathKey]
fromBookmarkData:data] objectForKey:NSURLPathKey] pathExtension];
+ if (ext)
+ type =
CFBridgingRelease(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
(__bridge CFStringRef)ext, NULL));
+ }
+ return type;
+}
+
@end
Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m 2026-10-30 16:03:45 UTC (rev 16750)
+++ trunk/SKBookmark.m 2026-10-30 16:43:19 UTC (rev 16751)
@@ -549,9 +549,7 @@
}
- (NSImage *)icon {
- NSURL *fileURL = [self fileURL];
- NSString *type = fileURL ? [[NSWorkspace sharedWorkspace]
typeOfFile:[fileURL path] error:NULL] : nil;
- return [[self class] iconForFileType:type hasSetup:[setup
objectForKey:SKDocumentSetupWindowFrameKey] != nil];
+ return [[self class] iconForFileType:[alias fileType] hasSetup:[setup
objectForKey:SKDocumentSetupWindowFrameKey] != nil];
}
- (NSUInteger)pageIndex {
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