|
@@ -31,6 +31,9 @@
|
|
#include <QNetworkDiskCache>
|
|
#include <QNetworkDiskCache>
|
|
#include <QTimer>
|
|
#include <QTimer>
|
|
#include <QUuid>
|
|
#include <QUuid>
|
|
|
|
+#if QT_VERSION >= 0x050000
|
|
|
|
+#include <QUrlQuery>
|
|
|
|
+#endif
|
|
|
|
|
|
namespace wkhtmltopdf {
|
|
namespace wkhtmltopdf {
|
|
/*!
|
|
/*!
|
|
@@ -103,7 +106,7 @@ QNetworkReply * MyNetworkAccessManager::createRequest(Operation op, const QNetwo
|
|
if (settings.repeatCustomHeaders) {
|
|
if (settings.repeatCustomHeaders) {
|
|
typedef QPair<QString, QString> HT;
|
|
typedef QPair<QString, QString> HT;
|
|
foreach (const HT & j, settings.customHeaders)
|
|
foreach (const HT & j, settings.customHeaders)
|
|
- r3.setRawHeader(j.first.toAscii(), j.second.toAscii());
|
|
|
|
|
|
+ r3.setRawHeader(j.first.toLatin1(), j.second.toLatin1());
|
|
}
|
|
}
|
|
return QNetworkAccessManager::createRequest(op, r3, outgoingData);
|
|
return QNetworkAccessManager::createRequest(op, r3, outgoingData);
|
|
}
|
|
}
|
|
@@ -415,10 +418,17 @@ void ResourceObject::load() {
|
|
postData.append("--\n");
|
|
postData.append("--\n");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
|
|
+#if QT_VERSION >= 0x050000
|
|
|
|
+ QUrlQuery q;
|
|
|
|
+ foreach (const settings::PostItem & pi, settings.post)
|
|
|
|
+ q.addQueryItem(pi.name, pi.value);
|
|
|
|
+ postData = q.query(QUrl::FullyEncoded).toLocal8Bit();
|
|
|
|
+#else
|
|
QUrl u;
|
|
QUrl u;
|
|
foreach (const settings::PostItem & pi, settings.post)
|
|
foreach (const settings::PostItem & pi, settings.post)
|
|
u.addQueryItem(pi.name, pi.value);
|
|
u.addQueryItem(pi.name, pi.value);
|
|
postData = u.encodedQuery();
|
|
postData = u.encodedQuery();
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -429,7 +439,7 @@ void ResourceObject::load() {
|
|
QNetworkRequest r = QNetworkRequest(url);
|
|
QNetworkRequest r = QNetworkRequest(url);
|
|
typedef QPair<QString, QString> HT;
|
|
typedef QPair<QString, QString> HT;
|
|
foreach (const HT & j, settings.customHeaders)
|
|
foreach (const HT & j, settings.customHeaders)
|
|
- r.setRawHeader(j.first.toAscii(), j.second.toAscii());
|
|
|
|
|
|
+ r.setRawHeader(j.first.toLatin1(), j.second.toLatin1());
|
|
|
|
|
|
if (postData.isEmpty())
|
|
if (postData.isEmpty())
|
|
webPage.mainFrame()->load(r);
|
|
webPage.mainFrame()->load(r);
|
|
@@ -634,7 +644,7 @@ QUrl MultiPageLoader::guessUrlFromString(const QString &string) {
|
|
|
|
|
|
QUrl url;
|
|
QUrl url;
|
|
if (isAscii) {
|
|
if (isAscii) {
|
|
- url = QUrl::fromEncoded(urlStr.toAscii(), QUrl::TolerantMode);
|
|
|
|
|
|
+ url = QUrl::fromEncoded(urlStr.toLatin1(), QUrl::TolerantMode);
|
|
} else {
|
|
} else {
|
|
url = QUrl(urlStr, QUrl::TolerantMode);
|
|
url = QUrl(urlStr, QUrl::TolerantMode);
|
|
}
|
|
}
|