mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
[RSS] Fix contextual menu in RSS torrents list
This commit is contained in:
parent
b9b7786477
commit
b78ccf289e
@ -112,20 +112,31 @@ void RSSImp::displayItemsListMenu(const QPoint&)
|
|||||||
{
|
{
|
||||||
QMenu myItemListMenu(this);
|
QMenu myItemListMenu(this);
|
||||||
QList<QListWidgetItem*> selectedItems = listArticles->selectedItems();
|
QList<QListWidgetItem*> selectedItems = listArticles->selectedItems();
|
||||||
if (selectedItems.size() > 0) {
|
if (selectedItems.size() <= 0)
|
||||||
bool has_attachment = false;
|
return;
|
||||||
foreach (const QListWidgetItem* item, selectedItems) {
|
|
||||||
if (m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString())
|
bool hasTorrent = false;
|
||||||
->getItem(item->data(Article::IdRole).toString())->hasAttachment()) {
|
bool hasLink = false;
|
||||||
has_attachment = true;
|
foreach (const QListWidgetItem* item, selectedItems) {
|
||||||
break;
|
if (!item) continue;
|
||||||
}
|
RssFeedPtr feed = m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString());
|
||||||
}
|
if (!feed) continue;
|
||||||
if (has_attachment)
|
RssArticlePtr article = feed->getItem(item->data(Article::IdRole).toString());
|
||||||
myItemListMenu.addAction(actionDownload_torrent);
|
if (!article) continue;
|
||||||
myItemListMenu.addAction(actionOpen_news_URL);
|
|
||||||
|
if (!article->torrentUrl().isEmpty())
|
||||||
|
hasTorrent = true;
|
||||||
|
if (!article->link().isEmpty())
|
||||||
|
hasLink = true;
|
||||||
|
if (hasTorrent && hasLink)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
myItemListMenu.exec(QCursor::pos());
|
if (hasTorrent)
|
||||||
|
myItemListMenu.addAction(actionDownload_torrent);
|
||||||
|
if (hasLink)
|
||||||
|
myItemListMenu.addAction(actionOpen_news_URL);
|
||||||
|
if (hasTorrent || hasLink)
|
||||||
|
myItemListMenu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSSImp::on_actionManage_cookies_triggered()
|
void RSSImp::on_actionManage_cookies_triggered()
|
||||||
|
Loading…
Reference in New Issue
Block a user