|
|
@ -37,17 +37,18 @@ |
|
|
|
#include "rssdownloadrulelist.h" |
|
|
|
#include "rssdownloadrulelist.h" |
|
|
|
#include "downloadthread.h" |
|
|
|
#include "downloadthread.h" |
|
|
|
|
|
|
|
|
|
|
|
RssManager::RssManager(): m_rssDownloader(new DownloadThread(this)) { |
|
|
|
RssManager::RssManager(): |
|
|
|
|
|
|
|
m_rssDownloader(new DownloadThread(this)), m_downloadRules(new RssDownloadRuleList) |
|
|
|
|
|
|
|
{ |
|
|
|
connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); |
|
|
|
connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); |
|
|
|
m_refreshInterval = RssSettings().getRSSRefreshInterval(); |
|
|
|
m_refreshInterval = RssSettings().getRSSRefreshInterval(); |
|
|
|
m_refreshTimer.start(m_refreshInterval*60000); |
|
|
|
m_refreshTimer.start(m_refreshInterval*60000); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
RssManager::~RssManager(){ |
|
|
|
RssManager::~RssManager(){ |
|
|
|
qDebug("Deleting RSSManager"); |
|
|
|
qDebug("Deleting RSSManager..."); |
|
|
|
m_refreshTimer.stop(); |
|
|
|
|
|
|
|
delete m_rssDownloader; |
|
|
|
delete m_rssDownloader; |
|
|
|
RssDownloadRuleList::drop(); |
|
|
|
delete m_downloadRules; |
|
|
|
saveItemsToDisk(); |
|
|
|
saveItemsToDisk(); |
|
|
|
saveStreamList(); |
|
|
|
saveStreamList(); |
|
|
|
qDebug("RSSManager deleted"); |
|
|
|
qDebug("RSSManager deleted"); |
|
|
@ -117,7 +118,7 @@ void RssManager::moveFile(const RssFilePtr& file, const RssFolderPtr& dest_folde |
|
|
|
void RssManager::saveStreamList() const { |
|
|
|
void RssManager::saveStreamList() const { |
|
|
|
QStringList streamsUrl; |
|
|
|
QStringList streamsUrl; |
|
|
|
QStringList aliases; |
|
|
|
QStringList aliases; |
|
|
|
QList<RssFeedPtr> streams = getAllFeeds(); |
|
|
|
RssFeedList streams = getAllFeeds(); |
|
|
|
foreach (const RssFeedPtr& stream, streams) { |
|
|
|
foreach (const RssFeedPtr& stream, streams) { |
|
|
|
QString stream_path = stream->pathHierarchy().join("\\"); |
|
|
|
QString stream_path = stream->pathHierarchy().join("\\"); |
|
|
|
if (stream_path.isNull()) { |
|
|
|
if (stream_path.isNull()) { |
|
|
@ -140,3 +141,9 @@ static bool laterItemDate(const RssArticlePtr& a, const RssArticlePtr& b) |
|
|
|
void RssManager::sortNewsList(RssArticleList& news_list) { |
|
|
|
void RssManager::sortNewsList(RssArticleList& news_list) { |
|
|
|
qSort(news_list.begin(), news_list.end(), laterItemDate); |
|
|
|
qSort(news_list.begin(), news_list.end(), laterItemDate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RssDownloadRuleList *RssManager::downloadRules() const |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Q_ASSERT(m_downloadRules); |
|
|
|
|
|
|
|
return m_downloadRules; |
|
|
|
|
|
|
|
} |
|
|
|