diff options
Diffstat (limited to 'src/dbus/qdbusconnection.cpp')
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index a46df16ac5..ff897faab6 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtDBus module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -58,18 +58,6 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QDBusConnectionManager, _q_manager) -QDBusConnectionPrivate *QDBusConnectionManager::sender() const -{ - QMutexLocker locker(&senderMutex); - return connection(senderName); -} - -void QDBusConnectionManager::setSender(const QDBusConnectionPrivate *s) -{ - QMutexLocker locker(&senderMutex); - senderName = (s ? s->name : QString()); -} - QDBusConnectionPrivate *QDBusConnectionManager::connection(const QString &name) const { return connectionHash.value(name, 0); @@ -774,6 +762,26 @@ bool QDBusConnection::disconnect(const QString &service, const QString &path, co */ bool QDBusConnection::registerObject(const QString &path, QObject *object, RegisterOptions options) { + return registerObject(path, QString(), object, options); +} + +/*! + \overload + \since 5.5 + + Registers the object \a object at path \a path with interface name \a interface + and returns \c true if the registration was successful. The \a options parameter + specifies how much of the object \a object will be exposed through + D-Bus. + + This function does not replace existing objects: if there is already an object registered at + path \a path, this function will return false. Use unregisterObject() to unregister it first. + + You cannot register an object as a child object of an object that + was registered with QDBusConnection::ExportChildObjects. +*/ +bool QDBusConnection::registerObject(const QString &path, const QString &interface, QObject *object, RegisterOptions options) +{ Q_ASSERT_X(QDBusUtil::isValidObjectPath(path), "QDBusConnection::registerObject", "Invalid object path given"); if (!d || !d->connection || !object || !options || !QDBusUtil::isValidObjectPath(path)) @@ -805,6 +813,7 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis // we can add the object here node->obj = object; node->flags = options; + node->interfaceName = interface; d->registerObject(node); //qDebug("REGISTERED FOR %s", path.toLocal8Bit().constData()); @@ -1096,29 +1105,20 @@ QDBusConnection QDBusConnection::systemBus() return *_q_systemBus(); } +#if QT_DEPRECATED_SINCE(5,5) /*! - \nonreentrant + \deprecated - Returns the connection that sent the signal, if called in a slot activated - by QDBus; otherwise it returns 0. + Always returns a disconnected, invalid QDBusConnection object. For the old + functionality of determining the sender connection, please use \ref QDBusContext. - \note Please avoid this function. This function is not thread-safe, so if - there's any other thread delivering a D-Bus call, this function may return - the wrong connection. In new code, please use QDBusContext::connection() - (see that class for a description on how to use it). + \sa QDBusContext */ QDBusConnection QDBusConnection::sender() { - return QDBusConnection(_q_manager()->sender()); -} - -/*! - \internal -*/ -void QDBusConnectionPrivate::setSender(const QDBusConnectionPrivate *s) -{ - _q_manager()->setSender(s); + return QDBusConnection(QString()); } +#endif /*! \internal |