Browse Source

- Already present RSS news were not remembered on startup

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
c35500dd29
  1. 15
      src/FeedDownloader.ui
  2. 6
      src/rss.h

15
src/FeedDownloader.ui

@ -227,6 +227,9 @@
<property name="text"> <property name="text">
<string>Matches:</string> <string>Matches:</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -240,6 +243,9 @@
<property name="text"> <property name="text">
<string>Does not match:</string> <string>Does not match:</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -253,6 +259,9 @@
<property name="text"> <property name="text">
<string>Destination folder:</string> <string>Destination folder:</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -327,6 +336,9 @@
<property name="text"> <property name="text">
<string>Torrent title:</string> <string>Torrent title:</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -340,6 +352,9 @@
<property name="text"> <property name="text">
<string>Result:</string> <string>Result:</string>
</property> </property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>

6
src/rss.h

@ -389,9 +389,10 @@ RssStream(bittorrent *BTSession, QString _url): BTSession(BTSession), url(_url),
foreach(RssItem *item, listItem) { foreach(RssItem *item, listItem) {
old_items << item->toHash(); old_items << item->toHash();
} }
qDebug("Saving %d old items for feed %s", old_items.size(), getAliasOrUrl().toLocal8Bit().data());
QHash<QString, QVariant> all_old_items = qBTRSS.value("old_items", QHash<QString, QVariant>()).toHash(); QHash<QString, QVariant> all_old_items = qBTRSS.value("old_items", QHash<QString, QVariant>()).toHash();
all_old_items[url] = old_items; all_old_items[url] = old_items;
qBTRSS.setValue(url, all_old_items); qBTRSS.setValue("old_items", all_old_items);
} }
removeAllItems(); removeAllItems();
if(QFile::exists(filePath)) if(QFile::exists(filePath))
@ -539,6 +540,7 @@ short readDoc(const QDomDocument& doc) {
QSettings qBTRSS("qBittorrent", "qBittorrent-rss"); QSettings qBTRSS("qBittorrent", "qBittorrent-rss");
QHash<QString, QVariant> all_old_items = qBTRSS.value("old_items", QHash<QString, QVariant>()).toHash(); QHash<QString, QVariant> all_old_items = qBTRSS.value("old_items", QHash<QString, QVariant>()).toHash();
QVariantList old_items = all_old_items.value(url, QVariantList()).toList(); QVariantList old_items = all_old_items.value(url, QVariantList()).toList();
qDebug("Loading %d old items for feed %s", old_items.size(), getAliasOrUrl().toLocal8Bit().data());
foreach(const QVariant &var_it, old_items) { foreach(const QVariant &var_it, old_items) {
QHash<QString, QVariant> item = var_it.toHash(); QHash<QString, QVariant> item = var_it.toHash();
RssItem *rss_item = RssItem::fromHash(item); RssItem *rss_item = RssItem::fromHash(item);
@ -583,7 +585,7 @@ short readDoc(const QDomDocument& doc) {
FeedFilter * matching_filter = FeedFilters::getFeedFilters(url).matches(item->getTitle()); FeedFilter * matching_filter = FeedFilters::getFeedFilters(url).matches(item->getTitle());
if(matching_filter != 0) { if(matching_filter != 0) {
// Download the torrent // Download the torrent
BTSession->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(item->getTorrentUrl()).arg(getAliasOrUrl())); BTSession->addConsoleMessage(tr("Automatically downloading %1 torrent from %2 RSS feed...").arg(item->getTitle()).arg(getAliasOrUrl()));
if(matching_filter->isValid()) { if(matching_filter->isValid()) {
QString save_path = matching_filter->getSavePath(); QString save_path = matching_filter->getSavePath();
if(save_path.isEmpty()) if(save_path.isEmpty())

Loading…
Cancel
Save