summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-12-28 21:51:30 -0200
committerThiago Macieira <thiago.macieira@intel.com>2015-01-06 19:41:36 +0100
commit2e2cf8a54954ac7cb1ce4929f9861978228e7bf6 (patch)
tree562accf9ac858223b6986eaf9209b5cbe716f1f7 /tests
parent32cbb363b969f364f18604ffa93f04938560210b (diff)
Remove the old QDBusConnection::sender functionality
This has been deprecated since QDBusContext was introduced (Qt 4.3). So it's time to remove the functionality. [ChangeLog][Important Behavior Change] QDBusConnection::sender() (deprecated since Qt 4.3) has changed to always return an invalid QDBusConnection. To know what connection the incoming call was received from, use QDBusContext. Change-Id: I355efb82c14e54ed718c8f892d8267e727b19118 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/dbus/qdbusinterface/myobject.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/auto/dbus/qdbusinterface/myobject.h b/tests/auto/dbus/qdbusinterface/myobject.h
index 9b337b2a28..cb350d043c 100644
--- a/tests/auto/dbus/qdbusinterface/myobject.h
+++ b/tests/auto/dbus/qdbusinterface/myobject.h
@@ -38,7 +38,7 @@
#include <QtDBus/QtDBus>
-class MyObject: public QObject
+class MyObject: public QObject, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.qtproject.QtDBus.MyObject")
@@ -123,15 +123,12 @@ public:
Q_INVOKABLE void ping_invokable(QDBusMessage msg)
{
- QDBusConnection sender = QDBusConnection::sender();
- if (!sender.isConnected())
- exit(1);
-
+ Q_ASSERT(QDBusContext::calledFromDBus());
++callCount;
callArgs = msg.arguments();
msg.setDelayedReply(true);
- if (!sender.send(msg.createReply(callArgs)))
+ if (!QDBusContext::connection().send(msg.createReply(callArgs)))
exit(1);
}
@@ -139,15 +136,12 @@ public slots:
void ping(QDBusMessage msg)
{
- QDBusConnection sender = QDBusConnection::sender();
- if (!sender.isConnected())
- exit(1);
-
+ Q_ASSERT(QDBusContext::calledFromDBus());
++callCount;
callArgs = msg.arguments();
msg.setDelayedReply(true);
- if (!sender.send(msg.createReply(callArgs)))
+ if (!QDBusContext::connection().send(msg.createReply(callArgs)))
exit(1);
}
};