Some model fixing.

This commit is contained in:
Martin Rotter 2014-09-19 16:44:45 +02:00
parent 2b772a7cc0
commit 56797cebbe
3 changed files with 15 additions and 8 deletions

View File

@ -39,6 +39,8 @@
#define APP_DONATE_URL "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XMWPLPK893VH4"
#define URI_SCHEME_FEED "feed://"
#define URI_SCHEME_HTTP "http://"
#define RELEASES_LIST "https://bitbucket.org/skunkos/rssguard/raw/master/resources/text/UPDATES?at=master"
#define DEFAULT_LOCALE "en_GB"
#define DEFAULT_FEED_ENCODING "UTF-8"

View File

@ -206,7 +206,7 @@ void FeedMessageViewer::createConnections() {
connect(m_feedsView, SIGNAL(feedsSelected(QList<int>)), m_messagesView, SLOT(loadFeeds(QList<int>)));
// If user changes status of some messages, recalculate message counts.
connect(m_messagesView, SIGNAL(feedCountsChanged(bool)), m_feedsView, SLOT(updateCountsOfSelectedFeeds()));
connect(m_messagesView, SIGNAL(feedCountsChanged(bool)), m_feedsView, SLOT(updateCountsOfSelectedFeeds(bool)));
// State of many messages is changed, then we need
// to reload selections.

View File

@ -38,10 +38,10 @@ Downloader::~Downloader() {
m_downloadManager->deleteLater();
}
void Downloader::downloadFile(const QString &url, int timeout, bool protected_contents,
const QString &username, const QString &password) {
void Downloader::downloadFile(const QString &url, int timeout, bool protected_contents, const QString &username, const QString &password) {
QNetworkRequest request;
QObject originatingObject;
QString non_const_url = url;
// Set credential information as originating object.
originatingObject.setProperty("protected", protected_contents);
@ -52,7 +52,14 @@ void Downloader::downloadFile(const QString &url, int timeout, bool protected_co
// Set url for this request and fire it up.
m_timer->setInterval(timeout);
request.setUrl(url);
if (non_const_url.startsWith(URI_SCHEME_FEED)) {
qDebug("Replacing URI schemes for '%s'.", qPrintable(non_const_url));
request.setUrl(non_const_url.replace(QRegExp(QString('^') + URI_SCHEME_FEED), QString(URI_SCHEME_HTTP)));
}
else {
request.setUrl(non_const_url);
}
runGetRequest(request);
}
@ -68,8 +75,7 @@ void Downloader::finished(QNetworkReply *reply) {
QNetworkRequest request = reply->request();
if (redirection_url.host().isEmpty()) {
request.setUrl(QUrl(reply->request().url().scheme() + "://" + reply->request().url().host() +
redirection_url.toString()));
request.setUrl(QUrl(reply->request().url().scheme() + "://" + reply->request().url().host() + redirection_url.toString()));
}
else {
request.setUrl(redirection_url);
@ -113,8 +119,7 @@ void Downloader::runGetRequest(const QNetworkRequest &request) {
m_timer->start();
m_activeReply = m_downloadManager->get(request);
connect(m_activeReply, SIGNAL(downloadProgress(qint64,qint64)),
this, SLOT(progressInternal(qint64,qint64)));
connect(m_activeReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(progressInternal(qint64,qint64)));
}
QVariant Downloader::lastContentType() const {