smf/smfservermodule/smfclient/common/smfactions.h
changeset 14 a469c0e6e7fb
parent 8 4102c67b6e56
equal deleted inserted replaced
13:b5d63d5fc252 14:a469c0e6e7fb
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
     8  *
     8  *
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
    11  *
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  *
    12  * Description:
    15  * Description:
    13  * Represents activities in terms similar to standard activity stream http://activitystrea.ms/
    16  * Represents activities in terms similar to standard activity stream http://activitystrea.ms/
    14  */
    17  */
    15 
    18 
    16 #ifndef SMFACTIONS_H_
    19 #ifndef SMFACTIONS_H_
    24 #include <qdatastream.h>
    27 #include <qdatastream.h>
    25 #include <QSharedData>
    28 #include <QSharedData>
    26 #include <QMetaType>
    29 #include <QMetaType>
    27 
    30 
    28 #include "smfclientglobal.h"
    31 #include "smfclientglobal.h"
    29 
    32 #include "smfpost.h"
       
    33 #include "smfcontact.h"
       
    34 
       
    35 /**
       
    36  * Implementation const
       
    37  */
       
    38 const int MaxSmfActivityEntrySize = 5000;
    30 
    39 
    31 /**
    40 /**
    32  * The actions in the activity based on Atom Activity Base Schema
    41  * The actions in the activity based on Atom Activity Base Schema
    33  * see http://activitystrea.ms/schema/1.0/activity-schema-01.html
    42  * see http://activitystrea.ms/schema/1.0/activity-schema-01.html
    34  */
    43  */
    42 	SmfActivityPlay,
    51 	SmfActivityPlay,
    43 	SmfActivityPost,
    52 	SmfActivityPost,
    44 	SmfActivitySave,
    53 	SmfActivitySave,
    45 	SmfActivityShare,
    54 	SmfActivityShare,
    46 	SmfActivityTag,
    55 	SmfActivityTag,
    47 	SmfActivityUpdate,
    56 	SmfActivityUpdate
    48 	};
    57 	};
    49 
    58 
    50 /**
    59 /**
    51  * The type of the object on which the activity is performed - as per Atom Activity Base Schema
    60  * The type of the object on which the activity is performed - as per Atom Activity Base Schema
    52  * see http://activitystrea.ms/schema/1.0/activity-schema-01.html
    61  * see http://activitystrea.ms/schema/1.0/activity-schema-01.html
    91  */
   100  */
    92 class SMFCLIENT_EXPORT SmfActivityObject 
   101 class SMFCLIENT_EXPORT SmfActivityObject 
    93 	{
   102 	{
    94 public:
   103 public:
    95 	/**
   104 	/**
    96 	 * Constructor with default argument
   105 	 * Constructor
    97 	 */
   106 	 */
    98 	SmfActivityObject();
   107 	SmfActivityObject();
    99 
   108 
   100 	/**
   109 	/**
   101 	 * Copy Constructor
   110 	 * Copy Constructor
   102 	 */
   111 	 */
   103 	SmfActivityObject(const SmfActivityObject& aOther);
   112 	SmfActivityObject(const SmfActivityObject& aOther);
   104 	
   113 	
   105 	/**
   114 	/**
       
   115 	 * Overloaded = operator
       
   116 	 * @param aOther The reference object
       
   117 	 * @return The target reference value
       
   118 	 */
       
   119 	SmfActivityObject& operator=( const SmfActivityObject &aOther );
       
   120 	
       
   121 	/**
   106 	 * Destructor
   122 	 * Destructor
   107 	 */
   123 	 */
   108 	~SmfActivityObject();
   124 	~SmfActivityObject();
   109 
   125 
   110 	/**
   126 	/**
   111 	 * retruns service specific Id of this object in the entry 
   127 	 * @return returns service specific Id of this object in the entry 
   112 	 */
   128 	 */
   113 	QString id() const;
   129 	QString id() const;
   114 	
   130 	
   115 	/**
   131 	/**
   116 	 * returns thumbnail if availabel for this object in the entry
   132 	 * @return returns thumbnail if availabel for this object in the entry
   117 	 */
   133 	 */
   118 	QImage thumbnail() const;
   134 	QImage thumbnail() const;
   119 	
   135 	
   120 	/**
   136 	/**
   121 	 * Captions for this object
   137 	 * @return Captions for this object
   122 	 */
   138 	 */
   123 	QString caption() const;
   139 	QString caption() const;
   124 	
   140 	
   125 	/**
   141 	/**
   126 	 * retruns the type of this object
   142 	 * @return retruns the type of this object
   127 	 */
   143 	 */
   128 	SmfActivityObjectType type() const;
   144 	SmfActivityObjectType type( ) const;
   129 	
   145 	
   130 	/**
   146 	/**
   131 	 * returns data of the object - see type() for casting
   147 	 * @return returns data of the object - see type() for casting
   132 	 */
   148 	 */
   133 	QVariant objData() const;
   149 	QVariant objData() const;
   134 	
   150 	
   135 	/**
   151 	/**
   136 	 * url of this object, e.g. url of the image on which somebody commented
   152 	 * @return url of this object, e.g. url of the image on which somebody commented
   137 	 */
   153 	 */
   138 	QString link() const;
   154 	QString link() const;
   139 	
   155 	
   140 	/**
   156 	/**
   141 	 * Time of creation of this object
   157 	 * @return Time of creation of this object
   142 	 */
   158 	 */
   143 	QDateTime time() const;
   159 	QDateTime time() const;
   144 	
   160 	
   145 	/**
   161 	/**
   146 	 * Description of the content of this object
   162 	 * @return Description of the content of this object
   147 	 */
   163 	 */
   148 	QString content() const;
   164 	QString content() const;
   149 
   165 
   150 	/**
   166 	/**
   151 	 * sets service specific id for this object
   167 	 * Sets service specific id for this object
       
   168 	 * @param aId The id to be set
   152 	 */
   169 	 */
   153 	void setId(const QString& aId);
   170 	void setId(const QString& aId);
   154 	
   171 	
   155 	/**
   172 	/**
   156 	 * sets thumbnail for this object , not mandatory
   173 	 * Sets thumbnail for this object , not mandatory
       
   174 	 * @param aIcon The thumbnail image
   157 	 */
   175 	 */
   158 	void setThumbnail(const QImage& aIcon);
   176 	void setThumbnail(const QImage& aIcon);
   159 	
   177 	
   160 	/**
   178 	/**
   161 	 * sets caption for this object
   179 	 * Sets caption for this object
       
   180 	 * @param aCaption The caption to be set
   162 	 */
   181 	 */
   163 	void setCaption(const QString& aCap);
   182 	void setCaption(const QString& aCap);
   164 	
   183 	
   165 	/**
   184 	/**
   166 	 * sets type of this object - ObjData should be set next accordingly
   185 	 * Sets type of this object - ObjData should be set next accordingly
       
   186 	 * @param aObjType The activity type to be set
   167 	 */
   187 	 */
   168 	void setType(const SmfActivityObjectType& aObjType);
   188 	void setType(const SmfActivityObjectType& aObjType);
   169 	
   189 	
   170 	/**
   190 	/**
   171 	 * sets object data e,g, SmfImage, SmfComment, SmfMusic, SmfEvent etc
   191 	 * Sets object data e,g, SmfImage, SmfComment, SmfMusic, SmfEvent etc
   172 	 * setType() with suitable type should have been called before  
   192 	 * setType() with suitable type should have been called before  
       
   193 	 * @param aData The object data to be set  
   173 	 */
   194 	 */
   174 	void setObjData( const QVariant& aData);
   195 	void setObjData( const QVariant& aData);
   175 	/**
   196 	
   176 	 * sets the url for the object
   197 	/**
       
   198 	 * Sets the url for the object
       
   199 	 * @param aLink The Link to be set
   177 	 */
   200 	 */
   178 	void setLink( const QString& aLink);
   201 	void setLink( const QString& aLink);
   179 	/**
   202 	
   180 	 * sets the time of creation/last modification of the object
   203 	/**
       
   204 	 * Sets the time of creation/last modification of the object
       
   205 	 * @param aTime The time to be set
   181 	 */
   206 	 */
   182 	void setTime( const QDateTime& aTime);
   207 	void setTime( const QDateTime& aTime);
   183 	
   208 	
   184 	/**
   209 	/**
   185 	 * sets the description of the content of this object
   210 	 * Sets the description of the content of this object
       
   211 	 * @param aText The content to be set
   186 	 */
   212 	 */
   187 	void setContent( const QString& aText) ;
   213 	void setContent( const QString& aText) ;
   188 	
   214 	
   189 private:
   215 private:
   190 	QSharedDataPointer<SmfActivityObjectPrivate> d;
   216 	QSharedDataPointer<SmfActivityObjectPrivate> d;
   191 	
   217 	
   192 	friend QDataStream& operator >> ( QDataStream &aOut, const SmfActivityObject& aData);
   218 	friend QDataStream& operator >> ( QDataStream &aOut, SmfActivityObject& aData);
   193 	friend QDataStream& operator << ( QDataStream &aIn, const SmfActivityObject& aData);	
   219 	friend QDataStream& operator << ( QDataStream &aIn, const SmfActivityObject& aData);	
   194 	};
   220 	};
       
   221 
       
   222 SMFCLIENT_EXPORT QDataStream& operator >> ( QDataStream &aOut, SmfActivityObject& aData);
       
   223 SMFCLIENT_EXPORT QDataStream& operator << ( QDataStream &aIn, const SmfActivityObject& aData);	
       
   224 
   195 // Make the class SmfActivityObject known to QMetaType, so that as to register it.
   225 // Make the class SmfActivityObject known to QMetaType, so that as to register it.
   196 Q_DECLARE_METATYPE(SmfActivityObject)
   226 Q_DECLARE_METATYPE(SmfActivityObject)
   197 
       
   198 
   227 
   199 
   228 
   200 
   229 
   201 
   230 
   202 class SmfActivityEntryPrivate;
   231 class SmfActivityEntryPrivate;
   212 	SmfActivityEntry();
   241 	SmfActivityEntry();
   213 	SmfActivityEntry(const SmfActivityEntry& aOther);
   242 	SmfActivityEntry(const SmfActivityEntry& aOther);
   214 	~SmfActivityEntry();
   243 	~SmfActivityEntry();
   215 	
   244 	
   216 	/**
   245 	/**
   217 	 * Returns service specific id of the of entry 
   246 	 * @return Returns service specific id of the of entry 
   218 	 */
   247 	 */
   219 	QString id() const;
   248 	QString id() const;
   220 	/**
   249 	/**
   221 	 * returns the title of the entry - mostly be a string 
   250 	 * @return Returns the title of the entry - mostly be a string 
   222 	 */
   251 	 */
   223 	SmfPost title() const;
   252 	SmfPost title() const;
   224 
   253 
   225 	/**
   254 	/**
   226 	 * returns detail descriptiopn of this entry in the activity list. might be absent if title is sufficient
   255 	 * @return Returns detail descriptiopn of this entry in the activity list. might be absent if title is sufficient
   227 	 */
   256 	 */
   228 	SmfPost details() const;
   257 	SmfPost details() const;
   229 	
   258 	
   230 	/**
   259 	/**
   231 	 * returns the author of the activity - the name and the uri field are most commonly used
   260 	 * @return Returns the author of the activity - the name and the uri field are most commonly used
   232 	 * Other information fields might be empty
   261 	 * Other information fields might be empty
   233 	 */
   262 	 */
   234 	SmfContact author() const;
   263 	SmfContact author() const;
   235 	
   264 	
   236 	/**
   265 	/**
   237 	 * returns the verb of the activity ,e.g. Robin "marked" Joseph as a friend   
   266 	 * @return Returns the verb of the activity ,e.g. Robin "marked" Joseph as a friend   
   238 	 */
   267 	 */
   239 	SmfActivityVerb actionName() const;
   268 	SmfActivityVerb actionName() const;
   240 
   269 
   241 	/**
   270 	/**
   242 	 * There can be multiple objects in a single activity entry, though this may be rare - only for few verbs.
   271 	 * There can be multiple objects in a single activity entry, though this may be rare - only for few verbs.
   243 	 * @return list of activity objects (mostly one object)
   272 	 * @return list of activity objects (mostly one object)
   244 	 */
   273 	 */
   245 	QList<SmfActivityObject> activities() const;
   274 	QList<SmfActivityObject> activities() const;
   246 	
   275 	
   247 	/**
   276 	/**
   248 	 * returns information about the target of the activity, for verbs that support a target.
   277 	 * @return Returns information about the target of the activity, for verbs that support a target.
   249 	 * For example, a target is a photo album to which photos were added
   278 	 * For example, a target is a photo album to which photos were added
   250 	 */
   279 	 */
   251 	SmfActivityObject targetObj() const;
   280 	SmfActivityObject targetObj() const;
   252 
   281 
   253 	/**
   282 	/**
   254 	 * sets service specific id of the of entry 
   283 	 * Sets service specific id of the of entry 
       
   284 	 * @param aId The id to be set
   255 	 */
   285 	 */
   256 	bool setId( const QString& aId);
   286 	bool setId( const QString& aId);
   257 	
   287 	
   258 	/**
   288 	/**
   259 	 * sets the title of the entry - mostly be a string 
   289 	 * Sets the title of the entry - mostly be a string
       
   290 	 * @param aTitle The title to be set 
   260 	 */
   291 	 */
   261 	bool setTitle(const SmfPost& aTitle);
   292 	bool setTitle(const SmfPost& aTitle);
   262 
   293 
   263 	/**
   294 	/**
   264 	 * sets detail descriptiopn of this entry in the activity list. might be absent if title is sufficient
   295 	 * Sets detail description of this entry in the activity list. might be absent if title is sufficient
       
   296 	 * @param aDetails The details to be set
   265 	 */
   297 	 */
   266 	bool setDetails(const SmfPost& aDetails);
   298 	bool setDetails(const SmfPost& aDetails);
   267 	
   299 	
   268 	/**
   300 	/**
   269 	 * sets the author of the activity - the name and the uri field are most commonly used
   301 	 * Sets the author of the activity - the name and the uri field are most commonly used
   270 	 * Other information fields might be empty
   302 	 * Oher information fields might be empty
       
   303 	 * @param aContact The author to be set
   271 	 */
   304 	 */
   272 	bool setAuthor(const SmfContact& aContact);
   305 	bool setAuthor(const SmfContact& aContact);
   273 	
   306 	
   274 	/**
   307 	/**
   275 	 * sets the verb of the activity ,e.g. Robin "marked" Joseph as a friend   
   308 	 * Sets the verb of the activity ,e.g. Robin "marked" Joseph as a friend
       
   309 	 * @param aVerb The action name to be set   
   276 	 */
   310 	 */
   277 	void setActionName(SmfActivityVerb  aVerb);
   311 	void setActionName(SmfActivityVerb  aVerb);
   278 
   312 
   279 	/**
   313 	/**
   280 	 * sets single or multiple objects in a single activity entry, though multiple may be rare - only for few verbs.
   314 	 * Sets single or multiple objects in a single activity entry, though multiple may be rare - only for few verbs.
   281 	 * @param list of activity objects (mostly one object)
   315 	 * @param list of activity objects (mostly one object)
   282 	 */
   316 	 */
   283 	bool setActivities(QList<SmfActivityObject>& aList);
   317 	bool setActivities(QList<SmfActivityObject>& aList);
   284 	
   318 	
   285 	/**
   319 	/**
   286 	 * returns information about the target of the activity, for verbs that support a target.
   320 	 * Returns information about the target of the activity, for verbs that support a target.
   287 	 * For example, a target is a photo album to which photos were added
   321 	 * For example, a target is a photo album to which photos were added
       
   322 	 * @param aTarget The activity object to be set
   288 	 */
   323 	 */
   289 	bool setTargetObj(const SmfActivityObject& aTarget);
   324 	bool setTargetObj(const SmfActivityObject& aTarget);
   290 	
   325 	
   291 private:
   326 private:
   292 	QSharedDataPointer<SmfActivityEntryPrivate> d;
   327 	QSharedDataPointer<SmfActivityEntryPrivate> d;
   293 	
   328 	
   294 	friend QDataStream& operator >> ( QDataStream &aOut, const SmfActivityEntry& aData);
   329 	friend QDataStream& operator >> ( QDataStream &aOut, SmfActivityEntry& aData);
   295 	friend QDataStream& operator << ( QDataStream &aIn, const SmfActivityEntry& aData);	
   330 	friend QDataStream& operator << ( QDataStream &aIn, const SmfActivityEntry& aData);	
   296 	};
   331 	};
       
   332 
       
   333 SMFCLIENT_EXPORT QDataStream& operator >> ( QDataStream &aOut, const SmfActivityEntry& aData);
       
   334 SMFCLIENT_EXPORT QDataStream& operator << ( QDataStream &aIn, const SmfActivityEntry& aData);	
       
   335 
   297 // Make the class SmfActivityEntry known to QMetaType, so that as to register it.
   336 // Make the class SmfActivityEntry known to QMetaType, so that as to register it.
   298 Q_DECLARE_METATYPE(SmfActivityEntry)
   337 Q_DECLARE_METATYPE(SmfActivityEntry)
   299 
   338 
   300 #endif /* SMFACTIONS_H_ */
   339 #endif /* SMFACTIONS_H_ */