diff --git a/Vienna/Sources/Database/Database.h b/Vienna/Sources/Database/Database.h index 21eb2c1c84..272b5ef7fb 100644 --- a/Vienna/Sources/Database/Database.h +++ b/Vienna/Sources/Database/Database.h @@ -24,6 +24,7 @@ @class Folder; @class Field; @class Article; +@class ArticleReference; @class CriteriaTree; typedef NS_OPTIONS(NSInteger, VNAQueryScope) { @@ -109,8 +110,8 @@ extern NSNotificationName const VNADatabaseDidDeleteFolderNotification; -(BOOL)addArticle:(Article *)article toFolder:(NSInteger)folderID; -(BOOL)updateArticle:(Article *)existingArticle ofFolder:(NSInteger)folderID withArticle:(Article *)article; -(BOOL)deleteArticle:(Article *)article; --(NSArray *)arrayOfUnreadArticlesRefs:(NSInteger)folderId; --(NSArray *)arrayOfArticles:(NSInteger)folderId filterString:(NSString *)filterString; +-(NSArray *)arrayOfUnreadArticlesRefs:(NSInteger)folderId; +-(NSArray
*)arrayOfArticles:(NSInteger)folderId filterString:(NSString *)filterString; -(void)markArticleRead:(NSInteger)folderId guid:(NSString *)guid isRead:(BOOL)isRead; -(void)markArticleFlagged:(NSInteger)folderId guid:(NSString *)guid isFlagged:(BOOL)isFlagged; -(void)markArticleDeleted:(Article *)article isDeleted:(BOOL)isDeleted; diff --git a/Vienna/Sources/Database/Database.m b/Vienna/Sources/Database/Database.m index 691bf4face..a5c381ec76 100644 --- a/Vienna/Sources/Database/Database.m +++ b/Vienna/Sources/Database/Database.m @@ -2171,7 +2171,7 @@ -(CriteriaTree *)criteriaForFolder:(NSInteger)folderId * articles in the specified folder. * Note : when possible, you should use the interface provided by the Folder class instead of this */ --(NSArray *)arrayOfUnreadArticlesRefs:(NSInteger)folderId +-(NSArray *)arrayOfUnreadArticlesRefs:(NSInteger)folderId { Folder * folder = [self folderFromID:folderId]; if (folder != nil) { diff --git a/Vienna/Sources/Main window/ArticleController.m b/Vienna/Sources/Main window/ArticleController.m index c849d5d5cc..286bd077f7 100644 --- a/Vienna/Sources/Main window/ArticleController.m +++ b/Vienna/Sources/Main window/ArticleController.m @@ -43,7 +43,7 @@ @interface ArticleController () --(NSArray *)applyFilter:(NSArray *)unfilteredArray; +-(NSArray
*)applyFilter:(NSArray
*)unfilteredArray; -(void)setSortColumnIdentifier:(NSString *)str; -(void)innerMarkReadByArray:(NSArray *)articleArray readFlag:(BOOL)readFlag; -(void)innerMarkFlaggedByArray:(NSArray *)articleArray flagged:(BOOL)flagged; @@ -521,7 +521,7 @@ -(void)refilterArrayOfArticles * Apply the active filter to unfilteredArray and return the filtered array. * This is done here rather than in the folder management code for simplicity. */ --(NSArray *)applyFilter:(NSArray *)unfilteredArray +-(NSArray
*)applyFilter:(NSArray
*)unfilteredArray { NSMutableArray * filteredArray = [NSMutableArray arrayWithArray:unfilteredArray]; @@ -875,7 +875,7 @@ -(void)markAllFoldersReadByArray:(NSArray *)folderArray * Given an array of folders, mark all the articles in those folders as read and * return a reference array listing all the articles that were actually marked. */ --(NSArray *)wrappedMarkAllFoldersReadInArray:(NSArray *)folderArray +-(NSArray *)wrappedMarkAllFoldersReadInArray:(NSArray *)folderArray { NSMutableArray * refArray = [NSMutableArray array]; @@ -887,15 +887,16 @@ -(NSArray *)wrappedMarkAllFoldersReadInArray:(NSArray *)folderArray [refArray addObjectsFromArray:[folder arrayOfUnreadArticlesRefs]]; [[Database sharedManager] markFolderRead:folderId]; } else if (folder.type == VNAFolderTypeOpenReader) { - NSArray * articleArray = [folder arrayOfUnreadArticlesRefs]; - [refArray addObjectsFromArray:articleArray]; + [refArray addObjectsFromArray:[folder arrayOfUnreadArticlesRefs]]; [[OpenReader sharedManager] markAllReadInFolder:folder]; } else { // For smart folders, we only mark read articles which should be visible with current filters NSString *filterString = APPCONTROLLER.filterString; NSArray * articleArray = [self applyFilter:[folder articlesWithFilter:filterString]]; - [refArray addObjectsFromArray:articleArray]; [self innerMarkReadByArray:articleArray readFlag:YES]; + for (id article in articleArray) { + [refArray addObject:[ArticleReference makeReference:(Article *)article]]; + } } } return [refArray copy]; diff --git a/Vienna/Sources/Models/Folder.h b/Vienna/Sources/Models/Folder.h index 9bf458af2d..c17858e4be 100644 --- a/Vienna/Sources/Models/Folder.h +++ b/Vienna/Sources/Models/Folder.h @@ -21,6 +21,7 @@ @import Cocoa; @class Article; +@class ArticleReference; /** Folder types @@ -116,7 +117,7 @@ typedef NS_OPTIONS(NSUInteger, VNAFolderFlag) { -(void)removeArticleFromCache:(NSString *)guid; -(void)restoreArticleToCache:(Article *)article; -(void)markArticlesInCacheRead; --(NSArray *)arrayOfUnreadArticlesRefs; +-(NSArray *)arrayOfUnreadArticlesRefs; -(NSComparisonResult)folderNameCompare:(Folder *)otherObject; -(NSComparisonResult)folderIDCompare:(Folder *)otherObject; @property (readonly, nonatomic) NSString *feedSourceFilePath; diff --git a/Vienna/Sources/Models/Folder.m b/Vienna/Sources/Models/Folder.m index 3cb1481a18..5adb1d9da1 100644 --- a/Vienna/Sources/Models/Folder.m +++ b/Vienna/Sources/Models/Folder.m @@ -655,7 +655,7 @@ -(void)markArticlesInCacheRead /* arrayOfUnreadArticlesRefs * Return an array of ArticleReference of all unread articles */ --(NSArray *)arrayOfUnreadArticlesRefs +-(NSArray *)arrayOfUnreadArticlesRefs { @synchronized(self) { if (self.isCached) {