example/clientapi/smf/inc/smfplugins/smfcontacts/smfpostproviderplugin.h
changeset 2 86af6c333601
parent 1 4b1e636e8a71
equal deleted inserted replaced
1:4b1e636e8a71 2:86af6c333601
     6  * @section LICENSE
     6  * @section LICENSE
     7  *
     7  *
     8  * Copyright (c) 2010 Sasken Communication Technologies Ltd. 
     8  * Copyright (c) 2010 Sasken Communication Technologies Ltd. 
     9  * All rights reserved.
     9  * All rights reserved.
    10  * This component and the accompanying materials are made available 
    10  * This component and the accompanying materials are made available 
    11  * under the terms of the "{License}" 
    11  * under the terms of the "Eclipse Public License v1.0"
    12  * which accompanies  this distribution, and is available 
    12  * which accompanies  this distribution, and is available 
    13  * at the URL "{LicenseUrl}".
    13  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
    14  * 
    14  * 
    15  * @section DESCRIPTION
    15  * @section DESCRIPTION
    16  *
    16  *
    17  * Interface specification for getting/posting updates to a social site
    17  * Interface specification for getting/posting updates to a social site
    18  */
    18  */
    19 
    19 
    20 #ifndef SMFPOSTPROVIDERPLUGIN_H_
    20 #ifndef SMFPOSTPROVIDERPLUGIN_H_
    21 #define SMFPOSTPROVIDERPLUGIN_H_
    21 #define SMFPOSTPROVIDERPLUGIN_H_
    22 
    22 
    23 #include <smfproviderbase.h>
    23 #include <smfpluginbase.h>
    24 #include <smfcontact.h>
    24 #include <smfcontact.h>
    25 #include <smfpost.h>
    25 #include <smfpost.h>
    26 #include <smfstatusdata.h>
    26 #include <smfplace.h>
    27 
       
    28 
    27 
    29 /**
    28 /**
    30  * SmfPresenceInfo.
    29  * SmfPresenceInfo.
    31  * Indicates the presence information of user like Online, Offline, Busy, 
    30  * Indicates the presence information of user like Online, Offline, Busy, 
    32  * Do no disturb, Appear Offline etc.
    31  * Do no disturb, Appear Offline etc.
    41 	  EAppearOffline,
    40 	  EAppearOffline,
    42 	  EOther
    41 	  EOther
    43 	};
    42 	};
    44 
    43 
    45 /**
    44 /**
       
    45  * @ingroup smf_plugin_group
    46  * Interface to get/update the posts to a service provider. This class
    46  * Interface to get/update the posts to a service provider. This class
    47  * provides basic functionality to allow applications to obtain list of
    47  * provides basic functionality to allow applications to obtain list of
    48  * posts, updates posts or change the presence information to a social 
    48  * posts, updates posts or change the presence information to a social 
    49  * networking service.
    49  * networking service.
    50  *
    50  *
    51  * All of the functionality described here should be implemented by a service
    51  * All of the functionality described here should be implemented by a service
    52  * specific plug-in.
    52  * specific plug-in.
    53  */
    53  */
    54 class SmfPostProviderPlugin : public QObject
    54 class SmfPostProviderPlugin : public SmfPluginBase
    55 	{
    55 	{
    56 	Q_OBJECT
    56 	Q_OBJECT
    57 public:
    57 public:
    58 	/**
    58 	/**
    59 	 * Constructor with default argument
    59 	 * Constructor with default argument
    65 	 * Destructor
    65 	 * Destructor
    66 	 */
    66 	 */
    67 	~SmfPostProviderPlugin( );
    67 	~SmfPostProviderPlugin( );
    68 	
    68 	
    69 	/**
    69 	/**
    70 	 * Method to get the provider information
    70 	 * Method that returns maximum no of chars (unicode) that service 
    71 	 * @return Instance of SmfProviderBase
    71 	 * provider can post without truncation. Negative value means 
       
    72 	 * no limit
       
    73 	 * @return Max characters that can be posted without truncation
    72 	 */
    74 	 */
    73 	virtual SmfProviderBase* getProviderInfo( ) = 0;
    75 	virtual qint32 maxCharsInPost( ) const = 0;
       
    76 	/**
       
    77 	 * Method that returns maximum no of items that can be returned 
       
    78 	 * in a single query to getPosts. Negative value means feature 
       
    79 	 * not supported.
       
    80 	 * @return Max items that can be returned in a single query
       
    81 	 */
       
    82 	virtual qint32 maxItems( ) const = 0;
       
    83 
       
    84 	/**
       
    85 	 * <Method that returns all the formatting of posts that this 
       
    86 	 * service provider supports. May return 0 items to mean 
       
    87 	 * only QString is supported.
       
    88 	 * @return Supported formats of posts
       
    89 	 */
       
    90 	virtual QVector<QTextFormat> supportedFormats ( ) const = 0;
       
    91 	
       
    92 	/**
       
    93 	 * Method that returns whether this SP supports Appearence
       
    94 	 * @return Returns true if Appearance is supported, else false. 
       
    95 	 * @see SmfAppearenceInfo
       
    96 	 */
       
    97 	virtual bool supportsAppearence ( ) const = 0;
    74 	
    98 	
    75 	/**
    99 	/**
    76 	 * Method to get the latest posts
   100 	 * Method to get the latest posts
    77 	 * @param aStatusData
       
    78 	 * @param aRequest [out] The request data to be sent to network
   101 	 * @param aRequest [out] The request data to be sent to network
       
   102 	 * @param aUser The user's contact in this SP, omit for self contact
    79 	 * @param aPageNum The page to be extracted
   103 	 * @param aPageNum The page to be extracted
    80 	 * @param aItemsPerPage Number of items per page
   104 	 * @param aItemsPerPage Number of items per page
    81 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
   105 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
    82 	 */
   106 	 */
    83 	virtual SmfPluginError getPosts( const SmfStatusData aStatusData,
   107 	virtual SmfPluginError retrieve( SmfPluginRequestData *aRequest,
    84 			SmfPluginRequestData *aRequest,
   108 			const SmfContact* aUser = 0,
    85 			const int aPageNum = 0, 
   109 			const int aPageNum = SMF_FIRST_PAGE, 
    86 			const int aItemsPerPage = 10 ) = 0;
   110 			const int aItemsPerPage = SMF_ITEMS_PER_PAGE ) = 0;
    87 
   111 
       
   112 	
    88 	/**
   113 	/**
    89 	 * Method to update a post
   114 	 * Method to update a post to own area.
       
   115 	 * @param aRequest [out] The request data to be sent to network
    90 	 * @param aPostData The post data to be posted
   116 	 * @param aPostData The post data to be posted
    91 	 * @param aLocation The location
   117 	 * @param aLocation The location
    92 	 * @param aRequest [out] The request data to be sent to network
       
    93 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
   118 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
    94 	 */
   119 	 */
    95 	virtual SmfPluginError updatePost( const SmfPost aPostData, 
   120 	virtual SmfPluginError post( SmfPluginRequestData *aRequest,
    96 			const QtMobility::QContactGeolocation aLocation,
   121 			const SmfPost aPostData, 
    97 			SmfPluginRequestData *aRequest ) = 0;
   122 			const SmfPlace aLocation ) = 0;
       
   123 	
       
   124 	/**
       
   125 	 * Method to update the last post to own area with new data
       
   126 	 * @param aRequest [out] The request data to be sent to network
       
   127 	 * @param aPostData The edited/new data to be posted
       
   128 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
       
   129 	 */
       
   130 	virtual SmfPluginError updatePost( SmfPluginRequestData *aRequest,
       
   131 			const SmfPost aPostData ) = 0;
    98 	
   132 	
    99 	/**
   133 	/**
   100 	 * Method to update a post to a particular contact
   134 	 * Method to update a post to a particular contact
       
   135 	 * @param aRequest [out] The request data to be sent to network
   101 	 * @param aPostData The post data to be posted
   136 	 * @param aPostData The post data to be posted
   102 	 * @param aContact The contact where the data has to be posted
   137 	 * @param aContact The contact where the data has to be posted
   103 	 * @param aLocation The location
   138 	 * @param aLocation The location
   104 	 * @param aRequest [out] The request data to be sent to network
       
   105 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
   139 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
   106 	 */
   140 	 */
   107 	virtual SmfPluginError updatePostDirected( const SmfPost aPostData, 
   141 	virtual SmfPluginError postDirected( SmfPluginRequestData *aRequest,
       
   142 			const SmfPost aPostData, 
   108 			const SmfContact aContact, 
   143 			const SmfContact aContact, 
   109 			const QtMobility::QContactGeolocation aLocation,
   144 			const SmfPlace aLocation = NULL ) = 0;
   110 			SmfPluginRequestData *aRequest ) = 0;
   145 	
       
   146 	
       
   147 	/**
       
   148 	 * Method to post a comment on a post.
       
   149 	 * @param aRequest [out] The request data to be sent to network
       
   150 	 * @param aTarget Post on which comment has to be posted
       
   151 	 * @param aComment comment to be posted
       
   152 	 * @param aLocation location data
       
   153 	 */
       
   154 	virtual SmfPluginError commentOnAPost(SmfPluginRequestData *aRequest,
       
   155 			const SmfPost& aTarget,
       
   156 			const SmfPost& aComment, 
       
   157 			const SmfPlace* aLocation = NULL);
       
   158 	
   111 	/**
   159 	/**
   112 	 * Method to update the presence information of the user
   160 	 * Method to update the presence information of the user
       
   161 	 * @param aRequest [out] The request data to be sent to network
   113 	 * @param aAppearence The appearence information
   162 	 * @param aAppearence The appearence information
   114 	 * @param aRequest [out] The request data to be sent to network
   163 	 * @param aStatus The status string
   115 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
   164 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
   116 	 */
   165 	 */
   117 	virtual SmfPluginError postAppearence( const SmfPresenceInfo aAppearence,
   166 	virtual SmfPluginError postAppearence( SmfPluginRequestData *aRequest,  
   118 			SmfPluginRequestData *aRequest ) = 0;
   167 			const SmfPresenceInfo aAppearence,
       
   168 			const QString aStatus ) = 0;
   119 	
   169 	
   120 	/**
   170 	/**
   121 	 * Method to get the result for a network request.
   171 	 * Share /a contact's post to user's friends and followers
   122 	 * @param aTransportResult The result of transport operation
   172 	 * (e.g. retweet in twitter, share on facebook)
   123 	 * @param aReply The QNetworkReply instance for the request
   173 	 * @param aRequest [out] The request data to be sent to network
   124 	 * @param aResult [out] An output parameter to the plugin manager.If the 
   174 	 * @param aPostData data to be posted
   125 	 * return value is SmfSendRequestAgain, QVariant will be of type 
   175 	 * @param aContact contact to which the post belonged
   126 	 * SmfPluginRequestData. 
   176 	 * @param aEdited whether user changed items within the post
   127 	 * If last operation was getPosts(), aResult will be of type QList<SmfPost>
   177 	 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone
   128 	 * If last operation was updatePost() or updatePostDirected() or 
       
   129 	 * postAppearence, aResult will be of type bool
       
   130 	 * @param aRetType [out] SmfPluginRetType
       
   131 	 * @param aIsLastPage [out] true if this the last page, else false
       
   132 	 * @return SmfPluginError 
       
   133 	 */
   178 	 */
   134 	virtual SmfPluginError responseAvailable( 
   179 	virtual SmfPluginError sharePost( SmfPluginRequestData *aRequest, 
   135 			const SmfTransportResult aTransportResult, 
   180 			const SmfPost& aPostData, 
   136 			QNetworkReply *aReply, 
   181 			const SmfContact& aContact, 
   137 			QVariant* aResult, 
   182 			const bool aEdited);
   138 			SmfPluginRetType aRetType,
   183 
   139 			bool aIsLastPage) = 0;
       
   140 	
   184 	
   141 	};
   185 	};
   142 
   186 
   143 Q_DECLARE_INTERFACE( SmfPostProviderPlugin, "org.symbian.smf.plugin.contact.posts/v1.0" );
   187 Q_DECLARE_INTERFACE( SmfPostProviderPlugin, "org.symbian.smf.plugin.contact.posts/v1.0" );
   144 
   188