Add openDocuments property to OakDocumentController

This uses OakDocument’s isOpen property to know which documents are open.

Currently not KVO compliant, but it probably should be.
This commit is contained in:
Allan Odgaard
2016-09-18 10:31:50 +02:00
parent fa2eaa1e50
commit 532e9742d2
2 changed files with 6 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ PUBLIC @interface OakDocumentController : NSObject
- (OakDocument*)documentWithPath:(NSString*)aPath;
- (OakDocument*)findDocumentWithIdentifier:(NSUUID*)anUUID;
- (NSArray<OakDocument*>*)documents;
- (NSArray<OakDocument*>*)openDocuments;
- (NSInteger)lruRankForDocument:(OakDocument*)aDocument;
- (void)didTouchDocument:(OakDocument*)aDocument;

View File

@@ -188,6 +188,11 @@ namespace
return res;
}
- (NSArray<OakDocument*>*)openDocuments
{
return [self.documents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"isOpen == YES"]];
}
// ======================
// = Last Recently Used =
// ======================