Browse Source

[RSS] Fix contextual menu in RSS torrents list

adaptive-webui-19844
ngosang 10 years ago
parent
commit
b78ccf289e
  1. 27
      src/gui/rss/rss_imp.cpp

27
src/gui/rss/rss_imp.cpp

@ -112,19 +112,30 @@ void RSSImp::displayItemsListMenu(const QPoint&) @@ -112,19 +112,30 @@ void RSSImp::displayItemsListMenu(const QPoint&)
{
QMenu myItemListMenu(this);
QList<QListWidgetItem*> selectedItems = listArticles->selectedItems();
if (selectedItems.size() > 0) {
bool has_attachment = false;
if (selectedItems.size() <= 0)
return;
bool hasTorrent = false;
bool hasLink = false;
foreach (const QListWidgetItem* item, selectedItems) {
if (m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString())
->getItem(item->data(Article::IdRole).toString())->hasAttachment()) {
has_attachment = true;
if (!item) continue;
RssFeedPtr feed = m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString());
if (!feed) continue;
RssArticlePtr article = feed->getItem(item->data(Article::IdRole).toString());
if (!article) continue;
if (!article->torrentUrl().isEmpty())
hasTorrent = true;
if (!article->link().isEmpty())
hasLink = true;
if (hasTorrent && hasLink)
break;
}
}
if (has_attachment)
if (hasTorrent)
myItemListMenu.addAction(actionDownload_torrent);
if (hasLink)
myItemListMenu.addAction(actionOpen_news_URL);
}
if (hasTorrent || hasLink)
myItemListMenu.exec(QCursor::pos());
}

Loading…
Cancel
Save