mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/ccopyobject.h
branchRCL_3
changeset 9 bee149131e4b
parent 0 a2952bb97e68
child 17 780c925249c1
equal deleted inserted replaced
4:d45095c2f4f3 9:bee149131e4b
    20 #define CCOPYOBJECT_H
    20 #define CCOPYOBJECT_H
    21 
    21 
    22 #include "crequestprocessor.h"
    22 #include "crequestprocessor.h"
    23 
    23 
    24 class RFs;
    24 class RFs;
    25 class CFileMan;
       
    26 class CMTPObjectMetaData;
    25 class CMTPObjectMetaData;
    27 class CMTPTypeObjectPropList;
    26 class CMTPTypeObjectPropList;
    28 class CMTPTypeObjectPropListElement;
    27 class CMTPTypeObjectPropListElement;
    29 class MMmMtpDpConfig;
    28 class MMmMtpDpConfig;
    30 
    29 
    68     /**
    67     /**
    69     * CopyObject request handler
    68     * CopyObject request handler
    70     */
    69     */
    71     IMPORT_C void ServiceL();
    70     IMPORT_C void ServiceL();
    72 
    71 
    73     /**
       
    74     * Set MetaData to CMetadataAccessWrapper, for internal use
       
    75     * @param aPropCode, specify property code of aMediaProp
       
    76     * @param aNewData, object property value which will be get from
       
    77     *    aObjectMetaData
       
    78     * @param aObjectMetaData, owner of the property which should be
       
    79     *    inserted or updated into database
       
    80     * @return response code
       
    81     */
       
    82     IMPORT_C TMTPResponseCode ServiceMetaDataToWrapper( const TUint16 aPropCode,
       
    83             MMTPType& aNewData,
       
    84             const CMTPObjectMetaData& aObject );
       
    85 
       
    86     virtual void ServiceGetSpecificObjectPropertyL( TUint16 aPropCode,
    72     virtual void ServiceGetSpecificObjectPropertyL( TUint16 aPropCode,
    87         TUint32 aHandle,
    73         TUint32 aHandle,
    88         const CMTPObjectMetaData& aObjectMetaData ) = 0;
    74         const CMTPObjectMetaData& aObjectMetaData ) = 0;
    89 
       
    90     virtual TMTPResponseCode ServiceSetSpecificObjectPropertyL( TUint16 aPropCode,
       
    91         const CMTPObjectMetaData& aObject,
       
    92         const CMTPTypeObjectPropListElement& aElement ) = 0;
       
    93 
       
    94     // from CActive
       
    95     IMPORT_C void RunL();
       
    96 
       
    97     IMPORT_C TInt RunError( TInt aError );
       
    98 
    75 
    99 private:
    76 private:
   100     /**
    77     /**
   101     * Retrieve the parameters of the request
    78     * Retrieve the parameters of the request
   102     */
    79     */
   105     void SetDefaultParentObjectL();
    82     void SetDefaultParentObjectL();
   106 
    83 
   107     /**
    84     /**
   108     * Copy object operation
    85     * Copy object operation
   109     */
    86     */
   110     void CopyObjectL( TUint32& aNewHandle );
    87     void CopyObjectL();
   111 
    88 
   112     /**
    89     /**
   113     * Check if we can copy the file to the new location
    90     * Check if we can copy the file to the new location
   114     */
    91     */
   115     TMTPResponseCode CanCopyObjectL( const TDesC& aOldName,
    92     TMTPResponseCode CanCopyObjectL( const TDesC& aOldName,
   116             const TDesC& aNewName ) const;
    93         const TDesC& aNewName ) const;
   117 
    94 
   118     /**
    95     /**
   119     * Save the object properties before doing the copy
    96     * Save the object properties before doing the copy
   120     */
    97     */
   121     void GetPreviousPropertiesL( const CMTPObjectMetaData& aObject );
    98     void GetPreviousPropertiesL( const CMTPObjectMetaData& aObject );
   130     * @param aNewFileName the new full filename after copy.
   107     * @param aNewFileName the new full filename after copy.
   131     * @return objectHandle of new copy of object.
   108     * @return objectHandle of new copy of object.
   132     */
   109     */
   133     TUint32 CopyFileL( const TDesC& aNewFileName );
   110     TUint32 CopyFileL( const TDesC& aNewFileName );
   134 
   111 
   135     /*
       
   136     * Generate the list of handles that need to be copied to the new location.
       
   137     */
       
   138     void GenerateObjectHandleListL( TUint32 aParentHandle );
       
   139 
       
   140     /**
       
   141     * A helper function of CopyObjectL.
       
   142     * @param aNewFolderName the new full file folder name after copy.
       
   143     * @return objecthandle of new copy of the folder.
       
   144     */
       
   145     TUint32 CopyFolderL( const TDesC& aNewFolderName );
       
   146 
       
   147     /**
       
   148     * Set the object properties in the object property store.
       
   149     */
       
   150     void SetPropertiesL( const TDesC& aOldFileName,
       
   151         const TDesC& aNewFileName,
       
   152         const CMTPObjectMetaData& aObject );
       
   153 
       
   154     /**
   112     /**
   155     * Update object info in the database.
   113     * Update object info in the database.
   156     */
   114     */
   157     TUint32 UpdateObjectInfoL( const TDesC& aOldObjectName,
   115     TUint32 AddObjectToStoreL( const TDesC& aOldObjectName,
   158             const TDesC& aNewObjectName);
   116         const TDesC& aNewObjectName );
   159 
       
   160     /*
       
   161     * A helper function of CopyObjectL
       
   162     * Copy a single object and update the database
       
   163     */
       
   164     void CopyAndUpdateL( TUint32 objectHandle );
       
   165 
   117 
   166 protected:
   118 protected:
   167     CMTPTypeObjectPropListElement* iPropertyElement;
   119     CMTPTypeObjectPropListElement* iPropertyElement;
   168     MMmMtpDpConfig& iDpConfig;
   120     MMmMtpDpConfig& iDpConfig;
   169     CMTPTypeObjectPropList* iPropertyList;
   121     CMTPTypeObjectPropList* iPropertyList;
       
   122 
   170 private:
   123 private:
       
   124     TUint32 iStorageId;
   171     CMTPObjectMetaData* iObjectInfo; // Not owned
   125     CMTPObjectMetaData* iObjectInfo; // Not owned
   172     RArray<TUint> iObjectHandles;
       
   173     CFileMan* iFileMan;
       
   174     HBufC* iDest;
   126     HBufC* iDest;
   175     TUint32 iNewParentHandle;
   127     TUint32 iNewParentHandle;
   176     TUint32 iHandle;
       
   177     TUint32 iStorageId;
       
   178     TInt iCopyObjectIndex;
       
   179     TInt iNumberOfObjects;
       
   180     HBufC* iPathToCopy;
       
   181     HBufC* iNewRootFolder;
       
   182     TTime iPreviousModifiedTime;
   128     TTime iPreviousModifiedTime;
   183 
   129 
   184     };
   130     };
   185 
   131 
   186 #endif // CCOPYOBJECT_H
   132 #endif // CCOPYOBJECT_H