phonebookengines/cntlistmodel/inc/cntpresenceinfoprovider.h
branchRCL_3
changeset 62 5b6f26637ad3
equal deleted inserted replaced
58:d4f567ce2e7c 62:5b6f26637ad3
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Presence info provider plugin for CntListModel. It can provide
       
    15 *              the presence information of a contact (icon2 field).
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef CNTPRESENCEINFOPROVIDER_H
       
    20 #define CNTPRESENCEINFOPROVIDER_H
       
    21 
       
    22 #include <cntinfoprovider.h>
       
    23 #include <qcontact.h>
       
    24 
       
    25 class PrcPresenceReader;
       
    26 class PrcPresenceBuddyInfoQt;
       
    27 
       
    28 QTM_BEGIN_NAMESPACE
       
    29 class QContactManager;
       
    30 QTM_END_NAMESPACE
       
    31 
       
    32 QTM_USE_NAMESPACE
       
    33 
       
    34 /**
       
    35     Presence info provider plugin for CntListModel. It can provide
       
    36     the presence information of a contact (icon2 field).
       
    37  */
       
    38 class CntPresenceInfoProvider : public CntInfoProvider
       
    39 {
       
    40     friend class TestCntPresenceInfoProvider;
       
    41     Q_OBJECT
       
    42     
       
    43 public:
       
    44     CntPresenceInfoProvider();
       
    45     ~CntPresenceInfoProvider();
       
    46     
       
    47 	// From CntInfoProvider
       
    48     QString id() const { return "presence"; };
       
    49     ContactInfoFields supportedFields() const;
       
    50     void requestInfo(const QContact& contact, ContactInfoFields requestedInfo);
       
    51     
       
    52 private slots:
       
    53     void handlePresenceUpdate(bool aSuccess, PrcPresenceBuddyInfoQt* aPresenceBuddyInfo);
       
    54     
       
    55 private:
       
    56     QString parsePresence(const QList<PrcPresenceBuddyInfoQt*>& buddyList);
       
    57 
       
    58 signals:
       
    59     void infoFieldReady(CntInfoProvider* sender, int contactId, ContactInfoField field, const QString& value);
       
    60     
       
    61 private:
       
    62     PrcPresenceReader*              iReader; // owned
       
    63     QContactManager*                mManager; // owned
       
    64     QMap<QString, QContactLocalId>  mBuddyMap;
       
    65 };
       
    66 
       
    67 #endif