mmappcomponents/harvester/inc/mpxharvesterfilehandler.h
changeset 0 a2952bb97e68
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:  File handler class to handle file scanning related events
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMPXHARVESTERFILEHANDLER_H
       
    20 #define CMPXHARVESTERFILEHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <f32file.h>
       
    24 #include <bamdesca.h>
       
    25 #include <mpxharvestercommon.h>
       
    26 
       
    27 // Foward Declaration
       
    28 class CMPXMedia;
       
    29 
       
    30 /**
       
    31  *  File handler class to handle file scanning related events
       
    32  *
       
    33  *  @lib mpxfilehandler.lib
       
    34  *  @since S60 3.0
       
    35  */
       
    36 class CMPXHarvesterFileHandler : public CBase
       
    37 
       
    38     {
       
    39 public:
       
    40 
       
    41     /**
       
    42     * Two-Phased Constructor
       
    43     * @param aFs file server session
       
    44     */
       
    45     IMPORT_C static CMPXHarvesterFileHandler* NewL( RFs& aFs );
       
    46 
       
    47     /**
       
    48     * Virtual destructor
       
    49     */
       
    50     virtual ~CMPXHarvesterFileHandler();
       
    51 
       
    52     /**
       
    53     * Scan all drives for files
       
    54     */
       
    55     virtual void ScanL() = 0;
       
    56 
       
    57     /**
       
    58     * Cancel the scanning operation
       
    59     */
       
    60     virtual void CancelScan() = 0;
       
    61 
       
    62     /**
       
    63     * Handles a system event
       
    64     * @param aEvent, the event
       
    65     * @param aData, event specific data
       
    66     */
       
    67     virtual void HandleSystemEventL( TSystemEvent aEvent,
       
    68                                      TInt aData ) = 0;
       
    69 
       
    70     /**
       
    71     * Add a file to the db
       
    72     * @param aPath File to add
       
    73     * @return CMPXMedia object for the item pointed to by aPath
       
    74     *         ownership transferred
       
    75     */
       
    76     virtual CMPXMedia* AddFileL( const TDesC& aPath ) = 0;
       
    77 
       
    78     /**
       
    79     * Add a file to the db
       
    80     * @param aMediaProp Media Property to add
       
    81     * @return TInt collection ID for the item added
       
    82     */
       
    83     virtual TInt AddFileL( CMPXMedia& aMediaProp ) = 0;
       
    84 
       
    85     /**
       
    86     * Remove a file from the db
       
    87     * @param aPath, File to remove
       
    88     * @return Collection ID of the removed file
       
    89     */
       
    90     virtual TInt RemoveFileL( const TDesC& aPath, TBool aEndTransaction ) = 0;
       
    91 
       
    92     /**
       
    93     * Remove multiple files from the db
       
    94     * @param aArray, array of files to remove
       
    95     */
       
    96     virtual void RemoveFilesL( const MDesCArray& aFilePaths ) = 0;
       
    97 
       
    98     /**
       
    99     * Remove all files from the db
       
   100     */
       
   101     virtual void RemoveAllFilesL() = 0;
       
   102 
       
   103     /**
       
   104     * Update a file with a new collection and time stamp
       
   105     * @param aFile, file path
       
   106     * @param aCollection, Collection ID (UID)
       
   107     */
       
   108     virtual void UpdateFileL( const TDesC& aFile, TInt aCollection ) = 0;
       
   109 
       
   110     /**
       
   111     * Rename a file
       
   112     * @param aOldPath, the existing file path
       
   113     * @param aNewPath, the new file path
       
   114     * @param aCollection, Collection ID (UID)
       
   115     */
       
   116     virtual void RenameFileL( const TDesC& aOldPath, const TDesC& aNewPath, TInt aCollection ) = 0;
       
   117 
       
   118     /**
       
   119     * Find the associated collection ID with a file
       
   120     * @return TInt containing the associated collection ID for a file
       
   121     */
       
   122     virtual TInt FindCollectionIdL( const TDesC& aFile ) = 0;
       
   123 
       
   124     /**
       
   125     * Recreate the harvester database
       
   126     * (To handle corruption )
       
   127     */
       
   128     virtual void RecreateDatabases() = 0;
       
   129 
       
   130     /**
       
   131     * Close harvester database transaction
       
   132     */
       
   133     virtual void CloseTransactionL() = 0;
       
   134 
       
   135     /**
       
   136     * Get a media object for the file
       
   137     * @param aPath File to add
       
   138     * @return CMPXMedia object for the item pointed to by aPath
       
   139     *         ownership transferred
       
   140     */
       
   141     virtual CMPXMedia* GetMediaForFileL( const TDesC& aPath ) = 0;
       
   142 
       
   143     /**
       
   144     * Get Collection Uid for the file
       
   145     * @param aMediaProp Media Property to add
       
   146     * @return TInt collection ID for the item added
       
   147     */
       
   148     virtual TInt GetColUidForFileL( const TDesC& aPath ) = 0;
       
   149     };
       
   150 
       
   151 #endif // CMPXHARVESTERFILEHANDLER_H