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;
refMessage->FindRef("refs", &entryRef);
BFile entryFile(&entryRef, B_WRITE_ONLY);
BString readStatus("Read");
entryFile.WriteAttrString("Feed:status", &readStatus);
if (fPreferences->EntryOpenAsHtml())
_OpenEntryFileAsHtml(entryRef);

View File

@ -46,14 +46,12 @@ Entry::Filetize()
file.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0, betype.String(),
betype.CountChars() + 1);
file.WriteAttr("Feed:name", B_STRING_TYPE, 0,
fTitle.String(), fTitle.CountChars());
file.WriteAttr("Feed:description", B_STRING_TYPE, 0,
fDescription.String(), fDescription.CountChars());
file.WriteAttr("Feed:source", B_STRING_TYPE, 0,
fFeedTitle.String(), fFeedTitle.CountChars());
file.WriteAttr("META:url", B_STRING_TYPE, 0, fPostUrl.String(),
fPostUrl.CountChars());
BString readStatus("Unread");
file.WriteAttrString("Feed:name", &fTitle);
file.WriteAttrString("Feed:description", &fDescription);
file.WriteAttrString("Feed:source", &fFeedTitle);
file.WriteAttrString("META:url", &fPostUrl);
file.WriteAttrString("Feed:status", &readStatus);
if (fDate != NULL) {
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);
SetCachePath(BString(path.Path()));
BString name;
BString url;
BString name, url;
file.ReadAttrString("META:url", &url);
file.ReadAttrString("Feed:name", &name);
file.ReadAttrString("Feed:hash", &fLastHash);
if (!url.IsEmpty())
SetXmlUrl(BUrl(url));
@ -120,8 +120,6 @@ Feed::Fetch()
{
BFile cacheFile = BFile(fCachePath, B_READ_WRITE | B_CREATE_FILE);
cacheFile.ReadAttrString("Feed:hash", &fLastHash);
int32 result = fetch(fXmlUrl, &cacheFile, &fHash, 30);
cacheFile.WriteAttrString("Feed:hash", &fHash);

View File

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