diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2012-07-02 18:44:41 +0300 |
---|---|---|
committer | Dario Freddi <dario.freddi@collabora.com> | 2012-07-03 11:11:24 +0200 |
commit | 7551b4f5157954fd6ec1c42d8d99d7a3f397cefa (patch) | |
tree | 02b3541b414a9ebd9a7aff0260c5757b0d921f5f | |
parent | 2cc843d26b61f4a6d227c481e244a5a835859fd5 (diff) |
dbus-tubes: remove the unused pending-dbus-tube.* files
-rw-r--r-- | TelepathyQt/pending-dbus-tube.cpp | 200 | ||||
-rw-r--r-- | TelepathyQt/pending-dbus-tube.h | 71 |
2 files changed, 0 insertions, 271 deletions
diff --git a/TelepathyQt/pending-dbus-tube.cpp b/TelepathyQt/pending-dbus-tube.cpp deleted file mode 100644 index a2239736..00000000 --- a/TelepathyQt/pending-dbus-tube.cpp +++ /dev/null @@ -1,200 +0,0 @@ -/* - * This file is part of TelepathyQt - * - * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include <TelepathyQt/PendingDBusTube> - -#include "TelepathyQt/_gen/pending-dbus-tube.moc.hpp" - -#include "TelepathyQt/debug-internal.h" - -#include <TelepathyQt/IncomingDBusTubeChannel> -#include <TelepathyQt/OutgoingDBusTubeChannel> -#include <TelepathyQt/PendingString> -#include <TelepathyQt/Types> - -namespace Tp -{ - -struct TP_QT_NO_EXPORT PendingDBusTube::Private -{ - Private(PendingDBusTube *parent); - - // Public object - PendingDBusTube *parent; - - DBusTubeChannelPtr tube; - - bool requiresCredentials; - uchar credentialByte; -}; - -PendingDBusTube::Private::Private(PendingDBusTube *parent) - : parent(parent), - requiresCredentials(false), - credentialByte(0) -{ -} - -/** - * \class PendingDBusTube - * \headerfile TelepathyQt/pending-dbus-tube.h <TelepathyQt/PendingDBusTube> - * - * A pending operation for accepting or offering a DBus tube - * - * This class represents an asynchronous operation for accepting or offering a DBus tube. - * Upon completion, the address of the opened tube is returned as a QString. - */ - -PendingDBusTube::PendingDBusTube( - PendingString *string, - bool requiresCredentials, - uchar credentialByte, - const DBusTubeChannelPtr &object) - : PendingOperation(object) - , mPriv(new Private(this)) -{ - mPriv->tube = object; - - mPriv->requiresCredentials = requiresCredentials; - mPriv->credentialByte = credentialByte; - - connect(mPriv->tube.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)), - this, SLOT(onChannelInvalidated(Tp::DBusProxy*,QString,QString))); - - if (string->isFinished()) { - onConnectionFinished(string); - } else { - // Connect the pending void - connect(string, SIGNAL(finished(Tp::PendingOperation*)), - this, SLOT(onConnectionFinished(Tp::PendingOperation*))); - } -} - -PendingDBusTube::PendingDBusTube( - const QString &errorName, - const QString &errorMessage, - const DBusTubeChannelPtr &object) - : PendingOperation(object) - , mPriv(new PendingDBusTube::Private(this)) -{ - setFinishedWithError(errorName, errorMessage); -} - -/** - * Class destructor - */ -PendingDBusTube::~PendingDBusTube() -{ - delete mPriv; -} - -/** - * When the operation has been completed successfully, returns the address of the opened DBus connection. - * - * Please note this function will return a meaningful value only if the operation has already - * been completed successfully: in case of failure or non-completion, an empty QString will be - * returned. - * - * \returns The address of the opened DBus connection. - */ -QString PendingDBusTube::address() const -{ - return mPriv->tube->address(); -} - -/** - * Return whether sending a credential byte once connecting to the socket is required. - * - * Note that if this method returns \c true, one should send a SCM_CREDS or SCM_CREDENTIALS - * and the credentialByte() once connected. If SCM_CREDS or SCM_CREDENTIALS cannot be sent, - * the credentialByte() should still be sent. - * - * \return \c true if sending credentials is required, \c false otherwise. - * \sa credentialByte() - */ -bool PendingDBusTube::requiresCredentials() const -{ - return mPriv->requiresCredentials; -} - -/** - * Return the credential byte to send once connecting to the socket if requiresCredentials() is \c - * true. - * - * \return The credential byte. - * \sa requiresCredentials() - */ -uchar PendingDBusTube::credentialByte() const -{ - return mPriv->credentialByte; -} - -void PendingDBusTube::onConnectionFinished(PendingOperation *op) -{ - if (isFinished()) { - // The operation has already failed - return; - } - - if (op->isError()) { - // Fail - setFinishedWithError(op->errorName(), op->errorMessage()); - return; - } - - debug() << "Accept/Offer 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::onStateChanged(TubeChannelState state) -{ - debug() << "Tube state changed to " << state; - if (state == TubeChannelStateOpen) { - // The tube is ready: mark the operation as finished - setFinished(); - } -} - -void PendingDBusTube::onChannelInvalidated(DBusProxy* proxy, - const QString& errorName, const QString& errorMessage) -{ - Q_UNUSED(proxy); - - if (isFinished()) { - // The operation has already finished - return; - } - - setFinishedWithError(errorName, errorMessage); -} - -} diff --git a/TelepathyQt/pending-dbus-tube.h b/TelepathyQt/pending-dbus-tube.h deleted file mode 100644 index b6f3e3f9..00000000 --- a/TelepathyQt/pending-dbus-tube.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is part of TelepathyQt - * - * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _TelepathyQt_pending_dbus_tube_h_HEADER_GUARD_ -#define _TelepathyQt_pending_dbus_tube_h_HEADER_GUARD_ - -#ifndef IN_TP_QT_HEADER -#error IN_TP_QT_HEADER -#endif - -#include <TelepathyQt/PendingOperation> -#include <TelepathyQt/OutgoingDBusTubeChannel> - -namespace Tp { - -class PendingString; - -class TP_QT_EXPORT PendingDBusTube : public PendingOperation -{ - Q_OBJECT - Q_DISABLE_COPY(PendingDBusTube) - -public: - virtual ~PendingDBusTube(); - - QString address() const; - - bool requiresCredentials() const; - uchar credentialByte() const; - -private Q_SLOTS: - TP_QT_NO_EXPORT void onConnectionFinished(Tp::PendingOperation *op); - TP_QT_NO_EXPORT void onStateChanged(Tp::TubeChannelState state); - TP_QT_NO_EXPORT void onChannelInvalidated(Tp::DBusProxy *proxy, - const QString &errorName, - const QString &errorMessage); - -private: - TP_QT_NO_EXPORT PendingDBusTube(PendingString *string, - bool requiresCredentials, uchar credentialByte, - const DBusTubeChannelPtr &object); - TP_QT_NO_EXPORT PendingDBusTube(const QString &errorName, const QString &errorMessage, - const DBusTubeChannelPtr &object); - - struct Private; - friend class OutgoingDBusTubeChannel; - friend class IncomingDBusTubeChannel; - friend struct Private; - Private *mPriv; -}; - -} - -#endif |