diff options
Diffstat (limited to 'src/dbus/qdbusserver.cpp')
-rw-r--r-- | src/dbus/qdbusserver.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index 078f56aa61..32471dfe5d 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -1,8 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) +** Contact: http://www.qt-project.org/ ** ** This file is part of the QtDBus module of the Qt Toolkit. ** @@ -35,6 +34,7 @@ ** ** ** +** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -82,6 +82,31 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent) } /*! + Constructs a QDBusServer with the given \a parent. The server will listen + for connections in \c {/tmp}. +*/ +QDBusServer::QDBusServer(QObject *parent) + : QObject(parent) +{ + const QString address = QLatin1String("unix:tmpdir=/tmp"); + + if (!qdbus_loadLibDBus()) { + d = 0; + return; + } + d = new QDBusConnectionPrivate(this); + + QMutexLocker locker(&QDBusConnectionManager::instance()->mutex); + QDBusConnectionManager::instance()->setConnection(QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(d)), d); + + QObject::connect(d, SIGNAL(newServerConnection(QDBusConnection)), + this, SIGNAL(newConnection(QDBusConnection))); + + QDBusErrorInternal error; + d->setServer(q_dbus_server_listen(address.toUtf8().constData(), error), error); +} + +/*! Destructs a QDBusServer */ QDBusServer::~QDBusServer() |