diff --git a/src/rss/rss_imp.cpp b/src/rss/rss_imp.cpp index 69c6f10c5..10c8d22df 100644 --- a/src/rss/rss_imp.cpp +++ b/src/rss/rss_imp.cpp @@ -327,18 +327,13 @@ void RSSImp::on_updateAllButton_clicked() { m_rssManager->refresh(); } -void RSSImp::downloadTorrent() { +void RSSImp::downloadSelectedTorrents() { QList selected_items = listArticles->selectedItems(); foreach (const QListWidgetItem* item, selected_items) { RssArticlePtr article = m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString()) ->getItem(item->data(Article::IdRole).toString()); - QString torrentLink; - if (article->hasAttachment()) - torrentLink = article->torrentUrl(); - else - torrentLink = article->link(); - + QString torrentLink = article->torrentUrl(); // Check if it is a magnet link if (torrentLink.startsWith("magnet:", Qt::CaseInsensitive)) QBtSession::instance()->addMagnetInteractive(torrentLink); @@ -698,14 +693,14 @@ RSSImp::RSSImp(QWidget *parent) : QWidget(parent), m_rssManager(new RssManager) connect(actionMark_items_read, SIGNAL(triggered()), this, SLOT(on_markReadButton_clicked())); // News list actions connect(actionOpen_news_URL, SIGNAL(triggered()), this, SLOT(openNewsUrl())); - connect(actionDownload_torrent, SIGNAL(triggered()), this, SLOT(downloadTorrent())); + connect(actionDownload_torrent, SIGNAL(triggered()), this, SLOT(downloadSelectedTorrents())); connect(m_feedList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(populateArticleList(QTreeWidgetItem*))); connect(m_feedList, SIGNAL(foldersAltered(QList)), this, SLOT(updateItemsInfos(QList))); connect(m_feedList, SIGNAL(overwriteAttempt(QString)), this, SLOT(displayOverwriteError(QString))); connect(listArticles, SIGNAL(itemSelectionChanged()), this, SLOT(refreshTextBrowser())); - connect(listArticles, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(downloadTorrent())); + connect(listArticles, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(downloadSelectedTorrents())); // Refresh all feeds m_rssManager->refresh(); diff --git a/src/rss/rss_imp.h b/src/rss/rss_imp.h index d9a94c825..1cf08b26c 100644 --- a/src/rss/rss_imp.h +++ b/src/rss/rss_imp.h @@ -72,7 +72,7 @@ private slots: void updateItemsInfos(const QList &items); void updateItemInfos(QTreeWidgetItem *item); void openNewsUrl(); - void downloadTorrent(); + void downloadSelectedTorrents(); void fillFeedsList(QTreeWidgetItem *parent=0, const RssFolderPtr& rss_parent = RssFolderPtr()); void saveSlidersPosition(); void restoreSlidersPosition(); diff --git a/src/rss/rssarticle.cpp b/src/rss/rssarticle.cpp index 6cd7732d6..bc6e6399f 100644 --- a/src/rss/rssarticle.cpp +++ b/src/rss/rssarticle.cpp @@ -81,7 +81,7 @@ QString RssArticle::author() const { } QString RssArticle::torrentUrl() const { - return m_torrentUrl; + return m_torrentUrl.isEmpty() ? m_link : m_torrentUrl; } QString RssArticle::link() const { diff --git a/src/rss/rssfeed.cpp b/src/rss/rssfeed.cpp index e6915af73..823402127 100644 --- a/src/rss/rssfeed.cpp +++ b/src/rss/rssfeed.cpp @@ -307,7 +307,7 @@ void RssFeed::handleNewArticle(const QString& feedUrl, const QVariantHash& artic // Torrent was downloaded, consider article as read article->markAsRead(); // Download the torrent - QString torrent_url = article->hasAttachment() ? article->torrentUrl() : article->link(); + QString torrent_url = article->torrentUrl(); QBtSession::instance()->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(article->title()).arg(displayName())); if (torrent_url.startsWith("magnet:", Qt::CaseInsensitive)) QBtSession::instance()->addMagnetSkipAddDlg(torrent_url, matching_rule->savePath(), matching_rule->label());