smf/inc/common/smfcontacts/smfcontact.h
changeset 3 0446eb7b28aa
child 5 edb9dc8273d9
equal deleted inserted replaced
2:86af6c333601 3:0446eb7b28aa
       
     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 "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  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * The contact class represents a social contact
       
    17  * Note: This class has dependencies on QtMobility project
       
    18  *
       
    19  */
       
    20 
       
    21 #ifndef SMFCONTACT_H_
       
    22 #define SMFCONTACT_H_
       
    23 
       
    24 #include "qtcontacts.h"
       
    25 #include <qdatastream.h>
       
    26 #include <QSharedData>
       
    27 #include <smfclientglobal.h>
       
    28 
       
    29 using namespace QtMobility;
       
    30 
       
    31 class SmfContactPrivate;
       
    32 
       
    33 /**
       
    34  * @ingroup smf_common_group
       
    35  * The contact class represents a social contact
       
    36  * 
       
    37  * Note: This class has dependencies on QtMobility project
       
    38  */
       
    39 class SMFCLIENT_EXPORT SmfContact : public QObject
       
    40 	{
       
    41 	Q_OBJECT
       
    42 
       
    43 public:
       
    44 	/**
       
    45 	 * Constructor with default argument
       
    46 	 * @param aParent The parent object
       
    47 	 */
       
    48 	SmfContact( QObject *aParent = 0 );
       
    49 	
       
    50 	/**
       
    51 	 * Copy Constructor
       
    52 	 * @param aOther The reference object
       
    53 	 */
       
    54 	SmfContact( const SmfContact &aOther );
       
    55 	
       
    56 	/**
       
    57 	 * Destructor
       
    58 	 */
       
    59 	~SmfContact( );
       
    60 	
       
    61 public slots:
       
    62 	/**
       
    63 	 * Method to get the available sub fields for contacts.
       
    64 	 * The following are the available sub types of a contact
       
    65 	 *   QtMobility::QContactAddress		Address;
       
    66 	 *   QtMobility::QContactAnniversary	Anniversary;
       
    67 	 *   QtMobility::QContactAvatar			Avatar;
       
    68 	 *   QtMobility::QContactBirthday		Birthday;
       
    69 	 *   QtMobility::QContactId				ContactId;
       
    70 	 *   QtMobility::QContactEmailAddress	EmailAddress;
       
    71 	 *   QtMobility::QContactGender			Gender;
       
    72 	 *   QtMobility::QContactGeolocation	Geolocation;
       
    73 	 *   QtMobility::QContactGuid			Guid;
       
    74 	 *   QtMobility::QContactName			Name;
       
    75 	 *   QtMobility::QContactNickname		Nickname;
       
    76 	 *   QtMobility::QContactNote			Note;
       
    77 	 *   QtMobility::QContactOnlineAccount	OnlineAccount;
       
    78 	 *   QtMobility::QContactOrganization	Organization;
       
    79 	 *   QtMobility::QContactPhoneNumber	PhoneNumber;
       
    80 	 *   QtMobility::QContactTimestamp		Timestamp;
       
    81 	 *   QtMobility::QContactType			Type;
       
    82 	 *   QtMobility::QContactUrl			Url;
       
    83 	 * @return The Available sub fields for this contact
       
    84 	 */
       
    85 	QStringList subTypes( ) const;
       
    86 	
       
    87 	/**
       
    88 	 * Method to convert an SmfContact to a QContact
       
    89 	 * Changes made to the returned QContact will not be reflected 
       
    90 	 * in its parent SmfContact object
       
    91 	 * @param aContact QContact corresponding to SmfContact 
       
    92 	 */
       
    93 	void convert( QContact &aContact ) const;
       
    94 	
       
    95 	/**
       
    96 	 * Method to get the value of a sub field for this contact
       
    97 	 * @param aSubType The sub field type 
       
    98 	 * @return The value of the sub field subType
       
    99 	 * @see subTypes()
       
   100 	 */
       
   101 	QVariant value( const QString& aSubType ) const;
       
   102 	
       
   103 private:
       
   104 	QSharedDataPointer<SmfContactPrivate> d;
       
   105 	
       
   106 	friend QDataStream &operator<<( QDataStream &aDataStream, 
       
   107 			const SmfContact &aContact );
       
   108 
       
   109 	friend QDataStream &operator>>( QDataStream &aDataStream, 
       
   110 			SmfContact &aContact );
       
   111 	
       
   112 	};
       
   113 
       
   114 
       
   115 /**
       
   116  * Method for Externalization. Writes the SmfContact object to 
       
   117  * the stream and returns a reference to the stream.
       
   118  * @param aDataStream Stream to be written
       
   119  * @param aContact The SmfContact object to be externalized
       
   120  * @return reference to the written stream
       
   121  */
       
   122 QDataStream &operator<<( QDataStream &aDataStream, 
       
   123 		const SmfContact &aContact );
       
   124 
       
   125 /**
       
   126  * Method for Internalization. Reads a SmfContact object from 
       
   127  * the stream and returns a reference to the stream.
       
   128  * @param aDataStream Stream to be read
       
   129  * @param aContact The SmfContact object to be internalized
       
   130  * @return reference to the stream
       
   131  */
       
   132 QDataStream &operator>>( QDataStream &aDataStream, 
       
   133 		SmfContact &aContact );
       
   134 
       
   135 // Make the class SmfContact known to QMetaType, so that as to register it.
       
   136 Q_DECLARE_METATYPE(SmfContact)
       
   137 
       
   138 #endif /* SMFCONTACT_H_ */