smf/smfservermodule/smfclient/client/smfcontactfetcher_p.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 
       
    16 #ifndef SMFCLIENTPRIVATE_H_
       
    17 #define SMFCLIENTPRIVATE_H_
       
    18 /**
       
    19  * Private Qt wrapper
       
    20  * Provided to accomodate diff facilities in diff platforms.
       
    21  * Uses Symbian client-server for Symbian
       
    22  * QDbus for linux
       
    23  * QLocalserver for rest of the platforms
       
    24  * Note:- only symbian client-server impl is provided at the moment
       
    25  **/
       
    26 #include "smfprovider.h"
       
    27 #include "SmfClientGlobal.h"
       
    28 #include "smfGlobal.h"
       
    29 #include "SmfObserver.h"
       
    30 
       
    31 class SmfProvider;
       
    32 
       
    33 
       
    34 #include <QObject>
       
    35 #include <QDateTime>
       
    36 #include <QStringList>
       
    37 
       
    38 #include "SmfObserver.h"
       
    39 #include "smfcontactfetcher.h"
       
    40 #include "smfpostprovider.h"
       
    41 #ifdef Q_OS_SYMBIAN
       
    42 class CSmfClientSymbian;
       
    43 #else
       
    44 class SmfClientQt;
       
    45 #endif
       
    46 
       
    47 
       
    48 class SmfContactFetcherPrivate : public smfObserver
       
    49 {
       
    50   Q_OBJECT
       
    51 
       
    52 public:
       
    53 
       
    54 
       
    55   SmfContactFetcherPrivate(SmfContactFetcher* contactFetcher=0);
       
    56   ~SmfContactFetcherPrivate();
       
    57   //Note we need to expose the methods later through some macro
       
    58 public:
       
    59   /**
       
    60    * Get the friend listing asynchronously. The friendsListAvailable() signal
       
    61    * is emitted with SmfContactList once data is arrived.
       
    62    * When the list is big user can specify the page number and per page item data.
       
    63    * If not supplied by the user default values are used.
       
    64    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    65    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    66    */
       
    67   bool friends(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
       
    68 
       
    69   /**
       
    70    * Get the list of followers asynchronously. The followersListAvailable() signal
       
    71    * is emitted with SmfContactList once data is arrived. Please note that some
       
    72    * service may not support followers/fans - FALSE is returned if not supported.
       
    73    * When the list is big user can specify the page number and per page item data.
       
    74    * If not supplied by the user default values are used.
       
    75    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    76    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    77    */
       
    78   bool followers(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE); // list of contact objects
       
    79 
       
    80   /**
       
    81    * Searches for a contact The searchContactFinished() signal
       
    82    * is emitted with SmfContactList once data is arrived.
       
    83    * When the list is big user can specify the page number and per page item data.
       
    84    * If not supplied by the user default values are used.
       
    85    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    86    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    87    */
       
    88   void search(SmfContact* contact,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ; // list of contact objects
       
    89 
       
    90   /**
       
    91    * Searches for a contacts (friends) who are near the user.
       
    92    * Signal searchNearFinished() is emitted with SmfContactList once data is arrived.
       
    93    * Proximity defines accuracy level
       
    94    * When the list is big user can specify the page number and per page item data.
       
    95    * If not supplied by the user default values are used.
       
    96    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    97    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    98    */
       
    99   //TODO:-implement 
       
   100   //bool searchNear(SmfPlace* location,SmfLocationSearchBoundary proximity,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ;
       
   101 
       
   102 
       
   103   /**
       
   104    * Get the list of groups. The groupListAvailable() signal
       
   105    * is emitted with SmfGroupList once data is arrived. False might be returned
       
   106    * if this service doesn't support any mode of grouping (very rare).
       
   107    * When the list is big user can specify the page number and per page item data.
       
   108    * If not supplied by the user default values are used.
       
   109    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   110    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   111    */
       
   112    bool groups(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ; // list of group objects
       
   113 
       
   114   /**
       
   115    * Searches for Smf Contacts in an Smf group.
       
   116    * When the list is big user can specify the page number and per page item data.
       
   117    * If not supplied by the user default values are used.
       
   118    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
   119    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
   120    * @param  group The group to be searcged in
       
   121    */
       
   122    bool searchInGroup(SmfGroup group,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ;
       
   123    
       
   124    //from smfobserver
       
   125    void resultsAvailable(QByteArray result,SmfRequestTypeID opcode,SmfError error);
       
   126 private:
       
   127   SmfProvider* m_baseProvider;
       
   128   //serialized byte array of provider
       
   129   QByteArray m_providerSerialized;
       
   130 #ifdef Q_OS_SYMBIAN
       
   131   CSmfClientSymbian* m_SmfClientPrivate;
       
   132   friend class CSmfClientSymbian;
       
   133 #else
       
   134   SmfClientQt* m_SmfClientPrivate;
       
   135   friend class SmfClientQt;
       
   136 #endif
       
   137   bool m_connected;
       
   138   SmfContactFetcher* m_contactFetcher;
       
   139   SmfContactList* m_contactList;
       
   140   QList<SmfGroup> m_grpList;
       
   141   SmfContactList m_frndist;
       
   142   SmfContact* m_contact;
       
   143   SmfGroup m_grp;
       
   144   void writeLog(QString log) const;
       
   145   //debugging
       
   146 //  SmfLogger* logger;
       
   147   //void writeLog(QString log) const;
       
   148 };
       
   149 
       
   150 QDataStream &operator<<( QDataStream &aDataStream, 
       
   151 		const SmfError &err );
       
   152 
       
   153 
       
   154 QDataStream &operator>>( QDataStream &aDataStream, 
       
   155 		SmfError &err );
       
   156 #endif /* SMFCLIENTPRIVATE_H_ */