smf/smfservermodule/smfclient/client/smfpostprovider_p.h
changeset 18 013a02bf2bb0
parent 17 106a4bfcb866
child 19 c412f0526c34
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
     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  * 
       
    17  *
       
    18  */
       
    19 #ifndef SMFPOSTPROVIDER_P_H_
       
    20 #define SMFPOSTPROVIDER_P_H_
       
    21 
       
    22 #include "smfprovider.h"
       
    23 #include "SmfClientGlobal.h"
       
    24 #include "smfGlobal.h"
       
    25 #include "SmfObserver.h"
       
    26 
       
    27 class SmfProvider;
       
    28 class SmfPostProvider;
       
    29 
       
    30 #include <QObject>
       
    31 #include <QDateTime>
       
    32 #include <QStringList>
       
    33 
       
    34 #include "smfobserver.h"
       
    35 #include "smfpostprovider.h"
       
    36 #ifdef Q_OS_SYMBIAN
       
    37 class CSmfClientSymbian;
       
    38 #else
       
    39 class SmfClientQt;
       
    40 #endif
       
    41 
       
    42 /**
       
    43  * Data size limits
       
    44  */
       
    45 /**
       
    46  * Single Post-1 MB
       
    47  */
       
    48 const int KSmfPostMaxSize = 1000000;
       
    49 /**
       
    50  * Private Qt wrapper
       
    51  * Provided to accomodate diff facilities in diff platforms.
       
    52  * Uses Symbian client-server for Symbian
       
    53  * QDbus for linux
       
    54  * QLocalserver for rest of the platforms
       
    55  * Note:- only symbian client-server impl is provided at the moment
       
    56  **/
       
    57 class SmfPostProviderPrivate: public smfObserver
       
    58 	{
       
    59 	Q_OBJECT
       
    60 
       
    61 public:
       
    62 
       
    63 	SmfPostProviderPrivate(SmfPostProvider* postProvider=0);
       
    64 	~SmfPostProviderPrivate();
       
    65 	/**
       
    66 	 * From smfobserver
       
    67 	 */
       
    68 	  void resultsAvailable(QByteArray result,SmfRequestTypeID opcode,SmfError error);
       
    69 	/**
       
    70 	 * Gets the posts asynchronously. The signal postsAvailable()with SmfPostList is emitted
       
    71 	 * once the post lists are available
       
    72 	 * @param user user's contact in this SP, omit for self contact
       
    73 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    74      * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE 
       
    75 	 * @see postsAvailable()
       
    76 	 */
       
    77 	void posts(SmfContact* user = 0,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
       
    78 	
       
    79 	/**
       
    80 	 * Updates a post to own area, the success of the post can be checked with signal
       
    81 	 * updatePostFinished() signal
       
    82 	 * @param postData data to be posted
       
    83 	 * @param location location data
       
    84 	 */
       
    85 	void post(SmfPost& postData,SmfLocation& location) ; 
       
    86 	/**
       
    87 	 * Updates the last post to own area with new data, the success of the post can be checked with signal
       
    88 	 * updatePostFinished() signal
       
    89 	 * @param postData edited/new data to be posted
       
    90 	 * @param location location data
       
    91 	 */
       
    92 	void updatePost(SmfPost& postData); 
       
    93 	
       
    94 	/**
       
    95 	 * Updates a post to a particular Smf contact. the success of the post can be checked with signal
       
    96 	 * updatePostFinished() signal.
       
    97 	 * @param postData data to be posted
       
    98 	 * @param contact contact to which the post is to be directed
       
    99 	 * @param location location data
       
   100 	 */
       
   101 	void postDirected(SmfPost& postData,SmfContact& contact,SmfLocation* location=0);
       
   102 	
       
   103 	/**
       
   104 	 * Posts appearance info of the user.e.g. appear offline, busy, do-not-disturb
       
   105 	 * @param appearence user appearance
       
   106 	 * @see SmfPresenceInfo
       
   107 	 * @return False on Failure/Not supported 
       
   108 	 */
       
   109 	bool postAppearence(SmfAppearenceInfo appearence); 
       
   110 	/**
       
   111 	 * Share /a contact's post to user's friends and followers (e.g. retweet in twitter, share on facebook)
       
   112 	 * emits updatePostFinished() signal when done.
       
   113 	 * @param postData data to be posted
       
   114 	 * @param contact contact to which the post belonged
       
   115 	 * @param bool whether user changed items within the post
       
   116 	 */
       
   117 	void sharePost(SmfPost& postData,SmfContact& contact,bool edited);
       
   118 
       
   119 	private:
       
   120 	  SmfProvider* m_baseProvider;
       
   121 	  //serialized byte array of provider+other info to be sent to the server
       
   122 	  //The order:- SmfProvider then params in order of their appearance in fn
       
   123 	  QByteArray m_serializedDataToServer;
       
   124 	  //serialized xtra info, order of serialization follows order of param
       
   125 	  QByteArray m_xtraInfoSerialized;
       
   126 	#ifdef Q_OS_SYMBIAN
       
   127 	  CSmfClientSymbian* m_SmfClientPrivate;
       
   128 	  friend class CSmfClientSymbian;
       
   129 	#else
       
   130 	  SmfClientQt* m_SmfClientPrivate;
       
   131 	  friend class SmfClientQt;
       
   132 	#endif
       
   133 	  bool m_connected;
       
   134 	  int m_xtraInfoFlag;
       
   135 	  int m_pageInfoFlag;
       
   136 	  SmfPostProvider* m_postProvider;
       
   137 	  SmfPostList* m_postList;
       
   138 	 void writeLog(QString log) const;
       
   139 	private:
       
   140 	 QString intfName;
       
   141 	};
       
   142 #endif /* SMFPOSTPROVIDER_P_H_ */