summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonah BrĂ¼chert <jbb.prv@gmx.de>2019-10-17 01:50:11 +0200
committerJonah BrĂ¼chert <jbb.prv@gmx.de>2020-01-18 19:29:13 +0100
commit8ecd337139777505d3ef2b837bd13bc660dcd6be (patch)
tree80d021dd049f3170aadef28cfba31c13939f2346
parent6ccb59117fdb261016d06b42167c24c99cbcecc4 (diff)
Port deprecated Qt uses
-rw-r--r--TelepathyQt/account.cpp4
-rw-r--r--TelepathyQt/base-channel.cpp16
-rw-r--r--TelepathyQt/channel-request.cpp8
-rw-r--r--TelepathyQt/client-registrar.cpp4
-rw-r--r--TelepathyQt/file-transfer-channel-creation-properties.cpp4
-rw-r--r--TelepathyQt/file-transfer-channel.cpp4
-rw-r--r--TelepathyQt/incoming-stream-tube-channel.cpp4
-rw-r--r--TelepathyQt/location-info.cpp4
-rw-r--r--TelepathyQt/message.cpp12
-rw-r--r--TelepathyQt/method-invocation-context.h16
-rw-r--r--TelepathyQt/pending-channel-request.cpp16
-rw-r--r--TelepathyQt/text-channel.cpp8
-rw-r--r--tests/dbus/account-basics.cpp16
-rw-r--r--tests/dbus/account-channel-dispatcher.cpp4
-rw-r--r--tests/dbus/client-factories.cpp12
-rw-r--r--tests/dbus/client.cpp20
-rw-r--r--tests/dbus/cm-protocol.cpp6
-rw-r--r--tests/dbus/stream-tube-handlers.cpp36
-rw-r--r--tests/dbus/types.cpp6
19 files changed, 170 insertions, 30 deletions
diff --git a/TelepathyQt/account.cpp b/TelepathyQt/account.cpp
index f6635e1d..378469af 100644
--- a/TelepathyQt/account.cpp
+++ b/TelepathyQt/account.cpp
@@ -390,7 +390,7 @@ QVariantMap conferenceCommonRequest(const QString &channelType, Tp::HandleType t
}
request.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE + QLatin1String(".InitialChannels"),
- qVariantFromValue(objectPaths));
+ QVariant::fromValue(objectPaths));
return request;
}
@@ -419,7 +419,7 @@ QVariantMap conferenceRequest(const QString &channelType, Tp::HandleType targetH
}
if (!handles.isEmpty()) {
request.insert(TP_QT_IFACE_CHANNEL_INTERFACE_CONFERENCE +
- QLatin1String(".InitialInviteeHandles"), qVariantFromValue(handles));
+ QLatin1String(".InitialInviteeHandles"), QVariant::fromValue(handles));
}
}
return request;
diff --git a/TelepathyQt/base-channel.cpp b/TelepathyQt/base-channel.cpp
index ea8460aa..3fe66944 100644
--- a/TelepathyQt/base-channel.cpp
+++ b/TelepathyQt/base-channel.cpp
@@ -824,7 +824,11 @@ struct TP_QT_NO_EXPORT BaseChannelFileTransferType::Private {
description = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Description")).toString();
qint64 dbusDataValue = request.value(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Date")).value<qint64>();
if (dbusDataValue != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
date.setTime_t(dbusDataValue);
+#else
+ date.setSecsSinceEpoch(dbusDataValue);
+#endif
}
if (request.contains(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".URI"))) {
@@ -909,7 +913,11 @@ QString BaseChannelFileTransferType::Adaptee::description() const
qlonglong BaseChannelFileTransferType::Adaptee::date() const
{
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
return mInterface->date().toTime_t();
+#else
+ return mInterface->date().toSecsSinceEpoch();
+#endif
}
Tp::SupportedSocketMap BaseChannelFileTransferType::Adaptee::availableSocketTypes() const
@@ -1272,7 +1280,11 @@ QVariantMap BaseChannelFileTransferType::immutableProperties() const
map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Description"),
QVariant::fromValue(description()));
map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Date"),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QVariant::fromValue(date().toTime_t()));
+#else
+ QVariant::fromValue(date().toSecsSinceEpoch()));
+#endif
map.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".AvailableSocketTypes"),
QVariant::fromValue(availableSocketTypes()));
@@ -3359,7 +3371,11 @@ uint BaseChannelRoomInterface::Adaptee::creatorHandle() const
qlonglong BaseChannelRoomInterface::Adaptee::creationTimestamp() const
{
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
return mInterface->creationTimestamp().toTime_t();
+#else
+ return mInterface->creationTimestamp().toSecsSinceEpoch();
+#endif
}
/**
diff --git a/TelepathyQt/channel-request.cpp b/TelepathyQt/channel-request.cpp
index ec94553e..ab0e11c7 100644
--- a/TelepathyQt/channel-request.cpp
+++ b/TelepathyQt/channel-request.cpp
@@ -225,7 +225,11 @@ void ChannelRequest::Private::extractMainProps(const QVariantMap &props, bool la
// FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690
uint stamp = (uint) qdbus_cast<qlonglong>(props.value(QLatin1String("UserActionTime")));
if (stamp != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime = QDateTime::fromTime_t(stamp);
+#else
+ userActionTime = QDateTime::fromSecsSinceEpoch(stamp);
+#endif
}
preferredHandler = qdbus_cast<QString>(props.value(QLatin1String("PreferredHandler")));
@@ -505,7 +509,11 @@ QVariantMap ChannelRequest::immutableProperties() const
if (userActionTime().isValid()) {
props.insert(TP_QT_IFACE_CHANNEL_REQUEST + QLatin1String(".UserActionTime"),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QVariant::fromValue(userActionTime().toTime_t()));
+#else
+ QVariant::fromValue(userActionTime().toSecsSinceEpoch()));
+#endif
}
if (!preferredHandler().isNull()) {
diff --git a/TelepathyQt/client-registrar.cpp b/TelepathyQt/client-registrar.cpp
index 9c647d05..3160fc93 100644
--- a/TelepathyQt/client-registrar.cpp
+++ b/TelepathyQt/client-registrar.cpp
@@ -455,7 +455,11 @@ void ClientHandlerAdaptor::HandleChannels(const QDBusObjectPath &accountPath,
// FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690
if (userActionTime_t != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
invocation->time = QDateTime::fromTime_t((uint) userActionTime_t);
+#else
+ invocation->time = QDateTime::fromSecsSinceEpoch((uint) userActionTime_t);
+#endif
}
invocation->ctx = HandleChannelsInvocationContext::create(mBus, message,
diff --git a/TelepathyQt/file-transfer-channel-creation-properties.cpp b/TelepathyQt/file-transfer-channel-creation-properties.cpp
index aa0d8229..d63152cb 100644
--- a/TelepathyQt/file-transfer-channel-creation-properties.cpp
+++ b/TelepathyQt/file-transfer-channel-creation-properties.cpp
@@ -464,7 +464,11 @@ QVariantMap FileTransferChannelCreationProperties::createRequest() const
if (hasLastModificationTime()) {
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Date"),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
(qulonglong) lastModificationTime().toTime_t());
+#else
+ (qulonglong) lastModificationTime().toSecsSinceEpoch());
+#endif
}
if (hasUri()) {
diff --git a/TelepathyQt/file-transfer-channel.cpp b/TelepathyQt/file-transfer-channel.cpp
index ec72fbbd..718ab48e 100644
--- a/TelepathyQt/file-transfer-channel.cpp
+++ b/TelepathyQt/file-transfer-channel.cpp
@@ -134,7 +134,11 @@ void FileTransferChannel::Private::extractProperties(const QVariantMap &props)
uri = qdbus_cast<QString>(props[QLatin1String("URI")]);
contentHash = qdbus_cast<QString>(props[QLatin1String("ContentHash")]);
description = qdbus_cast<QString>(props[QLatin1String("Description")]);
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
lastModificationTime.setTime_t((uint) qdbus_cast<qulonglong>(props[QLatin1String("Date")]));
+#else
+ lastModificationTime.setSecsSinceEpoch((uint) qdbus_cast<qulonglong>(props[QLatin1String("Date")]));
+#endif
contentHashType = (FileHashType) qdbus_cast<uint>(props[QLatin1String("ContentHashType")]);
initialOffset = qdbus_cast<qulonglong>(props[QLatin1String("InitialOffset")]);
size = qdbus_cast<qulonglong>(props[QLatin1String("Size")]);
diff --git a/TelepathyQt/incoming-stream-tube-channel.cpp b/TelepathyQt/incoming-stream-tube-channel.cpp
index 12468247..55611408 100644
--- a/TelepathyQt/incoming-stream-tube-channel.cpp
+++ b/TelepathyQt/incoming-stream-tube-channel.cpp
@@ -383,14 +383,14 @@ PendingStreamTubeConnection *IncomingStreamTubeChannel::acceptTubeAsUnixSocket(
QDBusVariant accessControlParam;
uchar credentialByte = 0;
if (accessControl == SocketAccessControlLocalhost) {
- accessControlParam.setVariant(qVariantFromValue(static_cast<uint>(0)));
+ accessControlParam.setVariant(QVariant::fromValue(static_cast<uint>(0)));
} else if (accessControl == SocketAccessControlCredentials) {
if (mPriv->initRandom) {
qsrand(QTime::currentTime().msec());
mPriv->initRandom = false;
}
credentialByte = static_cast<uchar>(qrand());
- accessControlParam.setVariant(qVariantFromValue(credentialByte));
+ accessControlParam.setVariant(QVariant::fromValue(credentialByte));
} else {
Q_ASSERT(false);
}
diff --git a/TelepathyQt/location-info.cpp b/TelepathyQt/location-info.cpp
index db7ac75b..866530d0 100644
--- a/TelepathyQt/location-info.cpp
+++ b/TelepathyQt/location-info.cpp
@@ -199,7 +199,11 @@ QDateTime LocationInfo::timestamp() const
qlonglong t = qdbus_cast<qlonglong>(mPriv->location.value(
QLatin1String("timestamp")));
if (t != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
return QDateTime::fromTime_t((uint) t);
+#else
+ return QDateTime::fromSecsSinceEpoch((uint) t);
+#endif
}
return QDateTime();
}
diff --git a/TelepathyQt/message.cpp b/TelepathyQt/message.cpp
index 380fb54c..b8cbd1f3 100644
--- a/TelepathyQt/message.cpp
+++ b/TelepathyQt/message.cpp
@@ -242,7 +242,11 @@ QDateTime Message::sent() const
// FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690
uint stamp = valueFromPart(mPriv->parts, 0, "message-sent").toUInt();
if (stamp != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
return QDateTime::fromTime_t(stamp);
+#else
+ return QDateTime::fromSecsSinceEpoch(stamp);
+#endif
} else {
return QDateTime();
}
@@ -729,7 +733,11 @@ ReceivedMessage::ReceivedMessage(const MessagePartList &parts,
if (!mPriv->parts[0].contains(QLatin1String("message-received"))) {
mPriv->parts[0].insert(QLatin1String("message-received"),
QDBusVariant(static_cast<qlonglong>(
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t())));
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch())));
+#endif
}
mPriv->textChannel = channel;
}
@@ -771,7 +779,11 @@ QDateTime ReceivedMessage::received() const
// FIXME See http://bugs.freedesktop.org/show_bug.cgi?id=21690
uint stamp = valueFromPart(mPriv->parts, 0, "message-received").toUInt();
if (stamp != 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
return QDateTime::fromTime_t(stamp);
+#else
+ return QDateTime::fromSecsSinceEpoch(stamp);
+#endif
} else {
return QDateTime();
}
diff --git a/TelepathyQt/method-invocation-context.h b/TelepathyQt/method-invocation-context.h
index 79f6476e..7b0978a9 100644
--- a/TelepathyQt/method-invocation-context.h
+++ b/TelepathyQt/method-invocation-context.h
@@ -119,14 +119,14 @@ public:
mFinished = true;
- setReplyValue(0, qVariantFromValue(t1));
- setReplyValue(1, qVariantFromValue(t2));
- setReplyValue(2, qVariantFromValue(t3));
- setReplyValue(3, qVariantFromValue(t4));
- setReplyValue(4, qVariantFromValue(t5));
- setReplyValue(5, qVariantFromValue(t6));
- setReplyValue(6, qVariantFromValue(t7));
- setReplyValue(7, qVariantFromValue(t8));
+ setReplyValue(0, QVariant::fromValue(t1));
+ setReplyValue(1, QVariant::fromValue(t2));
+ setReplyValue(2, QVariant::fromValue(t3));
+ setReplyValue(3, QVariant::fromValue(t4));
+ setReplyValue(4, QVariant::fromValue(t5));
+ setReplyValue(5, QVariant::fromValue(t6));
+ setReplyValue(6, QVariant::fromValue(t7));
+ setReplyValue(7, QVariant::fromValue(t8));
if (mReply.isEmpty()) {
mBus.send(mMessage.createReply());
diff --git a/TelepathyQt/pending-channel-request.cpp b/TelepathyQt/pending-channel-request.cpp
index 90c1acc5..9ca9078b 100644
--- a/TelepathyQt/pending-channel-request.cpp
+++ b/TelepathyQt/pending-channel-request.cpp
@@ -104,7 +104,11 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
channelDispatcherInterface->CreateChannelWithHints(
QDBusObjectPath(account->objectPath()),
requestedProperties,
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
+#else
+ userActionTime.isNull() ? 0 : userActionTime.toSecsSinceEpoch(),
+#endif
preferredHandler, hints.allHints()), this);
} else {
warning() << "Hints passed to channel request won't have an effect"
@@ -117,7 +121,11 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
channelDispatcherInterface->CreateChannel(
QDBusObjectPath(account->objectPath()),
requestedProperties,
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
+#else
+ userActionTime.isNull() ? 0 : userActionTime.toSecsSinceEpoch(),
+#endif
preferredHandler), this);
}
} else {
@@ -127,7 +135,11 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
channelDispatcherInterface->EnsureChannelWithHints(
QDBusObjectPath(account->objectPath()),
requestedProperties,
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
+#else
+ userActionTime.isNull() ? 0 : userActionTime.toSecsSinceEpoch(),
+#endif
preferredHandler, hints.allHints()), this);
} else {
warning() << "Hints passed to channel request won't have an effect"
@@ -140,7 +152,11 @@ PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
channelDispatcherInterface->EnsureChannel(
QDBusObjectPath(account->objectPath()),
requestedProperties,
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.isNull() ? 0 : userActionTime.toTime_t(),
+#else
+ userActionTime.isNull() ? 0 : userActionTime.toSecsSinceEpoch(),
+#endif
preferredHandler), this);
}
}
diff --git a/TelepathyQt/text-channel.cpp b/TelepathyQt/text-channel.cpp
index 28a1a2d5..262e7aa9 100644
--- a/TelepathyQt/text-channel.cpp
+++ b/TelepathyQt/text-channel.cpp
@@ -1140,7 +1140,11 @@ void TextChannel::onTextReceived(uint id, uint timestamp, uint sender,
MessagePart header;
if (timestamp == 0) {
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
timestamp = QDateTime::currentDateTime().toTime_t();
+#else
+ timestamp = QDateTime::currentDateTime().toSecsSinceEpoch();
+#endif
}
header.insert(QLatin1String("message-received"),
QDBusVariant(static_cast<qlonglong>(timestamp)));
@@ -1192,7 +1196,11 @@ void TextChannel::onTextSendError(uint error, uint timestamp, uint type,
header.insert(QLatin1String("message-received"),
QDBusVariant(static_cast<qlonglong>(
+#if QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t())));
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch())));
+#endif
header.insert(QLatin1String("message-type"),
QDBusVariant(static_cast<uint>(
ChannelTextMessageTypeDeliveryReport)));
diff --git a/tests/dbus/account-basics.cpp b/tests/dbus/account-basics.cpp
index 88e45240..d54a0c99 100644
--- a/tests/dbus/account-basics.cpp
+++ b/tests/dbus/account-basics.cpp
@@ -103,7 +103,7 @@ private:
#define TEST_IMPLEMENT_PROPERTY_CHANGE_SLOT(Type, PropertyName) \
void TestAccountBasics::onAccount ## PropertyName ## Changed(Type value) \
{ \
- mProps[QLatin1String(#PropertyName)] = qVariantFromValue(value); \
+ mProps[QLatin1String(#PropertyName)] = QVariant::fromValue(value); \
mLoop->exit(0); \
}
@@ -295,15 +295,15 @@ void TestAccountBasics::testBasics()
SimpleStatusSpec prSpec = { ConnectionPresenceTypeOffline, true, false };
expectedPresences.append(PresenceSpec(QLatin1String("offline"), prSpec));
}
- qSort(expectedPresences);
+ std::sort(expectedPresences.begin(), expectedPresences.end());
PresenceSpecList presences = acc->allowedPresenceStatuses(false);
- qSort(presences);
+ std::sort(presences.begin(), presences.end());
QCOMPARE(presences.size(), 2);
QCOMPARE(presences, expectedPresences);
presences = acc->allowedPresenceStatuses(true);
- qSort(presences);
+ std::sort(presences.begin(), presences.end());
QCOMPARE(presences.size(), 2);
QCOMPARE(presences, expectedPresences);
@@ -491,10 +491,10 @@ void TestAccountBasics::testBasics()
SimpleStatusSpec prSpec = { ConnectionPresenceTypeOffline, true, false };
expectedPresences.append(PresenceSpec(QLatin1String("offline"), prSpec));
}
- qSort(expectedPresences);
+ std::sort(expectedPresences.begin(), expectedPresences.end());
presences = acc->allowedPresenceStatuses(false);
- qSort(presences);
+ std::sort(presences.begin(), presences.end());
QCOMPARE(presences.size(), 3);
QCOMPARE(presences, expectedPresences);
@@ -502,10 +502,10 @@ void TestAccountBasics::testBasics()
SimpleStatusSpec prSpec = { ConnectionPresenceTypeExtendedAway, false, false };
expectedPresences.append(PresenceSpec(QLatin1String("xa"), prSpec));
}
- qSort(expectedPresences);
+ std::sort(expectedPresences.begin(), expectedPresences.end());
presences = acc->allowedPresenceStatuses(true);
- qSort(presences);
+ std::sort(presences.begin(), presences.end());
QCOMPARE(presences.size(), 4);
QCOMPARE(presences, expectedPresences);
diff --git a/tests/dbus/account-channel-dispatcher.cpp b/tests/dbus/account-channel-dispatcher.cpp
index 3085d756..edd89b17 100644
--- a/tests/dbus/account-channel-dispatcher.cpp
+++ b/tests/dbus/account-channel-dispatcher.cpp
@@ -1092,7 +1092,11 @@ void TestAccountChannelDispatcher::testCreateAndHandleChannelHandledAgain()
SLOT(onChannelHandledAgain(QDateTime,Tp::ChannelRequestHints)));
QDateTime timestamp(QDate::currentDate());
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
mChannelDispatcherAdaptor->invokeHandler(timestamp.toTime_t());
+#else
+ mChannelDispatcherAdaptor->invokeHandler(timestamp.toSecsSinceEpoch());
+#endif
QCOMPARE(mLoop->exec(), 0);
QCOMPARE(mChannelHandledAgainActionTime, timestamp);
diff --git a/tests/dbus/client-factories.cpp b/tests/dbus/client-factories.cpp
index 719007b5..210a3564 100644
--- a/tests/dbus/client-factories.cpp
+++ b/tests/dbus/client-factories.cpp
@@ -542,7 +542,11 @@ void TestClientFactories::initTestCase()
QObject *request = new QObject(this);
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
mUserActionTime = QDateTime::currentDateTime().toTime_t();
+#else
+ mUserActionTime = QDateTime::currentDateTime().toSecsSinceEpoch();
+#endif
new ChannelRequestAdaptor(QDBusObjectPath(mAccount->objectPath()),
mUserActionTime,
QString(),
@@ -886,7 +890,11 @@ void TestClientFactories::testHandleChannels()
QCOMPARE(client1->mHandleChannelsRequestsSatisfied.first()->account().data(),
mAccount.data());
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QCOMPARE(client1->mHandleChannelsUserActionTime.toTime_t(), mUserActionTime);
+#else
+ QCOMPARE(client1->mHandleChannelsUserActionTime.toSecsSinceEpoch(), mUserActionTime);
+#endif
Tp::ObjectPathList handledChannels;
QVERIFY(waitForProperty(handler1Iface->requestPropertyHandledChannels(), &handledChannels));
@@ -926,7 +934,11 @@ void TestClientFactories::testHandleChannels()
QCOMPARE(client2->mHandleChannelsRequestsSatisfied.first()->account().data(),
mAccount.data());
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QCOMPARE(client2->mHandleChannelsUserActionTime.toTime_t(), mUserActionTime);
+#else
+ QCOMPARE(client2->mHandleChannelsUserActionTime.toSecsSinceEpoch(), mUserActionTime);
+#endif
QVERIFY(waitForProperty(handler1Iface->requestPropertyHandledChannels(), &handledChannels));
QVERIFY(handledChannels.contains(QDBusObjectPath(mText1ChanPath)));
diff --git a/tests/dbus/client.cpp b/tests/dbus/client.cpp
index 758f8edb..6ecd1e68 100644
--- a/tests/dbus/client.cpp
+++ b/tests/dbus/client.cpp
@@ -480,7 +480,11 @@ void TestClient::initTestCase()
QObject *request = new QObject(this);
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
mUserActionTime = QDateTime::currentDateTime().toTime_t();
+#else
+ mUserActionTime = QDateTime::currentDateTime().toSecsSinceEpoch();
+#endif
ChannelRequestAdaptor *channelRequest = new ChannelRequestAdaptor(QDBusObjectPath(mAccount->objectPath()),
mUserActionTime,
QString(),
@@ -675,9 +679,9 @@ void TestClient::testObserveChannelsCommon(const AbstractClientPtr &clientObject
channelReqImmutableProps.insert(
TP_QT_IFACE_CHANNEL_REQUEST + QLatin1String(".Interface.DomainSpecific.IntegerProp"), 3);
channelReqImmutableProps.insert(TP_QT_IFACE_CHANNEL_REQUEST + QLatin1String(".Account"),
- qVariantFromValue(QDBusObjectPath(mAccount->objectPath())));
+ QVariant::fromValue(QDBusObjectPath(mAccount->objectPath())));
reqPropsMap.insert(QDBusObjectPath(mChannelRequestPath), channelReqImmutableProps);
- observerInfo.insert(QLatin1String("request-properties"), qVariantFromValue(reqPropsMap));
+ observerInfo.insert(QLatin1String("request-properties"), QVariant::fromValue(reqPropsMap));
observeIface->ObserveChannels(QDBusObjectPath(mAccount->objectPath()),
QDBusObjectPath(mConn->objectPath()),
channelDetailsList,
@@ -753,12 +757,12 @@ void TestClient::testAddDispatchOperation()
handledChannels.clear();
QVERIFY(waitForProperty(handler1Iface->requestPropertyHandledChannels(), &handledChannels));
QVERIFY(!handledChannels.isEmpty());
- qSort(handledChannels);
+ std::sort(handledChannels.begin(), handledChannels.end());
Tp::ObjectPathList expectedHandledChannels;
Q_FOREACH (const ChannelDetails &details, mCDO->Channels()) {
expectedHandledChannels << details.channel;
}
- qSort(expectedHandledChannels);
+ std::sort(expectedHandledChannels.begin(), expectedHandledChannels.end());
QCOMPARE(handledChannels, expectedHandledChannels);
}
@@ -789,7 +793,11 @@ void TestClient::testHandleChannels()
QCOMPARE(client1->mHandleChannelsConnection->objectPath(), mConn->objectPath());
QCOMPARE(client1->mHandleChannelsChannels.first()->objectPath(), mText1ChanPath);
QCOMPARE(client1->mHandleChannelsRequestsSatisfied.first()->objectPath(), mChannelRequestPath);
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QCOMPARE(client1->mHandleChannelsUserActionTime.toTime_t(), mUserActionTime);
+#else
+ QCOMPARE(client1->mHandleChannelsUserActionTime.toSecsSinceEpoch(), mUserActionTime);
+#endif
Tp::ObjectPathList handledChannels;
QVERIFY(waitForProperty(handler1Iface->requestPropertyHandledChannels(), &handledChannels));
@@ -817,7 +825,11 @@ void TestClient::testHandleChannels()
QCOMPARE(client2->mHandleChannelsConnection->objectPath(), mConn->objectPath());
QCOMPARE(client2->mHandleChannelsChannels.first()->objectPath(), mText2ChanPath);
QCOMPARE(client2->mHandleChannelsRequestsSatisfied.first()->objectPath(), mChannelRequestPath);
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QCOMPARE(client2->mHandleChannelsUserActionTime.toTime_t(), mUserActionTime);
+#else
+ QCOMPARE(client2->mHandleChannelsUserActionTime.toSecsSinceEpoch(), mUserActionTime);
+#endif
QVERIFY(waitForProperty(handler1Iface->requestPropertyHandledChannels(), &handledChannels));
QVERIFY(handledChannels.contains(QDBusObjectPath(mText1ChanPath)));
diff --git a/tests/dbus/cm-protocol.cpp b/tests/dbus/cm-protocol.cpp
index 31d34c1c..b84c560c 100644
--- a/tests/dbus/cm-protocol.cpp
+++ b/tests/dbus/cm-protocol.cpp
@@ -126,11 +126,11 @@ public:
ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".Interfaces"),
mInterfaces);
ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".Parameters"),
- qVariantFromValue(mParameters));
+ QVariant::fromValue(mParameters));
ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".ConnectionInterfaces"),
mConnInterfaces);
ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".RequestableChannelClasses"),
- qVariantFromValue(mRCCs));
+ QVariant::fromValue(mRCCs));
ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".VCardField"),
mVCardField);
ret.insert(TP_QT_IFACE_PROTOCOL + QLatin1String(".EnglishName"),
@@ -408,7 +408,7 @@ public:
{
QVariantMap ret;
ret.insert(TP_QT_IFACE_PROTOCOL_INTERFACE_PRESENCE + QLatin1String(".Statuses"),
- qVariantFromValue(mStatuses));
+ QVariant::fromValue(mStatuses));
return ret;
}
diff --git a/tests/dbus/stream-tube-handlers.cpp b/tests/dbus/stream-tube-handlers.cpp
index 1530aad9..6bb11d62 100644
--- a/tests/dbus/stream-tube-handlers.cpp
+++ b/tests/dbus/stream-tube-handlers.cpp
@@ -902,7 +902,11 @@ void TestStreamTubeHandlers::testBasicTcpExport()
QDBusConnection bus = server->registrar()->dbusConnection();
new ChannelRequestAdaptor(QDBusObjectPath(mAcc->objectPath()),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.toTime_t(),
+#else
+ userActionTime.toSecsSinceEpoch(),
+#endif
QString(),
QualifiedPropertyValueMapList(),
QStringList(),
@@ -921,7 +925,11 @@ void TestStreamTubeHandlers::testBasicTcpExport()
QDBusObjectPath(mConn->objectPath()),
ChannelDetailsList() << details,
ObjectPathList() << QDBusObjectPath(requestPath),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
userActionTime.toTime_t(),
+#else
+ userActionTime.toSecsSinceEpoch(),
+#endif
QVariantMap());
QCOMPARE(mLoop->exec(), 0);
@@ -1009,7 +1017,11 @@ void TestStreamTubeHandlers::testFailedExport()
QDBusObjectPath(mConn->objectPath()),
ChannelDetailsList() << details,
ObjectPathList(),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t(),
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch(),
+#endif
QVariantMap());
QCOMPARE(mLoop->exec(), 0);
@@ -1056,7 +1068,11 @@ void TestStreamTubeHandlers::testServerConnMonitoring()
QDBusObjectPath(mConn->objectPath()),
ChannelDetailsList() << details,
ObjectPathList(),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t(),
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch(),
+#endif
QVariantMap());
QCOMPARE(mLoop->exec(), 0);
@@ -1229,7 +1245,11 @@ void TestStreamTubeHandlers::testSSTHErrorPaths()
QDBusObjectPath(mConn->objectPath()),
ChannelDetailsList() << details,
ObjectPathList(),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t(),
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch(),
+#endif
QVariantMap());
processDBusQueue(mConn->client().data());
@@ -1245,7 +1265,11 @@ void TestStreamTubeHandlers::testSSTHErrorPaths()
QDBusObjectPath(mConn->objectPath()),
ChannelDetailsList() << details,
ObjectPathList(),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t(),
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch(),
+#endif
QVariantMap());
processDBusQueue(mConn->client().data());
@@ -1260,7 +1284,11 @@ void TestStreamTubeHandlers::testSSTHErrorPaths()
QDBusObjectPath(mConn->objectPath()),
ChannelDetailsList() << details,
ObjectPathList(),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t(),
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch(),
+#endif
QVariantMap());
processDBusQueue(mConn->client().data());
@@ -1280,7 +1308,11 @@ void TestStreamTubeHandlers::testSSTHErrorPaths()
QDBusObjectPath(mConn->objectPath()),
ChannelDetailsList() << details,
ObjectPathList(),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t(),
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch(),
+#endif
QVariantMap());
processDBusQueue(mConn->client().data());
@@ -1747,7 +1779,11 @@ void TestStreamTubeHandlers::testClientConnMonitoring()
QDBusObjectPath(mConn->objectPath()),
ChannelDetailsList() << details,
ObjectPathList(),
+#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
QDateTime::currentDateTime().toTime_t(),
+#else
+ QDateTime::currentDateTime().toSecsSinceEpoch(),
+#endif
QVariantMap());
QCOMPARE(mLoop->exec(), 0);
diff --git a/tests/dbus/types.cpp b/tests/dbus/types.cpp
index 313b50c7..8e4acba8 100644
--- a/tests/dbus/types.cpp
+++ b/tests/dbus/types.cpp
@@ -39,9 +39,9 @@ public: // Properties
SocketAddressIPv6 saIPv6;
saIPv6.address = QLatin1String("3.3.3.3");
saIPv6.port = 3333;
- ret.insert(QLatin1String("SU"), qVariantFromValue(su));
- ret.insert(QLatin1String("saIPv4"), qVariantFromValue(saIPv4));
- ret.insert(QLatin1String("saIPv6"), qVariantFromValue(saIPv6));
+ ret.insert(QLatin1String("SU"), QVariant::fromValue(su));
+ ret.insert(QLatin1String("saIPv4"), QVariant::fromValue(saIPv4));
+ ret.insert(QLatin1String("saIPv6"), QVariant::fromValue(saIPv6));
return ret;
}