example/clientapi/smf/inc/common/smfcontacts/smfcontact.h
changeset 1 4b1e636e8a71
child 2 86af6c333601
equal deleted inserted replaced
0:5d2360e70d9f 1:4b1e636e8a71
       
     1 /**************************************************************************************************
       
     2 * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "{License}"
       
     6 * which accompanies  this distribution, and is available
       
     7 * at the URL "{LicenseUrl}".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Manasij Roy
       
    14 * Description:
       
    15 * Interface spefication for profile of a contact in a social networking site
       
    16 *
       
    17 /*************************************************************************************************/
       
    18 
       
    19 #ifndef SMFPROFILE_H
       
    20 #define SMFPROFILE_H
       
    21 
       
    22 #include <QObject>
       
    23 
       
    24 //From Qt mobility project
       
    25 #include "qtcontacts.h"
       
    26 #include "../common/SmfClientGlobal.h"
       
    27 #include "smfprovider.h"
       
    28 /**
       
    29  * Interface for a contact from a service provider. This class
       
    30  * provides basic functionality to allow applications to obtain details of a
       
    31  * contact (self or friends) in a social networking service.
       
    32  * 
       
    33  * All of the functionality described here should be implemented by a service
       
    34  * specific plug-in object.
       
    35  * Note this class has dependencies on QtMobility project
       
    36  */
       
    37 class SMFCLIENT_EXPORT SmfContact : public QObject
       
    38 {
       
    39   Q_OBJECT
       
    40 
       
    41 public:
       
    42   /** 
       
    43    * Constructs SmfContact with base provider info
       
    44    * Seeing as this is a plug-in implementation, these will realistically
       
    45    * be generated by SMF factory of some kind
       
    46    */
       
    47   SmfContact(SmfProvider* baseProvider = 0);
       
    48   ~SmfContact();
       
    49 
       
    50 
       
    51   /**
       
    52    * Returns the available sub fields for contacts.
       
    53     * The following subtypes are available,-
       
    54     * QString userIdInProvider;
       
    55     * QtMobility::QContactAddress Adress;
       
    56     * QtMobility::QContactAnniversary Anniversary;
       
    57     * QtMobility::QContactAvatar  Avatar;
       
    58     * QtMobility::QContactBirthday Birthday;
       
    59     * QtMobility::QContactEmailAddress EmailAddress;
       
    60     * QtMobility::QContactGender Gender;
       
    61     * QtMobility::QContactGeolocation Geolocation;
       
    62     * QtMobility::QContactGuid Guid;
       
    63     * QtMobility::QContactName Name;
       
    64     * QtMobility::QContactNickname Nickname;
       
    65     * QtMobility::QContactNote Note;
       
    66     * QtMobility::QContactOnlineAccount OnlineAccount;
       
    67     * QtMobility::QContactOrganization  Organization;
       
    68     * QtMobility::QContactPhoneNumber PhoneNumber;
       
    69     * QtMobility::QContactTimestamp Timestamp;
       
    70     * QtMobility::QContactType Type;
       
    71     * QtMobility::QContactUrl  Url;
       
    72    */
       
    73   virtual QStringList subTypes() const;
       
    74   
       
    75   //APIs to get base provider info (SmfProvider)
       
    76   
       
    77   /**
       
    78    * Gets the base provider info, note setting the provider is not permitted here
       
    79    */
       
    80   virtual SmfProvider* getProvider() = 0;
       
    81   
       
    82 public slots:
       
    83 
       
    84 /**
       
    85  * Gets value of the sub field for any contact.
       
    86  * @param  subType sub field type 
       
    87  * @param info value of the sub field subType
       
    88  * @see subTypes()
       
    89  * The following subtypes are available,-
       
    90  * QString userIdInProvider;
       
    91  * QtMobility::QContactAddress Adress;
       
    92  * QtMobility::QContactAnniversary Anniversary;
       
    93  * QtMobility::QContactAvatar  Avatar;
       
    94  * QtMobility::QContactBirthday Birthday;
       
    95  * QtMobility::QContactEmailAddress EmailAddress;
       
    96  * QtMobility::QContactGender Gender;
       
    97  * QtMobility::QContactGeolocation Geolocation;
       
    98  * QtMobility::QContactGuid Guid;
       
    99  * QtMobility::QContactName Name;
       
   100  * QtMobility::QContactNickname Nickname;
       
   101  * QtMobility::QContactNote Note;
       
   102  * QtMobility::QContactOnlineAccount OnlineAccount;
       
   103  * QtMobility::QContactOrganization  Organization;
       
   104  * QtMobility::QContactPhoneNumber PhoneNumber;
       
   105  * QtMobility::QContactTimestamp Timestamp;
       
   106  * QtMobility::QContactType Type;
       
   107  * QtMobility::QContactUrl  Url;
       
   108  */
       
   109   virtual void value(const QString& subType,const QVariant& info); //for any contact
       
   110   
       
   111   /**
       
   112    * Sets the value of the sub field for self contact
       
   113    * @param  key sub field type 
       
   114    * @param value value to be set for  sub field key
       
   115    * @return success of the set
       
   116    * @see subTypes()
       
   117    */
       
   118   virtual bool setValue( const QString & key, const QVariant & value );//for self contact only
       
   119 	 
       
   120   
       
   121 signals:
       
   122 /**
       
   123  * Emitted when value of self contact changes.
       
   124  * @param key the key which is changed
       
   125  */
       
   126   void detailsUpdated(const QString& key); //for setvalue on self contact
       
   127   
       
   128 private:
       
   129   /**
       
   130    * Conatact details
       
   131    */
       
   132   QVariantMap m_details;
       
   133 	QString m_caption;
       
   134 	 /**
       
   135 	 * Externalization
       
   136 	 */
       
   137 };
       
   138 	/**
       
   139 	 * Externalization
       
   140 	 */
       
   141 	QDataStream &operator<<(QDataStream &, const SmfContact&);
       
   142 	/**
       
   143 	 * Internalization
       
   144 	 */
       
   145 QDataStream &operator>>(QDataStream &, SmfContact&);
       
   146 SMF_GETSERVICES(SmfContact, "org.symbian.smf.client.contact")
       
   147 #endif // SMFPROFILE_H