example/clientapi/smf/inc/smfclient/smfcontactfetcher.h
changeset 2 86af6c333601
parent 1 4b1e636e8a71
equal deleted inserted replaced
1:4b1e636e8a71 2:86af6c333601
     1 /*
     1 /**
     2 * Copyright (c) 2010 Sasken Communication Technologies Ltd.
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of the "{License}"
     5  * under the terms of the "Eclipse Public License v1.0" 
     6 * which accompanies  this distribution, and is available
     6  * which accompanies  this distribution, and is available
     7 * at the URL "{LicenseUrl}".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  * Manasij Roy, Nalina Hariharan
    14 * Description:
    14  * 
    15 * Interface spefication for list of contacts from a site
    15  * Description:
    16 *
    16  * The SmfEvent class represents an event
    17 */
    17  *
       
    18  */
    18 
    19 
    19 #ifndef SMFCONTACTHETCHER_H
    20 #ifndef SMFCONTACTHETCHER_H
    20 #define SMFCONTACTHETCHER_H
    21 #define SMFCONTACTHETCHER_H
    21 
    22 
    22 #include <QObject>
    23 #include <QObject>
       
    24 #include "smfglobal.h"
    23 #include "smfprovider.h"
    25 #include "smfprovider.h"
    24 #include "smfcontact.h"
    26 #include "smfcontact.h"
    25 
    27 #include "smfplace.h"
    26 class SmfProvider; //base-class for service provider
    28 class SmfProvider; //base-class for service provider
    27 class SmfContact; //class for Contact in a social network
    29 class SmfContact; //class for Contact in a social network
    28 class SmfGroup; //class for a group in social network
    30 class SmfGroup; //class for a group in social network
    29 class SmfContactList;
    31 typedef QList<SmfContact>  SmfContactList;
    30 
    32 
    31 //List of SmfGroup
    33 //List of SmfGroup
    32 typedef QList<SmfGroup> SmfGroupList;
    34 typedef QList<SmfGroup> SmfGroupList;
    33 /**
    35 /**
       
    36  * @ingroup smf_client_group 
    34  * Interface to search for contacts/connections from a service provider. This class
    37  * Interface to search for contacts/connections from a service provider. This class
    35  * provides basic functionality to allow applications to obtain list of
    38  * provides basic functionality to allow applications to obtain list of
    36  * contacts or friends in a social networking service.
    39  * contacts or friends in a social networking service.
    37  * Note that to get the base provider info like service name, icon, description etc
    40  * Note that to get the base provider info like service name, icon, description etc
    38  * use getProvider().
    41  * use getProvider().
    52   /**
    55   /**
    53    * Constructs the SmfContactFetcher.
    56    * Constructs the SmfContactFetcher.
    54    * @param parent base provider info
    57    * @param parent base provider info
    55    * @param contact Used for searching friends of the given contact
    58    * @param contact Used for searching friends of the given contact
    56    * Seeing as this is a plug-in implementation, these will realistically
    59    * Seeing as this is a plug-in implementation, these will realistically
    57    * be generated by SMF factory of some kind 
    60    * be generated by SMF factory of some kind
    58    */
    61    */
    59   SmfContactFetcher(SmfProvider* baseProvider = 0, SmfContact* contact = 0);
    62   SmfContactFetcher(SmfProvider* baseProvider);
       
    63   SmfContactFetcher(SmfProvider* baseProvider, SmfContact* contact);
    60   ~SmfContactFetcher();
    64   ~SmfContactFetcher();
    61 
    65 
    62 public:
    66 public:
    63   /**
    67   /**
    64    * Get the friend listing asynchronously. The friendsListAvailable() signal
    68    * Get the friend listing asynchronously. The friendsListAvailable() signal
    65    * is emitted with SmfContactList once data is arrived. 
    69    * is emitted with SmfContactList once data is arrived.
    66    */
    70    * When the list is big user can specify the page number and per page item data.
    67   virtual void friends() = 0; // list of contact objects
    71    * If not supplied by the user default values are used.
    68   
    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 
    69   /**
    77   /**
    70    * Get the list of followers asynchronously. The followersListAvailable() signal
    78    * Get the list of followers asynchronously. The followersListAvailable() signal
    71    * is emitted with SmfContactList once data is arrived. 
    79    * is emitted with SmfContactList once data is arrived. Please note that some
    72    */
    80    * service may not support followers/fans - FALSE is returned if not supported.
    73   virtual void followers() = 0; // list of contact objects
    81    * When the list is big user can specify the page number and per page item data.
    74   
    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 
    75   /**
    88   /**
    76    * Searches for a contact The searchContactFinished() signal
    89    * Searches for a contact The searchContactFinished() signal
    77    * is emitted with SmfContactList once data is arrived.
    90    * is emitted with SmfContactList once data is arrived.
    78    */
    91    * When the list is big user can specify the page number and per page item data.
    79   virtual void search(SmfContact* contact) = 0; // list of contact objects
    92    * If not supplied by the user default values are used.
    80   
    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 
    81   /**
   110   /**
    82    * Get the list of groups. The groupListAvailable() signal
   111    * Get the list of groups. The groupListAvailable() signal
    83    * is emitted with SmfGroupList once data is arrived. 
   112    * is emitted with SmfGroupList once data is arrived. False might be returned
    84    */
   113    * if this service doesn't support any mode of grouping (very rare).
    85   virtual void groups() = 0; // list of group objects
   114    * When the list is big user can specify the page number and per page item data.
    86   
   115    * If not supplied by the user default values are used.
    87   /**
   116    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
    88    * Searches for Smf Contacts in an Smf group
   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
    89    * @param  group The group to be searcged in
   127    * @param  group The group to be searcged in
    90    * The nextDataPageAvailable() signal
   128    */
    91    * of SmfProvider is emitted with SmfContactList once data is arrived.
   129    bool searchInGroup(SmfGroup group,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ; // list of contact objects
    92    */
   130 
    93   virtual void searchInGroup(SmfGroup group) = 0; // list of contact objects
   131 
    94 
       
    95  
       
    96   //APIs to get/set base provider info (SmfProvider)
   132   //APIs to get/set base provider info (SmfProvider)
    97   
   133 
    98   /**
   134   /**
    99    * Gets the base provider info
   135    * Gets the base provider info
   100    */
   136    */
   101   virtual SmfProvider* getProvider() = 0;
   137    SmfProvider* getProvider() ;
   102   
       
   103   /**
       
   104    * Sets the base provider info
       
   105    */
       
   106   virtual void setProvider(SmfProvider* provider) = 0;
       
   107 
       
   108 
   138 
   109 public slots:
   139 public slots:
   110 
   140 
   111 Q_SIGNALS:
   141 signals:
   112 
   142 
   113 	/**
   143 	/**
   114 	 * This signal is emitted when a request to get friends is completed.
   144 	 * This signal is emitted when a request to get friends is completed.
   115 	 * Note if number of friends is large, then it can download the list page by page.
   145 	 * Note if number of friends is large, then it can download the list page by page.
   116 	 * In that case this signal is emitted multiple times.
   146 	 * In that case this signal is emitted multiple times.
   117 	 *  @param list list of friends
   147 	 *  @param list list of friends
   118 	 *  @param error error string
   148 	 *  @param error error string
   119 	 *  @param pageNumber Page number
   149 	 *  @param resultPage Page number info
   120 	 *  @see friends()
   150 	 *  @see friends()
   121 	 */
   151 	 */
   122 	void friendsListAvailable(SmfContactList* list, QString error, int pageNumber=0); 
   152 	void friendsListAvailable(SmfContactList* list, QString error, SmfResultPage resultPage);
   123 
   153 
   124 	/**
   154 	/**
   125 	 * This signal is emitted when a request to get followers is completed
   155 	 * This signal is emitted when a request to get followers is completed
   126 	 *  Note if number of followers is large, then it can download the list page by page
   156 	 *  Note if number of followers is large, then it can download the list page by page
   127 	 *  In that case this signal is emitted multiple times.
   157 	 *  In that case this signal is emitted multiple times.
   128 	 *  @param list list of followers
   158 	 *  @param list list of followers
   129 	 *  @param error error string
   159 	 *  @param error error string
   130 	 *  @param pageNumber Page number
   160 	 *  @param resultPage Page number info
   131 	 *  @see followers()
   161 	 *  @see followers()
   132 	 */
   162 	 */
   133 	void followersListAvailable(SmfContactList* list, QString error, int pageNumber=0); 
   163 	void followersListAvailable(SmfContactList* list, QString error, SmfResultPage resultPage);
   134 	
   164 
   135 	/**
   165 	/**
   136 	 * This signal is emitted when a request to get groups is completed
   166 	 * This signal is emitted when a request to get groups is completed
   137 	 * Note if number of groups is large, then it can download the list page by page
   167 	 * Note if number of groups is large, then it can download the list page by page
   138 	 *  In that case this signal is emitted multiple times.
   168 	 *  In that case this signal is emitted multiple times.
   139 	 *  @param list list of groups
   169 	 *  @param list list of groups
   140 	 *  @param error error string
   170 	 *  @param error error string
   141 	 *  @param pageNumber Page number
   171 	 *  @param resultPage Page number info
   142 	 *  @see groups()
   172 	 *  @see groups()
   143 	 */
   173 	 */
   144 	void groupListAvailable(SmfGroupList* list, QString error, int pageNumber=0);
   174 	void groupListAvailable(SmfGroupList* list, QString error, SmfResultPage resultPage);
   145 	
   175 
   146 	/**
   176 	/**
   147 	 * Emitted when search for a contact is finished.
   177 	 * Emitted when search for a contact is finished.
   148 	 * Note if number of contacts in the search is large, then it can download the list page by page
   178 	 * Note if number of contacts in the search is large, then it can download the list page by page
   149 	 * In that case this signal is emitted multiple times.
   179 	 * In that case this signal is emitted multiple times.
   150 	 * @param list List of filtered contacts
   180 	 * @param list List of filtered contacts
   151 	 * @param pageNumber Page number
   181 	 * @param resultPage Page number info
   152 	 * @see search()
   182 	 * @see search()
   153 	 */
   183 	 */
   154 	void searchContactFinished(SmfContactList* list,QString error, int pageNumber=0);
   184 	void searchContactFinished(SmfContactList* list,QString error, SmfResultPage resultPage);
   155 	
   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 
   156 	/**
   197 	/**
   157 	 * Emitted when search for a contact in a group is finished
   198 	 * Emitted when search for a contact in a group is finished
   158 	 * Note if number of contacts in the search is large, then it can download the list page by page
   199 	 * Note if number of contacts in the search is large, then it can download the list page by page
   159 	 * In that case this signal is emitted multiple times.
   200 	 * In that case this signal is emitted multiple times.
   160 	 * @param list list of filtered contacts
   201 	 * @param list list of filtered contacts
   161 	 * @param pageNumber Page number
   202 	 * @param resultPage Page number info
   162 	 * @see searchInGroup()
   203 	 * @see searchInGroup()
   163 	 */
   204 	 */
   164 	void searchInGroupFinished(SmfContactList* list,QString error, int pageNumber=0);
   205 	void searchInGroupFinished(SmfContactList* list,QString error, SmfResultPage resultPage);
   165 
   206 
   166 private:
   207 private:
   167   SmfProvider* m_baseProvider;
   208   SmfProvider* m_baseProvider;
   168 };
   209 };
   169 
   210 
   170 SMF_GETSERVICES(SmfContactFetcher, "org.symbian.smf.client.contact.fetcher\0.2")
   211 SMF_SERVICE_NAME(SmfContactFetcher, "org.symbian.smf.client.contact.fetcher\0.2")
   171 #endif // SMFCONTACTHETCHER_H
   212 #endif // SMFCONTACTHETCHER_H