[Telepathy-commits] [telepathy-qt4/master] Add a PendingReadyAccount which is a subclass of PendingOperation that will be returned by Account::becomReady() allowing to get the Account easily from the slot triggered when the operation completes.

George Goldberg george.goldberg at collabora.co.uk
Thu Jan 29 13:52:24 PST 2009


---
 TelepathyQt4/Client/PendingReadyAccount       |   13 +++
 TelepathyQt4/Client/pending-ready-account.cpp |  110 +++++++++++++++++++++++++
 TelepathyQt4/Client/pending-ready-account.h   |   62 ++++++++++++++
 TelepathyQt4/Makefile.am                      |    4 +
 4 files changed, 189 insertions(+), 0 deletions(-)
 create mode 100644 TelepathyQt4/Client/PendingReadyAccount
 create mode 100644 TelepathyQt4/Client/pending-ready-account.cpp
 create mode 100644 TelepathyQt4/Client/pending-ready-account.h

diff --git a/TelepathyQt4/Client/PendingReadyAccount b/TelepathyQt4/Client/PendingReadyAccount
new file mode 100644
index 0000000..6ff95ca
--- /dev/null
+++ b/TelepathyQt4/Client/PendingReadyAccount
@@ -0,0 +1,13 @@
+#ifndef _TelepathyQt4_Client_PendingReadyAccount_HEADER_GUARD_
+#define _TelepathyQt4_Client_PendingReadyAccount_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#define IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <TelepathyQt4/Client/pending-ready-account.h>
+
+#undef IN_TELEPATHY_QT4_HEADER
+
+#endif
+// vim:set ft=cpp:
diff --git a/TelepathyQt4/Client/pending-ready-account.cpp b/TelepathyQt4/Client/pending-ready-account.cpp
new file mode 100644
index 0000000..03e551f
--- /dev/null
+++ b/TelepathyQt4/Client/pending-ready-account.cpp
@@ -0,0 +1,110 @@
+/*
+ * This file is part of TelepathyQt4
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * 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 <TelepathyQt4/Client/PendingReadyAccount>
+
+#include "TelepathyQt4/Client/_gen/pending-ready-account.moc.hpp"
+
+#include "TelepathyQt4/debug-internal.h"
+
+#include <QDBusPendingCallWatcher>
+#include <QDBusPendingReply>
+
+/**
+ * \addtogroup clientsideproxies Client-side proxies
+ *
+ * Proxy objects representing remote service objects accessed via D-Bus.
+ *
+ * In addition to providing direct access to methods, signals and properties
+ * exported by the remote objects, some of these proxies offer features like
+ * automatic inspection of remote object capabilities, property tracking,
+ * backwards compatibility helpers for older services and other utilities.
+ */
+
+namespace Telepathy
+{
+namespace Client
+{
+
+struct PendingReadyAccount::Private
+{
+    Private(Account::Features features, Account *account) :
+        features(features),
+        account(account)
+    {
+    }
+
+    Account::Features features;
+    Account *account;
+};
+
+/**
+ * \class PendingReadyAccount
+ * \ingroup clientaccount
+ * \headerfile <TelepathyQt4/Client/pending-ready-account.h> <TelepathyQt4/Client/PendingReadyAccount>
+ *
+ * Class containing the features requested and the reply to a request
+ * for an account to become ready. Instances of this class cannot be
+ * constructed directly; the only way to get one is via Account::becomeReady().
+ */
+
+/**
+ * Construct a PendingReadyAccount object.
+ *
+ * \param account The Account that will become ready.
+ */
+PendingReadyAccount::PendingReadyAccount(Account::Features features, Account *account)
+    : PendingOperation(account),
+      mPriv(new Private(features, account))
+{
+}
+
+/**
+ * Class destructor.
+ */
+PendingReadyAccount::~PendingReadyAccount()
+{
+    delete mPriv;
+}
+
+/**
+ * Return the Account object through which the request was made.
+ *
+ * \return Account object.
+ */
+Account *PendingReadyAccount::account() const
+{
+    return mPriv->account;
+}
+
+/**
+ * Return the Features that were requested to become ready on the
+ * account.
+ *
+ * \return Features.
+ */
+Account::Features PendingReadyAccount::features() const
+{
+    return mPriv->features;
+}
+
+} // Telepathy::Client
+} // Telepathy
diff --git a/TelepathyQt4/Client/pending-ready-account.h b/TelepathyQt4/Client/pending-ready-account.h
new file mode 100644
index 0000000..837675c
--- /dev/null
+++ b/TelepathyQt4/Client/pending-ready-account.h
@@ -0,0 +1,62 @@
+/*
+ * This file is part of TelepathyQt4
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * 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 _TelepathyQt4_cli_pending_ready_account_h_HEADER_GUARD_
+#define _TelepathyQt4_cli_pending_ready_account_h_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#error IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <TelepathyQt4/Client/Account>
+#include <TelepathyQt4/Client/PendingOperation>
+
+class QDBusPendingCallWatcher;
+
+namespace Telepathy
+{
+namespace Client
+{
+
+class PendingReadyAccount : public PendingOperation
+{
+    Q_OBJECT
+
+public:
+    ~PendingReadyAccount();
+
+    Account *account() const;
+    Account::Features features() const;
+
+private:
+    Q_DISABLE_COPY(PendingReadyAccount);
+    PendingReadyAccount(Account::Features features, Account *account);
+
+    struct Private;
+    friend struct Private;
+    friend class Account;
+    Private *mPriv;
+};
+
+} // Telepathy::Client
+} // Telepathy
+
+#endif
diff --git a/TelepathyQt4/Makefile.am b/TelepathyQt4/Makefile.am
index fa50f82..b0c6484 100644
--- a/TelepathyQt4/Makefile.am
+++ b/TelepathyQt4/Makefile.am
@@ -57,6 +57,7 @@ libtelepathy_qt4_la_SOURCES = \
     Client/pending-contacts.cpp \
     Client/pending-handles.cpp \
     Client/pending-operation.cpp \
+    Client/pending-ready-account.cpp \
     Client/pending-string-list.cpp \
     Client/properties.cpp \
     Client/referenced-handles.cpp \
@@ -104,6 +105,7 @@ nodist_libtelepathy_qt4_la_SOURCES = \
     Client/_gen/pending-contacts.moc.hpp \
     Client/_gen/pending-handles.moc.hpp \
     Client/_gen/pending-operation.moc.hpp \
+    Client/_gen/pending-ready-account.moc.hpp \
     Client/_gen/pending-string-list.moc.hpp \
     Client/_gen/simple-pending-operations.moc.hpp
 
@@ -139,6 +141,7 @@ tpqt4clientinclude_HEADERS = \
     Client/PendingContactAttributes \
     Client/PendingFailure \
     Client/PendingOperation \
+    Client/PendingReadyAccount \
     Client/PendingSuccess \
     Client/PendingStringList \
     Client/PendingVoidMethodCall \
@@ -198,6 +201,7 @@ tpqt4clientinclude_HEADERS = \
     Client/pending-contacts.h \
     Client/pending-handles.h \
     Client/pending-operation.h \
+    Client/pending-ready-account.h \
     Client/pending-string-list.h \
     Client/properties.h \
     Client/referenced-handles.h \
-- 
1.5.6.5




More information about the telepathy-commits mailing list