Changeset 561 for trunk/src/dbus/qdbusconnection.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/dbus/qdbusconnection.cpp
r2 r561 2 2 ** 3 3 ** 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]) 5 6 ** 6 7 ** This file is part of the QtDBus module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 558 558 const QString &name, QObject *receiver, const char *slot) 559 559 { 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); 575 561 } 576 562 … … 579 565 580 566 Connects the signal to the slot \a slot in object \a 581 receiver. Unlike the otherconnect() overload, this function567 receiver. Unlike the connect() overload, this function 582 568 allows one to specify the parameter signature to be connected 583 569 using the \a signature variable. The function will then verify … … 585 571 slot and return false otherwise. 586 572 573 574 587 575 \note This function verifies that the signal signature matches the 588 576 slot's parameters, but it does not verify that the actual … … 594 582 QObject *receiver, const char *slot) 595 583 { 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 596 615 if (!receiver || !slot || !d || !d->connection) 597 616 return false; … … 601 620 return false; 602 621 603 // check the slot604 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 empty611 hook.signature = signature; // it might get started later612 if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false))613 return false; // don't connect614 615 // avoid duplicating:616 622 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 */ 633 bool 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); 634 637 } 635 638 … … 637 640 \overload 638 641 639 Disconnects the signal from the slot \a slot in object\a640 receiver. Unlike the other disconnect() overload, this function641 allows one to specify the parameter signature to be disconnected642 using the \a signature variable. The function will then verify643 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 . 645 648 */ 646 649 bool QDBusConnection::disconnect(const QString &service, const QString &path, const QString& interface, 647 650 const QString &name, const QString &signature, 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 648 669 QObject *receiver, const char *slot) 649 670 { … … 655 676 return false; 656 677 657 // check the slot658 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 empty665 hook.signature = signature;666 if (!d->prepareHook(hook, key, service, owner, path, interface, name, receiver, slot, 0, false))667 return false; // don't disconnect668 669 // avoid duplicating:670 678 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); 689 680 } 690 681 … … 974 965 975 966 /*! 967 968 976 969 Returns the connection that sent the signal, if called in a slot activated 977 970 by QDBus; otherwise it returns 0. 971 972 973 974 975 978 976 */ 979 977 QDBusConnection QDBusConnection::sender() … … 1006 1004 ref.deref(); // busService has increased the refcounting to us 1007 1005 // avoid cyclic refcounting 1008 // if (mode != PeerMode)1009 QObject::connect(busService, SIGNAL(serviceOwnerChanged(QString,QString,QString)),1010 this, SIGNAL(serviceOwnerChanged(QString,QString,QString)));1011 1006 1012 1007 QObject::connect(this, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), 1013 1008 busService, SIGNAL(callWithCallbackFailed(QDBusError,QDBusMessage)), 1014 1009 Qt::QueuedConnection); 1015 1016 1010 } 1017 1011
Note:
See TracChangeset
for help on using the changeset viewer.