Use QTextBrowser instead of WebKit for downloadable contents page (currently only shows the page itself)
--- a/QTfrontend/hwform.cpp Sat Sep 03 12:35:49 2011 +0200
+++ b/QTfrontend/hwform.cpp Sat Sep 03 21:23:20 2011 +0400
@@ -1322,4 +1322,5 @@
}
} while(!fileName.isEmpty() && !ok);
}
-}
\ No newline at end of file
+}
+
--- a/QTfrontend/pagedata.cpp Sat Sep 03 12:35:49 2011 +0200
+++ b/QTfrontend/pagedata.cpp Sat Sep 03 21:23:20 2011 +0400
@@ -20,8 +20,11 @@
#include <QPushButton>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
+#include <QNetworkReply>
#include <QFileInfo>
#include <QFileDialog>
+#include <QTextBrowser>
+
#include "pagedata.h"
@@ -34,11 +37,21 @@
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
- web = new QWebView(this);
- connect(web, SIGNAL(linkClicked(const QUrl&)), this, SLOT(install(const QUrl&)));
- web->load(QUrl("http://m8y.org/hw/downloads/"));
- web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
+ web = new QTextBrowser(this);
+ connect(web, SIGNAL(anchorClicked(QUrl)), this, SLOT(install(const QUrl&)));
+ web->setOpenLinks(false);
+ //web->setSource();
+ //web->load(QUrl("http://m8y.org/hw/downloads/"));
+ //web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
pageLayout->addWidget(web, 0, 0, 1, 3);
+
+
+ QNetworkRequest newRequest(QUrl("http://m8y.org/hw/downloads/index.xhtml"));
+ //newRequest.setAttribute(QNetworkRequest::User, fileName);
+
+ QNetworkAccessManager *manager = new QNetworkAccessManager(this);
+ QNetworkReply *reply = manager->get(newRequest);
+ connect(reply, SIGNAL(finished()), this, SLOT(downloadIssueFinished()));
}
void PageDataDownload::install(const QUrl &url)
@@ -52,5 +65,19 @@
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QNetworkReply *reply = manager->get(newRequest);
//connect( reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)) );
-//connect( reply, SIGNAL(finished()), this, SLOT(downloadIssueFinished()));
}
+
+
+void PageDataDownload::downloadIssueFinished()
+{
+ QNetworkReply * reply = qobject_cast<QNetworkReply *>(sender());
+
+ if(reply)
+ {
+ web->setHtml(QString::fromUtf8(reply->readAll()));
+ }
+}
+
+
+
+
--- a/QTfrontend/pagedata.h Sat Sep 03 12:35:49 2011 +0200
+++ b/QTfrontend/pagedata.h Sat Sep 03 21:23:20 2011 +0400
@@ -18,10 +18,12 @@
#ifndef PAGE_DATA_H
#define PAGE_DATA_H
-#include <QWebView>
+
#include <QUrl>
#include "AbstractPage.h"
+class QTextBrowser;
+
class PageDataDownload : public AbstractPage
{
Q_OBJECT
@@ -30,10 +32,12 @@
PageDataDownload(QWidget* parent = 0);
QPushButton *BtnBack;
- QWebView *web;
+ QTextBrowser *web;
private slots:
void install(const QUrl &url);
+
+ void downloadIssueFinished();
};
#endif