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