smf/inc/smfclient/smfcontactfetcher.h
changeset 3 0446eb7b28aa
equal deleted inserted replaced
2:86af6c333601 3:0446eb7b28aa
       
     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 "smfplace.h"
       
    28 class SmfProvider; //base-class for service provider
       
    29 class SmfContact; //class for Contact in a social network
       
    30 class SmfGroup; //class for a group in social network
       
    31 typedef QList<SmfContact>  SmfContactList;
       
    32 
       
    33 //List of SmfGroup
       
    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(SmfPlace* 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   //APIs to get/set base provider info (SmfProvider)
       
   133 
       
   134   /**
       
   135    * Gets the base provider info
       
   136    */
       
   137    SmfProvider* getProvider() ;
       
   138 
       
   139 public slots:
       
   140 
       
   141 signals:
       
   142 
       
   143 	/**
       
   144 	 * This signal is emitted when a request to get friends is completed.
       
   145 	 * Note if number of friends is large, then it can download the list page by page.
       
   146 	 * In that case this signal is emitted multiple times.
       
   147 	 *  @param list list of friends
       
   148 	 *  @param error error string
       
   149 	 *  @param resultPage Page number info
       
   150 	 *  @see friends()
       
   151 	 */
       
   152 	void friendsListAvailable(SmfContactList* list, QString error, SmfResultPage resultPage);
       
   153 
       
   154 	/**
       
   155 	 * This signal is emitted when a request to get followers is completed
       
   156 	 *  Note if number of followers is large, then it can download the list page by page
       
   157 	 *  In that case this signal is emitted multiple times.
       
   158 	 *  @param list list of followers
       
   159 	 *  @param error error string
       
   160 	 *  @param resultPage Page number info
       
   161 	 *  @see followers()
       
   162 	 */
       
   163 	void followersListAvailable(SmfContactList* list, QString error, SmfResultPage resultPage);
       
   164 
       
   165 	/**
       
   166 	 * This signal is emitted when a request to get groups is completed
       
   167 	 * Note if number of groups is large, then it can download the list page by page
       
   168 	 *  In that case this signal is emitted multiple times.
       
   169 	 *  @param list list of groups
       
   170 	 *  @param error error string
       
   171 	 *  @param resultPage Page number info
       
   172 	 *  @see groups()
       
   173 	 */
       
   174 	void groupListAvailable(SmfGroupList* list, QString error, SmfResultPage resultPage);
       
   175 
       
   176 	/**
       
   177 	 * Emitted when search for a contact is finished.
       
   178 	 * Note if number of contacts in the search is large, then it can download the list page by page
       
   179 	 * In that case this signal is emitted multiple times.
       
   180 	 * @param list List of filtered contacts
       
   181 	 * @param resultPage Page number info
       
   182 	 * @see search()
       
   183 	 */
       
   184 	void searchContactFinished(SmfContactList* list,QString error, SmfResultPage resultPage);
       
   185 
       
   186 
       
   187 	/**
       
   188 	 * Emitted when search for contacts who are near a geographic location, is finished.
       
   189 	 * Note if number of contacts in the search is large, then it can download the list page by page
       
   190 	 * In that case this signal is emitted multiple times.
       
   191 	 * @param list List of filtered contacts
       
   192 	 * @param resultPage Page number info
       
   193 	 * @see search()
       
   194 	 */
       
   195 	void searchNearFinished(SmfContactList* list,QString error, SmfResultPage resultPage);
       
   196 
       
   197 	/**
       
   198 	 * Emitted when search for a contact in a group is finished
       
   199 	 * Note if number of contacts in the search is large, then it can download the list page by page
       
   200 	 * In that case this signal is emitted multiple times.
       
   201 	 * @param list list of filtered contacts
       
   202 	 * @param resultPage Page number info
       
   203 	 * @see searchInGroup()
       
   204 	 */
       
   205 	void searchInGroupFinished(SmfContactList* list,QString error, SmfResultPage resultPage);
       
   206 
       
   207 private:
       
   208   SmfProvider* m_baseProvider;
       
   209 };
       
   210 
       
   211 SMF_SERVICE_NAME(SmfContactFetcher, "org.symbian.smf.client.contact.fetcher\0.2")
       
   212 #endif // SMFCONTACTHETCHER_H