mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/inc/ccopyobject.h
branchRCL_3
changeset 17 780c925249c1
parent 9 bee149131e4b
equal deleted inserted replaced
15:d240f0a77280 17:780c925249c1
    19 #ifndef CCOPYOBJECT_H
    19 #ifndef CCOPYOBJECT_H
    20 #define CCOPYOBJECT_H
    20 #define CCOPYOBJECT_H
    21 
    21 
    22 #include "crequestprocessor.h"
    22 #include "crequestprocessor.h"
    23 
    23 
    24 class RFs;
       
    25 class CMTPObjectMetaData;
    24 class CMTPObjectMetaData;
    26 class CMTPTypeObjectPropList;
    25 class CMTPTypeObjectPropList;
    27 class CMTPTypeObjectPropListElement;
    26 class CMTPTypeObjectPropListElement;
    28 class MMmMtpDpConfig;
    27 class MMmMtpDpConfig;
    29 
    28 
    32 */
    31 */
    33 class CCopyObject : public CRequestProcessor
    32 class CCopyObject : public CRequestProcessor
    34     {
    33     {
    35 public:
    34 public:
    36     /**
    35     /**
    37     * Two-phase construction method
       
    38     * @param aFramework    The data provider framework
       
    39     * @param aConnection    The connection from which the request comes
       
    40     * @param aWrapper    medadata access interface
       
    41     * @return a pointer to the created request processor object
       
    42     */
       
    43     //IMPORT_C static MMmRequestProcessor* NewL( MMTPDataProviderFramework& aFramework,
       
    44     //        MMTPConnection& aConnection,
       
    45     //        CMmMtpDpMetadataAccessWrapper& aWrapper );
       
    46 
       
    47     /**
       
    48     * Destructor
    36     * Destructor
    49     */
    37     */
    50     IMPORT_C virtual ~CCopyObject();
    38     IMPORT_C virtual ~CCopyObject();
    51 
    39 
    52 protected:
    40 protected:
    53     /**
    41     /**
    54     * Standard c++ constructor
    42     * Standard c++ constructor
    55     */
    43     */
    56     IMPORT_C CCopyObject( MMTPDataProviderFramework& aFramework,
    44     IMPORT_C CCopyObject( MMTPDataProviderFramework& aFramework,
    57             MMTPConnection& aConnection,
    45         MMTPConnection& aConnection,
    58             MMmMtpDpConfig& aDpConfig );
    46         MMmMtpDpConfig& aDpConfig );
    59 
    47 
    60     /**
    48     /**
    61     * Second phase constructor
    49     * Second phase constructor
    62     */
    50     */
    63     IMPORT_C void ConstructL();
    51     IMPORT_C void ConstructL();
    77     /**
    65     /**
    78     * Retrieve the parameters of the request
    66     * Retrieve the parameters of the request
    79     */
    67     */
    80     void GetParametersL();
    68     void GetParametersL();
    81 
    69 
       
    70     /**
       
    71      * Set a default destination if it is not specified
       
    72      */
    82     void SetDefaultParentObjectL();
    73     void SetDefaultParentObjectL();
    83 
    74 
    84     /**
    75     /**
    85     * Copy object operation
    76     * Copy file and metadata and send response to pc
       
    77     * If everything was right, the handle of newly created file
       
    78     * should be sent back
    86     */
    79     */
    87     void CopyObjectL();
    80     void CopyObjectL();
    88 
    81 
    89     /**
    82     /**
    90     * Check if we can copy the file to the new location
    83     * Check if the file can be copied
       
    84     * @param aOldName used to get file size
       
    85     * @param aNewName the full path name of newly copied file
    91     */
    86     */
    92     TMTPResponseCode CanCopyObjectL( const TDesC& aOldName,
    87     TMTPResponseCode CanCopyObjectL( const TDesC& aOldName,
    93         const TDesC& aNewName ) const;
    88         const TDesC& aNewName ) const;
    94 
    89 
    95     /**
    90     /**
    96     * Save the object properties before doing the copy
    91     * Save the object properties before doing the copy
    97     */
    92     */
    98     void GetPreviousPropertiesL( const CMTPObjectMetaData& aObject );
    93     void GetPreviousPropertiesL();
    99 
    94 
   100     /**
    95     /**
   101     * Set the object properties after doing the copy
    96     * Set the object properties after doing the copy
   102     */
    97     */
   103     void SetPreviousPropertiesL( const CMTPObjectMetaData& aObject );
    98     void SetPreviousPropertiesL();
   104 
    99 
   105     /**
   100     /**
   106     * A helper function of CopyObjectL.
   101     * A helper function of CopyObjectL.
   107     * @param aNewFileName the new full filename after copy.
   102     * @param aNewFileName the new full filename after copy.
   108     * @return objectHandle of new copy of object.
   103     * @return handle of the newly copied object.
   109     */
   104     */
   110     TUint32 CopyFileL( const TDesC& aNewFileName );
   105     TUint32 CopyFileL( const TDesC& aNewFileName );
   111 
   106 
   112     /**
   107     /**
   113     * Update object info in the database.
   108     * Add metadata of the newly created file into database and
       
   109     * update related references
       
   110     * @param aOldObjectName old reference owner
       
   111     * @param aNewObjectName new reference owner
       
   112     * @return handle of the newly copied object
   114     */
   113     */
   115     TUint32 AddObjectToStoreL( const TDesC& aOldObjectName,
   114     TUint32 AddObjectToStoreL( const TDesC& aOldObjectName,
   116         const TDesC& aNewObjectName );
   115         const TDesC& aNewObjectName );
   117 
   116 
   118 protected:
   117 protected:
   120     MMmMtpDpConfig& iDpConfig;
   119     MMmMtpDpConfig& iDpConfig;
   121     CMTPTypeObjectPropList* iPropertyList;
   120     CMTPTypeObjectPropList* iPropertyList;
   122 
   121 
   123 private:
   122 private:
   124     TUint32 iStorageId;
   123     TUint32 iStorageId;
   125     CMTPObjectMetaData* iObjectInfo; // Not owned
   124     CMTPObjectMetaData* iSourceObject;
       
   125     CMTPObjectMetaData* iTargetObject;
   126     HBufC* iDest;
   126     HBufC* iDest;
   127     TUint32 iNewParentHandle;
   127     TUint32 iNewParentHandle;
   128     TTime iPreviousModifiedTime;
   128     TTime iPreviousModifiedTime;
   129 
   129 
   130     };
   130     };