Mark entries as 'read' and 'unread'

This commit is contained in:
Jaidyn Ann 2021-03-23 10:39:31 -05:00
parent 171de4e440
commit 90e220bf0f
4 changed files with 13 additions and 12 deletions

View File

@ -165,6 +165,10 @@ App::_OpenEntryFile(BMessage* refMessage)
{ {
entry_ref entryRef; entry_ref entryRef;
refMessage->FindRef("refs", &entryRef); refMessage->FindRef("refs", &entryRef);
BFile entryFile(&entryRef, B_WRITE_ONLY);
BString readStatus("Read");
entryFile.WriteAttrString("Feed:status", &readStatus);
if (fPreferences->EntryOpenAsHtml()) if (fPreferences->EntryOpenAsHtml())
_OpenEntryFileAsHtml(entryRef); _OpenEntryFileAsHtml(entryRef);

View File

@ -46,14 +46,12 @@ Entry::Filetize()
file.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0, betype.String(), file.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0, betype.String(),
betype.CountChars() + 1); betype.CountChars() + 1);
file.WriteAttr("Feed:name", B_STRING_TYPE, 0, BString readStatus("Unread");
fTitle.String(), fTitle.CountChars()); file.WriteAttrString("Feed:name", &fTitle);
file.WriteAttr("Feed:description", B_STRING_TYPE, 0, file.WriteAttrString("Feed:description", &fDescription);
fDescription.String(), fDescription.CountChars()); file.WriteAttrString("Feed:source", &fFeedTitle);
file.WriteAttr("Feed:source", B_STRING_TYPE, 0, file.WriteAttrString("META:url", &fPostUrl);
fFeedTitle.String(), fFeedTitle.CountChars()); file.WriteAttrString("Feed:status", &readStatus);
file.WriteAttr("META:url", B_STRING_TYPE, 0, fPostUrl.String(),
fPostUrl.CountChars());
if (fDate != NULL) { if (fDate != NULL) {
file.WriteAttr("Feed:when", B_TIME_TYPE, 0, &tt_date, sizeof(time_t)); file.WriteAttr("Feed:when", B_TIME_TYPE, 0, &tt_date, sizeof(time_t));

View File

@ -45,10 +45,10 @@ Feed::Feed(BEntry entry)
entry.GetPath(&path); entry.GetPath(&path);
SetCachePath(BString(path.Path())); SetCachePath(BString(path.Path()));
BString name; BString name, url;
BString url;
file.ReadAttrString("META:url", &url); file.ReadAttrString("META:url", &url);
file.ReadAttrString("Feed:name", &name); file.ReadAttrString("Feed:name", &name);
file.ReadAttrString("Feed:hash", &fLastHash);
if (!url.IsEmpty()) if (!url.IsEmpty())
SetXmlUrl(BUrl(url)); SetXmlUrl(BUrl(url));
@ -120,8 +120,6 @@ Feed::Fetch()
{ {
BFile cacheFile = BFile(fCachePath, B_READ_WRITE | B_CREATE_FILE); BFile cacheFile = BFile(fCachePath, B_READ_WRITE | B_CREATE_FILE);
cacheFile.ReadAttrString("Feed:hash", &fLastHash);
int32 result = fetch(fXmlUrl, &cacheFile, &fHash, 30); int32 result = fetch(fXmlUrl, &cacheFile, &fHash, 30);
cacheFile.WriteAttrString("Feed:hash", &fHash); cacheFile.WriteAttrString("Feed:hash", &fHash);

View File

@ -75,6 +75,7 @@ feedEntryMimeType()
addAttribute(info, "Feed:description", "Description"); addAttribute(info, "Feed:description", "Description");
addAttribute(info, "META:url", "URL"); addAttribute(info, "META:url", "URL");
addAttribute(info, "Feed:source", "Source"); addAttribute(info, "Feed:source", "Source");
addAttribute(info, "Feed:status", "Status");
addAttribute(info, "Feed:when", "When", B_TIME_TYPE, 150); addAttribute(info, "Feed:when", "When", B_TIME_TYPE, 150);
return mime.SetAttrInfo(&info); return mime.SetAttrInfo(&info);