Revision: 16776
          http://sourceforge.net/p/skim-app/code/16776
Author:   hofman
Date:     2026-11-01 22:37:13 +0000 (Sun, 01 Nov 2026)
Log Message:
-----------
scripting accessibility of children is only available for folder bookmarks

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

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2026-11-01 22:28:15 UTC (rev 16775)
+++ trunk/SKBookmark.m  2026-11-01 22:37:13 UTC (rev 16776)
@@ -256,11 +256,12 @@
 - (NSArray *)entireContents { return nil; }
 
 - (BOOL)isExpanded {
-    return [[SKBookmarkController sharedBookmarkController] 
isBookmarkExpanded:self];
+    return [self bookmarkType] == SKBookmarkTypeFolder && 
[[SKBookmarkController sharedBookmarkController] isBookmarkExpanded:self];
 }
 
 - (void)setExpanded:(BOOL)flag {
-    [[SKBookmarkController sharedBookmarkController] setExpanded:flag 
forBookmark:self];
+    if ([self bookmarkType] == SKBookmarkTypeFolder)
+        [[SKBookmarkController sharedBookmarkController] setExpanded:flag 
forBookmark:self];
 }
 
 - (NSArray *)bookmarks {
@@ -268,11 +269,21 @@
 }
 
 - (void)insertObject:(SKBookmark *)bookmark 
inBookmarksAtIndex:(NSUInteger)anIndex {
-    [[SKBookmarkController sharedBookmarkController] insertBookmark:bookmark 
atIndex:anIndex ofBookmark:self animate:NO];
+    if ([self bookmarkType] == SKBookmarkTypeFolder) {
+        [[SKBookmarkController sharedBookmarkController] 
insertBookmark:bookmark atIndex:anIndex ofBookmark:self animate:NO];
+    } else {
+        [[NSScriptCommand currentCommand] 
setScriptErrorNumber:NSReceiversCantHandleCommandScriptError];
+        [[NSScriptCommand currentCommand] setScriptErrorString:@"Invalid 
container for bookmark."];
+    }
 }
 
 - (void)removeObjectFromBookmarksAtIndex:(NSUInteger)anIndex {
-    [[SKBookmarkController sharedBookmarkController] 
removeBookmarkAtIndex:anIndex ofBookmark:self animate:NO];
+    if ([self bookmarkType] == SKBookmarkTypeFolder) {
+        [[SKBookmarkController sharedBookmarkController] 
removeBookmarkAtIndex:anIndex ofBookmark:self animate:NO];
+    } else {
+        [[NSScriptCommand currentCommand] 
setScriptErrorNumber:NSReceiversCantHandleCommandScriptError];
+        [[NSScriptCommand currentCommand] setScriptErrorString:@"Invalid 
container for bookmark."];
+    }
 }
 
 - (id)newScriptingObjectOfClass:(Class)objectClass forValueForKey:(NSString 
*)key withContentsValue:(id)contentsValue properties:(NSDictionary *)properties 
{

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

Reply via email to