--- a/example/clientapi/smf/inc/common/smfcontacts/smfcontact.h Thu Mar 25 14:44:08 2010 +0530
+++ b/example/clientapi/smf/inc/common/smfcontacts/smfcontact.h Tue Apr 06 16:35:37 2010 +0530
@@ -1,147 +1,135 @@
-/**************************************************************************************************
-* Copyright (c) 2010 Sasken Communication Technologies Ltd.
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the "{License}"
-* which accompanies this distribution, and is available
-* at the URL "{LicenseUrl}".
-*
-* Initial Contributors:
-* Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
-*
-* Contributors:
-* Manasij Roy
-* Description:
-* Interface spefication for profile of a contact in a social networking site
-*
-/*************************************************************************************************/
+/**
+ * Copyright (c) 2010 Sasken Communication Technologies Ltd.
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the "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:
+ * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
+ *
+ * Contributors:
+ * Manasij Roy, Nalina Hariharan
+ *
+ * Description:
+ * The contact class represents a social contact
+ * Note: This class has dependencies on QtMobility project
+ *
+ */
-#ifndef SMFPROFILE_H
-#define SMFPROFILE_H
+#ifndef SMFCONTACT_H_
+#define SMFCONTACT_H_
-#include <QObject>
-
-//From Qt mobility project
#include "qtcontacts.h"
-#include "../common/SmfClientGlobal.h"
-#include "smfprovider.h"
+#include <qdatastream.h>
+#include <QSharedData>
+#include <smfclientglobal.h>
+
+using namespace QtMobility;
+
+class SmfContactPrivate;
+
/**
- * Interface for a contact from a service provider. This class
- * provides basic functionality to allow applications to obtain details of a
- * contact (self or friends) in a social networking service.
+ * @ingroup smf_common_group
+ * The contact class represents a social contact
*
- * All of the functionality described here should be implemented by a service
- * specific plug-in object.
- * Note this class has dependencies on QtMobility project
+ * Note: This class has dependencies on QtMobility project
*/
class SMFCLIENT_EXPORT SmfContact : public QObject
-{
- Q_OBJECT
+ {
+ Q_OBJECT
public:
- /**
- * Constructs SmfContact with base provider info
- * Seeing as this is a plug-in implementation, these will realistically
- * be generated by SMF factory of some kind
- */
- SmfContact(SmfProvider* baseProvider = 0);
- ~SmfContact();
+ /**
+ * Constructor with default argument
+ * @param aParent The parent object
+ */
+ SmfContact( QObject *aParent = 0 );
+
+ /**
+ * Copy Constructor
+ * @param aOther The reference object
+ */
+ SmfContact( const SmfContact &aOther );
+
+ /**
+ * Destructor
+ */
+ ~SmfContact( );
+
+public slots:
+ /**
+ * Method to get the available sub fields for contacts.
+ * The following are the available sub types of a contact
+ * QtMobility::QContactAddress Address;
+ * QtMobility::QContactAnniversary Anniversary;
+ * QtMobility::QContactAvatar Avatar;
+ * QtMobility::QContactBirthday Birthday;
+ * QtMobility::QContactId ContactId;
+ * QtMobility::QContactEmailAddress EmailAddress;
+ * QtMobility::QContactGender Gender;
+ * QtMobility::QContactGeolocation Geolocation;
+ * QtMobility::QContactGuid Guid;
+ * QtMobility::QContactName Name;
+ * QtMobility::QContactNickname Nickname;
+ * QtMobility::QContactNote Note;
+ * QtMobility::QContactOnlineAccount OnlineAccount;
+ * QtMobility::QContactOrganization Organization;
+ * QtMobility::QContactPhoneNumber PhoneNumber;
+ * QtMobility::QContactTimestamp Timestamp;
+ * QtMobility::QContactType Type;
+ * QtMobility::QContactUrl Url;
+ * @return The Available sub fields for this contact
+ */
+ QStringList subTypes( ) const;
+
+ /**
+ * Method to convert an SmfContact to a QContact
+ * Changes made to the returned QContact will not be reflected
+ * in its parent SmfContact object
+ * @param aContact QContact corresponding to SmfContact
+ */
+ void convert( QContact &aContact ) const;
+
+ /**
+ * Method to get the value of a sub field for this contact
+ * @param aSubType The sub field type
+ * @return The value of the sub field subType
+ * @see subTypes()
+ */
+ QVariant value( const QString& aSubType ) const;
+
+private:
+ QSharedDataPointer<SmfContactPrivate> d;
+
+ friend QDataStream &operator<<( QDataStream &aDataStream,
+ const SmfContact &aContact );
+
+ friend QDataStream &operator>>( QDataStream &aDataStream,
+ SmfContact &aContact );
+
+ };
- /**
- * Returns the available sub fields for contacts.
- * The following subtypes are available,-
- * QString userIdInProvider;
- * QtMobility::QContactAddress Adress;
- * QtMobility::QContactAnniversary Anniversary;
- * QtMobility::QContactAvatar Avatar;
- * QtMobility::QContactBirthday Birthday;
- * QtMobility::QContactEmailAddress EmailAddress;
- * QtMobility::QContactGender Gender;
- * QtMobility::QContactGeolocation Geolocation;
- * QtMobility::QContactGuid Guid;
- * QtMobility::QContactName Name;
- * QtMobility::QContactNickname Nickname;
- * QtMobility::QContactNote Note;
- * QtMobility::QContactOnlineAccount OnlineAccount;
- * QtMobility::QContactOrganization Organization;
- * QtMobility::QContactPhoneNumber PhoneNumber;
- * QtMobility::QContactTimestamp Timestamp;
- * QtMobility::QContactType Type;
- * QtMobility::QContactUrl Url;
- */
- virtual QStringList subTypes() const;
-
- //APIs to get base provider info (SmfProvider)
-
- /**
- * Gets the base provider info, note setting the provider is not permitted here
- */
- virtual SmfProvider* getProvider() = 0;
-
-public slots:
+/**
+ * Method for Externalization. Writes the SmfContact object to
+ * the stream and returns a reference to the stream.
+ * @param aDataStream Stream to be written
+ * @param aContact The SmfContact object to be externalized
+ * @return reference to the written stream
+ */
+QDataStream &operator<<( QDataStream &aDataStream,
+ const SmfContact &aContact );
/**
- * Gets value of the sub field for any contact.
- * @param subType sub field type
- * @param info value of the sub field subType
- * @see subTypes()
- * The following subtypes are available,-
- * QString userIdInProvider;
- * QtMobility::QContactAddress Adress;
- * QtMobility::QContactAnniversary Anniversary;
- * QtMobility::QContactAvatar Avatar;
- * QtMobility::QContactBirthday Birthday;
- * QtMobility::QContactEmailAddress EmailAddress;
- * QtMobility::QContactGender Gender;
- * QtMobility::QContactGeolocation Geolocation;
- * QtMobility::QContactGuid Guid;
- * QtMobility::QContactName Name;
- * QtMobility::QContactNickname Nickname;
- * QtMobility::QContactNote Note;
- * QtMobility::QContactOnlineAccount OnlineAccount;
- * QtMobility::QContactOrganization Organization;
- * QtMobility::QContactPhoneNumber PhoneNumber;
- * QtMobility::QContactTimestamp Timestamp;
- * QtMobility::QContactType Type;
- * QtMobility::QContactUrl Url;
+ * Method for Internalization. Reads a SmfContact object from
+ * the stream and returns a reference to the stream.
+ * @param aDataStream Stream to be read
+ * @param aContact The SmfContact object to be internalized
+ * @return reference to the stream
*/
- virtual void value(const QString& subType,const QVariant& info); //for any contact
-
- /**
- * Sets the value of the sub field for self contact
- * @param key sub field type
- * @param value value to be set for sub field key
- * @return success of the set
- * @see subTypes()
- */
- virtual bool setValue( const QString & key, const QVariant & value );//for self contact only
-
-
-signals:
-/**
- * Emitted when value of self contact changes.
- * @param key the key which is changed
- */
- void detailsUpdated(const QString& key); //for setvalue on self contact
-
-private:
- /**
- * Conatact details
- */
- QVariantMap m_details;
- QString m_caption;
- /**
- * Externalization
- */
-};
- /**
- * Externalization
- */
- QDataStream &operator<<(QDataStream &, const SmfContact&);
- /**
- * Internalization
- */
-QDataStream &operator>>(QDataStream &, SmfContact&);
-SMF_GETSERVICES(SmfContact, "org.symbian.smf.client.contact")
-#endif // SMFPROFILE_H
+QDataStream &operator>>( QDataStream &aDataStream,
+ SmfContact &aContact );
+
+#endif /* SMFCONTACT_H_ */