mmappcomponents/collectionhelper/inc/mpxcollectionhelperimp.h
changeset 0 a2952bb97e68
child 45 09978a29cfde
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Collection helper implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMPXCOLLECTIONHELPERIMP_H
       
    20 #define CMPXCOLLECTIONHELPERIMP_H
       
    21 
       
    22 #include "mpxcollectionhelper.h"
       
    23 #include "mpxharvesterutilityobserver.h"
       
    24 #include "mpxmediatorobserver.h"
       
    25 
       
    26 // FOWARD DECLARATION
       
    27 class MMPXHarvesterUtility;
       
    28 class MMPXCollectionUtility;
       
    29 class CMPXCollectionPath;
       
    30 class CMPXMedia;
       
    31 class CMPXCollectionMediator;
       
    32 
       
    33 /**
       
    34  *  CMPXCollectionHelperImp
       
    35  *
       
    36  *  Wrapper implementation around collection utility
       
    37  *
       
    38  *  @lib mpxcollectionhelper.lib
       
    39  *  @since S60 3.1
       
    40  */
       
    41 NONSHARABLE_CLASS( CMPXCollectionHelperImp ): public CBase,
       
    42                                               public MMPXCollectionHelper,
       
    43                                               public MMPXHarvesterUtilityObserver,
       
    44                                               public MMPXMediatorObserver
       
    45     {
       
    46 public:
       
    47 
       
    48     /**
       
    49     * Two phased constructor
       
    50     */
       
    51     static CMPXCollectionHelperImp* NewL();
       
    52 
       
    53     /**
       
    54     * Two phased constructor
       
    55     */
       
    56     static CMPXCollectionHelperImp* NewLC();
       
    57 
       
    58     /**
       
    59     * Virtual destructor
       
    60     */
       
    61     virtual ~CMPXCollectionHelperImp();
       
    62 
       
    63 protected: // From MMPXCollectionHelper
       
    64 
       
    65     /**
       
    66     * Asynchronously adds supported song file or a playlist file to the
       
    67     * collection and registers it with Harvester so it won't be re-parsed
       
    68     * unnecessarily during next scan/refresh.
       
    69     *
       
    70     * For a song file, its metadata will be extracted stored in the collection.
       
    71     *
       
    72     * For a playlist file, it will be parsed and added to the collection. If
       
    73     * the playlist refers to songs that already exist in the collection, any
       
    74     * song metadata provided in the playlist file will be ignored. If the
       
    75     * playlist refers to songs that do not exist in the collection, they
       
    76     * will be added to the collection with the metadata provided in the
       
    77     * playlist file, if any. However, these songs are NOT registered with
       
    78     * Harvester; hence, during next scan/refresh, these songs will be scanned
       
    79     * and updated in the collection unnecessarily and cause scan/refresh
       
    80     * performance degradation. If any metadata of these songs is changed in
       
    81     * the collection before next scan/refresh, it will be lost after
       
    82     * scan/refresh.
       
    83     *
       
    84     *   WARNING:
       
    85     *       Client must add the songs to the collection prior to adding the
       
    86     *       playlist.
       
    87     *
       
    88     * @param aFile, full path and name of the file which is a supported media
       
    89     *        type. KErrNotSupported if file type is not supported.
       
    90     *
       
    91     * @aObserver observer for the callback, HandleAddFileCompleteL. If NULL,
       
    92     * no callback is issued.
       
    93     *
       
    94     * If client is interested in the id of the song/playlist added, client
       
    95     * can retrieve it via GetL or FindAllL.
       
    96     */
       
    97     void AddL( const TDesC& aFile, MMPXCollectionHelperObserver* aObserver );
       
    98 
       
    99     /**
       
   100     * Add a song or a playlist synchronously
       
   101     *
       
   102     * @param aMedia, media to be added.
       
   103     *
       
   104     * To add a song to the collection, the media provided MUST
       
   105     * contain the following attributes:
       
   106     *    KMPXMediaGeneralType:
       
   107     *       must be EMPXItem
       
   108     *
       
   109     *    KMPXMediaGeneralCategory:
       
   110     *       must be EMPXSong
       
   111     *
       
   112     *    KMPXMediaGeneralUri:
       
   113     *       full path of the song. Only supporting local path, i.e. path
       
   114     *       must starts with a drive letter.
       
   115     *
       
   116     *    Client must provide the metadata by filling other attributes. This
       
   117     *    song will be registered with Harvester so that it will not be
       
   118     *    unnecessarily scanned during the next scan/refresh.
       
   119     *
       
   120     * To add a playlist to the collection, the media provided MUST
       
   121     * contain the following attributes:
       
   122     *    KMPXMediaGeneralType:
       
   123     *       must be EMPXItem
       
   124     *
       
   125     *    KMPXMediaGeneralCategory:
       
   126     *       must be EMPXPlaylist
       
   127     *
       
   128     *    KMPXMediaGeneralUri:
       
   129     *       Provide full path of the playlist if there is an associated
       
   130     *       physical playlist file.; otherwise, provide the path and
       
   131     *       directory where the playlist should be located (e.g. e:\playlists\).
       
   132     *       In the later case, playlist will be created in the collection
       
   133     *       as a virtual playlist and URI will be generated. If client is
       
   134     *       interested in this generated URI, client can perform a search
       
   135     *       based on the returned Id. Only supporting local path, i.e. path
       
   136     *       must starts with a drive letter.
       
   137     *
       
   138     *    KMPXMediaGeneralTitle:
       
   139     *       Title of the playlist is NOT enforced be unique within the
       
   140     *       music collection.
       
   141     *
       
   142     *    KMPXMediaArrayCount:
       
   143     *    KMPXMediaArrayContents:
       
   144     *       This playlist can be an empty playlist. If this is the case,
       
   145     *       KMPXMediaArrayContents will be a CMPXMediaArray that doesn't
       
   146     *       contain any media and KMPXMediaArrayCount will be 0.
       
   147     *
       
   148     *       Each CMPXMedia contained in the media array represents
       
   149     *       a song. Each song must contain the following attributes:
       
   150     *           KMPXMediaGeneralType:
       
   151     *               must be EMPXItem
       
   152     *
       
   153     *           KMPXMediaGeneralCategory:
       
   154     *               must be EMPXSong
       
   155     *
       
   156     *       For songs that already exist in the collection, client
       
   157     *       must provide either KMPXMediaGeneralId or KMPXMediaGeneralUri.
       
   158     *
       
   159     *       For songs that do not exist in the collection, client
       
   160     *       must provide KMPXMediaGeneralUri and its metadata.
       
   161     *       These songs will be added to the music collection when
       
   162     *       the playlist is added. These songs added to the collection
       
   163     *       are NOT registered with Harvester; hence, during next
       
   164     *       scan/refresh, these songs will be scanned and updated in
       
   165     *       the collection unnecessarily and cause scan/refresh
       
   166     *       performance degradation. If any metadata of these songs is
       
   167     *       changed in the collection before next scan/refresh, it will
       
   168     *       be lost after scan/refresh.
       
   169     *
       
   170     *       WARNING:
       
   171     *       Client must add the songs to the collection prior to adding
       
   172     *       the playlist.
       
   173     *
       
   174     *    WARNING:
       
   175     *    This playlist is NOT registered with Harvester. If client
       
   176     *    creates a physical playlist file, Harvester will re-parse
       
   177     *    and update the playlist in the collection during the next
       
   178     *    scan/refresh unnecessarily and cause scan/refresh performance
       
   179     *    degradation. If this playlist is edited, the physical
       
   180     *    playlist file is NOT updated to reflect the changes.
       
   181     *
       
   182     * This API does not support adding songs to a saved playlist.
       
   183     *
       
   184     * This method will leave with KErrArgument if any mandatory
       
   185     * is missing.
       
   186     *
       
   187     * If client is interested in the id of the song/playlist added,
       
   188     * client can retrieve it via this aMedia upon return of this
       
   189     * method. e.g.
       
   190     *
       
   191     *    TMPXItemId mediaId = aMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
       
   192     */
       
   193     void AddL( CMPXMedia* aMedia );
       
   194 
       
   195     /**
       
   196     * Remove a song or a playlist from the collection. The correlating
       
   197     * file is not removed from the file system but this file is
       
   198     * de-registered with Harvester; hence, if the file isn't deleted
       
   199     * from the file system before the next scan/refresh, it will be
       
   200     * added back to the collection when scan/refresh is performed.
       
   201     *
       
   202     * @param aFile, file to remove.
       
   203     * @param aItemCat, category of the media to be removed. Either
       
   204     *        EMPXSong or EMPXPlaylist. Other categories, e.g. EMPXArtist,
       
   205     *        EMPXAlbum, EMPXGenre, and EMPXComposer cannot be removed
       
   206     *        from the collection with this method, they need to be removed
       
   207     *        from the collection via collection path.
       
   208     */
       
   209     void RemoveL( const TDesC& aFile, TMPXGeneralCategory aItemCat = EMPXSong  ); //lint !e1735
       
   210 
       
   211     /**
       
   212     * Remove all medias from the music collection regardless which drive
       
   213     * the medias are located and clear harvester's file registry. If the
       
   214     * media correlates to a file, the correlating file is not deleted from
       
   215     * the file system. If the file still exist during the next scan/refresh,
       
   216     * it will be added back to the collection.
       
   217     *
       
   218     *
       
   219     */
       
   220     void RemoveAllL();
       
   221 
       
   222     /**
       
   223     * Delete all records that have been marked as deleted.
       
   224     *
       
   225     * This API is dedicated to MTP and will leave with KErrNotSupported for
       
   226     * this implementation.
       
   227     */
       
   228     void CleanupDeletedMediasL();
       
   229 
       
   230     /**
       
   231     * Updates a media in the collection synchronously. For performance
       
   232     * consideration, it is recommended that client only sets the attribute
       
   233     * that needs to be updated.
       
   234     *
       
   235     * @param aMedia, media to be updated.
       
   236     *
       
   237     *        To update a song in the collection, the media provided MUST
       
   238     *        contain the following attributes:
       
   239     *           KMPXMediaGeneralType:
       
   240     *               must be EMPXItem
       
   241     *
       
   242     *           KMPXMediaGeneralCategory:
       
   243     *               must be EMPXSong
       
   244     *
       
   245     *           KMPXMediaGeneralUri:
       
   246     *               full path of the song. Only supporting local path,
       
   247     *               i.e. path must starts with a drive letter.
       
   248     *
       
   249     *        Additionally, this media should provide one or more of the
       
   250     *        following attributes for update:
       
   251     *               KMPXMediaGeneralTitle
       
   252     *               KMPXMediaGeneralComment
       
   253     *               KMPXMediaGeneralSynchronized
       
   254     *               KMPXMediaGeneralDeleted
       
   255     *               KMPXMediaGeneralModified
       
   256     *               KMPXMediaGeneralCopyright
       
   257     *               KMPXMediaGeneralDuration
       
   258     *               KMPXMediaGeneralFlags
       
   259     *               KMPXMediaGeneralPlayCount
       
   260     *               KMPXMediaGeneralLastPlaybackTime
       
   261     *           KMPXMediaIdMusic:
       
   262     *               KMPXMediaMusicArtist
       
   263     *               KMPXMediaMusicAlbum
       
   264     *               KMPXMediaMusicAlbumTrack
       
   265     *               KMPXMediaMusicGenre
       
   266     *               KMPXMediaMusicComposer
       
   267     *               KMPXMediaMusicYear
       
   268     *               KMPXMediaMusicRating
       
   269     *               KMPXMediaMusicAlbumArtFileName
       
   270     *               KMPXMediaMusicURL
       
   271     *           KMPXMediaIdAudio:
       
   272     *               KMPXMediaAudioSamplerate
       
   273     *               KMPXMediaAudioBitrate
       
   274     *               KMPXMediaAudioNumberOfChannels
       
   275     *           KMPXMediaIdDrm:
       
   276     *               KMPXMediaDrmType
       
   277     *           KMPXMediaIdMTP:
       
   278     *               KMPXMediaMTPDrmStatus
       
   279     *
       
   280     *        To update a playlist in the collection, the media provided MUST
       
   281     *        contain the following attributes:
       
   282     *           KMPXMediaGeneralType:
       
   283     *               must be EMPXItem
       
   284     *
       
   285     *           KMPXMediaGeneralCategory:
       
   286     *               must be EMPXPlaylist
       
   287     *
       
   288     *           KMPXMediaGeneralUri:
       
   289     *               full path of the playlist. Only supporting local path,
       
   290     *               i.e. path must starts with a drive letter.
       
   291     *
       
   292     *        If the media contains KMPXMediaArrayContents attribute, the
       
   293     *        content of the playlist will be overwritten with the new media
       
   294     *        array. If this attribute contains a CMPXMediaArray of 0 element,
       
   295     *        all songs in this playlist will be removed from the playlist
       
   296     *        (songs will remain in the collection and file system).
       
   297     *        e.g.
       
   298     *        1) "Playlist" originally contains "Song1", "Song2", and "Song3".
       
   299     *           If KMPXMediaArrayContents contains a CMPXMediaArray that
       
   300     *           contains "Song3" and "Song4", "Playlist" will be updated to
       
   301     *           contain "Song3" and "Song4".
       
   302     *        2) "Playlist" originally contains "Song1", "Song2", and "Song3".
       
   303     *           If KMPXMediaArrayContents contains a CMPXMediaArray that
       
   304     *           contains 0 element, "Playlist" will be updated so that it
       
   305     *           doesn't contain any songs. "Song1", "Song2", and "Song3"
       
   306     *           will remain in the collection.
       
   307     *
       
   308     *       If the media contains any of the following attributes, the
       
   309     *       playlist will be updated accordingly:
       
   310     *               KMPXMediaGeneralTitle
       
   311     *               KMPXMediaGeneralSynchronized
       
   312     *               KMPXMediaGeneralDeleted (DEPRECATED)
       
   313     *               KMPXMediaGeneralModified (DEPRECATED)
       
   314     *
       
   315     *       NOTE: If a client wishes to change the playlist title and modify
       
   316     *             its contents (i.e. the songs it includes), client needs to
       
   317     *             perform two separate SetL operations; one to update the
       
   318     *             playlist title providing KMPXMediaGeneralTitle attribute
       
   319     *             and the other to update its contents by providing
       
   320     *             KMPXMediaArrayContents.
       
   321     *
       
   322     */
       
   323     void SetL( CMPXMedia*& aMedia );
       
   324 
       
   325     /**
       
   326     * Changes the URI of a song or a playlist.
       
   327     *
       
   328     * @param aOldUri exiting URI of the song or playlist
       
   329     * @param aNewUri of the song or playlist
       
   330     *
       
   331     *   If a client requests the URI of a song to be changed, the corresponding
       
   332     *   song file will NOT be moved to the new location. Harvester's file registration
       
   333     *   will be updated, as well as the collection. Client MUST ensure that there
       
   334     *   is not already a file at the specified new location in the file system
       
   335     *   (Same restrictions as RFs::Rename) and the collection.
       
   336     *
       
   337     *   WARNING: For virtual playlists (i.e. playlists created from the device.
       
   338     *            They are referred to as virtual because there is no physical
       
   339     *            playlist file created), client MUST ensure the new URI doesn't
       
   340     *            clash with any existing playlist in the collection, as well as
       
   341     *            in the file system. Changing their filenames is NOT recommended.
       
   342     *            If a client wishes to change the extension of the virtual playlist,
       
   343     *            it's recommended the extension is changed to an extension that's
       
   344     *            not supported by any playlist plugin exists in the system.
       
   345     *
       
   346     *   Upon successful completion of this operation, the Id of the song/playlist
       
   347     *   will be changed in the collection. If client is interested in the Id of
       
   348     *   this media hereafter, GetL or FindAllL can be performed (search by new URI).
       
   349     *
       
   350     * @param aItemCat category of the file, either EMPXSong or EMPXPlaylist;
       
   351     *        otherwise, this method leaves with KErrArgument.
       
   352     */
       
   353     void RenameL( const TDesC& aOldUri,
       
   354                   const TDesC& aNewUri,
       
   355                   TMPXGeneralCategory aItemCat );
       
   356 
       
   357     /**
       
   358     * Gets the media for the song or playlist via its URI
       
   359     *
       
   360     * @param aFile, path of the song/playlist
       
   361     * @param aAttrs, what attributes to get back.
       
   362     *        Supported attributes for songs are:
       
   363     *           KMPXMediaIdGeneral:
       
   364     *               KMPXMediaGeneralId
       
   365     *               KMPXMediaGeneralTitle
       
   366     *               KMPXMediaGeneralUri
       
   367     *               KMPXMediaGeneralDrive
       
   368     *               KMPXMediaGeneralDuration
       
   369     *               KMPXMediaGeneralDate
       
   370     *               KMPXMediaGeneralComment
       
   371     *               KMPXMediaGeneralMimeType
       
   372     *               KMPXMediaGeneralSynchronized
       
   373     *               KMPXMediaGeneralDeleted
       
   374     *               KMPXMediaGeneralModified
       
   375     *               KMPXMediaGeneralCopyright
       
   376     *               KMPXMediaGeneralFlags
       
   377     *               KMPXMediaGeneralPlayCount
       
   378     *               KMPXMediaGeneralLastPlaybackTime
       
   379     *           KMPXMediaIdMusic:
       
   380     *               KMPXMediaMusicArtist
       
   381     *               KMPXMediaMusicAlbum
       
   382     *               KMPXMediaMusicAlbumTrack
       
   383     *               KMPXMediaMusicGenre
       
   384     *               KMPXMediaMusicComposer
       
   385     *               KMPXMediaMusicYear
       
   386     *               KMPXMediaMusicRating
       
   387     *               KMPXMediaMusicAlbumArtFileName
       
   388     *               KMPXMediaMusicURL
       
   389     *           KMPXMediaIdAudio:
       
   390     *               KMPXMediaAudioSamplerate
       
   391     *               KMPXMediaAudioBitrate
       
   392     *               KMPXMediaAudioNumberOfChannels
       
   393     *               KMPXMediaAudioCodec
       
   394     *           KMPXMediaIdMTP:
       
   395     *               KMPXMediaMTPDrmStatus
       
   396     *
       
   397     *        Supported attributes for playlists are:
       
   398     *           KMPXMediaIdGeneral:
       
   399     *               KMPXMediaGeneralId
       
   400     *               KMPXMediaGeneralCollectionId
       
   401     *               KMPXMediaGeneralTitle
       
   402     *               KMPXMediaGeneralUri
       
   403     *               KMPXMediaGeneralDrive
       
   404     *               KMPXMediaGeneralSynchronized
       
   405     *               KMPXMediaGeneralDeleted (DEPRECATED)
       
   406     *               KMPXMediaGeneralModified (DEPRECATED)
       
   407     *               KMPXMediaGeneralFlags
       
   408     *               KMPXMediaGeneralCount
       
   409     *               KMPXMediaGeneralDate
       
   410     *
       
   411     * @param aItemCat category of the file, either EMPXSong or
       
   412     *        EMPXPlaylist; otherwise, this method leaves with
       
   413     *        KErrArgument.
       
   414     *
       
   415     * @return media object representing the given file with
       
   416     *         the requested attributes. Note that the playlist
       
   417     *         media object does not contain songs included in
       
   418     *         the playlist. If client is interested in finding
       
   419     *         the songs in the playlist, FindAllL can be used
       
   420     *         (please see #2 in FindAllL).
       
   421     */
       
   422     CMPXMedia* GetL( const TDesC& aFile,
       
   423                      const TArray<TMPXAttribute>& aAttrs,
       
   424                      TMPXGeneralCategory aItemCat );
       
   425 
       
   426     /**
       
   427     * Gets the media for the song or playlist via its URI
       
   428     *
       
   429     * This implementation do not support this method.
       
   430     */
       
   431     const CMPXMedia& GetL( const TDesC& aFile,
       
   432                            TMPXGeneralCategory aItemCat );
       
   433 
       
   434     /**
       
   435     * Find media(s) in music collection.
       
   436     *
       
   437     * @param aCriteria, criteria to search upon
       
   438     *
       
   439     * 1) To find all songs in the collection, here are the mandatory attributes:
       
   440     *    KMPXMediaGeneralType:
       
   441     *       must be EMPXGroup
       
   442     *
       
   443     *    KMPXMediaGeneralCategory:
       
   444     *       must be EMPXSong
       
   445     *
       
   446     *    If the following optional attributes are provided, the search results
       
   447     *    are narrowed down further: (these attributes can be combined)
       
   448     *       KMPXMediaGeneralTitle
       
   449     *           ==> songs with the specified title
       
   450     *       KMPXMediaGeneralDrive
       
   451     *           ==> songs in the specified drive
       
   452     *       KMPXMediaGeneralSynchronized
       
   453     *           ==> songs that are/are not synchronized through MTP
       
   454     *       KMPXMediaGeneralDeleted
       
   455     *           ==> songs that are/are not marked as deleted since the last MTP
       
   456     *               session
       
   457     *       KMPXMediaGeneralModified
       
   458     *           ==> songs that are/are not modified since the last MTP session
       
   459     *
       
   460     * 2) To find all songs for a particular artist/album/genre/composer/playlist
       
   461     *    in the collection, here are the mandatory attributes:
       
   462     *    KMPXMediaGeneralType:
       
   463     *       must be EMPXGroup
       
   464     *
       
   465     *    KMPXMediaGeneralCategory:
       
   466     *       must be EMPXSong
       
   467     *
       
   468     *    KMPXMediaIdGeneralId:
       
   469     *       the Id of the artist/album/genre/composer/playlist
       
   470     *
       
   471     *    NOTE: Songs in an album are sorted by album track, then title, except
       
   472     *          for songs in the unknown album. Songs in the unknown album are
       
   473     *          sorted by title.
       
   474     *
       
   475     * 3) To find all songs for a particular album of an artist in the collection,
       
   476     *    here are the mandatory attributes:
       
   477     *    KMPXMediaGeneralType:
       
   478     *       must be EMPXGroup
       
   479     *
       
   480     *    KMPXMediaGeneralCategory:
       
   481     *       must be EMPXSong
       
   482     *
       
   483     *    KMPXMediaIdGeneralId:
       
   484     *       the Id of the album
       
   485     *
       
   486     *    KMPXMediaGeneralContainerId:
       
   487     *       the Id of the artist
       
   488     *
       
   489     *    NOTE: These songs are sorted by album track, then title, except
       
   490     *          for songs in the unknown album. Songs in the unknown album are
       
   491     *          sorted by title.
       
   492     *
       
   493     * 4)To find a particular song, here are the mandatory attributes:
       
   494     *    KMPXMediaGeneralType:
       
   495     *       must be EMPXItem
       
   496     *
       
   497     *    KMPXMediaGeneralCategory:
       
   498     *       must be EMPXSong
       
   499     *
       
   500     *    And one or all of the following attributes:
       
   501     *       KMPXMediaGeneralUri
       
   502     *       KPXMediaIdGeneralId
       
   503     *
       
   504     * 5) To find all artists/albums/genres/composers/playlists in the
       
   505     *    collection, here are the mandatory attributes:
       
   506     *    KMPXMediaGeneralType:
       
   507     *       must be EMPXGroup
       
   508     *
       
   509     *    KMPXMediaGeneralCategory:
       
   510     *       must be EMPXArtist for artists
       
   511     *               EMPXAlbum for albums
       
   512     *               EMPXGenre for genres
       
   513     *               EMPXComposer for composers
       
   514     *               EMPXPlaylist for playlists
       
   515     *
       
   516     *    If the following optional attributes are provided for playlists,
       
   517     *    the search results are narrowed down further: (these attributes
       
   518     *    can be combined)
       
   519     *       KMPXMediaGeneralDrive
       
   520     *           ==> playlists in the specified drive
       
   521     *       KMPXMediaGeneralSynchronized
       
   522     *           ==> playlists that are/are not synchronized through MTP
       
   523     *       KMPXMediaGeneralDeleted (DEPRECATED)
       
   524     *           ==> playlists that are/are not marked as deleted since the last MTP
       
   525     *               session
       
   526     *       KMPXMediaGeneralModified (DEPRECATED)
       
   527     *           ==> playlists that are/are not modified since the last MTP session
       
   528     *
       
   529     *    NOTE: results returned do not contain songs included in
       
   530     *          the category. To obtain songs included in the category,
       
   531     *          please refer to 2 and/or 3.
       
   532     *
       
   533     * 6) To find a particular playlist in the collection, here are the mandatory
       
   534     *    attributes:
       
   535     *    KMPXMediaGeneralType:
       
   536     *       must be EMPXItem
       
   537     *
       
   538     *    KMPXMediaGeneralCategory:
       
   539     *       must be EMPXPlaylist
       
   540     *
       
   541     *    And one or all of the following attributes:
       
   542     *       KMPXMediaGeneralUri
       
   543     *       KMPXMediaGeneralTitle
       
   544     *       KMPXMediaIdGeneralId
       
   545     *
       
   546     *    NOTE: results returned do not contain songs included in the playlist.
       
   547     *          To obtain songs included in the playlist, please refer to 2.
       
   548     *
       
   549     * 7) To find a particular artist/album/genre/composer in the collection, here
       
   550     *    are the mandatory attributes:
       
   551     *    KMPXMediaGeneralType:
       
   552     *       must be EMPXItem
       
   553     *
       
   554     *    KMPXMediaGeneralCategory:
       
   555     *       must be EMPXArtist for artist
       
   556     *               EMPXAlbum for album
       
   557     *               EMPXGenre for genre
       
   558     *               EMPXComposer for composer
       
   559     *
       
   560     *    And one or all of the following attributes:
       
   561     *       KMPXMediaGeneralTitle
       
   562     *       KMPXMediaIdGeneralId
       
   563     *
       
   564     *    NOTE:
       
   565     *    a) results returned do not contain songs included in the category.
       
   566     *       To obtain songs included in the category, please refer to 2.
       
   567     *    b) unknown artist/album/genre/composer will be the last item in
       
   568     *       the result array
       
   569     *
       
   570     * @param aAttrs, attributes to return
       
   571     *        Supported attributes for songs are:
       
   572     *           KMPXMediaIdGeneral:
       
   573     *               KMPXMediaGeneralId
       
   574     *               KMPXMediaGeneralTitle
       
   575     *               KMPXMediaGeneralUri
       
   576     *               KMPXMediaGeneralDrive
       
   577     *               KMPXMediaGeneralDuration
       
   578     *               KMPXMediaGeneralDate
       
   579     *               KMPXMediaGeneralComment
       
   580     *               KMPXMediaGeneralMimeType
       
   581     *               KMPXMediaGeneralSynchronized
       
   582     *               KMPXMediaGeneralDeleted
       
   583     *               KMPXMediaGeneralModified
       
   584     *               KMPXMediaGeneralCopyright
       
   585     *               KMPXMediaGeneralFlags
       
   586     *               KMPXMediaGeneralPlayCount
       
   587     *               KMPXMediaGeneralLastPlaybackTime
       
   588     *           KMPXMediaIdMusic:
       
   589     *               KMPXMediaMusicArtist
       
   590     *               KMPXMediaMusicAlbum
       
   591     *               KMPXMediaMusicAlbumTrack
       
   592     *               KMPXMediaMusicGenre
       
   593     *               KMPXMediaMusicComposer
       
   594     *               KMPXMediaMusicYear
       
   595     *               KMPXMediaMusicRating
       
   596     *               KMPXMediaMusicAlbumArtFileName
       
   597     *               KMPXMediaMusicURL
       
   598     *           KMPXMediaIdAudio:
       
   599     *               KMPXMediaAudioSamplerate
       
   600     *               KMPXMediaAudioBitrate
       
   601     *               KMPXMediaAudioNumberOfChannels
       
   602     *               KMPXMediaAudioCodec
       
   603     *           KMPXMediaIdMTP:
       
   604     *               KMPXMediaMTPDrmStatus
       
   605     *
       
   606     *        Supported attributes for playlists are:
       
   607     *           KMPXMediaIdGeneral:
       
   608     *               KMPXMediaGeneralId
       
   609     *               KMPXMediaGeneralCollectionId
       
   610     *               KMPXMediaGeneralTitle
       
   611     *               KMPXMediaGeneralUri
       
   612     *               KMPXMediaGeneralDrive
       
   613     *               KMPXMediaGeneralSynchronized
       
   614     *               KMPXMediaGeneralDeleted (DEPRECATED)
       
   615     *               KMPXMediaGeneralModified (DEPRECATED)
       
   616     *               KMPXMediaGeneralFlags
       
   617     *               KMPXMediaGeneralCount
       
   618     *               KMPXMediaGeneralDate
       
   619     *
       
   620     *        Supported attributes for artists/albums/genres/composers are:
       
   621     *           KMPXMediaIdGeneral:
       
   622     *               KMPXMediaGeneralId
       
   623     *               KMPXMediaGeneralTitle
       
   624     *
       
   625     * @return search results. The returned media contains the following
       
   626     *         attributes:
       
   627     *           KMPXMediaGeneralType:
       
   628     *               EMPXGroup
       
   629     *
       
   630     *           KMPXMediaGeneralCategory:
       
   631     *               the category of the found media(s), e.g. EMPXSong for
       
   632     *               scenarios 1-4.
       
   633     *
       
   634     *           KMPXMediaArrayCount:
       
   635     *               the number of matching media(s). 0 if no match found.
       
   636     *
       
   637     *           KMPXMediaArrayContents:
       
   638     *               this array contains the found media(s). If client
       
   639     *               was looking for songs, each media in the array
       
   640     *               represents a song, similarly for artists, albums, genres,
       
   641     *               composers, and playlists. Each media contains
       
   642     *                   KMPXMediaGeneralType:
       
   643     *                       EMPXItem
       
   644     *                   KMPXMediaGeneralCategory:
       
   645     *                       category of the found media
       
   646     *
       
   647     *                   The rest of the attributes returned are as specified
       
   648     *                   by the aAttrs parameter.
       
   649     */
       
   650     CMPXMedia* FindAllL( CMPXMedia& aCriteria,
       
   651                          const TArray<TMPXAttribute>& aAttrs );
       
   652 
       
   653     /**
       
   654     * Frees this object
       
   655     */
       
   656     void Close();
       
   657 
       
   658 protected: // From Base Class
       
   659 
       
   660     /**
       
   661     * From MMPXHarvesterUtilityObserver
       
   662     */
       
   663     void HandlePlaylistExportCompletedL( CMPXMedia* aProp,
       
   664                                          TInt aErr );
       
   665 
       
   666     /**
       
   667     * From MMPXHarvesterUtilityObserver
       
   668     */
       
   669     void HandlePlaylistImportCompletedL( CMPXMedia* aProp,
       
   670                                          TInt aErr );
       
   671 
       
   672     /**
       
   673     * From MMPXHarvesterUtilityObserver
       
   674     */
       
   675     void HandleFileAddCompletedL( CMPXMedia* aProp,
       
   676                                   TInt aErr );
       
   677 
       
   678     /**
       
   679     * From MMPXHarvesterUtilityObserver
       
   680     */
       
   681     void HandleDeleteCompletedL( TInt aErr );
       
   682 
       
   683     /**
       
   684     * From MMPXMediatorObserver
       
   685     */
       
   686     void HandleMediatorPathUpdatedL( CMPXMedia*& aMedia,
       
   687                                      TUid  aOldPath  );
       
   688     /**
       
   689     * From MMPXHarvesterUtilityObserver
       
   690     */
       
   691     void HandleFileImportCompletedL( CMPXMedia* aMedia, TInt aErr  );
       
   692 
       
   693     /**
       
   694     * From MMPXHarvesterUtilityObserver
       
   695     */
       
   696     void HandleFileGetMediaCompletedL( CMPXMedia* aMedia, TInt aErr );
       
   697 
       
   698 private:
       
   699 
       
   700     /**
       
   701     * Adds the file to the collection, constructs the collection path
       
   702     * @param aMedia media item to add to the collection
       
   703     */
       
   704     void DoAddToCollectionL( CMPXMedia* aMedia );
       
   705 
       
   706 protected:
       
   707 
       
   708     /**
       
   709     * Private Constructor
       
   710     */
       
   711     CMPXCollectionHelperImp();
       
   712 
       
   713     /**
       
   714     * 2nd Phased constructor
       
   715     */
       
   716     void ConstructL();
       
   717 
       
   718 protected: // data
       
   719 
       
   720     MMPXHarvesterUtility*   iHvsUtility;
       
   721     MMPXCollectionUtility*  iCollectionUtil;
       
   722     CMPXCollectionMediator* iMediator;
       
   723 
       
   724     MMPXCollectionHelperObserver* iObserver;  // not owned
       
   725     TUid                          iMusicCollectionId;
       
   726     TBool                         iInitialized;
       
   727     };
       
   728 
       
   729 #endif // CMPXCOLLECTIONHELPERIMP_H