diff options
| author | Linus Jahn <lnj@kaidan.im> | 2021-03-17 18:54:34 +0100 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2021-03-17 19:12:46 +0100 |
| commit | 6d778d84fd2faac6a899a1c70f2dcb9bd4e0b164 (patch) | |
| tree | 4af0ecd72b191d77c79f760a99dda172d41036ee | |
| parent | 84b387c198a1ad368c0fc16a776ecaef85e3b1b2 (diff) | |
| download | qxmpp-6d778d84fd2faac6a899a1c70f2dcb9bd4e0b164.tar.gz | |
Fix build with Qt 5.7
We only test 5.9 with the CI... :/
| -rw-r--r-- | src/base/QXmppGlobal.h.in | 4 | ||||
| -rw-r--r-- | src/base/QXmppUtils.cpp | 11 | ||||
| -rw-r--r-- | tests/qxmppbitsofbinarycontentid/tst_qxmppbitsofbinarycontentid.cpp | 2 | ||||
| -rw-r--r-- | tests/qxmppmessage/tst_qxmppmessage.cpp | 2 | ||||
| -rw-r--r-- | tests/qxmppstreaminitiationiq/tst_qxmppstreaminitiationiq.cpp | 2 |
5 files changed, 16 insertions, 5 deletions
diff --git a/src/base/QXmppGlobal.h.in b/src/base/QXmppGlobal.h.in index 7982f3b9..5f94196d 100644 --- a/src/base/QXmppGlobal.h.in +++ b/src/base/QXmppGlobal.h.in @@ -73,5 +73,9 @@ inline QLatin1String QXmppVersion() #define Q_DECL_ENUMERATOR_DEPRECATED_X(msg) #endif +#ifndef QT_WARNING_DISABLE_DEPRECATED +#define QT_WARNING_DISABLE_DEPRECATED +#endif + #endif // QXMPPGLOBAL_H diff --git a/src/base/QXmppUtils.cpp b/src/base/QXmppUtils.cpp index e17f95ec..3a858a30 100644 --- a/src/base/QXmppUtils.cpp +++ b/src/base/QXmppUtils.cpp @@ -126,8 +126,13 @@ QDateTime QXmppUtils::datetimeFromString(const QString &str) /// QString QXmppUtils::datetimeToString(const QDateTime &dt) { - if (dt.time().msec()) + if (dt.time().msec()) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) return dt.toUTC().toString(Qt::ISODateWithMs); +#else + return dt.toUTC().toString("yyyy-MM-ddTHH:mm:ss.zzzZ"); +#endif + } return dt.toUTC().toString(Qt::ISODate); } @@ -144,14 +149,14 @@ int QXmppUtils::timezoneOffsetFromString(const QString &str) return 0; // No offset from UTC - if (match.captured(1) == u'Z') + if (match.captured(1) == QChar(u'Z')) return 0; // Calculate offset const int offset = match.captured(3).toInt() * 3600 + match.captured(4).toInt() * 60; - if (match.captured(2) == u'-') + if (match.captured(2) == QChar(u'-')) return -offset; return offset; } diff --git a/tests/qxmppbitsofbinarycontentid/tst_qxmppbitsofbinarycontentid.cpp b/tests/qxmppbitsofbinarycontentid/tst_qxmppbitsofbinarycontentid.cpp index 37223ba8..5205d7ea 100644 --- a/tests/qxmppbitsofbinarycontentid/tst_qxmppbitsofbinarycontentid.cpp +++ b/tests/qxmppbitsofbinarycontentid/tst_qxmppbitsofbinarycontentid.cpp @@ -26,6 +26,8 @@ #include "util.h" #include <QObject> +Q_DECLARE_METATYPE(QCryptographicHash::Algorithm) + class tst_QXmppBitsOfBinaryContentId : public QObject { Q_OBJECT diff --git a/tests/qxmppmessage/tst_qxmppmessage.cpp b/tests/qxmppmessage/tst_qxmppmessage.cpp index 5e75a116..42255c57 100644 --- a/tests/qxmppmessage/tst_qxmppmessage.cpp +++ b/tests/qxmppmessage/tst_qxmppmessage.cpp @@ -1096,7 +1096,7 @@ void tst_QXmppMessage::testMixInvitation() QXmppMessage message; parsePacket(message, xml); - QVERIFY(message.mixInvitation()); + QVERIFY(message.mixInvitation().has_value()); serializePacket(message, xml); } diff --git a/tests/qxmppstreaminitiationiq/tst_qxmppstreaminitiationiq.cpp b/tests/qxmppstreaminitiationiq/tst_qxmppstreaminitiationiq.cpp index 79b4292c..c755e3b3 100644 --- a/tests/qxmppstreaminitiationiq/tst_qxmppstreaminitiationiq.cpp +++ b/tests/qxmppstreaminitiationiq/tst_qxmppstreaminitiationiq.cpp @@ -49,7 +49,7 @@ void tst_QXmppStreamInitiationIq::testFileInfo_data() QTest::newRow("normal") << QByteArray("<file xmlns=\"http://jabber.org/protocol/si/profile/file-transfer\" name=\"test.txt\" size=\"1022\"/>") - << QDateTime() + << QDateTime().toUTC() << QString() << QByteArray() << QString("test.txt") |
