example/clientapi/smf/inc/smfclient/smfcontactfetcher.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 list of contacts from a site
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef SMFCONTACTHETCHER_H
       
    20 #define SMFCONTACTHETCHER_H
       
    21 
       
    22 #include <QObject>
       
    23 #include "smfprovider.h"
       
    24 #include "smfcontact.h"
       
    25 
       
    26 class SmfProvider; //base-class for service provider
       
    27 class SmfContact; //class for Contact in a social network
       
    28 class SmfGroup; //class for a group in social network
       
    29 class SmfContactList;
       
    30 
       
    31 //List of SmfGroup
       
    32 typedef QList<SmfGroup> SmfGroupList;
       
    33 /**
       
    34  * Interface to search for contacts/connections from a service provider. This class
       
    35  * provides basic functionality to allow applications to obtain list of
       
    36  * contacts or friends in a social networking service.
       
    37  * Note that to get the base provider info like service name, icon, description etc
       
    38  * use getProvider().
       
    39  * See also:
       
    40  * SmfProvider::serviceName(), SmfProvider::serviceIcon(), SmfProvider::description()
       
    41  *
       
    42  * All of the functionality described here should be implemented by a service
       
    43  * specific plug-in object.
       
    44  * Interface name:- org.symbian.smf.client.contact.fetcher
       
    45  */
       
    46 class SMFCLIENT_EXPORT SmfContactFetcher : public QObject
       
    47 {
       
    48   Q_OBJECT
       
    49 
       
    50 public:
       
    51 
       
    52   /**
       
    53    * Constructs the SmfContactFetcher.
       
    54    * @param parent base provider info
       
    55    * @param contact Used for searching friends of the given contact
       
    56    * Seeing as this is a plug-in implementation, these will realistically
       
    57    * be generated by SMF factory of some kind 
       
    58    */
       
    59   SmfContactFetcher(SmfProvider* baseProvider = 0, SmfContact* contact = 0);
       
    60   ~SmfContactFetcher();
       
    61 
       
    62 public:
       
    63   /**
       
    64    * Get the friend listing asynchronously. The friendsListAvailable() signal
       
    65    * is emitted with SmfContactList once data is arrived. 
       
    66    */
       
    67   virtual void friends() = 0; // list of contact objects
       
    68   
       
    69   /**
       
    70    * Get the list of followers asynchronously. The followersListAvailable() signal
       
    71    * is emitted with SmfContactList once data is arrived. 
       
    72    */
       
    73   virtual void followers() = 0; // list of contact objects
       
    74   
       
    75   /**
       
    76    * Searches for a contact The searchContactFinished() signal
       
    77    * is emitted with SmfContactList once data is arrived.
       
    78    */
       
    79   virtual void search(SmfContact* contact) = 0; // list of contact objects
       
    80   
       
    81   /**
       
    82    * Get the list of groups. The groupListAvailable() signal
       
    83    * is emitted with SmfGroupList once data is arrived. 
       
    84    */
       
    85   virtual void groups() = 0; // list of group objects
       
    86   
       
    87   /**
       
    88    * Searches for Smf Contacts in an Smf group
       
    89    * @param  group The group to be searcged in
       
    90    * The nextDataPageAvailable() signal
       
    91    * of SmfProvider is emitted with SmfContactList once data is arrived.
       
    92    */
       
    93   virtual void searchInGroup(SmfGroup group) = 0; // list of contact objects
       
    94 
       
    95  
       
    96   //APIs to get/set base provider info (SmfProvider)
       
    97   
       
    98   /**
       
    99    * Gets the base provider info
       
   100    */
       
   101   virtual SmfProvider* getProvider() = 0;
       
   102   
       
   103   /**
       
   104    * Sets the base provider info
       
   105    */
       
   106   virtual void setProvider(SmfProvider* provider) = 0;
       
   107 
       
   108 
       
   109 public slots:
       
   110 
       
   111 Q_SIGNALS:
       
   112 
       
   113 	/**
       
   114 	 * 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.
       
   116 	 * In that case this signal is emitted multiple times.
       
   117 	 *  @param list list of friends
       
   118 	 *  @param error error string
       
   119 	 *  @param pageNumber Page number
       
   120 	 *  @see friends()
       
   121 	 */
       
   122 	void friendsListAvailable(SmfContactList* list, QString error, int pageNumber=0); 
       
   123 
       
   124 	/**
       
   125 	 * 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
       
   127 	 *  In that case this signal is emitted multiple times.
       
   128 	 *  @param list list of followers
       
   129 	 *  @param error error string
       
   130 	 *  @param pageNumber Page number
       
   131 	 *  @see followers()
       
   132 	 */
       
   133 	void followersListAvailable(SmfContactList* list, QString error, int pageNumber=0); 
       
   134 	
       
   135 	/**
       
   136 	 * 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
       
   138 	 *  In that case this signal is emitted multiple times.
       
   139 	 *  @param list list of groups
       
   140 	 *  @param error error string
       
   141 	 *  @param pageNumber Page number
       
   142 	 *  @see groups()
       
   143 	 */
       
   144 	void groupListAvailable(SmfGroupList* list, QString error, int pageNumber=0);
       
   145 	
       
   146 	/**
       
   147 	 * 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
       
   149 	 * In that case this signal is emitted multiple times.
       
   150 	 * @param list List of filtered contacts
       
   151 	 * @param pageNumber Page number
       
   152 	 * @see search()
       
   153 	 */
       
   154 	void searchContactFinished(SmfContactList* list,QString error, int pageNumber=0);
       
   155 	
       
   156 	/**
       
   157 	 * 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
       
   159 	 * In that case this signal is emitted multiple times.
       
   160 	 * @param list list of filtered contacts
       
   161 	 * @param pageNumber Page number
       
   162 	 * @see searchInGroup()
       
   163 	 */
       
   164 	void searchInGroupFinished(SmfContactList* list,QString error, int pageNumber=0);
       
   165 
       
   166 private:
       
   167   SmfProvider* m_baseProvider;
       
   168 };
       
   169 
       
   170 SMF_GETSERVICES(SmfContactFetcher, "org.symbian.smf.client.contact.fetcher\0.2")
       
   171 #endif // SMFCONTACTHETCHER_H