mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 13:58:51 +03:00
[RSS] Fix contextual menu in RSS torrents list
This commit is contained in:
parent
b9b7786477
commit
b78ccf289e
1 changed files with 24 additions and 13 deletions
|
@ -112,19 +112,30 @@ 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;
|
||||||
|
|
||||||
|
bool hasTorrent = false;
|
||||||
|
bool hasLink = false;
|
||||||
foreach (const QListWidgetItem* item, selectedItems) {
|
foreach (const QListWidgetItem* item, selectedItems) {
|
||||||
if (m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString())
|
if (!item) continue;
|
||||||
->getItem(item->data(Article::IdRole).toString())->hasAttachment()) {
|
RssFeedPtr feed = m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString());
|
||||||
has_attachment = true;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
if (hasTorrent)
|
||||||
if (has_attachment)
|
|
||||||
myItemListMenu.addAction(actionDownload_torrent);
|
myItemListMenu.addAction(actionDownload_torrent);
|
||||||
|
if (hasLink)
|
||||||
myItemListMenu.addAction(actionOpen_news_URL);
|
myItemListMenu.addAction(actionOpen_news_URL);
|
||||||
}
|
if (hasTorrent || hasLink)
|
||||||
myItemListMenu.exec(QCursor::pos());
|
myItemListMenu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue