example/clientapi/smf/inc/smfclient/smfpostprovider.h
changeset 1 4b1e636e8a71
child 2 86af6c333601
equal deleted inserted replaced
0:5d2360e70d9f 1:4b1e636e8a71
       
     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 "{License}"
       
     6 * which accompanies  this distribution, and is available
       
     7 * at the URL "{LicenseUrl}".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Interface spefication for posting updates to a social site
       
    16 *
       
    17 */
       
    18 #ifndef SMFPOSTPROVIDER_H
       
    19 #define SMFPOSTPROVIDER_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <qmobilityglobal.h>
       
    23 #include <qgeopositioninfo.h>
       
    24 
       
    25 #include "smfprovider.h"
       
    26 #include "smfcontact.h"
       
    27 
       
    28 class SmfProvider; //base-class for service provider
       
    29 class SmfContact; //class for Contact in a social network
       
    30 
       
    31 
       
    32 
       
    33 /**
       
    34  * Location info
       
    35  */
       
    36 typedef QtMobility::QGeoPositionInfo SmfLocationInfo ;
       
    37 class SmfPost; //class for information (text, image and url) contained in post in social network
       
    38 class SmfContactModel;
       
    39 class SmfStatusData;
       
    40 
       
    41 //Post lists
       
    42 typedef QList<SmfPost> SmfPostList;
       
    43 /**
       
    44  * Interface to post scrap/tweet like info.
       
    45  * Note that branding information for the particular service implementation
       
    46  * is available from getProvider() API. See also:
       
    47  * SmfProvider::serviceName(), SmfProvider::serviceIcon(), SmfProvider::description()
       
    48  *
       
    49  * All of the functionality described here should be implemented by a service
       
    50  * specific plug-in object.
       
    51  * Interface name for SmfPostProvider is org.symbian.smf.client.contact.posts
       
    52  */
       
    53 class SMFCLIENT_EXPORT SmfPostProvider : public QObject
       
    54 {
       
    55   Q_OBJECT
       
    56 
       
    57 public:
       
    58   /**
       
    59    * Constructs SmfPostProvider.
       
    60    * @param baseProvider The base provider info
       
    61    * Seeing as this is a plug-in implementation, these will realistically
       
    62    * be generated by SMF factory of some kind
       
    63    */
       
    64   SmfPostProvider(SmfProvider* baseProvider = 0);
       
    65   ~SmfPostProvider();
       
    66 
       
    67   /**
       
    68    *  Presence info of the user
       
    69    */
       
    70 enum SmfPresenceInfo
       
    71 	{
       
    72 	  ENotSupported,
       
    73 	  EOnline,
       
    74 	  EOffline,
       
    75 	  EBusy,
       
    76 	  EDoNotDisturb,
       
    77 	  EAppearOffline,
       
    78 	  EOther
       
    79 	};
       
    80 
       
    81 public:
       
    82   /**
       
    83    * Gets the posts asynchronously. The signal postsAvailable()with SmfPostList is emitted
       
    84    * once the post lists are available
       
    85    * @see postsAvailable()
       
    86    */
       
    87   virtual void getPosts(SmfStatusData statusData) = 0; 
       
    88   
       
    89   /**
       
    90    * Gets the model
       
    91    */
       
    92   virtual SmfContactModel   model() = 0; 
       
    93 
       
    94 public slots:
       
    95 
       
    96 	/**
       
    97 	 * Updates a post, the success of the post can be checked with signal
       
    98 	 * updatePostFinished() signal
       
    99 	 * @param postData data to be posted
       
   100 	 * @param location location data
       
   101 	 */
       
   102   virtual void updatePost(SmfPost& postData,SmfLocationInfo& location) = 0; // list of contact objects
       
   103 	/**
       
   104 	 * Updates a post, the success of the post can be checked with signal
       
   105 	 * updatePostFinished() signal
       
   106 	 * @param postData data to be posted
       
   107 	 * @param location location data
       
   108 	 */
       
   109   virtual void updatePost(SmfPost& postData) = 0; // list of contact objects
       
   110   
       
   111   /**
       
   112    * Updates a post to a particular Smf contact. the success of the post can be checked with signal
       
   113    * updatePostFinished() signal.
       
   114    * @param postData data to be posted
       
   115    * @param contact contact to which the post is to be directed
       
   116    * @param location location data
       
   117    */
       
   118   virtual void updatePostDirected(SmfPost& postData,SmfContact& contact,SmfLocationInfo location) = 0; // list of contact objects
       
   119   
       
   120   /**
       
   121    * Posts appearance info of the user.
       
   122    * @param appearence user appearance
       
   123    * @see SmfPresenceInfo
       
   124    */
       
   125   virtual QList<SmfContact> postAppearence(SmfPresenceInfo appearence) = 0; // appear offline, busy, do-not-disturb
       
   126   
       
   127   //APIs to get/set base provider info (SmfProvider)
       
   128   
       
   129   /**
       
   130    * Gets the base provider info
       
   131    */
       
   132   virtual SmfProvider* getProvider() = 0;
       
   133   
       
   134   /**
       
   135    * Sets the base provider info
       
   136    */
       
   137   virtual void setProvider(SmfProvider* provider) = 0;
       
   138 
       
   139   Q_SIGNALS:
       
   140 
       
   141 	/**
       
   142 	 * Emitted when a request to  getPosts() is finished
       
   143 	 * Note if number of posts is large, then it can download the list page by page
       
   144 	 * In that case this signal is emitted multiple times.
       
   145 	 * @param list list of posts
       
   146 	 * @param error error string
       
   147 	 * @param pageNumber Page number
       
   148 	 */
       
   149 	void postsAvailable(SmfPostList* list, QString error, int pageNumber=0);
       
   150 	
       
   151 	/**
       
   152 	 * Emitted when update post is finished.
       
   153 	 * @param success the success of the update
       
   154 	 */
       
   155 	void updatePostFinished(bool success);
       
   156 
       
   157 private:
       
   158   SmfProvider* m_baseProvider;
       
   159 };
       
   160 
       
   161 SMF_GETSERVICES(SmfPostProvider, "org.symbian.smf.client.contact.posts\0.2")
       
   162 #endif // SMFPOSTPROVIDER_H