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:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • 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
Note: See TracChangeset for help on using the changeset viewer.