Changeset View
Standalone View
documentation/qthelp/qthelpnetwork.h
Show All 13 Lines | 1 | /* This file is part of KDevelop | |||
---|---|---|---|---|---|
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License | ||
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to | ||
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | Boston, MA 02110-1301, USA. | 17 | Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | #ifndef QTHELPNETWORK_H | 19 | #ifndef QTHELPNETWORK_H | ||
20 | #define QTHELPNETWORK_H | 20 | #define QTHELPNETWORK_H | ||
21 | 21 | | |||
22 | #include "debug.h" | ||||
23 | | ||||
22 | #include <QNetworkReply> | 24 | #include <QNetworkReply> | ||
23 | #include <QTimer> | 25 | #include <QTimer> | ||
24 | #include <QHelpEngine> | 26 | #include <QHelpEngine> | ||
25 | #include <QMimeDatabase> | 27 | #include <QMimeDatabase> | ||
26 | #include <QMimeType> | 28 | #include <QMimeType> | ||
27 | 29 | | |||
28 | class HelpNetworkReply : public QNetworkReply | 30 | class HelpNetworkReply : public QNetworkReply | ||
29 | { | 31 | { | ||
Show All 13 Lines | |||||
43 | 45 | | |||
44 | HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request, | 46 | HelpNetworkReply::HelpNetworkReply(const QNetworkRequest &request, | ||
45 | const QByteArray &fileData, const QString &mimeType) | 47 | const QByteArray &fileData, const QString &mimeType) | ||
46 | : data(fileData), origLen(fileData.length()) | 48 | : data(fileData), origLen(fileData.length()) | ||
47 | { | 49 | { | ||
48 | setRequest(request); | 50 | setRequest(request); | ||
49 | setOpenMode(QIODevice::ReadOnly); | 51 | setOpenMode(QIODevice::ReadOnly); | ||
50 | 52 | | |||
53 | // Instantly finish processing if data is empty. Without this code the loadFinished() | ||||
kfunk: This hunk looks good to me . +1 | |||||
54 | // signal will never be emitted by the corresponding QWebView. | ||||
55 | if (!origLen) { | ||||
56 | qCDebug(QTHELP) << "Empty data for" << request.url().toDisplayString(); | ||||
57 | QTimer::singleShot(0, this, SIGNAL(finished())); | ||||
58 | } | ||||
59 | | ||||
51 | setHeader(QNetworkRequest::ContentTypeHeader, mimeType); | 60 | setHeader(QNetworkRequest::ContentTypeHeader, mimeType); | ||
Do you have more information about that issue? A bug report maybe? Does it only happen for Qt 5.7.0? Now we're always patching contents of .css files here, regardless where the .css file came from. Not a good idea I think. kfunk: Do you have more information about that issue? A bug report maybe? Does it only happen for Qt 5. | |||||
No, it also happens on ubuntu 16.04 with Qt 5.5.1 - CSS images are not displayed.
Ok, we can move this to QtHelpDocumentation::setUserStyleSheet() method. Or don't fix this issue - now we lost some small images like arrows, not so critical. antonanikin: > Does it only happen for Qt 5.7.0?
No, it also happens on ubuntu 16.04 with Qt 5.5.1 - CSS… | |||||
Original offline.css contains 10 (for Qt 5.7.0) wrong lines with relative paths for images. I think it not right to add all such fixes into setUserStyleSheet() method. Therefore we have such variants:
What are you think about it? antonanikin: > we can move this to QtHelpDocumentation::setUserStyleSheet() method
Original `offline.css`… | |||||
If it's just offline.css, can we try to a more exact matching on the fileName()? So we can be sure we only replace stuff in the right file. kfunk: If it's just `offline.css`, can we try to a more exact matching on the `fileName()`? So we can… | |||||
kfunk: +1 on pushing the zero-length content fix as -is. | |||||
52 | setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen)); | 61 | setHeader(QNetworkRequest::ContentLengthHeader, QByteArray::number(origLen)); | ||
53 | QTimer::singleShot(0, this, SIGNAL(metaDataChanged())); | 62 | QTimer::singleShot(0, this, SIGNAL(metaDataChanged())); | ||
54 | QTimer::singleShot(0, this, SIGNAL(readyRead())); | 63 | QTimer::singleShot(0, this, SIGNAL(readyRead())); | ||
55 | } | 64 | } | ||
56 | 65 | | |||
57 | qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen) | 66 | qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen) | ||
58 | { | 67 | { | ||
59 | qint64 len = qMin(qint64(data.length()), maxlen); | 68 | qint64 len = qMin(qint64(data.length()), maxlen); | ||
Show All 40 Lines |
This hunk looks good to me . +1