[Telepathy-commits] [telepathy-qt4/master] Add stub ContactManager class

Olli Salli olli.salli at collabora.co.uk
Wed Jan 28 04:04:10 PST 2009


---
 TelepathyQt4/Client/ContactManager      |   13 ++++++
 TelepathyQt4/Client/connection.cpp      |   15 ++++++-
 TelepathyQt4/Client/connection.h        |    2 +
 TelepathyQt4/Client/contact-manager.cpp |   73 +++++++++++++++++++++++++++++++
 TelepathyQt4/Client/contact-manager.h   |   57 ++++++++++++++++++++++++
 TelepathyQt4/Makefile.am                |    3 +
 6 files changed, 161 insertions(+), 2 deletions(-)
 create mode 100644 TelepathyQt4/Client/ContactManager
 create mode 100644 TelepathyQt4/Client/contact-manager.cpp
 create mode 100644 TelepathyQt4/Client/contact-manager.h

diff --git a/TelepathyQt4/Client/ContactManager b/TelepathyQt4/Client/ContactManager
new file mode 100644
index 0000000..7e0bf0d
--- /dev/null
+++ b/TelepathyQt4/Client/ContactManager
@@ -0,0 +1,13 @@
+#ifndef _TelepathyQt4_Client_ContactManager_HEADER_GUARD_
+#define _TelepathyQt4_Client_ContactManager_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#define IN_TELEPATHY_QT4_HEADER
+#endif
+
+#include <TelepathyQt4/Client/contact-manager.h>
+
+#undef IN_TELEPATHY_QT4_HEADER
+
+#endif
+// vim:set ft=cpp:
diff --git a/TelepathyQt4/Client/connection.cpp b/TelepathyQt4/Client/connection.cpp
index b0ce8f6..666279b 100644
--- a/TelepathyQt4/Client/connection.cpp
+++ b/TelepathyQt4/Client/connection.cpp
@@ -29,6 +29,7 @@
 
 #include "TelepathyQt4/debug-internal.h"
 
+#include <TelepathyQt4/Client/ContactManager>
 #include <TelepathyQt4/Client/PendingChannel>
 #include <TelepathyQt4/Client/PendingContactAttributes>
 #include <TelepathyQt4/Client/PendingFailure>
@@ -166,6 +167,8 @@ struct Connection::Private
     static QMap<QPair<QString, QString>, HandleContext *> handleContexts;
     static QMutex handleContextsLock;
     HandleContext *handleContext;
+
+    ContactManager *contactManager;
 };
 
 // Handle tracking
@@ -227,20 +230,23 @@ Connection::Private::Private(Connection *parent)
       statusReason(ConnectionStatusReasonNoneSpecified),
       haveInitialStatus(false),
       selfHandle(0),
-      handleContext(0)
+      handleContext(0),
+      contactManager(new ContactManager(parent))
 {
     selfPresence.type = Telepathy::ConnectionPresenceTypeUnknown;
 }
 
 Connection::Private::~Private()
 {
-    QMutexLocker locker(&handleContextsLock);
+    delete contactManager;
 
     if (!handleContext) {
         // initial introspection is not done
         return;
     }
 
+    QMutexLocker locker(&handleContextsLock);
+
     // All handle contexts locked, so safe
     if (!--handleContext->refcount) {
         debug() << "Destroying HandleContext";
@@ -1460,6 +1466,11 @@ PendingContactAttributes *Connection::getContactAttributes(const UIntList &handl
     return pending;
 }
 
+ContactManager *Connection::contactManager() const
+{
+    return mPriv->contactManager;
+}
+
 void Connection::refHandle(uint type, uint handle)
 {
     Private::HandleContext *handleContext = mPriv->handleContext;
diff --git a/TelepathyQt4/Client/connection.h b/TelepathyQt4/Client/connection.h
index b4d749c..6bda2ca 100644
--- a/TelepathyQt4/Client/connection.h
+++ b/TelepathyQt4/Client/connection.h
@@ -44,6 +44,7 @@ namespace Client
 {
 
 class Channel;
+class ContactManager;
 class PendingChannel;
 class PendingContactAttributes;
 class PendingHandles;
@@ -161,6 +162,7 @@ public:
 
     PendingContactAttributes *getContactAttributes(const UIntList &contacts,
             const QStringList &interfaces, bool reference = true);
+    ContactManager *contactManager() const;
 
     bool isReady(Features features = 0) const;
 
diff --git a/TelepathyQt4/Client/contact-manager.cpp b/TelepathyQt4/Client/contact-manager.cpp
new file mode 100644
index 0000000..efdb98a
--- /dev/null
+++ b/TelepathyQt4/Client/contact-manager.cpp
@@ -0,0 +1,73 @@
+/*
+ * This file is part of TelepathyQt4
+ *
+ * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2008 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/ContactManager>
+
+#include <TelepathyQt4/Client/Connection>
+#include "TelepathyQt4/debug-internal.h"
+
+/**
+ * \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.
+ */
+
+/**
+ * \defgroup clientconn Connection proxies
+ * \ingroup clientsideproxies
+ *
+ * Proxy objects representing remote Telepathy Connection objects.
+ */
+
+namespace Telepathy
+{
+namespace Client
+{
+
+/**
+ * \class ContactManager
+ * \ingroup clientconn
+ * \headerfile <TelepathyQt4/Client/contact-manager.h> <TelepathyQt4/Client/ContactManager>
+ */
+
+struct ContactManager::Private
+{
+    Connection *conn;
+};
+
+ContactManager::ContactManager(Connection *parent)
+    : mPriv(new Private)
+{
+    mPriv->conn = parent;
+}
+
+ContactManager::~ContactManager()
+{
+    delete mPriv;
+}
+
+}
+}
diff --git a/TelepathyQt4/Client/contact-manager.h b/TelepathyQt4/Client/contact-manager.h
new file mode 100644
index 0000000..a70216f
--- /dev/null
+++ b/TelepathyQt4/Client/contact-manager.h
@@ -0,0 +1,57 @@
+/*
+ * This file is part of TelepathyQt4
+ *
+ * Copyright (C) 2008-2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2008-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_contact_manager_h_HEADER_GUARD_
+#define _TelepathyQt4_cli_contact_manager_h_HEADER_GUARD_
+
+#ifndef IN_TELEPATHY_QT4_HEADER
+#error IN_TELEPATHY_QT4_HEADER
+#endif
+
+namespace Telepathy
+{
+namespace Client
+{
+
+class Connection;
+class Contact;
+class PendingContacts;
+
+class ContactManager
+{
+    public:
+
+        Connection *connection();
+
+    private:
+        ContactManager(Connection *parent);
+        ~ContactManager();
+
+        struct Private;
+        friend struct Private;
+        friend class Connection;
+        Private *mPriv;
+};
+
+} // Telepathy::Client
+} // Telepathy
+
+#endif
diff --git a/TelepathyQt4/Makefile.am b/TelepathyQt4/Makefile.am
index a46840b..681b3d5 100644
--- a/TelepathyQt4/Makefile.am
+++ b/TelepathyQt4/Makefile.am
@@ -43,6 +43,7 @@ libtelepathy_qt4_la_SOURCES = \
     Client/connection-manager.cpp \
     Client/connection-internal.h \
     Client/connection-manager-internal.h \
+    Client/contact-manager.cpp \
     Client/dbus.cpp \
     Client/dbus-proxy.cpp \
     Client/media-session-handler.cpp \
@@ -121,6 +122,7 @@ tpqt4clientinclude_HEADERS = \
     Client/Channel \
     Client/Connection \
     Client/ConnectionManager \
+    Client/ContactManager \
     Client/DBus \
     Client/DBusProxy \
     Client/MediaSessionHandler \
@@ -177,6 +179,7 @@ tpqt4clientinclude_HEADERS = \
     Client/channel.h \
     Client/connection.h \
     Client/connection-manager.h \
+    Client/contact-manager.h \
     Client/dbus.h \
     Client/dbus-proxy.h \
     Client/media-session-handler.h \
-- 
1.5.6.5




More information about the telepathy-commits mailing list