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

View File

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

View File

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

View File

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

View File

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

View File

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