smf/smfservermodule/smfclient/client/smfcontactfetcher.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 SmfEvent class represents an event
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFCONTACTHETCHER_H
       
    21 #define SMFCONTACTHETCHER_H
       
    22 
       
    23 #include <QObject>
       
    24 #include "smfglobal.h"
       
    25 #include "smfprovider.h"
       
    26 #include "smfcontact.h"
       
    27 #include "smflocation.h"
       
    28 #include "smfgroup.h"
       
    29 class SmfProvider; //base-class for service provider
       
    30 class SmfContact; //class for Contact in a social network
       
    31 class SmfGroup; //class for a group in social network
       
    32 
       
    33 typedef QList<SmfContact>  SmfContactList;
       
    34 typedef QList<SmfGroup> SmfGroupList;
       
    35 /**
       
    36  * @ingroup smf_client_group 
       
    37  * Interface to search for contacts/connections from a service provider. This class
       
    38  * provides basic functionality to allow applications to obtain list of
       
    39  * contacts or friends in a social networking service.
       
    40  * Note that to get the base provider info like service name, icon, description etc
       
    41  * use getProvider().
       
    42  * See also:
       
    43  * SmfProvider::serviceName(), SmfProvider::serviceIcon(), SmfProvider::description()
       
    44  *
       
    45  * All of the functionality described here should be implemented by a service
       
    46  * specific plug-in object.
       
    47  * Interface name:- org.symbian.smf.client.contact.fetcher
       
    48  */
       
    49 class  SMFCLIENT_EXPORT SmfContactFetcher : public QObject
       
    50 {
       
    51   Q_OBJECT
       
    52 
       
    53 public:
       
    54 
       
    55   /**
       
    56    * Constructs the SmfContactFetcher.
       
    57    * @param parent base provider info
       
    58    * @param contact Used for searching friends of the given contact
       
    59    * Seeing as this is a plug-in implementation, these will realistically
       
    60    * be generated by SMF factory of some kind
       
    61    */
       
    62   SmfContactFetcher(SmfProvider* baseProvider);
       
    63   SmfContactFetcher(SmfProvider* baseProvider, SmfContact* contact);
       
    64   ~SmfContactFetcher();
       
    65 
       
    66 public:
       
    67   /**
       
    68    * Get the friend listing asynchronously. The friendsListAvailable() signal
       
    69    * is emitted with SmfContactList once data is arrived.
       
    70    * When the list is big user can specify the page number and per page item data.
       
    71    * If not supplied by the user default values are used.
       
    72    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    73    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    74    */
       
    75   bool friends(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
       
    76 
       
    77   /**
       
    78    * Get the list of followers asynchronously. The followersListAvailable() signal
       
    79    * is emitted with SmfContactList once data is arrived. Please note that some
       
    80    * service may not support followers/fans - FALSE is returned if not supported.
       
    81    * When the list is big user can specify the page number and per page item data.
       
    82    * If not supplied by the user default values are used.
       
    83    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    84    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    85    */
       
    86   bool followers(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE); // list of contact objects
       
    87 
       
    88   /**
       
    89    * Searches for a contact The searchContactFinished() signal
       
    90    * is emitted with SmfContactList once data is arrived.
       
    91    * When the list is big user can specify the page number and per page item data.
       
    92    * If not supplied by the user default values are used.
       
    93    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    94    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    95    */
       
    96   void search(SmfContact* contact,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ; // list of contact objects
       
    97 
       
    98   /**
       
    99    * Searches for a contacts (friends) who are near the user.
       
   100    * Signal searchNearFinished() is emitted with SmfContactList once data is arrived.
       
   101    * Proximity defines accuracy level
       
   102    * When the list is big user can specify the page number and per page item data.
       
   103    * If not supplied by the user default values are used.
       
   104    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   105    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   106    */
       
   107   bool searchNear(SmfLocation* location,SmfLocationSearchBoundary proximity,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ;
       
   108 
       
   109 
       
   110   /**
       
   111    * Get the list of groups. The groupListAvailable() signal
       
   112    * is emitted with SmfGroupList once data is arrived. False might be returned
       
   113    * if this service doesn't support any mode of grouping (very rare).
       
   114    * When the list is big user can specify the page number and per page item data.
       
   115    * If not supplied by the user default values are used.
       
   116    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   117    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   118    */
       
   119    bool groups(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ; // list of group objects
       
   120 
       
   121   /**
       
   122    * Searches for Smf Contacts in an Smf group.
       
   123    * When the list is big user can specify the page number and per page item data.
       
   124    * If not supplied by the user default values are used.
       
   125    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   126    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   127    * @param  group The group to be searcged in
       
   128    */
       
   129    bool searchInGroup(SmfGroup group,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE); // list of contact objects
       
   130    
       
   131    /**
       
   132     * Request for a custom operation.
       
   133     * @param operationId OperationId
       
   134     * @param customData Custom data to be sent
       
   135     * Note:-Interpretation of operationId and customData is upto the concerned
       
   136     * plugin and client application. service provider should provide some
       
   137     * serializing-deserializing utilities for these custom data
       
   138     */
       
   139    void customRequest(const int& operationId,QByteArray* customData);
       
   140 
       
   141   //APIs to get/set base provider info (SmfProvider)
       
   142 
       
   143   /**
       
   144    * Gets the base provider info
       
   145    */
       
   146    SmfProvider* getProvider() ;
       
   147 
       
   148 signals:
       
   149 
       
   150 	/**
       
   151 	 * This signal is emitted when a request to get friends is completed.
       
   152 	 * Note if number of friends is large, then it can download the list page by page.
       
   153 	 * In that case this signal is emitted multiple times.
       
   154 	 *  @param list list of friends
       
   155 	 *  @param error error value
       
   156 	 *  @param resultPage Page number info
       
   157 	 *  @see friends()
       
   158 	 */
       
   159 	void friendsListAvailable(SmfContactList* list, SmfError error, SmfResultPage resultPage);
       
   160 
       
   161 	/**
       
   162 	 * This signal is emitted when a request to get followers is completed
       
   163 	 *  Note if number of followers is large, then it can download the list page by page
       
   164 	 *  In that case this signal is emitted multiple times.
       
   165 	 *  @param list list of followers
       
   166 	 *  @param error error value
       
   167 	 *  @param resultPage Page number info
       
   168 	 *  @see followers()
       
   169 	 */
       
   170 	void followersListAvailable(SmfContactList* list, SmfError error, SmfResultPage resultPage);
       
   171 
       
   172 	/**
       
   173 	 * This signal is emitted when a request to get groups is completed
       
   174 	 * Note if number of groups is large, then it can download the list page by page
       
   175 	 *  In that case this signal is emitted multiple times.
       
   176 	 *  @param list list of groups
       
   177 	 *  @param error error value
       
   178 	 *  @param resultPage Page number info
       
   179 	 *  @see groups()
       
   180 	 */
       
   181 	void groupListAvailable(SmfGroupList* list, SmfError error, SmfResultPage resultPage);
       
   182 
       
   183 	/**
       
   184 	 * Emitted when search for a contact is finished.
       
   185 	 * Note if number of contacts in the search is large, then it can download the list page by page
       
   186 	 * In that case this signal is emitted multiple times.
       
   187 	 * @param list List of filtered contacts
       
   188 	 * @param resultPage Page number info
       
   189 	 * @see search()
       
   190 	 */
       
   191 	void searchContactFinished(SmfContactList* list,SmfError error, SmfResultPage resultPage);
       
   192 
       
   193 
       
   194 	/**
       
   195 	 * Emitted when search for contacts who are near a geographic location, is finished.
       
   196 	 * Note if number of contacts in the search is large, then it can download the list page by page
       
   197 	 * In that case this signal is emitted multiple times.
       
   198 	 * @param list List of filtered contacts
       
   199 	 * @param resultPage Page number info
       
   200 	 * @see search()
       
   201 	 */
       
   202 	void searchNearFinished(SmfContactList* list,SmfError error, SmfResultPage resultPage);
       
   203 
       
   204 	/**
       
   205 	 * Emitted when search for a contact in a group is finished
       
   206 	 * Note if number of contacts in the search is large, then it can download the list page by page
       
   207 	 * In that case this signal is emitted multiple times.
       
   208 	 * @param list list of filtered contacts
       
   209 	 * @param resultPage Page number info
       
   210 	 * @see searchInGroup()
       
   211 	 */
       
   212 	void searchInGroupFinished(SmfContactList* list,SmfError error, SmfResultPage resultPage);
       
   213 	
       
   214 	/**
       
   215 	 * Emitted when custom data is available
       
   216 	 * @param operationId Requested operation id
       
   217 	 * @param customData Custom data received, interpretation is not the responsibility of Smf
       
   218 	 */
       
   219 	void customDataAvailable(int operationId, QByteArray* customData);
       
   220 	//so that private impl can directly call emit
       
   221 	friend class SmfContactFetcherPrivate;
       
   222 private:
       
   223   SmfProvider* m_baseProvider;
       
   224   SmfContact* m_frndContact; //used for searching
       
   225   //private impl wrapper
       
   226   SmfContactFetcherPrivate* m_private;
       
   227 
       
   228 };
       
   229 
       
   230 SMF_SERVICE_NAME(SmfContactFetcher, "org.symbian.smf.client.contact.fetcher\0.2")
       
   231 #endif // SMFCONTACTHETCHER_H