smf/smfservermodule/smfclient/client/smfcontactfetcher_p.h
changeset 18 013a02bf2bb0
parent 17 106a4bfcb866
child 19 c412f0526c34
equal deleted inserted replaced
17:106a4bfcb866 18:013a02bf2bb0
     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 #include "smflocation.h"
       
    42 #ifdef Q_OS_SYMBIAN
       
    43 class CSmfClientSymbian;
       
    44 #else
       
    45 class SmfClientQt;
       
    46 #endif
       
    47 
       
    48 
       
    49 class SmfContactFetcherPrivate : public smfObserver
       
    50 {
       
    51   Q_OBJECT
       
    52 
       
    53 public:
       
    54 
       
    55 
       
    56   SmfContactFetcherPrivate(SmfContactFetcher* contactFetcher=0);
       
    57   ~SmfContactFetcherPrivate();
       
    58   //Note we need to expose the methods later through some macro
       
    59 public:
       
    60   /**
       
    61    * Get the friend listing asynchronously. The friendsListAvailable() signal
       
    62    * is emitted with SmfContactList once data is arrived.
       
    63    * When the list is big user can specify the page number and per page item data.
       
    64    * If not supplied by the user default values are used.
       
    65    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    66    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    67    */
       
    68   bool friends(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
       
    69 
       
    70   /**
       
    71    * Get the list of followers asynchronously. The followersListAvailable() signal
       
    72    * is emitted with SmfContactList once data is arrived. Please note that some
       
    73    * service may not support followers/fans - FALSE is returned if not supported.
       
    74    * When the list is big user can specify the page number and per page item data.
       
    75    * If not supplied by the user default values are used.
       
    76    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    77    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    78    */
       
    79   bool followers(int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE); // list of contact objects
       
    80 
       
    81   /**
       
    82    * Searches for a contact The searchContactFinished() signal
       
    83    * is emitted with SmfContactList once data is arrived.
       
    84    * When the list is big user can specify the page number and per page item data.
       
    85    * If not supplied by the user default values are used.
       
    86    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    87    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    88    */
       
    89   void search(SmfContact* contact,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE) ; // list of contact objects
       
    90 
       
    91   /**
       
    92    * Searches for a contacts (friends) who are near the user.
       
    93    * Signal searchNearFinished() is emitted with SmfContactList once data is arrived.
       
    94    * Proximity defines accuracy level
       
    95    * When the list is big user can specify the page number and per page item data.
       
    96    * If not supplied by the user default values are used.
       
    97    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    98    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    99    */
       
   100   bool searchNear(SmfLocation* 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   //serialized xtra info, order of serialization follows order of param
       
   131   QByteArray m_xtraInfoSerialized;
       
   132 #ifdef Q_OS_SYMBIAN
       
   133   CSmfClientSymbian* m_SmfClientPrivate;
       
   134   friend class CSmfClientSymbian;
       
   135   int m_xtraInfoFlag;
       
   136   int m_pageInfoFlag;
       
   137  #else
       
   138   SmfClientQt* m_SmfClientPrivate;
       
   139   friend class SmfClientQt;
       
   140 #endif
       
   141   bool m_connected;
       
   142   SmfContactFetcher* m_contactFetcher;
       
   143   SmfContactList* m_contactList;
       
   144   QList<SmfGroup> m_grpList;
       
   145   SmfContactList m_frndist;
       
   146   SmfContact* m_contact;
       
   147   SmfGroup m_grp;
       
   148   void writeLog(QString log) const;
       
   149   //debugging
       
   150 //  SmfLogger* logger;
       
   151   //void writeLog(QString log) const;
       
   152 };
       
   153 
       
   154 QDataStream &operator<<( QDataStream &aDataStream, 
       
   155 		const SmfError &err );
       
   156 
       
   157 
       
   158 QDataStream &operator>>( QDataStream &aDataStream, 
       
   159 		SmfError &err );
       
   160 #endif /* SMFCLIENTPRIVATE_H_ */