Browse Source

Merge pull request #6455 from Chocobo1/qt4

Fix issues when compiling with Qt4
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
bf3ef61a1d
  1. 8
      src/base/http/server.cpp
  2. 20
      src/base/utils/string.cpp

8
src/base/http/server.cpp

@ -28,14 +28,18 @@ @@ -28,14 +28,18 @@
* exception statement from your version.
*/
#include "server.h"
#include <QNetworkProxy>
#include <QStringList>
#ifndef QT_NO_OPENSSL
#include <QSslSocket>
#else
#include <QTcpSocket>
#endif
#include <QNetworkProxy>
#include "connection.h"
#include "server.h"
using namespace Http;

20
src/base/utils/string.cpp

@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
#include <QByteArray>
#include <QtGlobal>
#include <QLocale>
#ifdef QBT_USES_QT5
#include <QCollator>
#endif
@ -217,6 +218,23 @@ QString Utils::String::toHtmlEscaped(const QString &str) @@ -217,6 +218,23 @@ QString Utils::String::toHtmlEscaped(const QString &str)
#ifdef QBT_USES_QT5
return str.toHtmlEscaped();
#else
return Qt::escape(str);
// code from Qt
QString rich;
const int len = str.length();
rich.reserve(int(len * 1.1));
for (int i = 0; i < len; ++i) {
if (str.at(i) == QLatin1Char('<'))
rich += QLatin1String("&lt;");
else if (str.at(i) == QLatin1Char('>'))
rich += QLatin1String("&gt;");
else if (str.at(i) == QLatin1Char('&'))
rich += QLatin1String("&amp;");
else if (str.at(i) == QLatin1Char('"'))
rich += QLatin1String("&quot;");
else
rich += str.at(i);
}
rich.squeeze();
return rich;
#endif
}

Loading…
Cancel
Save