mds_plat/content_listing_framework_collection_manager_api/inc/mediacollectionmanager.h
changeset 58 fe894bb075c2
parent 51 87e65c44ff3a
child 60 79f826a55db2
equal deleted inserted replaced
51:87e65c44ff3a 58:fe894bb075c2
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *  Description :
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef MMEDIACOLLECTIONMANAGER_H
       
    21 #define MMEDIACOLLECTIONMANAGER_H
       
    22 
       
    23 
       
    24 #include <badesca.h>
       
    25 
       
    26 /// Propertie flags for media collections
       
    27 enum TMediaCollectionProperties
       
    28     {
       
    29     /// Collection items are in Phone memory
       
    30     EMCPhoneMemoryCollection = 0x00000001,
       
    31     /// Collection items are in MMC
       
    32     EMCMmcCollection = 0x00000002
       
    33     };
       
    34 
       
    35 class MMediaCollectionManager;
       
    36 class MMediaCollectionInfoExt;
       
    37 class MMediaCollectionManagerExt;
       
    38 class MMediaCollectionObserverExt;
       
    39 
       
    40 /**
       
    41  *  Factory for Media Collection Manager
       
    42  *
       
    43  *  @lib MediaCollectionManager.lib
       
    44  *  @since S60 3.2
       
    45  */
       
    46 class MediaCollectionManagerFactory
       
    47     {
       
    48 public: // New functions
       
    49 
       
    50 	/**
       
    51 	 * Create new instance of Media Collection Manager
       
    52 	 * @return New instance of Media Collection Manager.
       
    53 	 *         Ownership is transferred to the client application.
       
    54 	 */
       
    55 	IMPORT_C static MMediaCollectionManager* CreateCollectionManagerL();
       
    56 
       
    57 private:
       
    58 	// Prohibit C++ default constructor.
       
    59 	MediaCollectionManagerFactory();
       
    60 	// Prohibit Destructor.
       
    61 	~MediaCollectionManagerFactory();
       
    62     };
       
    63 
       
    64 /**
       
    65  *  Media Collection Info interface,
       
    66  *   use MMediaCollectionManager to get collections
       
    67  *
       
    68  *  @lib N/A
       
    69  *  @since S60 3.2
       
    70  */
       
    71 class MMediaCollectionInfo
       
    72     {
       
    73 public:
       
    74 	virtual ~MMediaCollectionInfo() {}
       
    75 
       
    76 public:
       
    77 	/**
       
    78 	* Returns the name of the collection
       
    79 	* @since S60 3.2
       
    80 	* @return Name of the collection
       
    81 	*/
       
    82 	virtual const TDesC& Name() const = 0;
       
    83 
       
    84 	/**
       
    85 	* Returns the id of the album
       
    86 	* @since S60 3.2
       
    87 	* @return The id of the album
       
    88 	*/
       
    89 	virtual TInt Id() const = 0;
       
    90 
       
    91 	/**
       
    92 	* Returns list of media types that are defined for the collection.
       
    93 	* See media types from CLFContentListing.hrh TCLFMediaType
       
    94 	* @since S60 3.2
       
    95 	* @return List of media types that are defined for the collection.
       
    96 	*/
       
    97 	virtual const RArray<TInt>& CollectionItemTypes() const = 0;
       
    98 	
       
    99 	/**
       
   100 	* Returns collection propertie flags
       
   101 	* Properties are defined in TMediaCollectionProperties
       
   102 	* Should not be used in 5.0 or later!
       
   103 	* @since S60 3.2, depricated in 5.0
       
   104 	* @return Properties flags
       
   105 	*/
       
   106 	virtual TInt32 Properties() const = 0;
       
   107 
       
   108 private: // Extension interface
       
   109 
       
   110 	/**
       
   111 	* This member is internal and not intended for use.
       
   112 	*/
       
   113 	virtual MMediaCollectionInfoExt* Extension()
       
   114 						{ return NULL; }
       
   115 	virtual const MMediaCollectionInfoExt* Extension() const
       
   116 						{ return NULL; }
       
   117     };
       
   118 
       
   119 
       
   120 /**
       
   121  *  Observer interface to get notification about changes in
       
   122  *   Media Collection Manager
       
   123  *
       
   124  *  @lib N/A
       
   125  *  @since S60 3.2
       
   126  */
       
   127 class MMediaCollectionObserver
       
   128     {
       
   129 public:
       
   130 	/**
       
   131 	* Collection manager uses this method to notify about
       
   132 	*  created/deleted/modified collections.
       
   133 	* @since 3.2
       
   134 	* @param aCollectionIdArray
       
   135 	*/
       
   136 	virtual void CollectionChangedL(
       
   137 						const TArray<TInt>& aCollectionIdArray ) = 0;
       
   138 
       
   139 	/**
       
   140 	* Collection manager uses this method to notify about
       
   141 	*  possible errors.
       
   142 	* @since 3.2
       
   143 	* @param aError Collection manager error status
       
   144 	*               KErrCorrupt if collection manager is corrupted and
       
   145 	*               possible some data is lost
       
   146 	*/
       
   147 	virtual void CollectionManagerErrorL(
       
   148 						TInt aError ) = 0;
       
   149 
       
   150 protected:
       
   151 
       
   152 	/**
       
   153 	* Destructor.
       
   154 	*/
       
   155 	virtual ~MMediaCollectionObserver() {}
       
   156 
       
   157 private: // Extension interface
       
   158 
       
   159 	/**
       
   160 	* This member is internal and not intended for use.
       
   161 	*/
       
   162 	virtual MMediaCollectionObserverExt* Extension()
       
   163 						{ return NULL; }
       
   164 	virtual const MMediaCollectionObserverExt* Extension() const
       
   165 						{ return NULL; }
       
   166     };
       
   167 
       
   168 /**
       
   169  *  Media Collection Manager
       
   170  *
       
   171  *  Use this class to get Media Collections, create new collections,
       
   172  *   delete collections, rename collections, add files to collections,
       
   173  *   remove files from collections.
       
   174  *
       
   175  *  @lib N/A
       
   176  *  @since S60 3.2
       
   177  */
       
   178 class MMediaCollectionManager
       
   179     {
       
   180 public:
       
   181 	virtual ~MMediaCollectionManager() {}
       
   182 
       
   183 public: // New functions
       
   184 
       
   185 	/**
       
   186 	* Return collection info by index.
       
   187 	* @since 3.2
       
   188 	* @param aCollectionInfoArray Collection infos are added to this array
       
   189 	*/
       
   190 	virtual void GetCollectionInfosL(
       
   191 						RPointerArray<MMediaCollectionInfo>&
       
   192 											aCollectionInfoArray ) const = 0;
       
   193 
       
   194 	/**
       
   195 	* Return collection info by ID.
       
   196 	* @since 3.2
       
   197 	* @param aId Collection ID
       
   198 	* @return Pointer to a MMediaCollectionInfo object
       
   199 	*         Ownership is transferred to client
       
   200 	*/
       
   201 	virtual MMediaCollectionInfo* CollectionInfoByIdLC(
       
   202 						TInt aId ) const = 0;
       
   203 
       
   204 	/**
       
   205 	* Create new collection.
       
   206 	* @since 3.2
       
   207 	* @param aName Name of the collection
       
   208 	* @param aCollectionItemTypes List of media types that are
       
   209 	*         in the collection.
       
   210 	*        Use media types from CLFContentListing.hrh TCLFMediaType.
       
   211 	*        NOTE! that collection manager doesn't check is added item defined
       
   212 	*              mediatype. This is only for client(s) for grouping different
       
   213 	*              type folders.
       
   214 	* @param aStorage In 3.2 See TMediaCollectionProperties
       
   215 	*        NOTE! If given propertie set is not supported then
       
   216 	*              function leaves with KErrNotSupported
       
   217 	         NOTE! In 5.0 Drive number where the collection is to be created!
       
   218 	* @return ID of the creaded collection
       
   219 	*/
       
   220 	virtual TInt CreateCollectionL(
       
   221 						const TDesC& aName,
       
   222 						const TArray<TInt>& aCollectionItemTypes,
       
   223 						TInt32 aStorage) = 0;
       
   224 
       
   225 	/**
       
   226 	* Delete collection.
       
   227 	* NOTE! this doesn't delete items that are in collection.
       
   228 	* @since 3.2
       
   229 	* @param aId ID of the collection
       
   230 	*/
       
   231 	virtual void DeleteCollectionL(
       
   232 						TInt aId ) = 0;
       
   233 
       
   234 	/**
       
   235 	* Rename collection.
       
   236 	* @since 3.2
       
   237 	* @param aId ID of the collection.
       
   238 	*            If collection doesn't found then
       
   239 	*            function leaves with KErrNotFound
       
   240 	* @param aNewName new name of the collection
       
   241 	*/
       
   242 	virtual void RenameCollectionL(
       
   243 						TInt aId,
       
   244 						const TDesC& aNewName ) = 0;
       
   245 
       
   246 	/**
       
   247 	* Add item(s) to collection.
       
   248 	* @since 3.2
       
   249 	* @param aId Collection ID
       
   250 	*            If collection doesn't found then
       
   251 	*            function leaves with KErrNotFound
       
   252 	* @param aItemArray
       
   253 	* @param aRemoveFromOtherCollections Is item removed from other
       
   254 	*                                    available collections.
       
   255 	*/
       
   256 	virtual void AddToCollectionL(
       
   257 						TInt aId,
       
   258 						const MDesCArray& aItemArray,
       
   259 						TBool aRemoveFromOtherCollections = ETrue ) = 0;
       
   260 
       
   261 	/**
       
   262 	* Remove item(s) from collection.
       
   263 	* @since 3.2
       
   264 	* @param aId Collection ID
       
   265 	*            If collection doesn't found then
       
   266 	*            function leaves with KErrNotFound
       
   267 	* @param aItemArray
       
   268 	*/
       
   269 	virtual void RemoveFromCollectionL(
       
   270 						TInt aId,
       
   271 						const MDesCArray& aItemArray ) = 0;
       
   272 
       
   273 	/**
       
   274 	* Remove item(s) from all collections.
       
   275 	* @since 3.2
       
   276 	* @param aItemArray
       
   277 	*/
       
   278 	virtual void RemoveFromAllCollectionsL(
       
   279 						const MDesCArray& aItemArray ) = 0;
       
   280 
       
   281 
       
   282 	/**
       
   283 	* Get collection items.
       
   284 	* @since 3.2
       
   285 	* @param aId Collection ID
       
   286 	*            If collection doesn't found then
       
   287 	*            function leaves with KErrNotFound
       
   288 	* @param aItemArray Item are added to the array
       
   289 	*/
       
   290 	virtual void GetCollectionItemArrayL(
       
   291 						TInt aId,
       
   292 						CDesCArray& aItemArray ) const = 0;
       
   293 
       
   294 	/**
       
   295 	* Find collections IDs by item.
       
   296 	* @since 3.2
       
   297 	* @param aItem
       
   298 	* @param aIdArray Possible collection IDs are added to the array
       
   299 	*/
       
   300 	virtual void GetCollectionIdByItemL(
       
   301 						const TDesC& aItem,
       
   302 						RArray<TInt>& aIdArray ) const = 0;
       
   303 
       
   304 	/**
       
   305 	* Add collection observer.
       
   306 	* @since 3.2
       
   307 	* @param aObserver
       
   308 	*/
       
   309 	virtual void AddCollectionObserverL(
       
   310 						MMediaCollectionObserver& aObserver ) = 0;
       
   311 
       
   312 	/**
       
   313 	* Remove collection observer.
       
   314 	* @since 3.2
       
   315 	* @param aObserver
       
   316 	*/
       
   317 	virtual void RemoveCollectionObserverL(
       
   318 						MMediaCollectionObserver& aObserver ) = 0;
       
   319 
       
   320 	/**
       
   321 	* Get the drivenumber of the drive where collection is located by collection id
       
   322 	* @since 5.0
       
   323 	* @param aId id of the collection
       
   324 	* @return DriveNumber of the drive where collection is located
       
   325 	*/						
       
   326 	virtual TInt32 GetDriveByIdL( TInt aId ) = 0;
       
   327 
       
   328 private: // Extension interface
       
   329 
       
   330 	/**
       
   331 	* This member is internal and not intended for use.
       
   332 	*/
       
   333 	virtual MMediaCollectionManagerExt* Extension()
       
   334 						{ return NULL; }
       
   335 	virtual const MMediaCollectionManagerExt* Extension() const
       
   336 						{ return NULL; }
       
   337 
       
   338     };
       
   339 
       
   340 #endif // MMEDIACOLLECTIONMANAGER_H