Changeset 561 for trunk/src/dbus


Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
1 deleted
60 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/dbus/dbus.pro

    r2 r561  
    1 TARGET          = QtDBus
    2 QPRO_PWD        = $$PWD
    3 QT              = core xml
    4 CONFIG         += link_pkgconfig
    5 DEFINES        += QDBUS_MAKEDLL DBUS_API_SUBJECT_TO_CHANGE
     1TARGET = QtDBus
     2QPRO_PWD = $$PWD
     3QT = core \
     4    xml
     5CONFIG += link_pkgconfig
     6DEFINES += QDBUS_MAKEDLL \
     7    DBUS_API_SUBJECT_TO_CHANGE
    68QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
    7 
    8 contains(QT_CONFIG, dbus-linked) {
    9     LIBS       += $$QT_LIBS_DBUS
    10     DEFINES    += QT_LINKED_LIBDBUS
     9contains(QT_CONFIG, dbus-linked) {
     10    LIBS_PRIVATE += $$QT_LIBS_DBUS
     11    DEFINES += QT_LINKED_LIBDBUS
    1112}
    1213
    13 #INCLUDEPATH += .
    14 
    15 unix {
    16    QMAKE_PKGCONFIG_DESCRIPTION = Qt DBus module
    17    QMAKE_PKGCONFIG_REQUIRES = QtCore QtXml
     14# INCLUDEPATH += .
     15unix {
     16    QMAKE_PKGCONFIG_DESCRIPTION = Qt \
     17        DBus \
     18        module
     19    QMAKE_PKGCONFIG_REQUIRES = QtCore \
     20        QtXml
    1821}
    19 
    20 win32 {
    21    LIBS += -lws2_32 -ladvapi32 -lnetapi32 -luser32
    22    CONFIG(debug, debug|release):LIBS += -ldbus-1d
    23    else:LIBS += -ldbus-1
     22win32 {
     23    LIBS_PRIVATE += -lws2_32 \
     24        -ladvapi32 \
     25        -lnetapi32 \
     26        -luser32
     27    CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d
     28    else:LIBS_PRIVATE += -ldbus-1
    2429}
    25 
    2630include(../qbase.pri)
    27 
    28 PUB_HEADERS =  qdbusargument.h \
    29                qdbusconnectioninterface.h \
    30                qdbusmacros.h \
    31                qdbuserror.h \
    32                qdbusextratypes.h \
    33                qdbusmessage.h \
    34                qdbusserver.h \
    35                qdbusconnection.h \
    36                qdbusabstractinterface.h \
    37                qdbusinterface.h \
    38                qdbusabstractadaptor.h \
    39                qdbusreply.h \
    40                qdbusmetatype.h \
    41                qdbuspendingcall.h \
    42                qdbuspendingreply.h \
    43                qdbuscontext.h
    44 
     31PUB_HEADERS = qdbusargument.h \
     32    qdbusconnectioninterface.h \
     33    qdbusmacros.h \
     34    qdbuserror.h \
     35    qdbusextratypes.h \
     36    qdbusmessage.h \
     37    qdbusserver.h \
     38    qdbusconnection.h \
     39    qdbusabstractinterface.h \
     40    qdbusinterface.h \
     41    qdbusabstractadaptor.h \
     42    qdbusreply.h \
     43    qdbusmetatype.h \
     44    qdbuspendingcall.h \
     45    qdbuspendingreply.h \
     46    qdbuscontext.h
    4547HEADERS += $$PUB_HEADERS \
    46            qdbusconnection_p.h qdbusmessage_p.h \
    47            qdbusinterface_p.h qdbusxmlparser_p.h qdbusabstractadaptor_p.h \
    48            qdbusargument_p.h qdbusutil_p.h qdbusabstractinterface_p.h \
    49            qdbuscontext_p.h qdbusthreaddebug_p.h qdbusintegrator_p.h \
    50            qdbuspendingcall_p.h qdbus_symbols_p.h
    51 
    52 SOURCES += qdbusconnection.cpp  \
    53         qdbusconnectioninterface.cpp \
    54         qdbuserror.cpp          \
    55         qdbusintegrator.cpp     \
    56         qdbusmessage.cpp        \
    57         qdbusserver.cpp         \
    58         qdbusabstractinterface.cpp \
    59         qdbusinterface.cpp      \
    60         qdbusxmlparser.cpp      \
    61         qdbusutil.cpp           \
    62         qdbusintrospection.cpp  \
    63         qdbusabstractadaptor.cpp \
    64         qdbusthread.cpp \
    65         qdbusinternalfilters.cpp \
    66         qdbusmetaobject.cpp     \
    67         qdbusxmlgenerator.cpp   \
    68         qdbusmisc.cpp           \
    69         qdbusargument.cpp       \
    70         qdbusreply.cpp          \
    71         qdbusmetatype.cpp       \
    72         qdbusextratypes.cpp     \
    73         qdbusmarshaller.cpp     \
    74         qdbuscontext.cpp        \
    75         qdbuspendingcall.cpp    \
    76         qdbuspendingreply.cpp   \
    77         qdbus_symbols.cpp
    78 
     48    qdbusconnection_p.h \
     49    qdbusmessage_p.h \
     50    qdbusinterface_p.h \
     51    qdbusxmlparser_p.h \
     52    qdbusabstractadaptor_p.h \
     53    qdbusargument_p.h \
     54    qdbusutil_p.h \
     55    qdbusabstractinterface_p.h \
     56    qdbuscontext_p.h \
     57    qdbusthreaddebug_p.h \
     58    qdbusintegrator_p.h \
     59    qdbuspendingcall_p.h \
     60    qdbus_symbols_p.h \
     61    qdbusservicewatcher.h
     62SOURCES += qdbusconnection.cpp \
     63    qdbusconnectioninterface.cpp \
     64    qdbuserror.cpp \
     65    qdbusintegrator.cpp \
     66    qdbusmessage.cpp \
     67    qdbusserver.cpp \
     68    qdbusabstractinterface.cpp \
     69    qdbusinterface.cpp \
     70    qdbusxmlparser.cpp \
     71    qdbusutil.cpp \
     72    qdbusintrospection.cpp \
     73    qdbusabstractadaptor.cpp \
     74    qdbusinternalfilters.cpp \
     75    qdbusmetaobject.cpp \
     76    qdbusxmlgenerator.cpp \
     77    qdbusmisc.cpp \
     78    qdbusargument.cpp \
     79    qdbusreply.cpp \
     80    qdbusmetatype.cpp \
     81    qdbusextratypes.cpp \
     82    qdbusmarshaller.cpp \
     83    qdbuscontext.cpp \
     84    qdbuspendingcall.cpp \
     85    qdbuspendingreply.cpp \
     86    qdbus_symbols.cpp \
     87    qdbusservicewatcher.cpp
  • trunk/src/dbus/qdbus_symbols.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbus_symbols_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    354354           (signature, error), return)
    355355DEFINEFUNC(dbus_bool_t     , dbus_type_is_basic, (int            typecode),
    356            (typecode), return);
     356           (typecode), return)
    357357DEFINEFUNC(dbus_bool_t     , dbus_type_is_fixed, (int            typecode),
    358358           (typecode), return)
    359359
     360
     361
     362
    360363QT_END_NAMESPACE
    361364
  • trunk/src/dbus/qdbusabstractadaptor.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    265265void QDBusAdaptorConnector::relaySlot(void **argv)
    266266{
    267     QObjectPrivate *d = static_cast<QObjectPrivate *>(d_ptr);
     267    QObjectPrivate *d = static_cast<QObjectPrivate *>(d_ptr);
    268268    relay(d->currentSender->sender, d->currentSender->signal, argv);
    269269}
  • trunk/src/dbus/qdbusabstractadaptor.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusabstractadaptor_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusabstractinterface.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4545#include "qdbusargument.h"
    4646#include "qdbuspendingcall.h"
     47
    4748#include "qdbusmetaobject_p.h"
    4849#include "qdbusmetatype_p.h"
     
    5253
    5354QT_BEGIN_NAMESPACE
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
    5478
    5579QDBusAbstractInterfacePrivate::QDBusAbstractInterfacePrivate(const QString &serv,
     
    5882                                                             const QDBusConnection& con,
    5983                                                             bool isDynamic)
    60     : connection(con), service(serv), path(p), interface(iface), isValid(true)
    61 {
    62     if (isDynamic) {
    63         // QDBusInterface: service and object path can't be empty, but interface can
    64 #if 0
    65         Q_ASSERT_X(QDBusUtil::isValidBusName(service),
    66                    "QDBusInterface::QDBusInterface", "Invalid service name");
    67         Q_ASSERT_X(QDBusUtil::isValidObjectPath(path),
    68                    "QDBusInterface::QDBusInterface", "Invalid object path given");
    69         Q_ASSERT_X(interface.isEmpty() || QDBusUtil::isValidInterfaceName(interface),
    70                    "QDBusInterface::QDBusInterface", "Invalid interface name");
    71 #else
    72         if (!QDBusUtil::isValidBusName(service)) {
    73             lastError = QDBusError(QDBusError::Disconnected,
    74                                    QLatin1String("Invalid service name"));
    75             isValid = false;
    76         } else if (!QDBusUtil::isValidObjectPath(path)) {
    77             lastError = QDBusError(QDBusError::Disconnected,
    78                                    QLatin1String("Invalid object name given"));
    79             isValid = false;
    80         } else if (!interface.isEmpty() && !QDBusUtil::isValidInterfaceName(interface)) {
    81             lastError = QDBusError(QDBusError::Disconnected,
    82                                    QLatin1String("Invalid interface name"));
    83             isValid = false;
    84         }
    85 #endif
    86     } else {
    87         // all others: service and path can be empty here, but interface can't
    88 #if 0
    89         Q_ASSERT_X(service.isEmpty() || QDBusUtil::isValidBusName(service),
    90                    "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid service name");
    91         Q_ASSERT_X(path.isEmpty() || QDBusUtil::isValidObjectPath(path),
    92                    "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid object path given");
    93         Q_ASSERT_X(QDBusUtil::isValidInterfaceName(interface),
    94                    "QDBusAbstractInterface::QDBusAbstractInterface", "Invalid interface class!");
    95 #else
    96         if (!service.isEmpty() && !QDBusUtil::isValidBusName(service)) {
    97             lastError = QDBusError(QDBusError::Disconnected,
    98                                    QLatin1String("Invalid service name"));
    99             isValid = false;
    100         } else if (!path.isEmpty() && !QDBusUtil::isValidObjectPath(path)) {
    101             lastError = QDBusError(QDBusError::Disconnected,
    102                                    QLatin1String("Invalid object path given"));
    103             isValid = false;
    104         } else if (!QDBusUtil::isValidInterfaceName(interface)) {
    105             lastError = QDBusError(QDBusError::Disconnected,
    106                                    QLatin1String("Invalid interface class"));
    107             isValid = false;
    108         }
    109 #endif
    110     }
    111 
     84    : connection(con), service(serv), path(p), interface(iface),
     85      lastError(checkIfValid(serv, p, iface, isDynamic)),
     86      isValid(!lastError.isValid())
     87{
    11288    if (!isValid)
    11389        return;
     
    11692        lastError = QDBusError(QDBusError::Disconnected,
    11793                               QLatin1String("Not connected to D-Bus server"));
    118         isValid = false;
    11994    } else if (!service.isEmpty()) {
    12095        currentOwner = connectionPrivate()->getNameOwner(service); // verify the name owner
    12196        if (currentOwner.isEmpty()) {
    122             isValid = false;
    12397            lastError = connectionPrivate()->lastError;
    12498        }
     
    126100}
    127101
    128 QVariant QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp) const
    129 {
    130     if (!connection.isConnected())    // not connected
    131         return QVariant();
     102bool QDBusAbstractInterfacePrivate::canMakeCalls() const
     103{
     104    // recheck only if we have a wildcard (i.e. empty) service or path
     105    // if any are empty, set the error message according to QDBusUtil
     106    if (service.isEmpty())
     107        return QDBusUtil::checkBusName(service, QDBusUtil::EmptyNotAllowed, &lastError);
     108    if (path.isEmpty())
     109        return QDBusUtil::checkObjectPath(path, QDBusUtil::EmptyNotAllowed, &lastError);
     110    return true;
     111}
     112
     113void QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, QVariant &where) const
     114{
     115    if (!isValid || !canMakeCalls()) {   // can't make calls
     116        where.clear();
     117        return;
     118    }
    132119
    133120    // is this metatype registered?
    134     int mid;
    135     const char *expectedSignature;
    136     if (mp.type() == QVariant::LastType) {
    137         // We're asking to read a QVariant
    138         mid = qMetaTypeId<QDBusVariant>();
    139         expectedSignature = "v";
    140     } else {
    141         mid = QMetaType::type(mp.typeName());
    142         expectedSignature = QDBusMetaType::typeToSignature(mid);
     121    const char *expectedSignature = "";
     122    if (mp.type() != 0xff) {
     123        expectedSignature = QDBusMetaType::typeToSignature(where.userType());
    143124        if (expectedSignature == 0) {
    144125            qWarning("QDBusAbstractInterface: type %s must be registered with QtDBus before it can be "
    145126                     "used to read property %s.%s",
    146127                     mp.typeName(), qPrintable(interface), mp.name());
    147             return QVariant();
     128            lastError = QDBusError(QDBusError::Failed,
     129                                   QString::fromLatin1("Unregistered type %1 cannot be handled")
     130                                   .arg(QLatin1String(mp.typeName())));
     131            where.clear();
     132            return;
    148133        }
    149134    }
     
    153138                                                      QLatin1String(DBUS_INTERFACE_PROPERTIES),
    154139                                                      QLatin1String("Get"));
     140
    155141    msg << interface << QString::fromUtf8(mp.name());
    156142    QDBusMessage reply = connection.call(msg, QDBus::Block);
     
    158144    if (reply.type() != QDBusMessage::ReplyMessage) {
    159145        lastError = reply;
    160         return QVariant();
     146        where.clear();
     147        return;
    161148    }
    162149    if (reply.signature() != QLatin1String("v")) {
     
    164151                                       DBUS_INTERFACE_PROPERTIES);
    165152        lastError = QDBusError(QDBusError::InvalidSignature, errmsg.arg(reply.signature()));
    166         return QVariant();
     153        where.clear();
     154        return;
    167155    }
    168156
     
    171159    QVariant value = qvariant_cast<QDBusVariant>(reply.arguments().at(0)).variant();
    172160
    173     if (value.userType() == mid)
    174         return value;       // simple match
     161    if (value.userType() == where.userType() || mp.type() == 0xff
     162        || (expectedSignature[0] == 'v' && expectedSignature[1] == '\0')) {
     163        // simple match
     164        where = value;
     165        return;
     166    }
    175167
    176168    if (value.userType() == qMetaTypeId<QDBusArgument>()) {
     
    180172        foundSignature = arg.currentSignature().toLatin1();
    181173        if (foundSignature == expectedSignature) {
    182             void *null = 0;
    183             QVariant result(mid, null);
    184             QDBusMetaType::demarshall(arg, mid, result.data());
    185 
    186             if (mp.type() == QVariant::LastType)
    187                 // special case: QVariant
    188                 return qvariant_cast<QDBusVariant>(result).variant();
    189             return result;
     174            // signatures match, we can demarshall
     175            QDBusMetaType::demarshall(arg, where.userType(), where.data());
     176            return;
    190177        }
    191178    } else {
     
    204191                                      QString::fromLatin1(mp.typeName()),
    205192                                      QString::fromLatin1(expectedSignature)));
    206     return QVariant();
    207 }
    208 
    209 void QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value)
    210 {
    211     if (!connection.isConnected())    // not connected
    212         return;
     193    where.clear();
     194    return;
     195}
     196
     197bool QDBusAbstractInterfacePrivate::setProperty(const QMetaProperty &mp, const QVariant &value)
     198{
     199    if (!isValid || !canMakeCalls())    // can't make calls
     200        return false;
    213201
    214202    // send the value
     
    216204                                                QLatin1String(DBUS_INTERFACE_PROPERTIES),
    217205                                                QLatin1String("Set"));
     206
    218207    msg << interface << QString::fromUtf8(mp.name()) << qVariantFromValue(QDBusVariant(value));
    219208    QDBusMessage reply = connection.call(msg, QDBus::Block);
    220209
    221     if (reply.type() != QDBusMessage::ReplyMessage)
     210    if (reply.type() != QDBusMessage::ReplyMessage)
    222211        lastError = reply;
     212
     213
     214
    223215}
    224216
     
    231223    if (name == service) {
    232224        currentOwner = newOwner;
    233         isValid = !newOwner.isEmpty();
    234     }
    235 }
    236 
     225    }
     226}
     227
     228QDBusAbstractInterfaceBase::QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &d, QObject *parent)
     229    : QObject(d, parent)
     230{
     231}
     232
     233int QDBusAbstractInterfaceBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
     234{
     235    int saved_id = _id;
     236    _id = QObject::qt_metacall(_c, _id, _a);
     237    if (_id < 0)
     238        return _id;
     239
     240    if (_c == QMetaObject::ReadProperty || _c == QMetaObject::WriteProperty) {
     241        QMetaProperty mp = metaObject()->property(saved_id);
     242        int &status = *reinterpret_cast<int *>(_a[2]);
     243        QVariant &variant = *reinterpret_cast<QVariant *>(_a[1]);
     244
     245        if (_c == QMetaObject::WriteProperty) {
     246            status = d_func()->setProperty(mp, variant) ? 1 : 0;
     247        } else {
     248            d_func()->property(mp, variant);
     249            status = variant.isValid() ? 1 : 0;
     250        }
     251        _id = -1;
     252    }
     253    return _id;
     254}
    237255
    238256/*!
     
    259277*/
    260278QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d, QObject *parent)
    261     : QObject(d, parent)
     279    : Q(d, parent)
    262280{
    263281    // keep track of the service owner
    264     if (d_func()->isValid)
    265         QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
    266                          this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
     282    if (d.isValid &&
     283        d.connection.isConnected()
     284        && !d.service.isEmpty()
     285        && !d.service.startsWith(QLatin1Char(':')))
     286        d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service
     287                                     QString(), // path
     288                                     QLatin1String(DBUS_INTERFACE_DBUS), // interface
     289                                     QLatin1String("NameOwnerChanged"),
     290                                     QStringList() << d.service,
     291                                     QString(), // signature
     292                                     this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
    267293}
    268294
     
    275301                                               const char *interface, const QDBusConnection &con,
    276302                                               QObject *parent)
    277     : QObject(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface),
     303    : Q(*new QDBusAbstractInterfacePrivate(service, path, QString::fromLatin1(interface),
    278304                                                 con, false), parent)
    279305{
    280306    // keep track of the service owner
    281     if (d_func()->connection.isConnected())
    282         QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
    283                          this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
     307    if (d_func()->isValid &&
     308        d_func()->connection.isConnected()
     309        && !service.isEmpty()
     310        && !service.startsWith(QLatin1Char(':')))
     311        d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service
     312                                     QString(), // path
     313                                     QLatin1String(DBUS_INTERFACE_DBUS), // interface
     314                                     QLatin1String("NameOwnerChanged"),
     315                                     QStringList() << service,
     316                                     QString(), //signature
     317                                     this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
    284318}
    285319
     
    301335bool QDBusAbstractInterface::isValid() const
    302336{
    303     return d_func()->isValid;
     337    return ;
    304338}
    305339
     
    367401{
    368402    Q_D(QDBusAbstractInterface);
     403
     404
     405
    369406
    370407    QString m = method;
     
    398435//    qDebug() << "QDBusAbstractInterface" << "Service" << service() << "Path:" << path();
    399436    QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), m);
     437
    400438    msg.setArguments(args);
    401439
     
    426464    Q_D(QDBusAbstractInterface);
    427465
     466
     467
     468
    428469    QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), interface(), method);
     470
    429471    msg.setArguments(args);
    430472    return d->connection.asyncCall(msg);
     
    441483    This function returns true if the queueing succeeds. It does
    442484    not indicate that the executed call succeeded. If it fails,
    443     the \a errorMethod is called.
     485    the \a errorMethod is called. If the queueing failed, this
     486    function returns false and no slot will be called.
    444487 
    445488    The \a returnMethod must have as its parameters the types returned
     
    454497                                              const QList<QVariant> &args,
    455498                                              QObject *receiver,
    456                                               const char *returnMethod,
     499      const char *returnMethod,
    457500                                              const char *errorMethod)
    458501{
    459502    Q_D(QDBusAbstractInterface);
    460503
     504
     505
     506
    461507    QDBusMessage msg = QDBusMessage::createMethodCall(service(),
    462                                                       path(),
    463                                                       interface(),
    464                                                       method);
     508                                                      path(),
     509                                                      interface(),
     510                                                      method);
     511    QDBusMessagePrivate::setParametersValidated(msg, true);
    465512    msg.setArguments(args);
    466513
    467514    d->lastError = 0;
    468515    return d->connection.callWithCallback(msg,
    469                                           receiver,
    470                                           returnMethod,
    471                                           errorMethod);
     516  receiver,
     517  returnMethod,
     518  errorMethod);
    472519}
    473520
     
    493540                                              const QList<QVariant> &args,
    494541                                              QObject *receiver,
    495                                               const char *slot)
     542      const char *slot)
    496543{
    497544    return callWithCallback(method, args, receiver, slot, 0);
     
    504551void QDBusAbstractInterface::connectNotify(const char *signal)
    505552{
     553
     554
     555
     556
     557
    506558    // we end up recursing here, so optimise away
    507559    if (qstrcmp(signal + 1, "destroyed(QObject*)") == 0)
    508560        return;
    509561
    510     // someone connecting to one of our signals
     562    QDBusConnectionPrivate *conn = d->connectionPrivate();
     563    if (conn) {
     564        conn->connectRelay(d->service, d->path, d->interface,
     565                           this, signal);
     566    }
     567}
     568
     569/*!
     570    \internal
     571    Catch signal disconnections.
     572*/
     573void QDBusAbstractInterface::disconnectNotify(const char *signal)
     574{
     575    // someone disconnecting from one of our signals
    511576    Q_D(QDBusAbstractInterface);
     577
     578
    512579
    513580    QDBusConnectionPrivate *conn = d->connectionPrivate();
    514581    if (conn)
    515         conn->connectRelay(d->service, d->currentOwner, d->path, d->interface,
    516                            this, signal);
    517 }
    518 
    519 /*!
    520     \internal
    521     Catch signal disconnections.
    522 */
    523 void QDBusAbstractInterface::disconnectNotify(const char *signal)
    524 {
    525     // someone disconnecting from one of our signals
    526     Q_D(QDBusAbstractInterface);
    527 
    528     QDBusConnectionPrivate *conn = d->connectionPrivate();
    529     if (conn)
    530         conn->disconnectRelay(d->service, d->currentOwner, d->path, d->interface,
     582        conn->disconnectRelay(d->service, d->path, d->interface,
    531583                              this, signal);
    532584}
     
    541593    // we're only called from generated code anyways
    542594
    543     int idx = metaObject()->indexOfProperty(propname);
    544     if (idx != -1)
    545         return d_func()->property(metaObject()->property(idx));
    546     qWarning("QDBusAbstractInterface::internalPropGet called with unknown property '%s'", propname);
    547     return QVariant();          // error
     595    return property(propname);
    548596}
    549597
     
    554602void QDBusAbstractInterface::internalPropSet(const char *propname, const QVariant &value)
    555603{
    556     Q_D(QDBusAbstractInterface);
    557 
    558     // assume this property exists and is writeable
    559     // we're only called from generated code anyways
    560 
    561     int idx = metaObject()->indexOfProperty(propname);
    562     if (idx != -1)
    563         d->setProperty(metaObject()->property(idx), value);
    564     else
    565         qWarning("QDBusAbstractInterface::internalPropGet called with unknown property '%s'", propname);
     604    setProperty(propname, value);
    566605}
    567606
  • trunk/src/dbus/qdbusabstractinterface.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6262
    6363class QDBusAbstractInterfacePrivate;
    64 class QDBUS_EXPORT QDBusAbstractInterface: public QObject
     64
     65class QDBUS_EXPORT QDBusAbstractInterfaceBase: public QObject
     66{
     67public:
     68    int qt_metacall(QMetaObject::Call, int, void**);
     69protected:
     70    QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent);
     71private:
     72    Q_DECLARE_PRIVATE(QDBusAbstractInterface)
     73};
     74
     75class QDBUS_EXPORT QDBusAbstractInterface:
     76#ifdef Q_QDOC
     77        public QObject
     78#else
     79        public QDBusAbstractInterfaceBase
     80#endif
    6581{
    6682    Q_OBJECT
  • trunk/src/dbus/qdbusabstractinterface_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7676    QString interface;
    7777    mutable QDBusError lastError;
     78
     79
     80
    7881    bool isValid;
    7982
     
    8184                                  const QString &iface, const QDBusConnection& con, bool dynamic);
    8285    virtual ~QDBusAbstractInterfacePrivate() { }
     86
    8387
    8488    // these functions do not check if the property is valid
    85     QVariant property(const QMetaProperty &mp) const;
    86     void setProperty(const QMetaProperty &mp, const QVariant &value);
     89    ) const;
     90    setProperty(const QMetaProperty &mp, const QVariant &value);
    8791
    8892    // return conn's d pointer
  • trunk/src/dbus/qdbusargument.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusargument.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusargument_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5555
    5656#include <qdbusargument.h>
    57 #include <qdbus_symbols_p.h>
     57#include
    5858
    5959QT_BEGIN_NAMESPACE
     
    131131    void open(QDBusMarshaller &sub, int code, const char *signature);
    132132    void close();
    133     void error();
     133    void error();
    134134
    135135    bool appendVariantInternal(const QVariant &arg);
     
    141141    QDBusMarshaller *parent;
    142142    QByteArray *ba;
     143
    143144    char closeCode;
    144145    bool ok;
  • trunk/src/dbus/qdbusconnection.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    558558                              const QString &name, QObject *receiver, const char *slot)
    559559{
    560     return connect(service, path, interface, name, QString(), receiver, slot);
    561 }
    562 
    563 /*!
    564     Disconnects the signal specified by the \a service, \a path, \a interface and \a name parameters from
    565     the slot \a slot in object \a receiver. The arguments \a service and \a path can be empty,
    566     denoting a disconnection from all signals of the (\a interface, \a name) pair, from all remote
    567     applications.
    568 
    569     Returns true if the disconnection was successful.
    570 */
    571 bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString &interface,
    572                                  const QString &name, QObject *receiver, const char *slot)
    573 {
    574     return disconnect(service, path, interface, name, QString(), receiver, slot);
     560    return connect(service, path, interface, name, QStringList(), QString(), receiver, slot);
    575561}
    576562
     
    579565
    580566    Connects the signal to the slot \a slot in object \a
    581     receiver. Unlike the other connect() overload, this function
     567    receiver. Unlike the connect() overload, this function
    582568    allows one to specify the parameter signature to be connected
    583569    using the \a signature variable. The function will then verify
     
    585571    slot and return false otherwise.
    586572
     573
     574
    587575    \note This function verifies that the signal signature matches the
    588576          slot's parameters, but it does not verify that the actual
     
    594582                              QObject *receiver, const char *slot)
    595583{
     584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
     602
     603
     604
     605
     606
     607
     608
     609
     610
     611
     612
     613
     614
    596615    if (!receiver || !slot || !d || !d->connection)
    597616        return false;
     
    601620        return false;
    602621
    603     // check the slot
    604     QDBusConnectionPrivate::SignalHook hook;
    605     QString key;
    606     QString name2 = name;
    607     if (name2.isNull())
    608         name2.detach();
    609 
    610     QString owner = d->getNameOwner(service); // we don't care if the owner is empty
    611     hook.signature = signature;               // it might get started later
    612     if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false))
    613         return false;           // don't connect
    614 
    615     // avoid duplicating:
    616622    QDBusWriteLocker locker(ConnectAction, d);
    617     QDBusConnectionPrivate::SignalHookHash::ConstIterator it = d->signalHooks.find(key);
    618     QDBusConnectionPrivate::SignalHookHash::ConstIterator end = d->signalHooks.constEnd();
    619     for ( ; it != end && it.key() == key; ++it) {
    620         const QDBusConnectionPrivate::SignalHook &entry = it.value();
    621         if (entry.service == hook.service &&
    622             entry.owner == hook.owner &&
    623             entry.path == hook.path &&
    624             entry.signature == hook.signature &&
    625             entry.obj == hook.obj &&
    626             entry.midx == hook.midx) {
    627             // no need to compare the parameters if it's the same slot
    628             return true;        // already there
    629         }
    630     }
    631 
    632     d->connectSignal(key, hook);
    633     return true;
     623    return d->connectSignal(service, path, interface, name, argumentMatch, signature, receiver, slot);
     624}
     625
     626/*!
     627    Disconnects the signal specified by the \a service, \a path, \a interface
     628    and \a name parameters from the slot \a slot in object \a receiver. The
     629    arguments must be the same as passed to the connect() function.
     630
     631    Returns true if the disconnection was successful.
     632*/
     633bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString &interface,
     634                                 const QString &name, QObject *receiver, const char *slot)
     635{
     636    return disconnect(service, path, interface, name, QStringList(), QString(), receiver, slot);
    634637}
    635638
     
    637640    \overload
    638641
    639     Disconnects the signal from the slot \a slot in object \a
    640     receiver. Unlike the other disconnect() overload, this function
    641     allows one to specify the parameter signature to be disconnected
    642     using the \a signature variable. The function will then verify
    643     that this signature is connected to the slot specified by \a slot
    644     and return false otherwise.
     642    Disconnects the signal \a
     643    n
     644   
     645   
     646
     647    .
    645648*/
    646649bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString& interface,
    647650                                 const QString &name, const QString &signature,
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
    648669                                 QObject *receiver, const char *slot)
    649670{
     
    655676        return false;
    656677
    657     // check the slot
    658     QDBusConnectionPrivate::SignalHook hook;
    659     QString key;
    660     QString name2 = name;
    661     if (name2.isNull())
    662         name2.detach();
    663 
    664     QString owner = d->getNameOwner(service); // we don't care of owner is empty
    665     hook.signature = signature;
    666     if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false))
    667         return false;           // don't disconnect
    668 
    669     // avoid duplicating:
    670678    QDBusWriteLocker locker(DisconnectAction, d);
    671     QDBusConnectionPrivate::SignalHookHash::Iterator it = d->signalHooks.find(key);
    672     QDBusConnectionPrivate::SignalHookHash::Iterator end = d->signalHooks.end();
    673     for ( ; it != end && it.key() == key; ++it) {
    674         const QDBusConnectionPrivate::SignalHook &entry = it.value();
    675         if (entry.service == hook.service &&
    676             entry.owner == hook.owner &&
    677             entry.path == hook.path &&
    678             entry.signature == hook.signature &&
    679             entry.obj == hook.obj &&
    680             entry.midx == hook.midx) {
    681             // no need to compare the parameters if it's the same slot
    682             d->disconnectSignal(it);
    683             return true;        // it was there
    684         }
    685     }
    686 
    687     // the slot was not found
    688     return false;
     679    return d->disconnectSignal(service, path, interface, name, argumentMatch, signature, receiver, slot);
    689680}
    690681
     
    974965
    975966/*!
     967
     968
    976969  Returns the connection that sent the signal, if called in a slot activated
    977970  by QDBus; otherwise it returns 0.
     971
     972
     973
     974
     975
    978976*/
    979977QDBusConnection QDBusConnection::sender()
     
    10061004    ref.deref(); // busService has increased the refcounting to us
    10071005                 // avoid cyclic refcounting
    1008 //    if (mode != PeerMode)
    1009     QObject::connect(busService, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
    1010                      this, SIGNAL(serviceOwnerChanged(QString,QString,QString)));
    10111006
    10121007    QObject::connect(this, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)),
    10131008                     busService, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)),
    10141009                     Qt::QueuedConnection);
    1015 
    10161010}
    10171011
  • trunk/src/dbus/qdbusconnection.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    133133    bool connect(const QString &service, const QString &path, const QString &interface,
    134134                 const QString &name, QObject *receiver, const char *slot);
    135     bool disconnect(const QString &service, const QString &path, const QString &interface,
    136                     const QString &name, QObject *receiver, const char *slot);
    137 
    138135    bool connect(const QString &service, const QString &path, const QString &interface,
    139136                 const QString &name, const QString& signature,
    140137                 QObject *receiver, const char *slot);
     138
     139
     140
     141
     142
     143
    141144    bool disconnect(const QString &service, const QString &path, const QString &interface,
    142145                    const QString &name, const QString& signature,
     146
     147
     148
    143149                    QObject *receiver, const char *slot);
    144150
  • trunk/src/dbus/qdbusconnection_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6868#include <QtCore/qvector.h>
    6969
    70 #include <qdbus_symbols_p.h>
     70#include
    7171
    7272#include <qdbusmessage.h>
     
    120120    {
    121121        inline SignalHook() : obj(0), midx(-1) { }
    122         QString owner, service, path, signature;
     122        QString service, path, signature;
    123123        QObject* obj;
    124124        int midx;
    125125        QList<int> params;
     126
    126127        QByteArray matchRule;
    127128    };
     
    156157    typedef QHash<QByteArray, int> MatchRefCountHash;
    157158
     159
     160
     161
     162
     163
     164
     165
    158166public:
    159167    // public methods are entry points from other objects
     
    176184    int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver,
    177185                           const char *returnMethod, const char *errorMethod, int timeout = -1);
     186
     187
     188
    178189    void connectSignal(const QString &key, const SignalHook &hook);
    179190    SignalHookHash::Iterator disconnectSignal(SignalHookHash::Iterator &it);
     191
     192
     193
    180194    void registerObject(const ObjectTreeNode *node);
    181     void connectRelay(const QString &service, const QString &currentOwner,
     195    void connectRelay(const QString &service,
    182196                      const QString &path, const QString &interface,
    183197                      QDBusAbstractInterface *receiver, const char *signal);
    184     void disconnectRelay(const QString &service, const QString &currentOwner,
     198    void disconnectRelay(const QString &service,
    185199                         const QString &path, const QString &interface,
    186200                         QDBusAbstractInterface *receiver, const char *signal);
     
    191205    QDBusMetaObject *findMetaObject(const QString &service, const QString &path,
    192206                                    const QString &interface, QDBusError &error);
    193 
    194     void registerService(const QString &serviceName);
    195     void unregisterService(const QString &serviceName);
    196207
    197208    void postEventToThread(int action, QObject *target, QEvent *event);
     
    218229
    219230    bool isServiceRegisteredByThread(const QString &serviceName) const;
     231
     232
    220233
    221234protected:
     
    231244    void relaySignal(QObject *obj, const QMetaObject *, int signalId, const QVariantList &args);
    232245    void _q_serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
     246
     247
    233248
    234249signals:
     
    265280
    266281    QStringList serviceNames;
     282
    267283    SignalHookHash signalHooks;
    268284    MatchRefCountHash matchRefCounts;
     
    277293    static int findSlot(QObject *obj, const QByteArray &normalizedName, QList<int>& params);
    278294    static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key,
    279                             const QString &service, const QString &owner,
     295                            const QString &service,
    280296                            const QString &path, const QString &interface, const QString &name,
     297
    281298                            QObject *receiver, const char *signal, int minMIdx,
    282299                            bool buildSignature);
     
    301318extern int qDBusNameToTypeId(const char *name);
    302319extern bool qDBusCheckAsyncTag(const char *tag);
     320
     321
    303322
    304323// in qdbusinternalfilters.cpp
     
    311330                                        const QDBusMessage &msg);
    312331
    313 // in qdbusxmlgenerator.cpp
    314 extern QString qDBusInterfaceFromMetaObject(const QMetaObject *mo);
    315 
    316332QT_END_NAMESPACE
    317333
  • trunk/src/dbus/qdbusconnectioninterface.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5050#include <QtCore/QDebug>
    5151
    52 #include <qdbus_symbols_p.h>          // for the DBUS_* constants
     52#include           // for the DBUS_* constants
    5353
    5454QT_BEGIN_NAMESPACE
     
    337337        QDBusAbstractInterface::connectNotify(SIGNAL(NameLost(QString)));
    338338
    339     else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0)
     339    else if (qstrcmp(signalName, SIGNAL(serviceOwnerChanged(QString,QString,QString))) == 0) {
     340        static bool warningPrinted = false;
     341        if (!warningPrinted) {
     342            qWarning("Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)");
     343            warningPrinted = true;
     344        }
    340345        QDBusAbstractInterface::connectNotify(SIGNAL(NameOwnerChanged(QString,QString,QString)));
     346
    341347}
    342348
     
    389395    \a newOwner is empty, the name \a name has no current owner and is
    390396    no longer available.
     397
     398
     399
     400
     401
     402
    391403*/
    392404
  • trunk/src/dbus/qdbusconnectioninterface.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbuscontext.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbuscontext.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7575private:
    7676    QDBusContextPrivate *d_ptr;
    77     Q_DECLARE_PRIVATE(QDBusContext)
     77   
    7878};
    7979
  • trunk/src/dbus/qdbuscontext_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusdemarshaller.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbuserror.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4545#include <qvarlengtharray.h>
    4646
    47 #include <qdbus_symbols_p.h>
     47#include
    4848#include "qdbusmessage.h"
    4949#include "qdbusmessage_p.h"
     
    9292com.trolltech.QtDBus.Error.InternalError
    9393org.freedesktop.DBus.Error.UnknownObject
     94
     95
     96
     97
    9498*/
    9599
     
    117121    "com.trolltech.QtDBus.Error.InternalError\0"
    118122    "org.freedesktop.DBus.Error.UnknownObject\0"
     123
     124
     125
     126
    119127    "\0";
    120128
     
    122130       0,    6,   40,   76,  118,  153,  191,  231,
    123131     273,  313,  349,  384,  421,  461,  501,  540,
    124      581,  617,  661,  705,  746,    0
     132     581,  617,  661,  705,  746,  787,  829,  874,
     133     918,    0
    125134};
    126135
     
    217226    \value InternalError        An internal error occurred
    218227                                (\c com.trolltech.QtDBus.Error.InternalError)
     228
     229
     230
     231
     232
     233
     234
     235
     236
    219237    \value UnknownObject        The remote object could not be found.
    220 
    221238*/
    222239
     
    340357QDebug operator<<(QDebug dbg, const QDBusError &msg)
    341358{
    342     dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ")";
     359    dbg.nospace() << "QDBusError(" << msg.name() << ", " << msg.message() << ;
    343360    return dbg.space();
    344361}
  • trunk/src/dbus/qdbuserror.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8282        InternalError,
    8383        UnknownObject,
     84
     85
     86
     87
    8488
    8589#ifndef Q_QDOC
    8690        // don't use this one!
    87         LastErrorType = UnknownObject
     91        LastErrorType =
    8892#endif
    8993    };
  • trunk/src/dbus/qdbusextratypes.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusextratypes.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    175175{ QVariant::operator=(dBusVariant); }
    176176
     177
     178
     179
    177180QT_END_NAMESPACE
    178181
  • trunk/src/dbus/qdbusintegrator.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7575    if (th && !th->objectName().isEmpty())
    7676        dbg.nospace() << ", name=" << th->objectName();
    77     dbg.nospace() << ")";
     77    dbg.nospace() << ;
    7878    return dbg.space();
    7979}
     
    9191    else
    9292        dbg.nospace() << conn->thread();
    93     dbg.nospace() << ")";
     93    dbg.nospace() << ;
    9494    return dbg.space();
    9595}
     
    391391} // extern "C"
    392392
    393 static QByteArray buildMatchRule(const QString &service, const QString & /*owner*/,
     393static QByteArray buildMatchRule(const QString &service,
    394394                                 const QString &objectPath, const QString &interface,
    395                                  const QString &member, const QString & /*signature*/)
     395                                 const QString &member, const QString & /*signature*/)
    396396{
    397397    QString result = QLatin1String("type='signal',");
     
    406406    if (!member.isEmpty())
    407407        result += keyValue.arg(QLatin1String("member"), member);
     408
     409
     410
     411
     412
     413
     414
     415
    408416
    409417    result.chop(1);             // remove ending comma
     
    492500    // object not found
    493501    return 0;
     502
     503
     504
     505
     506
    494507}
    495508
     
    566579    QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator end = haystack.children.constEnd();
    567580    for ( ; it != end; ++it)
    568         huntAndEmit(connection, msg, needle, *it, isScriptable, isAdaptor, path + QLatin1String("/") + it->name);
     581        huntAndEmit(connection, msg, needle, *it, isScriptable, isAdaptor, path + QLatin1) + it->name);
    569582
    570583    if (needle == haystack.obj) {
     
    921934      rootNode(QString(QLatin1Char('/')))
    922935{
    923     static const bool threads = qDBusInitThreads();
    924     static const int debugging = ::isDebugging = qgetenv("QDBUS_DEBUG").toInt();
     936    static const bool threads = q_dbus_threads_init_default();
     937    static const int debugging = qgetenv("QDBUS_DEBUG").toInt();
     938    ::isDebugging = debugging;
    925939    Q_UNUSED(threads)
     940
    926941
    927942#ifdef QDBUS_THREAD_DEBUG
     
    933948
    934949    rootNode.flags = 0;
    935 
    936     connect(this, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
    937             this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
    938950}
    939951
     
    11031115
    11041116    for (int i = 0; i < pendingWatches.size(); ++i)
    1105         if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_READABLE))
     1117        if (!q_dbus_watch_handle(pendingWatches[i], DBUS_WATCH_ABLE))
    11061118            qDebug("OUT OF MEM");
    11071119}
     
    11261138                                         const QVariantList &args)
    11271139{
    1128     int mciid = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE);
    1129     Q_ASSERT(mciid != -1);
    1130 
    1131     QMetaClassInfo mci = mo->classInfo(mciid);
    1132     Q_ASSERT(mci.value());
    1133     const char *interface = mci.value();
     1140    QString interface = qDBusInterfaceFromMetaObject(mo);
    11341141
    11351142    QMetaMethod mm = mo->method(signalId);
     
    11471154
    11481155    QDBusReadLocker locker(RelaySignalAction, this);
    1149     QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), QLatin1String(interface),
     1156    QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), ,
    11501157                                                      QLatin1String(memberName));
     1158
    11511159    message.setArguments(args);
    1152     DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
     1160    QDBusError error;
     1161    DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error);
    11531162    if (!msg) {
    1154         qWarning("QDBusConnection: Could not emit signal %s.%s", interface, memberName.constData());
     1163        qWarning("QDBusConnection: Could not emit signal %s.%s: %s", qPrintable(interface), memberName.constData(),
     1164                 qPrintable(error.message()));
     1165        lastError = error;
    11551166        return;
    11561167    }
     
    11661177                                                    const QString &oldOwner, const QString &newOwner)
    11671178{
    1168     if (oldOwner == baseService)
    1169         unregisterService(name);
    1170     if (newOwner == baseService)
    1171         registerService(name);
    1172 
     1179    Q_UNUSED(oldOwner);
    11731180    QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this);
    1174     QMutableHashIterator<QString, SignalHook> it(signalHooks);
    1175     it.toFront();
    1176     while (it.hasNext())
    1177         if (it.next().value().service == name)
    1178             it.value().owner = newOwner;
     1181    WatchedServicesHash::Iterator it = watchedServices.find(name);
     1182    if (it == watchedServices.end())
     1183        return;
     1184    if (oldOwner != it->owner)
     1185        qWarning("QDBusConnection: name '%s' had owner '%s' but we thought it was '%s'",
     1186                 qPrintable(name), qPrintable(oldOwner), qPrintable(it->owner));
     1187
     1188    qDBusDebug() << this << "Updating name" << name << "from" << oldOwner << "to" << newOwner;
     1189    it->owner = newOwner;
    11791190}
    11801191
     
    11941205
    11951206bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key,
    1196                                          const QString &service, const QString &owner,
     1207                                         const QString &service,
    11971208                                         const QString &path, const QString &interface, const QString &name,
     1209
    11981210                                         QObject *receiver, const char *signal, int minMIdx,
    11991211                                         bool buildSignature)
     
    12121224
    12131225    hook.service = service;
    1214     hook.owner = owner; // we don't care if the service has an owner yet
    12151226    hook.path = path;
    12161227    hook.obj = receiver;
     1228
    12171229
    12181230    // build the D-Bus signal name and signature
     
    12361248    }
    12371249
    1238     hook.matchRule = buildMatchRule(service, owner, path, interface, mname, hook.signature);
     1250    hook.matchRule = buildMatchRule(service, , hook.signature);
    12391251    return true;                // connect to this signal
    12401252}
     
    13651377    if (node.flags & (QDBusConnection::ExportScriptableSlots|QDBusConnection::ExportNonScriptableSlots)) {
    13661378        bool interfaceFound = true;
    1367         if (!msg.interface().isEmpty()) {
    1368             // check if the interface name matches anything in the class hierarchy
    1369             const QMetaObject *mo = node.obj->metaObject();
    1370             for ( ; !interfaceFound && mo != &QObject::staticMetaObject; mo = mo->superClass())
    1371                 interfaceFound = msg.interface() == qDBusInterfaceFromMetaObject(mo);
    1372         }
     1379        if (!msg.interface().isEmpty())
     1380            interfaceFound = qDBusInterfaceInObject(node.obj, msg.interface());
    13731381
    13741382        if (interfaceFound) {
     
    14831491    for ( ; it != end && it.key() == key; ++it) {
    14841492        const SignalHook &hook = it.value();
    1485         if (!hook.owner.isEmpty() && hook.owner != msg.service())
    1486             continue;
     1493        if (!hook.service.isEmpty()) {
     1494            const QString owner =
     1495                    shouldWatchService(hook.service) ?
     1496                    watchedServices.value(hook.service).owner :
     1497                    hook.service;
     1498            if (owner != msg.service())
     1499                continue;
     1500        }
    14871501        if (!hook.path.isEmpty() && hook.path != msg.path())
    14881502            continue;
     
    14911505        if (hook.signature.isEmpty() && !hook.signature.isNull() && !msg.signature().isEmpty())
    14921506            continue;
     1507
     1508
     1509
     1510
     1511
     1512
     1513
     1514
     1515
     1516
     1517
     1518
     1519
     1520
     1521
     1522
     1523
     1524
    14931525
    14941526        activateSignal(hook, msg);
     
    16251657        baseService = QString::fromUtf8(service);
    16261658    } else {
    1627         qWarning("QDBusConnectionPrivate::SetConnection: Unable to get base service");
    1628     }
     1659        qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service");
     1660    }
     1661
     1662    QString busService = QLatin1String(DBUS_SERVICE_DBUS);
     1663    WatchedServicesHash::mapped_type &bus = watchedServices[busService];
     1664    bus.refcount = 1;
     1665    bus.owner = getNameOwnerNoCache(busService);
     1666    connectSignal(busService, QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(),
     1667                  this, SLOT(registerService(QString)));
     1668    connectSignal(busService, QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(),
     1669                  this, SLOT(unregisterService(QString)));
     1670
    16291671
    16301672    q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0);
     
    17081750                                // through the d_ptr->localReply link
    17091751
    1710     DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
     1752    QDBusError error;
     1753    DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &error);
    17111754    if (!msg) {
    17121755        if (message.type() == QDBusMessage::MethodCallMessage)
    1713             qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",
     1756            qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",
    17141757                     qPrintable(message.service()), qPrintable(message.path()),
    1715                      qPrintable(message.interface()), qPrintable(message.member()));
     1758                     qPrintable(message.interface()), qPrintable(message.member()),
     1759                     qPrintable(error.message()));
    17161760        else if (message.type() == QDBusMessage::SignalMessage)
    1717             qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\"",
     1761            qWarning("QDBusConnection: error: could not send signal path \"%s\" interface \"%s\" member \"%s\"",
    17181762                     qPrintable(message.path()), qPrintable(message.interface()),
    1719                      qPrintable(message.member()));
     1763                     qPrintable(message.member()),
     1764                     qPrintable(error.message()));
    17201765        else
    1721             qWarning("QDBusConnection: error: could not send %s message to service \"%s\"",
     1766            qWarning("QDBusConnection: error: could not send %s message to service \"%s\"",
    17221767                     message.type() == QDBusMessage::ReplyMessage ? "reply" :
    17231768                     message.type() == QDBusMessage::ErrorMessage ? "error" :
    1724                      "invalid", qPrintable(message.service()));
     1769                     "invalid", qPrintable(message.service()),
     1770                     qPrintable(error.message()));
     1771        lastError = error;
    17251772        return 0;
    17261773    }
     
    17491796
    17501797    if (!QCoreApplication::instance() || sendMode == QDBus::Block) {
    1751         DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
     1798        QDBusError err;
     1799        DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, &err);
    17521800        if (!msg) {
    1753             qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",
     1801            qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",
    17541802                     qPrintable(message.service()), qPrintable(message.path()),
    1755                      qPrintable(message.interface()), qPrintable(message.member()));
    1756             return QDBusMessage();
     1803                     qPrintable(message.interface()), qPrintable(message.member()),
     1804                     qPrintable(err.message()));
     1805            lastError = err;
     1806            return QDBusMessage::createError(err);
    17571807        }
    17581808
     
    17641814
    17651815        if (!!error) {
    1766             QDBusError qe = error;
    1767             lastError = qe;
    1768             return QDBusMessage::createError(qe);
     1816            lastError = err = error;
     1817            return QDBusMessage::createError(err);
    17691818        }
    17701819
     
    17761825    } else { // use the event loop
    17771826        QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout);
    1778         if (!pcall)
    1779             return QDBusMessage();
    1780 
    1781         pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
    1782         QEventLoop loop;
    1783         loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit()));
    1784         loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit()));
    1785 
    1786         // enter the event loop and wait for a reply
    1787         loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents);
     1827        Q_ASSERT(pcall);
     1828
     1829        if (pcall->replyMessage.type() != QDBusMessage::InvalidMessage) {
     1830            pcall->watcherHelper = new QDBusPendingCallWatcherHelper;
     1831            QEventLoop loop;
     1832            loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit()));
     1833            loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit()));
     1834
     1835            // enter the event loop and wait for a reply
     1836            loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents);
     1837        }
    17881838
    17891839        QDBusMessage reply = pcall->replyMessage;
     
    18411891    }
    18421892
    1843     DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
    1844     if (!msg) {
    1845         qWarning("QDBusConnection: error: could not send message to service \"%s\" path \"%s\" interface \"%s\" member \"%s\"",
    1846                  qPrintable(message.service()), qPrintable(message.path()),
    1847                  qPrintable(message.interface()), qPrintable(message.member()));
    1848         return 0;
    1849     }
    1850 
    18511893    checkThread();
    1852     qDBusDebug() << QThread::currentThread() << "sending message (async):" << message;
    1853     DBusPendingCall *pending = 0;
    18541894    QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate;
    18551895    pcall->sentMessage = message;
    18561896    pcall->ref = 0;
     1897
     1898
     1899
     1900
     1901
     1902
     1903
     1904
     1905
     1906
     1907
     1908
     1909
     1910
     1911
    18571912
    18581913    QDBusDispatchLocker locker(SendWithReplyAsyncAction, this);
     
    18681923        } else {
    18691924            // we're probably disconnected at this point
    1870             lastError = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server"));
     1925            lastError = QDBusError(QDBusError::Disconnected, QLatin1String("Not connected to server"));
    18711926        }
    18721927    } else {
    1873         lastError = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory"));
     1928        lastError = QDBusError(QDBusError::NoMemory, QLatin1String("Out of memory"));
    18741929    }
    18751930
    18761931    q_dbus_message_unref(msg);
    1877     pcall->replyMessage = QDBusMessage::createError(lastError);
     1932    pcall->replyMessage = QDBusMessage::createError(rror);
    18781933    return pcall;
    18791934}
     
    18841939{
    18851940    QDBusPendingCallPrivate *pcall = sendWithReplyAsync(message, timeout);
    1886     if (!pcall)
    1887         return 0;
     1941    Q_ASSERT(pcall);
    18881942
    18891943    // has it already finished (dispatched locally)?
     
    19261980}
    19271981
     1982
     1983
     1984
     1985
     1986
     1987
     1988
     1989
     1990
     1991
     1992
     1993
     1994
     1995
     1996
     1997
     1998
     1999
     2000
     2001
     2002
     2003
     2004
     2005
     2006
     2007
     2008
     2009
     2010
     2011
     2012
     2013
     2014
     2015
     2016
    19282017void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook &hook)
    19292018{
    19302019    signalHooks.insertMulti(key, hook);
    19312020    connect(hook.obj, SIGNAL(destroyed(QObject*)), SLOT(objectDestroyed(QObject*)),
    1932             Qt::DirectConnection);
     2021            Qt::);
    19332022
    19342023    MatchRefCountHash::iterator it = matchRefCounts.find(hook.matchRule);
     
    19532042                     qPrintable(qerror.name()), qPrintable(qerror.message()));
    19542043            Q_ASSERT(false);
    1955         }
    1956     }
     2044        } else {
     2045            // Successfully connected the signal
     2046            // Do we need to watch for this name?
     2047            if (shouldWatchService(hook.service)) {
     2048                WatchedServicesHash::mapped_type &data = watchedServices[hook.service];
     2049                if (data.refcount) {
     2050                    // already watching
     2051                    ++data.refcount;
     2052                } else {
     2053                    // we need to watch for this service changing
     2054                    QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
     2055                    connectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
     2056                                  QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
     2057                                  this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
     2058                    data.owner = getNameOwnerNoCache(hook.service);
     2059                    qDBusDebug() << this << "Watching service" << hook.service << "for owner changes (current owner:"
     2060                            << data.owner << ")";
     2061                }
     2062            }
     2063        }
     2064    }
     2065}
     2066
     2067bool QDBusConnectionPrivate::disconnectSignal(const QString &service,
     2068                                              const QString &path, const QString &interface, const QString &name,
     2069                                              const QStringList &argumentMatch, const QString &signature,
     2070                                              QObject *receiver, const char *slot)
     2071{
     2072    // check the slot
     2073    QDBusConnectionPrivate::SignalHook hook;
     2074    QString key;
     2075    QString name2 = name;
     2076    if (name2.isNull())
     2077        name2.detach();
     2078
     2079    hook.signature = signature;
     2080    if (!prepareHook(hook, key, service, path, interface, name, argumentMatch, receiver, slot, 0, false))
     2081        return false;           // don't disconnect
     2082
     2083    // avoid duplicating:
     2084    QDBusConnectionPrivate::SignalHookHash::Iterator it = signalHooks.find(key);
     2085    QDBusConnectionPrivate::SignalHookHash::Iterator end = signalHooks.end();
     2086    for ( ; it != end && it.key() == key; ++it) {
     2087        const QDBusConnectionPrivate::SignalHook &entry = it.value();
     2088        if (entry.service == hook.service &&
     2089            entry.path == hook.path &&
     2090            entry.signature == hook.signature &&
     2091            entry.obj == hook.obj &&
     2092            entry.midx == hook.midx) {
     2093            // no need to compare the parameters if it's the same slot
     2094            disconnectSignal(it);
     2095            return true;        // it was there
     2096        }
     2097    }
     2098
     2099    // the slot was not found
     2100    return false;
    19572101}
    19582102
     
    19612105{
    19622106    const SignalHook &hook = it.value();
     2107
     2108
     2109
     2110
     2111
     2112
     2113
     2114
     2115
     2116
     2117
     2118
     2119
    19632120
    19642121    bool erase = false;
     
    20102167}
    20112168
    2012 void QDBusConnectionPrivate::connectRelay(const QString &service, const QString &owner,
     2169void QDBusConnectionPrivate::connectRelay(const QString &service,
    20132170                                          const QString &path, const QString &interface,
    20142171                                          QDBusAbstractInterface *receiver,
     
    20202177    QString key;
    20212178
    2022     if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal,
     2179    if (!prepareHook(hook, key, service, (), receiver, signal,
    20232180                     QDBusAbstractInterface::staticMetaObject.methodCount(), true))
    20242181        return;                 // don't connect
     
    20312188        const SignalHook &entry = it.value();
    20322189        if (entry.service == hook.service &&
    2033             entry.owner == hook.owner &&
    20342190            entry.path == hook.path &&
    20352191            entry.signature == hook.signature &&
     
    20422198}
    20432199
    2044 void QDBusConnectionPrivate::disconnectRelay(const QString &service, const QString &owner,
     2200void QDBusConnectionPrivate::disconnectRelay(const QString &service,
    20452201                                             const QString &path, const QString &interface,
    20462202                                             QDBusAbstractInterface *receiver,
     
    20522208    QString key;
    20532209
    2054     if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal,
     2210    if (!prepareHook(hook, key, service, (), receiver, signal,
    20552211                     QDBusAbstractInterface::staticMetaObject.methodCount(), true))
    20562212        return;                 // don't connect
     
    20632219        const SignalHook &entry = it.value();
    20642220        if (entry.service == hook.service &&
    2065             entry.owner == hook.owner &&
    20662221            entry.path == hook.path &&
    20672222            entry.signature == hook.signature &&
     
    20812236    if (QDBusUtil::isValidUniqueConnectionName(serviceName))
    20822237        return serviceName;
    2083     if (!connection || !QDBusUtil::isValidBusName(serviceName))
     2238    if (!connection)
    20842239        return QString();
    20852240
     2241
     2242
     2243
     2244
     2245
     2246
     2247
     2248
     2249
     2250
     2251
     2252
     2253
     2254
    20862255    QDBusMessage msg = QDBusMessage::createMethodCall(QLatin1String(DBUS_SERVICE_DBUS),
    20872256            QLatin1String(DBUS_PATH_DBUS), QLatin1String(DBUS_INTERFACE_DBUS),
    20882257            QLatin1String("GetNameOwner"));
     2258
    20892259    msg << serviceName;
    20902260    QDBusMessage reply = sendWithReply(msg, QDBus::Block);
     
    21102280                                                QLatin1String(DBUS_INTERFACE_INTROSPECTABLE),
    21112281                                                QLatin1String("Introspect"));
     2282
    21122283
    21132284    QDBusMessage reply = sendWithReply(msg, QDBus::Block);
  • trunk/src/dbus/qdbusintegrator_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5555#define QDBUSINTEGRATOR_P_H
    5656
    57 #include <qdbus_symbols_p.h>
     57#include
    5858
    5959#include "qcoreevent.h"
  • trunk/src/dbus/qdbusinterface.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include "qdbusinterface.h"
    4343
    44 #include <qdbus_symbols_p.h>
     44#include
    4545#include <QtCore/qpointer.h>
    4646#include <QtCore/qstringlist.h>
     
    5252QT_BEGIN_NAMESPACE
    5353
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
    54150QDBusInterfacePrivate::QDBusInterfacePrivate(const QString &serv, const QString &p,
    55151                                             const QString &iface, const QDBusConnection &con)
     
    62158        if (!metaObject) {
    63159            // creation failed, somehow
    64             isValid = false;
     160            // most common causes are that the service doesn't exist or doesn't support introspection
     161            // those are not fatal errors, so we continue working
     162
    65163            if (!lastError.isValid())
    66164                lastError = QDBusError(QDBusError::InternalError, QLatin1String("Unknown error"));
     
    137235const QMetaObject *QDBusInterface::metaObject() const
    138236{
    139     return d_func()->isValid ? d_func()->metaObject : &QDBusAbstractInterface::staticMetaObject;
     237    return d_func()-> ? d_func()->metaObject : &QDBusAbstractInterface::staticMetaObject;
    140238}
    141239
     
    187285            // we will assume that the input arguments were passed correctly
    188286            QVariantList args;
    189             for (int i = 1; i <= inputTypesCount; ++i)
     287            int i = 1;
     288            for ( ; i <= inputTypesCount; ++i)
    190289                args << QVariant(inputTypes[i], argv[i]);
    191290
    192291            // make the call
    193             QPointer<QDBusInterface> qq = q;
    194292            QDBusMessage reply = q->callWithArgumentList(QDBus::Block, methodName, args);
    195             args.clear();
    196 
    197             // we ignore return values
    198 
    199             // access to "this" or to "q" below this point must check for "qq"
    200             // we may have been deleted!
    201 
    202             if (!qq.isNull())
    203                 lastError = reply;
     293
     294            if (reply.type() == QDBusMessage::ReplyMessage) {
     295                // attempt to demarshall the return values
     296                args = reply.arguments();
     297                QVariantList::ConstIterator it = args.constBegin();
     298                const int *outputTypes = metaObject->outputTypesForMethod(id);
     299                int outputTypesCount = *outputTypes++;
     300
     301                if (*mm.typeName()) {
     302                    // this method has a return type
     303                    if (argv[0] && it != args.constEnd())
     304                        copyArgument(argv[0], *outputTypes++, *it);
     305
     306                    // skip this argument even if we didn't copy it
     307                    --outputTypesCount;
     308                    ++it;
     309                }
     310
     311                for (int j = 0; j < outputTypesCount && it != args.constEnd(); ++i, ++j, ++it) {
     312                    copyArgument(argv[i], outputTypes[j], *it);
     313                }
     314            }
    204315
    205316            // done
     317
    206318            return -1;
    207319        }
    208     } else if (c == QMetaObject::ReadProperty) {
    209         // Qt doesn't support non-readable properties
    210         // we have to re-check
    211         QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset());
    212         if (!mp.isReadable())
    213             return -1;          // don't read
    214 
    215         QVariant *value = reinterpret_cast<QVariant*>(argv[1]);
    216         argv[1] = 0;
    217         *value = property(mp);
    218 
    219         return -1;              // handled, error or not
    220     } else if (c == QMetaObject::WriteProperty) {
    221         // QMetaProperty::write has already checked that we're writable
    222         // it has also checked that the type is right
    223         QVariant *value = reinterpret_cast<QVariant *>(argv[1]);
    224         QMetaProperty mp = metaObject->property(id + metaObject->propertyOffset());
    225 
    226         setProperty(mp, *value);
    227         return -1;
    228320    }
    229321    return id;
  • trunk/src/dbus/qdbusinterface.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusinterface_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5555#define QDBUSINTERFACEPRIVATE_H
    5656
    57 #include <qdbusabstractinterface_p.h>
    58 #include <qdbusmetaobject_p.h>
     57#include
     58#include
    5959#include <qdbusinterface.h>
    6060
  • trunk/src/dbus/qdbusinternalfilters.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include "qdbusconnection_p.h"
    4343
    44 #include <qdbus_symbols_p.h>
     44#include
    4545#include <QtCore/qcoreapplication.h>
    4646#include <QtCore/qmetaobject.h>
     
    5454#include "qdbusmessage.h"
    5555#include "qdbusmetatype.h"
     56
    5657#include "qdbusmessage_p.h"
    5758#include "qdbusutil_p.h"
     
    178179// implement the D-Bus interface org.freedesktop.DBus.Properties
    179180
    180 static QDBusMessage qDBusPropertyError(const QDBusMessage &msg, const QString &interface_name)
    181 {
    182     return msg.createErrorReply(QLatin1String(DBUS_ERROR_INVALID_ARGS),
     181static Error(const QDBusMessage &msg, const QString &interface_name)
     182{
     183    return msg.createErrorReply(Q,
    183184                                QString::fromLatin1("Interface %1 was not found in object %2")
    184185                                .arg(interface_name)
    185186                                .arg(msg.path()));
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
    186198}
    187199
     
    199211    QDBusAdaptorConnector *connector;
    200212    QVariant value;
     213
    201214    if (node.flags & QDBusConnection::ExportAdaptors &&
    202215        (connector = qDBusFindAdaptorConnector(node.obj))) {
     
    218231            it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
    219232                             interface_name);
    220             if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface))
     233            if (it != connector->adaptors.constEnd() && interface_name == QLatin1String(it->interface)) {
     234                interfaceFound = true;
    221235                value = it->adaptor->property(property_name);
    222         }
    223     }
    224 
    225     if (!value.isValid() && node.flags & (QDBusConnection::ExportAllProperties |
    226                                           QDBusConnection::ExportNonScriptableProperties)) {
     236            }
     237        }
     238    }
     239
     240    if (!interfaceFound && !value.isValid()
     241        && node.flags & (QDBusConnection::ExportAllProperties |
     242                         QDBusConnection::ExportNonScriptableProperties)) {
    227243        // try the object itself
    228         int pidx = node.obj->metaObject()->indexOfProperty(property_name);
    229         if (pidx != -1) {
    230             QMetaProperty mp = node.obj->metaObject()->property(pidx);
    231             if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
    232                 (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
    233                 value = mp.read(node.obj);
     244        if (!interface_name.isEmpty())
     245            interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
     246
     247        if (interfaceFound) {
     248            int pidx = node.obj->metaObject()->indexOfProperty(property_name);
     249            if (pidx != -1) {
     250                QMetaProperty mp = node.obj->metaObject()->property(pidx);
     251                if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
     252                    (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
     253                    value = mp.read(node.obj);
     254            }
    234255        }
    235256    }
     
    237258    if (!value.isValid()) {
    238259        // the property was not found
    239         return qDBusPropertyError(msg, interface_name);
     260        if (!interfaceFound)
     261            return interfaceNotFoundError(msg, interface_name);
     262        return propertyNotFoundError(msg, interface_name, property_name);
    240263    }
    241264
    242265    return msg.createReply(qVariantFromValue(QDBusVariant(value)));
     266
     267
     268
     269
     270
     271
     272
     273
     274
     275
     276
     277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
    243347}
    244348
     
    264368            for (QDBusAdaptorConnector::AdaptorMap::ConstIterator it = connector->adaptors.constBegin(),
    265369                 end = connector->adaptors.constEnd(); it != end; ++it) {
    266                 const QMetaObject *mo = it->adaptor->metaObject();
    267                 int pidx = mo->indexOfProperty(property_name);
    268                 if (pidx != -1) {
    269                     mo->property(pidx).write(it->adaptor, value);
    270                     return msg.createReply();
    271                 }
     370                int status = writeProperty(it->adaptor, property_name, value);
     371                if (status == PropertyNotFound)
     372                    continue;
     373                return propertyWriteReply(msg, interface_name, property_name, status);
    272374            }
    273375        } else {
     
    275377            it = qLowerBound(connector->adaptors.constBegin(), connector->adaptors.constEnd(),
    276378                             interface_name);
    277             if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface))
    278                 if (it->adaptor->setProperty(property_name, value))
    279                     return msg.createReply();
     379            if (it != connector->adaptors.end() && interface_name == QLatin1String(it->interface)) {
     380                return propertyWriteReply(msg, interface_name, property_name,
     381                                          writeProperty(it->adaptor, property_name, value));
     382            }
    280383        }
    281384    }
     
    284387                      QDBusConnection::ExportNonScriptableProperties)) {
    285388        // try the object itself
    286         int pidx = node.obj->metaObject()->indexOfProperty(property_name);
    287         if (pidx != -1) {
    288             QMetaProperty mp = node.obj->metaObject()->property(pidx);
    289             if ((mp.isScriptable() && (node.flags & QDBusConnection::ExportScriptableProperties)) ||
    290                 (!mp.isScriptable() && (node.flags & QDBusConnection::ExportNonScriptableProperties)))
    291                 if (mp.write(node.obj, value))
    292                     return msg.createReply();
    293         }
    294     }
    295 
    296     // the property was not found or not written to
    297     return qDBusPropertyError(msg, interface_name);
     389        bool interfaceFound = true;
     390        if (!interface_name.isEmpty())
     391            interfaceFound = qDBusInterfaceInObject(node.obj, interface_name);
     392
     393        if (interfaceFound) {
     394            return propertyWriteReply(msg, interface_name, property_name,
     395                                      writeProperty(node.obj, property_name, value, node.flags));
     396        }
     397    }
     398
     399    // the property was not found
     400    if (!interface_name.isEmpty())
     401        return interfaceNotFoundError(msg, interface_name);
     402    return propertyWriteReply(msg, interface_name, property_name, PropertyNotFound);
    298403}
    299404
     
    386491    if (!interfaceFound && !interface_name.isEmpty()) {
    387492        // the interface was not found
    388         return qDBusPropertyError(msg, interface_name);
     493        return Error(msg, interface_name);
    389494    }
    390495
  • trunk/src/dbus/qdbusintrospection.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusintrospection_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusmacros.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusmarshaller.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    122122    QByteArray data = arg.path().toUtf8();
    123123    if (!ba && data.isEmpty())
    124         error();
     124        error();
    125125    const char *cdata = data.constData();
    126126    qIterAppend(&iterator, ba, DBUS_TYPE_OBJECT_PATH, &cdata);
     
    131131    QByteArray data = arg.signature().toUtf8();
    132132    if (!ba && data.isEmpty())
    133         error();
     133        error();
    134134    const char *cdata = data.constData();
    135135    qIterAppend(&iterator, ba, DBUS_TYPE_SIGNATURE, &cdata);
     
    162162    if (id == QVariant::Invalid) {
    163163        qWarning("QDBusMarshaller: cannot add a null QDBusVariant");
    164         error();
     164        error();
    165165        return false;
    166166    }
     
    181181                 "Use qDBusRegisterMetaType to register it",
    182182                 QVariant::typeToName( id ), id);
    183         error();
     183        error(QString::fromLatin1("Unregistered type %1 passed in arguments")
     184              .arg(QLatin1String(QVariant::typeToName(id))));
    184185        return false;
    185186    }
     
    221222                 "Use qDBusRegisterMetaType to register it",
    222223                 QVariant::typeToName( QVariant::Type(id) ), id);
    223         error();
     224        error(QString::fromLatin1("Unregistered type %1 passed in arguments")
     225              .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id)))));
    224226        return this;
    225227    }
     
    235237                 "Use qDBusRegisterMetaType to register it",
    236238                 QVariant::typeToName( QVariant::Type(kid) ), kid);
    237         error();
     239        error(QString::fromLatin1("Unregistered type %1 passed in arguments")
     240              .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid)))));
    238241        return this;
    239242    }
     
    241244        qWarning("QDBusMarshaller: type '%s' (%d) cannot be used as the key type in a D-BUS map.",
    242245                 QVariant::typeToName( QVariant::Type(kid) ), kid);
    243         error();
     246        error(QString::fromLatin1("Type %1 passed in arguments cannot be used as a key in a map")
     247              .arg(QLatin1String(QVariant::typeToName(QVariant::Type(kid)))));
    244248        return this;
    245249    }
     
    247251    const char *vsignature = QDBusMetaType::typeToSignature( QVariant::Type(vid) );
    248252    if (!vsignature) {
     253
    249254        qWarning("QDBusMarshaller: type `%s' (%d) is not registered with D-BUS. "
    250255                 "Use qDBusRegisterMetaType to register it",
    251                  QVariant::typeToName( QVariant::Type(vid) ), vid);
    252         error();
     256                 typeName, vid);
     257        error(QString::fromLatin1("Unregistered type %1 passed in arguments")
     258              .arg(QLatin1String(typeName)));
    253259        return this;
    254260    }
     
    329335}
    330336
    331 void QDBusMarshaller::error()
     337void QDBusMarshaller::error()
    332338{
    333339    ok = false;
    334340    if (parent)
    335         parent->error();
     341        parent->error(msg);
     342    else
     343        errorString = msg;
    336344}
    337345
     
    341349    if (id == QVariant::Invalid) {
    342350        qWarning("QDBusMarshaller: cannot add an invalid QVariant");
    343         error();
     351        error();
    344352        return false;
    345353    }
     
    372380                 "Use qDBusRegisterMetaType to register it",
    373381                 QVariant::typeToName( QVariant::Type(id) ), id);
    374         error();
     382        error(QString::fromLatin1("Unregistered type %1 passed in arguments")
     383              .arg(QLatin1String(QVariant::typeToName(QVariant::Type(id)))));
    375384        return false;
    376385    }
     
    379388#ifdef __OPTIMIZE__
    380389    case DBUS_TYPE_BYTE:
    381     case DBUS_TYPE_BOOLEAN:
    382390    case DBUS_TYPE_INT16:
    383391    case DBUS_TYPE_UINT16:
     
    389397        qIterAppend(&iterator, ba, *signature, arg.constData());
    390398        return true;
    391 
    392     case DBUS_TYPE_STRING:
    393     case DBUS_TYPE_OBJECT_PATH:
    394     case DBUS_TYPE_SIGNATURE: {
    395         const QByteArray data =
    396             reinterpret_cast<const QString *>(arg.constData())->toUtf8();
    397         const char *rawData = data.constData();
    398         qIterAppend(&iterator, ba, *signature, &rawData);
    399         return true;
    400     }
     399    case DBUS_TYPE_BOOLEAN:
     400        append( arg.toBool() );
     401        return true;
    401402#else
    402403    case DBUS_TYPE_BYTE:
     
    427428        append( arg.toDouble() );
    428429        return true;
     430
     431
    429432    case DBUS_TYPE_STRING:
    430433        append( arg.toString() );
     
    436439        append( qvariant_cast<QDBusSignature>(arg) );
    437440        return true;
    438 #endif
    439441
    440442    // compound types:
  • trunk/src/dbus/qdbusmessage.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4545#include <qstringlist.h>
    4646
    47 #include <qdbus_symbols_p.h>
     47#include
    4848
    4949#include "qdbusargument_p.h"
     
    6363QDBusMessagePrivate::QDBusMessagePrivate()
    6464    : msg(0), reply(0), type(DBUS_MESSAGE_TYPE_INVALID),
    65       timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false)
     65      timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false),
     66      parametersValidated(false)
    6667{
    6768}
     
    9596    Constructs a DBusMessage object from this object. The returned value must be de-referenced
    9697    with q_dbus_message_unref.
    97 */
    98 DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
    99 {
    100     if (!qdbus_loadLibDBus())
     98
     99    The \a error object is set to indicate the error if anything went wrong with the
     100    marshalling. Usually, this error message will be placed in the reply, as if the call failed.
     101    The \a error pointer must not be null.
     102*/
     103DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDBusError *error)
     104{
     105    if (!qdbus_loadLibDBus()) {
     106        *error = QDBusError(QDBusError::Failed, QLatin1String("Could not open lidbus-1 library"));
    101107        return 0;
     108
    102109
    103110    DBusMessage *msg = 0;
     
    109116        break;
    110117    case DBUS_MESSAGE_TYPE_METHOD_CALL:
    111         msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), data(d_ptr->path.toUtf8()),
    112                                            data(d_ptr->interface.toUtf8()), data(d_ptr->name.toUtf8()));
     118        // only service and interface can be empty -> path and name must not be empty
     119        if (!d_ptr->parametersValidated) {
     120            if (!QDBusUtil::checkBusName(d_ptr->service, QDBusUtil::EmptyAllowed, error))
     121                return 0;
     122            if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error))
     123                return 0;
     124            if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error))
     125                return 0;
     126            if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method"))
     127                return 0;
     128        }
     129
     130        msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(),
     131                                             data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8());
    113132        break;
    114133    case DBUS_MESSAGE_TYPE_METHOD_RETURN:
     
    120139        break;
    121140    case DBUS_MESSAGE_TYPE_ERROR:
     141
     142
     143
     144
     145
    122146        msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR);
    123         q_dbus_message_set_error_name(msg, data(d_ptr->name.toUtf8()));
     147        q_dbus_message_set_error_name(msg, d));
    124148        if (!d_ptr->localMessage) {
    125149            q_dbus_message_set_destination(msg, q_dbus_message_get_sender(d_ptr->reply));
     
    128152        break;
    129153    case DBUS_MESSAGE_TYPE_SIGNAL:
    130         msg = q_dbus_message_new_signal(data(d_ptr->path.toUtf8()), data(d_ptr->interface.toUtf8()),
    131                                       data(d_ptr->name.toUtf8()));
     154        // nothing can be empty here
     155        if (!d_ptr->parametersValidated) {
     156            if (!QDBusUtil::checkObjectPath(d_ptr->path, QDBusUtil::EmptyNotAllowed, error))
     157                return 0;
     158            if (!QDBusUtil::checkInterfaceName(d_ptr->interface, QDBusUtil::EmptyAllowed, error))
     159                return 0;
     160            if (!QDBusUtil::checkMemberName(d_ptr->name, QDBusUtil::EmptyNotAllowed, error, "method"))
     161                return 0;
     162        }
     163
     164        msg = q_dbus_message_new_signal(d_ptr->path.toUtf8(), d_ptr->interface.toUtf8(),
     165                                        d_ptr->name.toUtf8());
    132166        break;
    133167    default:
     
    135169        break;
    136170    }
    137 #if 0
    138     DBusError err;
    139     q_dbus_error_init(&err);
    140     if (q_dbus_error_is_set(&err)) {
    141         QDBusError qe(&err);
    142         qDebug() << "QDBusMessagePrivate::toDBusMessage" << qe;
    143     }
    144 #endif
    145     if (!msg)
    146         return 0;
     171
     172    // if we got here, the parameters validated
     173    // and since the message parameters cannot be changed once the message is created
     174    // we can record this fact
     175    d_ptr->parametersValidated = true;
    147176
    148177    QDBusMarshaller marshaller;
     
    162191    // not ok;
    163192    q_dbus_message_unref(msg);
    164     Q_ASSERT(false);
     193    );
    165194    return 0;
    166195}
     
    240269            // we must marshall and demarshall again so as to create QDBusArgument
    241270            // entries for the complex types
    242             DBusMessage *message = toDBusMessage(asSent);
     271            QDBusError error;
     272            DBusMessage *message = toDBusMessage(asSent, &error);
     273            if (!message) {
     274                // failed to marshall, so it's a call error
     275                return QDBusMessage::createError(error);
     276            }
     277
    243278            q_dbus_message_set_sender(message, conn.baseService.toUtf8());
    244279
     
    459494  the message \a msg. Returns the DBus message.
    460495*/
     496
     497
     498
     499
     500
     501
     502
    461503
    462504/*!
     
    666708*/
    667709#ifndef QT_NO_DEBUG_STREAM
    668 QDebug operator<<(QDebug dbg, QDBusMessage::MessageType t)
     710QDebug operator<<(QDebug dbg, QDBusMessage::MessageType t)
    669711{
    670712    switch (t)
  • trunk/src/dbus/qdbusmessage.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    8888    inline QDBusMessage createErrorReply(const QDBusError &err) const
    8989    { return createErrorReply(err.name(), err.message()); }
    90     inline QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const;
     90    QDBusMessage createErrorReply(QDBusError::ErrorType type, const QString &msg) const;
    9191
     92
    9293    QString service() const;
    9394    QString path() const;
     
    114115};
    115116
    116 inline QDBusMessage QDBusMessage::createErrorReply(QDBusError::ErrorType atype, const QString &amsg) const
    117 { return createErrorReply(QDBusError::errorString(atype), amsg); }
    118 
    119117#ifndef QT_NO_DEBUG_STREAM
    120118QDBUS_EXPORT QDebug operator<<(QDebug, const QDBusMessage &);
  • trunk/src/dbus/qdbusmessage_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5656#include <qatomic.h>
    5757#include <qstring.h>
     58
    5859
    5960struct DBusMessage;
     
    7071
    7172    QList<QVariant> arguments;
     73
     74
     75
    7276    QString service, path, interface, name, message, signature;
     77
    7378    DBusMessage *msg;
    7479    DBusMessage *reply;
     
    8085    mutable uint delayedReply : 1;
    8186    uint localMessage : 1;
     87
    8288
    83     static DBusMessage *toDBusMessage(const QDBusMessage &message);
     89    static void setParametersValidated(QDBusMessage &msg, bool enable)
     90    { msg.d_ptr->parametersValidated = enable; }
     91
     92    static DBusMessage *toDBusMessage(const QDBusMessage &message, QDBusError *error);
    8493    static QDBusMessage fromDBusMessage(DBusMessage *dmsg);
    8594
  • trunk/src/dbus/qdbusmetaobject.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    602602    // mark as an error
    603603    error = QDBusError(QDBusError::UnknownInterface,
    604                        QString( QLatin1String("Interface '%1' was not found") )
     604        )
    605605                       .arg(interface));
    606606    return 0;
  • trunk/src/dbus/qdbusmetaobject_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusmetatype.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4343
    4444#include <string.h>
    45 #include <qdbus_symbols_p.h>
     45#include
    4646
    4747#include <qbytearray.h>
  • trunk/src/dbus/qdbusmetatype.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusmetatype_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusmisc.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include <string.h>
    4343
     44
    4445#include <QtCore/qvariant.h>
    4546#include <QtCore/qmetaobject.h>
     
    4849#include "qdbusconnection_p.h"
    4950#include "qdbusmetatype_p.h"
     51
    5052
    5153QT_BEGIN_NAMESPACE
     
    7274        id = QMetaType::type(name);
    7375    return id;
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
    74121}
    75122
  • trunk/src/dbus/qdbuspendingcall.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    311311bool QDBusPendingCall::isFinished() const
    312312{
    313     return d && (d->replyMessage.type() != QDBusMessage::InvalidMessage);
     313    return (d->replyMessage.type() != QDBusMessage::InvalidMessage);
    314314}
    315315
     
    410410#endif
    411411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
    412450
    413451class QDBusPendingCallWatcherPrivate: public QObjectPrivate
     
    433471    : QObject(*new QDBusPendingCallWatcherPrivate, parent), QDBusPendingCall(call)
    434472{
    435     if (d) {
    436         if (!d->watcherHelper)
     473    if (d) {
     474        if (!d->watcherHelper)
    437475            d->watcherHelper = new QDBusPendingCallWatcherHelper;
     476
     477
     478
     479
     480
    438481        d->watcherHelper->add(this);
    439482    }
     
    465508
    466509        // our signals were queued, so deliver them
     510
    467511        QCoreApplication::sendPostedEvents(this, QEvent::MetaCall);
    468512    }
  • trunk/src/dbus/qdbuspendingcall.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7979#endif
    8080
     81
     82
     83
    8184protected:
    8285    QExplicitlySharedDataPointer<QDBusPendingCallPrivate> d;
  • trunk/src/dbus/qdbuspendingcall_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    6464QT_BEGIN_NAMESPACE
    6565
     66
    6667class QDBusPendingCallWatcher;
    6768class QDBusPendingCallWatcherHelper;
     
    9596    void setMetaTypes(int count, const int *types);
    9697    void checkReceivedSignature();
     98
     99
    97100};
    98101
  • trunk/src/dbus/qdbuspendingreply.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbuspendingreply.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    189189    inline void calculateMetaTypes()
    190190    {
     191
    191192        int typeIds[Count > 0 ? Count : 1]; // use at least one since zero-sized arrays aren't valid
    192193        ForEach::fillMetaTypes(typeIds);
  • trunk/src/dbus/qdbusreply.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusreply.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusserver.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    7070        return;
    7171
    72     QObject::connect(d, SIGNAL(newServerConnection(const QDBusConnection &)),
    73                      this, SIGNAL(newConnection(const QDBusConnection &)));
     72    QObject::connect(d, SIGNAL(newServerConnection()),
     73                     this, SIGNAL(newConnection()));
    7474
    7575    // server = q_dbus_server_listen( "unix:tmpdir=/tmp", &error);
  • trunk/src/dbus/qdbusserver.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusthreaddebug_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    101101    ToggleWatchAction = 62,
    102102    SocketReadAction = 63,
    103     SocketWriteAction = 64,
     103    SocketWriteAction = 64
    104104};
    105105
  • trunk/src/dbus/qdbusutil.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242#include "qdbusutil_p.h"
    4343
    44 #include <qdbus_symbols_p.h>
     44#include
    4545
    4646#include <QtCore/qstringlist.h>
     
    8181
    8282    if (argType == QVariant::StringList) {
    83         out += QLatin1String("{");
     83        out += QLatin1);
    8484        QStringList list = arg.toStringList();
    8585        foreach (QString item, list)
     
    8787        if (!list.isEmpty())
    8888            out.chop(2);
    89         out += QLatin1String("}");
     89        out += QLatin1);
    9090    } else if (argType == QVariant::ByteArray) {
    91         out += QLatin1String("{");
     91        out += QLatin1);
    9292        QByteArray list = arg.toByteArray();
    9393        for (int i = 0; i < list.count(); ++i) {
     
    9797        if (!list.isEmpty())
    9898            out.chop(2);
    99         out += QLatin1String("}");
     99        out += QLatin1);
    100100    } else if (argType == QVariant::List) {
    101         out += QLatin1String("{");
     101        out += QLatin1);
    102102        QList<QVariant> list = arg.toList();
    103103        foreach (QVariant item, list) {
     
    108108        if (!list.isEmpty())
    109109            out.chop(2);
    110         out += QLatin1String("}");
     110        out += QLatin1);
    111111    } else if (argType == QMetaType::Char || argType == QMetaType::Short || argType == QMetaType::Int
    112112               || argType == QMetaType::Long || argType == QMetaType::LongLong) {
     
    143143        out += QLatin1Char(']');
    144144    } else if (arg.canConvert(QVariant::String)) {
    145         out += QLatin1String("\"") + arg.toString() + QLatin1String("\"");
     145        out += QLatin1);
    146146    } else {
    147147        out += QLatin1Char('[');
     
    227227    if (elementType != QDBusArgument::BasicType && elementType != QDBusArgument::VariantType
    228228            && elementType != QDBusArgument::MapEntryType)
    229         out += QLatin1String("]");
     229        out += QLatin1);
    230230
    231231    return true;
  • trunk/src/dbus/qdbusutil_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5858
    5959#include <QtDBus/qdbusmacros.h>
     60
    6061
    6162QT_BEGIN_HEADER
     
    8485
    8586    QDBUS_EXPORT QString argumentToString(const QVariant &variant);
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
    86154}
    87155
  • trunk/src/dbus/qdbusxmlgenerator.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
    4040****************************************************************************/
    4141
    42 #include <QtCore/qcoreapplication.h>
    4342#include <QtCore/qmetaobject.h>
    4443#include <QtCore/qstringlist.h>
     
    205204                xml += QString::fromLatin1("      <annotation name=\"com.trolltech.QtDBus.QtTypeName.%1%2\" value=\"%3\"/>\n")
    206205                       .arg(isOutput ? QLatin1String("Out") : QLatin1String("In"))
    207                        .arg(isOutput ? j - inputCount : j - 1)
     206                       .arg(isOutput ? j - inputCount : j - 1)
    208207                       .arg(typeNameToXml(typeName));
    209208            }
     
    232231    return retval;
    233232}
    234 
    235 QString qDBusInterfaceFromMetaObject(const QMetaObject *mo)
    236 {
    237     QString interface;
    238 
    239     int idx = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE);
    240     if (idx >= mo->classInfoOffset()) {
    241         interface = QLatin1String(mo->classInfo(idx).value());
    242     } else {
    243         interface = QLatin1String(mo->className());
    244         interface.replace(QLatin1String("::"), QLatin1String("."));
    245 
    246         if (interface.startsWith(QLatin1String("QDBus"))) {
    247             interface.prepend(QLatin1String("com.trolltech.QtDBus."));
    248         } else if (interface.startsWith(QLatin1Char('Q')) &&
    249                    interface.length() >= 2 && interface.at(1).isUpper()) {
    250             // assume it's Qt
    251             interface.prepend(QLatin1String("com.trolltech.Qt."));
    252         } else if (!QCoreApplication::instance()||
    253                    QCoreApplication::instance()->applicationName().isEmpty()) {
    254             interface.prepend(QLatin1String("local."));
    255          } else {
    256             interface.prepend(QLatin1Char('.')).prepend(QCoreApplication::instance()->applicationName());
    257             QStringList domainName =
    258                 QCoreApplication::instance()->organizationDomain().split(QLatin1Char('.'),
    259                                                                          QString::SkipEmptyParts);
    260             if (domainName.isEmpty())
    261                  interface.prepend(QLatin1String("local."));
    262             else
    263                 for (int i = 0; i < domainName.count(); ++i)
    264                     interface.prepend(QLatin1Char('.')).prepend(domainName.at(i));
    265          }
    266      }
    267  
    268     return interface;
    269  }
    270233
    271234QString qDBusGenerateMetaObjectXml(QString interface, const QMetaObject *mo,
  • trunk/src/dbus/qdbusxmlparser.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/dbus/qdbusxmlparser_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtDBus module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5757#include <QtXml/qdom.h>
    5858#include <qdbusmacros.h>
    59 #include <qdbusintrospection_p.h>
     59#include
    6060
    6161QT_BEGIN_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.