Revision: 16762
          http://sourceforge.net/p/skim-app/code/16762
Author:   hofman
Date:     2026-10-31 17:58:34 +0000 (Sat, 31 Oct 2026)
Log Message:
-----------
Allow initalizing setup bookmark without alias/bookmark data, otherwise the tab 
indexes for a session bookmark are wrong

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

Modified: trunk/SKBookmark.m
===================================================================
--- trunk/SKBookmark.m  2026-10-31 17:25:33 UTC (rev 16761)
+++ trunk/SKBookmark.m  2026-10-31 17:58:34 UTC (rev 16762)
@@ -481,22 +481,18 @@
             alias = [[SKAlias alloc] initWithAliasData:data];
         else if ((data = [aSetupDict objectForKey:BOOKMARK_KEY]))
             alias = [[SKAlias alloc] initWithBookmarkData:data];
-        if (alias) {
-            NSNumber *pageIndexNumber = [aSetupDict 
objectForKey:PAGEINDEX_KEY];
-            pageIndex = pageIndexNumber ? [pageIndexNumber 
unsignedIntegerValue] : NSNotFound;
-            label = [aLabel copy];
-            if ([aSetupDict objectForKey:SKDocumentSetupWindowFrameKey]) {
-                setup = [aSetupDict mutableCopy];
-                [(NSMutableDictionary *)setup removeObjectsForKeys:@[TYPE_KEY, 
ALIASDATA_KEY, BOOKMARK_KEY, LABEL_KEY]];
-                if (pageIndexNumber && pageIndex == NSNotFound)
-                    [(NSMutableDictionary *)setup 
removeObjectForKey:PAGEINDEX_KEY];
-            } else if ([aSetupDict objectForKey:SNAPSHOTS_KEY]) {
-                setup = @{SNAPSHOTS_KEY:[aSetupDict 
objectForKey:SNAPSHOTS_KEY]};
-            } else {
-                setup = nil;
-            }
+        NSNumber *pageIndexNumber = [aSetupDict objectForKey:PAGEINDEX_KEY];
+        pageIndex = pageIndexNumber ? [pageIndexNumber unsignedIntegerValue] : 
NSNotFound;
+        label = [aLabel copy];
+        if ([aSetupDict objectForKey:SKDocumentSetupWindowFrameKey]) {
+            setup = [aSetupDict mutableCopy];
+            [(NSMutableDictionary *)setup removeObjectsForKeys:@[TYPE_KEY, 
ALIASDATA_KEY, BOOKMARK_KEY, LABEL_KEY]];
+            if (pageIndexNumber && pageIndex == NSNotFound)
+                [(NSMutableDictionary *)setup 
removeObjectForKey:PAGEINDEX_KEY];
+        } else if ([aSetupDict objectForKey:SNAPSHOTS_KEY]) {
+            setup = @{SNAPSHOTS_KEY:[aSetupDict objectForKey:SNAPSHOTS_KEY]};
         } else {
-            self = nil;
+            setup = nil;
         }
     }
     return self;
@@ -511,7 +507,12 @@
     NSData *data = [alias data];
     NSString *dataKey = [alias isBookmark] ? BOOKMARK_KEY : ALIASDATA_KEY;
     [properties removeObjectForKey:[dataKey isEqualToString:ALIASDATA_KEY] ? 
BOOKMARK_KEY : ALIASDATA_KEY];
+    [properties setObject:BOOKMARK_STRING forKey:TYPE_KEY];
+    [properties setValue:data forKey:dataKey];
+    [properties setValue:label forKey:LABEL_KEY];
     [properties addEntriesFromDictionary:[NSDictionary 
dictionaryWithObjectsAndKeys:BOOKMARK_STRING, TYPE_KEY, data, dataKey, label, 
LABEL_KEY, nil]];
+    if (data == nil && label)
+        [properties setObject:label forKey:LABEL_KEY];
     if (pageIndex != NSNotFound) {
         [properties setObject:[NSNumber numberWithUnsignedInteger:pageIndex] 
forKey:PAGEINDEX_KEY];
         if ([setup objectForKey:PAGEINDEX_KEY] && [[setup 
objectForKey:PAGEINDEX_KEY] unsignedIntegerValue] != 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

Reply via email to