mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-28 15:34:16 +00:00
Merge pull request #6744 from glassez/fix-rss
Fix crash when delete last RSS feed. Closes #6742
This commit is contained in:
commit
706097ddda
@ -38,7 +38,7 @@ ArticleListWidget::ArticleListWidget(QWidget *parent)
|
|||||||
{
|
{
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
checkInvariant();
|
checkInvariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,14 +93,9 @@ void ArticleListWidget::handleArticleAdded(RSS::Article *rssArticle)
|
|||||||
|
|
||||||
void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
|
void ArticleListWidget::handleArticleRead(RSS::Article *rssArticle)
|
||||||
{
|
{
|
||||||
if (m_unreadOnly) {
|
auto item = mapRSSArticle(rssArticle);
|
||||||
delete m_rssArticleToListItemMapping.take(rssArticle);
|
item->setData(Qt::ForegroundRole, QColor("grey"));
|
||||||
}
|
item->setData(Qt::DecorationRole, QIcon(":/icons/sphere.png"));
|
||||||
else {
|
|
||||||
auto item = mapRSSArticle(rssArticle);
|
|
||||||
item->setData(Qt::ForegroundRole, QColor("grey"));
|
|
||||||
item->setData(Qt::DecorationRole, QIcon(":/icons/sphere.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
checkInvariant();
|
checkInvariant();
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,11 @@ void FeedListWidget::handleItemPathChanged(RSS::Item *rssItem)
|
|||||||
void FeedListWidget::handleItemAboutToBeRemoved(RSS::Item *rssItem)
|
void FeedListWidget::handleItemAboutToBeRemoved(RSS::Item *rssItem)
|
||||||
{
|
{
|
||||||
delete m_rssToTreeItemMapping.take(rssItem);
|
delete m_rssToTreeItemMapping.take(rssItem);
|
||||||
|
|
||||||
|
// RSS Item is still valid in this slot so if it is the last
|
||||||
|
// item we should prevent Unread list populating
|
||||||
|
if (m_rssToTreeItemMapping.size() == 1)
|
||||||
|
setCurrentItem(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *FeedListWidget::stickyUnreadItem() const
|
QTreeWidgetItem *FeedListWidget::stickyUnreadItem() const
|
||||||
@ -164,6 +169,8 @@ QList<QTreeWidgetItem *> FeedListWidget::getAllOpenedFolders(QTreeWidgetItem *pa
|
|||||||
|
|
||||||
RSS::Item *FeedListWidget::getRSSItem(QTreeWidgetItem *item) const
|
RSS::Item *FeedListWidget::getRSSItem(QTreeWidgetItem *item) const
|
||||||
{
|
{
|
||||||
|
if (!item) return nullptr;
|
||||||
|
|
||||||
return reinterpret_cast<RSS::Item *>(item->data(0, Qt::UserRole).value<quintptr>());
|
return reinterpret_cast<RSS::Item *>(item->data(0, Qt::UserRole).value<quintptr>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,11 +416,6 @@ void RSSWidget::copySelectedFeedsURL()
|
|||||||
|
|
||||||
void RSSWidget::handleCurrentFeedItemChanged(QTreeWidgetItem *currentItem)
|
void RSSWidget::handleCurrentFeedItemChanged(QTreeWidgetItem *currentItem)
|
||||||
{
|
{
|
||||||
if (!currentItem) {
|
|
||||||
m_articleListWidget->clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_articleListWidget->setRSSItem(m_feedListWidget->getRSSItem(currentItem)
|
m_articleListWidget->setRSSItem(m_feedListWidget->getRSSItem(currentItem)
|
||||||
, (currentItem == m_feedListWidget->stickyUnreadItem()));
|
, (currentItem == m_feedListWidget->stickyUnreadItem()));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user