diff options
Diffstat (limited to 'test/qt/qpong.cpp')
-rw-r--r-- | test/qt/qpong.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/qt/qpong.cpp b/test/qt/qpong.cpp new file mode 100644 index 00000000..38e5c78d --- /dev/null +++ b/test/qt/qpong.cpp @@ -0,0 +1,35 @@ +#define DBUS_API_SUBJECT_TO_CHANGE +#include <QtCore/QtCore> +#include <dbus/qdbus.h> + +class Pong: public QObject +{ + Q_OBJECT +public slots: + + void ping(const QDBusMessage &msg) + { + QDBusMessage reply = QDBusMessage::methodReply(msg); + reply << static_cast<QList<QVariant> >(msg); + if (!msg.connection().send(reply)) + exit(1); + } +}; + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + + QDBusConnection &con = QDBus::sessionBus(); + if (!con.requestName("org.kde.selftest")) + exit(2); + + Pong pong; + con.registerObject("/org/kde/selftest", &pong, QDBusConnection::ExportSlots); + + printf("ready.\n"); + + return app.exec(); +} + +#include "qpong.moc" |