phonebookengines/cntlistmodel/inc/cntpresenceinfoprovider.h
changeset 46 efe85016a067
child 61 d30183af6ca6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookengines/cntlistmodel/inc/cntpresenceinfoprovider.h	Wed Jun 23 18:02:44 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Presence info provider plugin for CntListModel. It can provide
+*              the presence information of a contact (icon2 field).
+*
+*/
+
+#ifndef CNTPRESENCEINFOPROVIDER_H
+#define CNTPRESENCEINFOPROVIDER_H
+
+#include "cntinfoprovider.h"
+#include <qcontact.h>
+
+class PrcPresenceReader;
+class PrcPresenceBuddyInfoQt;
+
+QTM_BEGIN_NAMESPACE
+class QContactManager;
+QTM_END_NAMESPACE
+
+QTM_USE_NAMESPACE
+
+/**
+    Presence info provider plugin for CntListModel. It can provide
+    the presence information of a contact (icon2 field).
+ */
+class CntPresenceInfoProvider : public CntInfoProvider
+{
+    friend class TestCntPresenceInfoProvider;
+    Q_OBJECT
+    
+public:
+    CntPresenceInfoProvider();
+    ~CntPresenceInfoProvider();
+    
+	// From CntInfoProvider
+    QString id() const { return "presence"; };
+    ContactInfoFields supportedFields() const;
+    void requestInfo(const QContact& contact, ContactInfoFields requestedInfo);
+    
+private slots:
+    void handlePresenceUpdate(bool aSuccess, PrcPresenceBuddyInfoQt* aPresenceBuddyInfo);
+    
+private:
+    QString parsePresence(const QList<PrcPresenceBuddyInfoQt*>& buddyList);
+    
+private:
+    PrcPresenceReader*              iReader; // owned
+    QContactManager*                mManager; // owned
+    QMap<QString, QContactLocalId>  mBuddyMap;
+};
+
+#endif