diff options
author | Dario Freddi <dario.freddi@collabora.co.uk> | 2011-06-09 16:40:26 +0200 |
---|---|---|
committer | Dario Freddi <dario.freddi@collabora.com> | 2012-07-03 11:11:20 +0200 |
commit | a9b4d2c813df13fb18ba5447a639e0fac1bbd0c6 (patch) | |
tree | 3d8d60c17176fa6c2f0c0c04be5813b209db3bad | |
parent | 4f5bf8fa028626755f4405af63a78dfa6d5cfa21 (diff) |
dbus-tubes: Merge onAcceptFinished and onOfferFinished
-rw-r--r-- | TelepathyQt/pending-dbus-tube.cpp | 36 | ||||
-rw-r--r-- | TelepathyQt/pending-dbus-tube.h | 3 |
2 files changed, 7 insertions, 32 deletions
diff --git a/TelepathyQt/pending-dbus-tube.cpp b/TelepathyQt/pending-dbus-tube.cpp index b7b3ff776..755ab8b3 100644 --- a/TelepathyQt/pending-dbus-tube.cpp +++ b/TelepathyQt/pending-dbus-tube.cpp @@ -71,11 +71,11 @@ PendingDBusTube::PendingDBusTube( mPriv->tube = object; if (string->isFinished()) { - onAcceptFinished(string); + onConnectionFinished(string); } else { // Connect the pending void connect(string, SIGNAL(finished(Tp::PendingOperation*)), - this, SLOT(onAcceptFinished(Tp::PendingOperation*))); + this, SLOT(onConnectionFinished(Tp::PendingOperation*))); } } @@ -88,11 +88,11 @@ PendingDBusTube::PendingDBusTube( mPriv->tube = object; if (string->isFinished()) { - onOfferFinished(string); + onConnectionFinished(string); } else { // Connect the pending void connect(string, SIGNAL(finished(Tp::PendingOperation*)), - this, SLOT(onOfferFinished(Tp::PendingOperation*))); + this, SLOT(onConnectionFinished(Tp::PendingOperation*))); } } @@ -128,7 +128,7 @@ QString PendingDBusTube::address() const return mPriv->tube->address(); } -void PendingDBusTube::onAcceptFinished(PendingOperation *op) +void PendingDBusTube::onConnectionFinished(PendingOperation *op) { if (op->isError()) { // Fail @@ -136,31 +136,7 @@ void PendingDBusTube::onAcceptFinished(PendingOperation *op) return; } - debug() << "Accept tube finished successfully"; - - // Now get the address and set it - PendingString *ps = qobject_cast<PendingString*>(op); - mPriv->tube->setAddress(ps->result()); - - // It might have been already opened - check - if (mPriv->tube->state() == TubeChannelStateOpen) { - onStateChanged(mPriv->tube->state()); - } else { - // Wait until the tube gets opened on the other side - connect(mPriv->tube.data(), SIGNAL(stateChanged(Tp::TubeChannelState)), - this, SLOT(onStateChanged(Tp::TubeChannelState))); - } -} - -void PendingDBusTube::onOfferFinished(PendingOperation *op) -{ - if (op->isError()) { - // Fail - setFinishedWithError(op->errorName(), op->errorMessage()); - return; - } - - debug() << "Offer tube finished successfully"; + debug() << "Accept/Offer tube finished successfully"; // Now get the address and set it PendingString *ps = qobject_cast<PendingString*>(op); diff --git a/TelepathyQt/pending-dbus-tube.h b/TelepathyQt/pending-dbus-tube.h index 9da37453..9a771974 100644 --- a/TelepathyQt/pending-dbus-tube.h +++ b/TelepathyQt/pending-dbus-tube.h @@ -43,8 +43,7 @@ public: QString address() const; private Q_SLOTS: - TP_QT_NO_EXPORT void onAcceptFinished(Tp::PendingOperation *op); - TP_QT_NO_EXPORT void onOfferFinished(Tp::PendingOperation *op); + TP_QT_NO_EXPORT void onConnectionFinished(Tp::PendingOperation *op); TP_QT_NO_EXPORT void onStateChanged(Tp::TubeChannelState state); private: |