smf/smfservermodule/smfclient/client/smfgallery.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  * Description:
       
    16  * The SmfGallery class 
       
    17  *
       
    18  */
       
    19 
       
    20 #ifndef SMFGALLERY_H
       
    21 #define SMFGALLERY_H
       
    22 
       
    23 #include "smfglobal.h"
       
    24 #include "smfprovider.h"
       
    25 #include "smfclientglobal.h"
       
    26 #include "smfpicture.h"
       
    27 #include "smfpicturealbum.h"
       
    28 #include "smfcomment.h"
       
    29 #include "smfcontact.h"
       
    30 
       
    31 #include <QObject>
       
    32 #include <QDateTime>
       
    33 #include <QStringList>
       
    34 
       
    35 #include <qmobilityglobal.h>
       
    36 
       
    37 
       
    38 
       
    39 class SmfGalleryPrivate;
       
    40 /**
       
    41  * @ingroup smf_client_group 
       
    42  * Interface to a remote gallery service. This class
       
    43  * provides some basic gallery functionality to allow applications
       
    44  * to interact with a picture gallery in a social network.
       
    45  *
       
    46  * Note that branding information for the particular service implementation
       
    47  * is available from getProvider() API. See also:
       
    48  * SmfProvider::serviceName(), SmfProvider::serviceIcon()
       
    49  *
       
    50  * All of the functionality described here should be implemented by a service
       
    51  * specific plug-in object.
       
    52  * Interface name for SmfGallery org.symbian.smf.client.gallery
       
    53  */
       
    54 class SMFCLIENT_EXPORT SmfGallery : public QObject
       
    55 {
       
    56   Q_OBJECT
       
    57 
       
    58 public:
       
    59   /**
       
    60    * Constructs SmfGallery.
       
    61    * @param baseProvider The base provider info
       
    62    * Seeing as this is a plug-in implementation, these will realistically
       
    63    be generated by SMF factory of some kind
       
    64    */
       
    65 
       
    66   SmfGallery(SmfProvider* baseprovider);
       
    67   ~SmfGallery();
       
    68 
       
    69 	public slots:
       
    70 	/**
       
    71 	 * Get the album listing asynchronously.
       
    72 	 * The albumsAvailable() signal is emitted with SmfPictureAlbumList once the albums have arrived.
       
    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 names the subject or any keywords to be used to filter albums with that name
       
    76 	 * @param user the user whose albums are requested 
       
    77 	 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    78 	 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    79 	 */
       
    80 	void albums(QStringList names, SmfContact* user, int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
       
    81 	
       
    82 	
       
    83   /**
       
    84    * Get the picture listing asynchronously.
       
    85    * The picturesAvailable() signal is emitted with SmfPictureList once the pictures have arrived.
       
    86    * When the list is big user can specify the page number and per page item data.
       
    87    * If not supplied by the user default values are used.
       
    88 	 * @param albums album(s) whose pictures are being requested
       
    89    * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query.
       
    90    * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE
       
    91    */
       
    92 	void pictures(SmfPictureAlbumList &albums, int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
       
    93 
       
    94   /**
       
    95    * Returns a user title/caption for the picture
       
    96    */
       
    97   QString description(SmfPicture& picture);
       
    98   /**
       
    99    * Gets the base provider info
       
   100    */
       
   101    SmfProvider* getProvider() ;
       
   102 	//friend so that it can directly emit SmfPostProvider's signal
       
   103 	friend class SmfGalleryPrivate;
       
   104 public slots:
       
   105 	/**
       
   106 	 * Upload an image.Implemented as slot to connect to UI controls more easily
       
   107 	 * uploadFinished() signal is emitted with the success value of the upload
       
   108 	 * @param image the image to be uploaded
       
   109 	 * @param album the optional destination album name 
       
   110 	 */
       
   111 	void upload(SmfPicture* image, SmfPictureAlbum* album=NULL) ;
       
   112 
       
   113 	/**
       
   114 	 * Upload an list image.Implemented as slot to connect to UI controls more easily
       
   115 	 * uploadFinished() signal is emitted with the success value of the upload
       
   116 	 * @param images the list image to be uploaded
       
   117 	 * @param album the optional destination album name 
       
   118 	 */
       
   119 	void upload(SmfPictureList* images, SmfPictureAlbum* album=NULL) ;
       
   120 
       
   121   /**
       
   122    * Posts a comment for an image. uploadFinished() signal is emitted
       
   123    * with success of the post once comment is posted.
       
   124    * @param image Image to comment on
       
   125    * @param comment Comment to post
       
   126    */
       
   127    void postComment(SmfPicture image, SmfComment comment) ;
       
   128    /**
       
   129 	* Request for a custom operation.
       
   130 	* @param operationId OperationId
       
   131 	* @param customData Custom data to be sent
       
   132 	* Note:-Interpretation of operationId and customData is upto the concerned
       
   133 	* plugin and client application. service provider should provide some
       
   134 	* serializing-deserializing utilities for these custom data
       
   135 	*/
       
   136    void customRequest(const int& operationId,QByteArray* customData);
       
   137 signals:
       
   138 	
       
   139 	/*
       
   140 	 * Notification on arrival of list of SmfPictureAlbum as a result of call to @ref albums().
       
   141 	 * @param pics Picture list
       
   142 	 * @param error Error string
       
   143 	 * @param resultPage Page number info
       
   144 	 */
       
   145 	void albumsAvailable(SmfPictureAlbumList* albums, SmfError error, SmfResultPage resultPage);
       
   146 	
       
   147 	/*
       
   148 	 * Notification on arrival of list of SmfPicture as a result of request.
       
   149 	 * Note if number of friends is large, then it can download the list page by page.
       
   150 	 * In that case this signal is emitted multiple times.
       
   151 	 * through pictures().
       
   152 	 * @param pics Picture list
       
   153 	 * @param error Error string
       
   154 	 * @param resultPage Page number info
       
   155 	 */
       
   156 	void picturesAvailable(SmfPictureList* pics, SmfError error, SmfResultPage resultPage);
       
   157 
       
   158   /**
       
   159    * Notification of the success of the uploading of image/comment
       
   160    * @param error The upload success result of each individual pictures
       
   161    */
       
   162   void uploadFinished(QList<SmfError> error);
       
   163 	/**
       
   164 	 * Emitted when custom data is available
       
   165 	 * @param operationId Requested operation id
       
   166 	 * @param customData Custom data received, interpretation is not the responsibility of Smf
       
   167 	 */
       
   168 	void customDataAvailable(int operationId, QByteArray* customData);
       
   169 
       
   170 	/** friend so that it can directly emit SmfGallery's signal*/
       
   171 	friend class SmfGalleryPrivate;
       
   172 
       
   173 
       
   174 private:
       
   175 	SmfProvider* m_baseProvider;
       
   176 	//private impl wrapper
       
   177 	SmfGalleryPrivate* m_private;
       
   178 
       
   179 };
       
   180 
       
   181 SMF_SERVICE_NAME(SmfGallery, "org.symbian.smf.client.gallery\0.2")
       
   182 
       
   183 #endif // SMFGALLERY_H
       
   184