Work on feed-on-page detection.

This commit is contained in:
Martin Rotter 2015-04-19 21:03:15 +02:00
parent 06fb567eac
commit 0b15e72d30
3 changed files with 20 additions and 0 deletions

View File

@ -32,6 +32,14 @@
NetworkFactory::NetworkFactory() {
}
QStringList NetworkFactory::extractFeedLinksFromHtmlPage(const QString &html) {
QStringList feeds;
return feeds;
}
QString NetworkFactory::networkErrorText(QNetworkReply::NetworkError error_code) {
switch (error_code) {
case QNetworkReply::ProtocolUnknownError:

View File

@ -34,6 +34,8 @@ class NetworkFactory {
explicit NetworkFactory();
public:
static QStringList extractFeedLinksFromHtmlPage(const QString &html);
// Returns human readable text for given network error.
static QString networkErrorText(QNetworkReply::NetworkError error_code);

View File

@ -21,6 +21,7 @@
#include "network-web/webbrowsernetworkaccessmanager.h"
#include "network-web/webpage.h"
#include "network-web/webview.h"
#include "network-web/networkfactory.h"
#include "miscellaneous/skinfactory.h"
#include "gui/formmain.h"
#include "gui/tabwidget.h"
@ -158,6 +159,15 @@ void WebBrowser::onLoadingProgress(int progress) {
void WebBrowser::onLoadingFinished(bool success) {
Q_UNUSED(success)
if (success) {
// Let's check if there are any feeds defined on the web and eventually
// display "Add feeds" button.
QString loaded_html = m_webView->page()->toHtml();
QStringList feeds_on_page = NetworkFactory::extractFeedLinksFromHtmlPage(loaded_html);
// TODO: mame načteno html, nyni z něj funkcí vytáhneme seznam adres kanálů. dodelat tu fci.
}
m_loadingProgress->hide();
}