|
From: <ho...@us...> - 2025-10-23 16:50:48
|
Revision: 15701
http://sourceforge.net/p/skim-app/code/15701
Author: hofman
Date: 2025-10-23 16:50:47 +0000 (Thu, 23 Oct 2025)
Log Message:
-----------
find recently closed bookmarks only when popuplating its submenu
Modified Paths:
--------------
trunk/SKBookmarkController.m
Modified: trunk/SKBookmarkController.m
===================================================================
--- trunk/SKBookmarkController.m 2025-10-23 16:31:28 UTC (rev 15700)
+++ trunk/SKBookmarkController.m 2025-10-23 16:50:47 UTC (rev 15701)
@@ -624,6 +624,13 @@
}
- (SKBookmark *)closedDocumentsBookmark {
+ if ([recentDocuments count] > [[[NSDocumentController sharedDocumentController] documents] count])
+ return [[SKBookmark alloc] initFolderWithChildren:nil label:NSLocalizedString(@"Recently Closed", @"Menu item title")];
+ else
+ return nil;
+}
+
+- (NSArray *)closedDocumentBookmarks {
NSArray *openFileURLs = [[[NSDocumentController sharedDocumentController] documents] valueForKey:@"fileURL"];
NSMutableArray *closedBms = [NSMutableArray array];
for (SKBookmark *aBm in recentDocuments) {
@@ -631,9 +638,7 @@
if (fileURL && ([closedBms count] > 0 || [openFileURLs containsObject:fileURL] == NO))
[closedBms addObject:aBm];
}
- if ([closedBms count] > 0)
- return [[SKBookmark alloc] initFolderWithChildren:closedBms label:NSLocalizedString(@"Recently Closed", @"Menu item title")];
- return nil;
+ return closedBms;
}
- (SKBookmark *)currentDocumentBookmark {
@@ -698,6 +703,10 @@
if ([bookmark isKindOfClass:[SKBookmark class]]) {
NSArray *bookmarks = [bookmark children];
+ if (tag == SKBookmarkTagClosedDocuments && [bookmarks count] == 0) {
+ bookmarks = [self closedDocumentBookmarks];
+ [bookmark insertChildren:bookmarks atIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [bookmarks count])]];
+ }
if (tag == SKBookmarkTagBookmarksMenu) {
NSInteger i = [menu numberOfItems];
while (i-- > 0 && ([[menu itemAtIndex:i] isSeparatorItem] || [[menu itemAtIndex:i] representedObject]))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|