Save manually-written feed titles

This commit is contained in:
Jaidyn Ann 2021-03-21 14:21:14 -05:00
parent ff7d97aa80
commit 3a423f8a92
6 changed files with 15 additions and 7 deletions

View File

@ -16,7 +16,7 @@
AtomFeed::AtomFeed() AtomFeed::AtomFeed()
{ {
fTitle = BString("Untitled Feed"); fTitle = BString("");
fCachePath = BString(""); fCachePath = BString("");
} }
@ -24,6 +24,7 @@ AtomFeed::AtomFeed()
AtomFeed::AtomFeed(Feed* feed) AtomFeed::AtomFeed(Feed* feed)
: AtomFeed::AtomFeed() : AtomFeed::AtomFeed()
{ {
SetTitle(feed->Title());
SetXmlUrl(feed->XmlUrl()); SetXmlUrl(feed->XmlUrl());
SetCachePath(feed->CachePath()); SetCachePath(feed->CachePath());
} }

View File

@ -90,7 +90,7 @@ Feed::Feed(Feed* feed)
Feed::Feed() Feed::Feed()
: :
fTitle(BString("Untitled Feed")) fTitle(BString(""))
{ {
fLastDate = BDateTime::CurrentDateTime(B_LOCAL_TIME); fLastDate = BDateTime::CurrentDateTime(B_LOCAL_TIME);
} }
@ -243,7 +243,7 @@ Feed::SetTitle(const char* titleStr)
bool bool
Feed::_SetTitle(tinyxml2::XMLElement* elem) Feed::_SetTitle(tinyxml2::XMLElement* elem)
{ {
if (elem != NULL) if (elem != NULL && fTitle.IsEmpty() == true)
return SetTitle(elem->GetText()); return SetTitle(elem->GetText());
else return false; else return false;
} }

View File

@ -17,6 +17,7 @@
#include "FeedController.h" #include "FeedController.h"
#include "FeedListItem.h" #include "FeedListItem.h"
#include "FeedsView.h" #include "FeedsView.h"
#include "Util.h"
FeedEditWindow::FeedEditWindow() FeedEditWindow::FeedEditWindow()
@ -163,7 +164,7 @@ FeedEditWindow::_SaveFeed()
BString filename; BString filename;
if (title.IsEmpty()) if (title.IsEmpty())
filename = BString(urlString); filename = BString(urlToFilename(BUrl(urlString)));
else else
filename = BString(title); filename = BString(title);
subPath.Append(filename); subPath.Append(filename);

View File

@ -18,6 +18,8 @@ FeedListItem::FeedListItem(Feed* feed)
fFeedUrl(feed->XmlUrl()), fFeedUrl(feed->XmlUrl()),
fFeedPath(feed->CachePath()) fFeedPath(feed->CachePath())
{ {
if (feed->Title().IsEmpty() == true)
SetText("Untitled Feed");
} }

View File

@ -50,6 +50,7 @@ FeedsView::MessageReceived(BMessage* msg)
} }
case kFeedsEditButton: case kFeedsEditButton:
{ {
if (msg->GetInt32("index", -1) >= 0)
_EditSelectedFeed(); _EditSelectedFeed();
break; break;
} }
@ -92,8 +93,10 @@ FeedsView::MessageReceived(BMessage* msg)
if (msg->FindInt32("total", &total) == B_OK if (msg->FindInt32("total", &total) == B_OK
&& msg->FindInt32("current", &current) == B_OK) && msg->FindInt32("current", &current) == B_OK)
{ {
if (total == current) if (total == current) {
fProgressLabel->SetText(""); fProgressLabel->SetText("");
_PopulateFeedList();
}
} }
break; break;
} }

View File

@ -14,7 +14,7 @@
RssFeed::RssFeed() RssFeed::RssFeed()
{ {
fTitle = BString("Untitled Feed"); fTitle = BString("");
fXmlUrl = BString(""); fXmlUrl = BString("");
} }
@ -22,6 +22,7 @@ RssFeed::RssFeed()
RssFeed::RssFeed(Feed* feed) RssFeed::RssFeed(Feed* feed)
: RssFeed::RssFeed() : RssFeed::RssFeed()
{ {
SetTitle(feed->Title());
SetXmlUrl(feed->XmlUrl()); SetXmlUrl(feed->XmlUrl());
SetCachePath(feed->CachePath()); SetCachePath(feed->CachePath());
} }