smf/smfservermodule/smfclient/common/smfpost.h
changeset 7 be09cf1f39dd
equal deleted inserted replaced
6:c39a6cfd1fb9 7:be09cf1f39dd
       
     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 post class represents an instance of a post to a SN site
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFPOST_H_
       
    21 #define SMFPOST_H_
       
    22 
       
    23 #include <QImage>
       
    24 #include <QUrl>
       
    25 #include <qdatastream.h>
       
    26 #include <QMetaType>
       
    27 #include <QSharedData>
       
    28 #include <QTextDocument>
       
    29 #include <smfclientglobal.h>
       
    30 
       
    31 #include "smfpost_p.h"
       
    32 
       
    33 /**
       
    34  *  Presence info of the user
       
    35  */
       
    36 enum SmfAppearenceInfo
       
    37 	{
       
    38 	EAppearanceNotSupported,
       
    39 	EOnline,
       
    40 	EOffline,
       
    41 	EBusy,
       
    42 	EDoNotDisturb,
       
    43 	EAppearOffline,
       
    44 	EOther
       
    45 	};
       
    46 //To sort out conflict betwn client and PM, later should be removed
       
    47 typedef SmfAppearenceInfo SmfPresenceInfo;
       
    48 /**
       
    49  * @ingroup smf_common_group
       
    50  * The post class represents an instance of a post to a SN site
       
    51  */
       
    52 class SMFCLIENT_EXPORT SmfPost //: public QTextDocument
       
    53 	{
       
    54 public:
       
    55 	/**
       
    56 	 * Constructor with default argument
       
    57 	 * @param text Text
       
    58 	 */
       
    59 	SmfPost( );
       
    60 	
       
    61 	/**
       
    62 	 * Constructor
       
    63 	 * @param aText The post's text
       
    64 	 * @param aImage The post's image
       
    65 	 * @param aUrl The post's url
       
    66 	 */
       
    67 	SmfPost( QString aTitle, QString aDesc, QImage aImage, QUrl aUrl );
       
    68 
       
    69 	/**
       
    70 	 * Copy Constructor
       
    71 	 * @param aOther The reference object
       
    72 	 */
       
    73 	SmfPost( const SmfPost &aOther );
       
    74 	
       
    75 	/**
       
    76 	 * Overloaded = operator
       
    77 	 * @param aOther The reference object
       
    78 	 * @return The target reference value
       
    79 	 */
       
    80 	SmfPost& operator=( const SmfPost &aOther );
       
    81 	
       
    82 	/**
       
    83 	 * Destructor
       
    84 	 */
       
    85 	~SmfPost( );
       
    86 	
       
    87 	/**
       
    88 	 * Method to get the title of the post
       
    89 	 * @return The post's title
       
    90 	 */
       
    91 	QString title( ) const;
       
    92 	
       
    93 	/**
       
    94 	 * Method to get the description of the post
       
    95 	 * @return The post's description
       
    96 	 */
       
    97 	QString description( ) const;
       
    98 	
       
    99 	/**
       
   100 	 * Method to get the image of the post
       
   101 	 * @return The post's image
       
   102 	 */
       
   103 	QImage image( ) const;
       
   104 	
       
   105 	/**
       
   106 	 * Method to get the url of the post
       
   107 	 * @return The post's url
       
   108 	 */
       
   109 	QUrl url( ) const;
       
   110 	
       
   111 	/**
       
   112 	 * Method to get the id of the post
       
   113 	 * @return The ID value 
       
   114 	 */
       
   115 	QString id( ) const;
       
   116 	
       
   117 	/**
       
   118 	 * Method to set the title of the post
       
   119 	 * @param aTitle The post's new title
       
   120 	 */
       
   121 	void setTitle( const QString &aTitle );
       
   122 	
       
   123 	/**
       
   124 	 * Method to set the description of the post
       
   125 	 * @param aDesc The post's new description
       
   126 	 */
       
   127 	void setDescription( const QString &aDesc );
       
   128 	
       
   129 	/**
       
   130 	 * Method to set the image of the post
       
   131 	 * @param aPic The post's image
       
   132 	 */
       
   133 	void setImage( const QImage& aPic );
       
   134 	
       
   135 	/**
       
   136 	 * Method to set the url of the post
       
   137 	 * @param aUrl The post's url
       
   138 	 */
       
   139 	void setUrl( QUrl& aUrl );
       
   140 	/**
       
   141 	 * Method to get the id of the post
       
   142 	 */
       
   143 	void setId(QString aPostId);
       
   144 	
       
   145 private:
       
   146 	QSharedDataPointer<SmfPostPrivate> d;
       
   147 
       
   148 	friend QDataStream &operator<<( QDataStream &aDataStream, 
       
   149 			const SmfPost &aPost );
       
   150 
       
   151 	friend QDataStream &operator>>( QDataStream &aDataStream, 
       
   152 			SmfPost &aPost );
       
   153 	
       
   154 	};
       
   155 
       
   156 
       
   157 /**
       
   158  * Method for Externalization. Writes the SmfPost object to 
       
   159  * the stream and returns a reference to the stream.
       
   160  * @param aDataStream Stream to be written
       
   161  * @param aPost The SmfPost object to be externalized
       
   162  * @return reference to the written stream
       
   163  */
       
   164 SMFCLIENT_EXPORT QDataStream &operator<<( QDataStream &aDataStream, 
       
   165 		const SmfPost &aPost );
       
   166 
       
   167 /**
       
   168  * Method for Internalization. Reads a SmfPost object from 
       
   169  * the stream and returns a reference to the stream.
       
   170  * @param aDataStream Stream to be read
       
   171  * @param aPost The SmfPost object to be internalized
       
   172  * @return reference to the stream
       
   173  */
       
   174 SMFCLIENT_EXPORT QDataStream &operator>>( QDataStream &aDataStream, 
       
   175 		SmfPost &aPost);
       
   176 
       
   177 typedef QList<SmfPost> SmfPostList;
       
   178 
       
   179 // Make the class SmfPost known to QMetaType, so that as to register it.
       
   180 Q_DECLARE_METATYPE(SmfPost)
       
   181 Q_DECLARE_METATYPE(QList<SmfPost>)
       
   182 
       
   183 #endif /* SMFPOST_H_ */