epoc32/include/mw/mmsvattachmentmanager.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 epoc32/include/mmsvattachmentmanager.h@2fe1408b6811
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __MMSVATTACHMENTMANAGER_H__
williamr@2
    17
#define __MMSVATTACHMENTMANAGER_H__
williamr@2
    18
williamr@2
    19
#include <e32base.h>
williamr@2
    20
#include <msvstd.h>
williamr@2
    21
#include <cmsvattachment.h>
williamr@2
    22
williamr@2
    23
class MMsvAttachmentManager
williamr@2
    24
/**
williamr@2
    25
Defines the attachment management interface.
williamr@2
    26
williamr@2
    27
This class is a pure virtual interface class that defines the APIs to be used for
williamr@2
    28
attachment management in the Messaging Framework. It is expected that the clients of
williamr@2
    29
this interface will be MTMs implementations that require attachment management.
williamr@2
    30
williamr@2
    31
The API allows is based around the use of the CMsvAttachment object that represents
williamr@2
    32
any type of attachment that is supported by the Messaging Framework. The CMsvAttachment
williamr@2
    33
object provides users with various attributes about the attachment without having to
williamr@2
    34
actually load or retrieve the attachment.
williamr@2
    35
williamr@2
    36
This attachment manager API supports the following different types of attachments:
williamr@2
    37
1 - File attachments, file based attachments that are copied or created in the message 
williamr@2
    38
	store.
williamr@2
    39
2 - Linked file attachments, file based attachments that are not copied and are simply 
williamr@2
    40
	linked to the file location on disk.
williamr@2
    41
3 - Message entry attachments, existing message entries that can be registered as
williamr@2
    42
	attachments of another message entry.
williamr@2
    43
williamr@2
    44
For file based attachments, this API also supports the retrieval of the files as
williamr@2
    45
open read-only file handles.
williamr@2
    46
williamr@2
    47
All functionality that requires the attachment manager to be in edit mode have been
williamr@2
    48
defined as asynchronous. The attachment manager does not allow multiple asynchronous
williamr@2
    49
requests to be made at the same time.
williamr@2
    50
williamr@2
    51
@see CMsvAttachment
williamr@2
    52
@publishedAll
williamr@2
    53
@released
williamr@2
    54
*/
williamr@2
    55
	{
williamr@2
    56
public:	
williamr@2
    57
	/**
williamr@2
    58
	Adds an attachment to the message store by file path.
williamr@2
    59
	
williamr@2
    60
	The attachment file must be located in a public area. The file path must also be a
williamr@2
    61
	full path specification. The file is copied into the message store.
williamr@2
    62
	
williamr@2
    63
	@param aFilePath The absolute file path of the attachment file.
williamr@2
    64
	@param aAttachmentInfo The attachment info associated with the file.
williamr@2
    65
	  If the routine does not leave, then ownership will be transferred to the
williamr@2
    66
	  attachment manager. If the routine does leave then ownership will not have
williamr@2
    67
	  been transfered and the caller is responsible for cleanup.
williamr@2
    68
	@param aStatus The client's request status to complete when the operation has completed.
williamr@2
    69
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
    70
	*/
williamr@2
    71
	virtual void AddAttachmentL(const TDesC& aFilePath, CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus) = 0;
williamr@2
    72
		
williamr@2
    73
	/**
williamr@2
    74
	Adds an attachment to the message store by file handle.
williamr@2
    75
	
williamr@2
    76
	This is used to add an attachment from an open file handle such as when adding a file
williamr@2
    77
	from the caller's private area. The file is copied into the message store. The message
williamr@2
    78
	server is responsible for closing the file handle once copied.
williamr@2
    79
	
williamr@2
    80
	@param aFileHandle An open file handle for the attachment file. Ownership is transferred. The caller must close the file handle.
williamr@2
    81
	@param aAttachmentInfo The attachment info associated with the file.
williamr@2
    82
	  If the routine does not leave, then ownership will be transferred to the
williamr@2
    83
	  attachment manager. If the routine does leave then ownership will not have
williamr@2
    84
	  been transfered and the caller is responsible for cleanup.
williamr@2
    85
	@param aStatus The client's request status to complete.
williamr@2
    86
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
    87
	*/
williamr@2
    88
	virtual void AddAttachmentL(RFile& aFileHandle, CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus) = 0;
williamr@2
    89
	
williamr@2
    90
	/**
williamr@2
    91
	Adds an attachment as a linked file attachment.
williamr@2
    92
	
williamr@2
    93
	The attachment is added as a link by its file path. The attachment is not copied to the
williamr@2
    94
	message store. The attachment is linked and therefore must be in a public location.
williamr@2
    95
	
williamr@2
    96
	It is possible to change a linked attachment file after it has been attached to a message
williamr@2
    97
	entry. No integrity checking is carried out. This is left to individual MTMs or implementors
williamr@2
    98
	of this interface to decide if any checking is required such as checking if the size has changed.
williamr@2
    99
	
williamr@2
   100
	@param aFilePath The absolute file path of the linked attachment file.
williamr@2
   101
	@param aAttachmentInfo The attachment info associated with the file.
williamr@2
   102
	  If the routine does not leave, then ownership will be transferred to the
williamr@2
   103
	  attachment manager. If the routine does leave then ownership will not have
williamr@2
   104
	  been transfered and the caller is responsible for cleanup.
williamr@2
   105
	@param aStatus The client's request status to complete.
williamr@2
   106
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   107
	*/
williamr@2
   108
	virtual void AddLinkedAttachmentL(const TDesC& aFilePath, CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus) = 0;
williamr@2
   109
	
williamr@2
   110
	/**
williamr@2
   111
	Adds a message entry as an attachment.
williamr@2
   112
	
williamr@2
   113
	The message entry is registered as an attachment of the	current message entry. The attachment
williamr@2
   114
	message entry is not copied.
williamr@2
   115
	
williamr@2
   116
	@param aEntryId The message Id of the entry to register as an attachment.
williamr@2
   117
	@param aAttachmentInfo The attachment info associated with the file.
williamr@2
   118
	  If the routine does not leave, then ownership will be transferred to the
williamr@2
   119
	  attachment manager. If the routine does leave then ownership will not have
williamr@2
   120
	  been transfered and the caller is responsible for cleanup.
williamr@2
   121
	@param aStatus The client's request status to complete.
williamr@2
   122
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   123
	*/
williamr@2
   124
	virtual void AddEntryAsAttachmentL(TMsvId aEntryId, CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus) = 0;
williamr@2
   125
	
williamr@2
   126
	/**
williamr@2
   127
	Creates a new empty attachment file.
williamr@2
   128
	
williamr@2
   129
	The caller is returned an open writable file handle to an empty attachment file in the message
williamr@2
   130
	store. The caller must pass in an uninitialised file handle. The file handle cannot be used
williamr@2
   131
	until the asynchronous request completes successfully. If the request is sucessful the file handle
williamr@2
   132
	is open and must close by the caller once the data has been written to it.
williamr@2
   133
	
williamr@2
   134
	@param aFileName The filename to assign to the newly create attachment file.
williamr@2
   135
	@param aAttachmentFile An uninitialised file handle. This is opened and can be written to if the
williamr@2
   136
		   request is successful. Ownership is transferred . The caller must close the file handle.
williamr@2
   137
	@param aAttachmentInfo The attachment info associated with the file.
williamr@2
   138
	  If the routine does not leave, then ownership will be transferred to the
williamr@2
   139
	  attachment manager. If the routine does leave then ownership will not have
williamr@2
   140
	  been transfered and the caller is responsible for cleanup.
williamr@2
   141
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   142
	*/
williamr@2
   143
	virtual void CreateAttachmentL(const TDesC& aFileName, RFile& aAttachmentFile, CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus) = 0;
williamr@2
   144
	
williamr@2
   145
	
williamr@2
   146
	/**
williamr@2
   147
	Renames the physical filename of an attachment.
williamr@2
   148
		
williamr@2
   149
	@param aIndex The array index position of the attachment to be renamed.
williamr@2
   150
	@param aNewName The new name of the attachment.
williamr@2
   151
	@param aStatus The client's request status to complete.
williamr@2
   152
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   153
	@leave KErrAlreadyExists If the supplied attachment filename already exists.
williamr@2
   154
	*/	
williamr@2
   155
	virtual void RenameAttachmentL(TInt aIndex, const TDesC& aNewName, TRequestStatus& aStatus) = 0;
williamr@2
   156
williamr@2
   157
	
williamr@2
   158
	/**
williamr@2
   159
	Counts the number of attachments.
williamr@2
   160
	
williamr@2
   161
	Returns the number of attachments associated with the message entry. This includes all the
williamr@2
   162
	attachments that have not been commited yet.
williamr@2
   163
	@return The number of attachments.
williamr@2
   164
	*/
williamr@2
   165
	virtual TInt AttachmentCount() const = 0;
williamr@2
   166
	
williamr@2
   167
	/**
williamr@2
   168
	Returns an attachment info object.
williamr@2
   169
	
williamr@2
   170
	This object contains attributes and information about the attachment without having actually
williamr@2
   171
	retrieving the actual attachment. The caller assumes ownership of the returned object.
williamr@2
   172
	
williamr@2
   173
	@param aIndex The array index position of the attachment.
williamr@2
   174
	@return The attachment info for the attachment. Ownership is passed to caller,
williamr@2
   175
	*/
williamr@2
   176
	virtual CMsvAttachment* GetAttachmentInfoL(TInt aIndex) = 0;
williamr@2
   177
	
williamr@2
   178
	/**
williamr@2
   179
	Returns an attachment info object.
williamr@2
   180
	
williamr@2
   181
	This object contains attributes and information about the attachment without having actually
williamr@2
   182
	retrieving the actual attachment. The caller assumes ownership of the returned object.
williamr@2
   183
	
williamr@2
   184
	@param aId The attachment Id of the attachment.
williamr@2
   185
	@return The attachment info for the attachment. Ownership is passed to caller,
williamr@2
   186
	@leave KErrNotFound If an attachment with the specified attachment Id is not found.
williamr@2
   187
	*/
williamr@2
   188
	virtual CMsvAttachment* GetAttachmentInfoL(TMsvAttachmentId aId) = 0;
williamr@2
   189
williamr@2
   190
	/**
williamr@2
   191
	Modifies the attachment info for a particular attachment.
williamr@2
   192
	
williamr@2
   193
	This allows callers to modify an existing attachment info object for a particular attachment.
williamr@2
   194
	The attachment info object passed in replaces the existing attachment info object and takes
williamr@2
   195
	ownership for the object passed in. It is expected that callers will use GetAttachmentInfoL 
williamr@2
   196
	to get the object, make some changes and pass it back into this method.
williamr@2
   197
	
williamr@2
   198
	@param aAttachmentInfo The attachment info associated with the file.
williamr@2
   199
	  If the routine does not leave, then ownership will be transferred to the
williamr@2
   200
	  attachment manager. If the routine does leave then ownership will not have
williamr@2
   201
	  been transfered and the caller is responsible for cleanup.
williamr@2
   202
	@param aStatus The client's request status to complete.
williamr@2
   203
	@leave KErrNotFound If the attachment that is trying to be modified cannot be found.
williamr@2
   204
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   205
	*/
williamr@2
   206
	virtual void ModifyAttachmentInfoL(CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus) = 0;
williamr@2
   207
williamr@2
   208
	/**
williamr@2
   209
	Returns an open file handle for the attachment file.
williamr@2
   210
	
williamr@2
   211
	Returns a read-only open file handle for the attachment file. This only applies to file based
williamr@2
   212
	attachments ie. file attachment and linked file attachments. The caller is responsible for
williamr@2
   213
	closing the returned file handle.
williamr@2
   214
	
williamr@2
   215
	@param aIndex The array index position of the attachment.
williamr@2
   216
	@return A read-only open file handle for the attachment file. Caller must close the handle.
williamr@2
   217
	@leave KErrNotSupported If the attachment is not a file attachment in the message store.
williamr@2
   218
	*/
williamr@2
   219
	virtual RFile GetAttachmentFileL(TInt aIndex) = 0;
williamr@2
   220
	
williamr@2
   221
	/**
williamr@2
   222
	Returns an open file handle for the attachment file.
williamr@2
   223
	
williamr@2
   224
	Returns a read-only open file handle for the attachment file. This only applies to file based
williamr@2
   225
	attachments ie. file attachment and linked file attachments. The caller is responsible for
williamr@2
   226
	closing the returned file handle.
williamr@2
   227
	
williamr@2
   228
	@param aIndex The array index position of the attachment.
williamr@2
   229
	@return A read-only open file handle for the attachment file. Caller must close the handle.
williamr@2
   230
	@leave KErrNotSupported If the attachment is not a file attachment in the message store.
williamr@2
   231
	@leave KErrNotFound If an attachment with the specified attachment Id is not found.
williamr@2
   232
	*/
williamr@2
   233
	virtual RFile GetAttachmentFileL(TMsvAttachmentId aId) = 0;
williamr@2
   234
	
williamr@2
   235
	/**
williamr@2
   236
	Returns an open writable file handle for the attachment file.
williamr@2
   237
	
williamr@2
   238
	Returns a writable open file handle for the attachment file. This only applies to file based
williamr@2
   239
	attachments ie. file attachment and linked file attachments. The caller is responsible for
williamr@2
   240
	closing the returned file handle.
williamr@2
   241
	
williamr@2
   242
	@param aIndex The array index position of the attachment.
williamr@2
   243
	@return A writable open file handle for the attachment file. Caller must close the handle.
williamr@2
   244
	@leave KErrNotSupported If the attachment is not a file attachment in the message store.
williamr@2
   245
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   246
	@internalComponent
williamr@2
   247
	*/
williamr@2
   248
	virtual RFile GetAttachmentFileForWriteL(TInt aIndex) = 0;
williamr@2
   249
	
williamr@2
   250
	/**
williamr@2
   251
	Returns an open writable file handle for the attachment file.
williamr@2
   252
	
williamr@2
   253
	Returns a writable open file handle for the attachment file. This only applies to file based
williamr@2
   254
	attachments ie. file attachment and linked file attachments. The caller is responsible for
williamr@2
   255
	closing the returned file handle.
williamr@2
   256
	
williamr@2
   257
	@param aIndex The array index position of the attachment.
williamr@2
   258
	@return A writable open file handle for the attachment file. Caller must close the handle.
williamr@2
   259
	@leave KErrNotSupported If the attachment is not a file attachment in the message store.
williamr@2
   260
	@leave KErrNotFound If an attachment with the specified attachment Id is not found.
williamr@2
   261
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   262
	@internalComponent
williamr@2
   263
	*/
williamr@2
   264
	virtual RFile GetAttachmentFileForWriteL(TMsvAttachmentId aId) = 0;
williamr@2
   265
	
williamr@2
   266
	/**
williamr@2
   267
	Removes the attachment from the message entry.
williamr@2
   268
	
williamr@2
   269
	This changes the array index values of all the attachments after the removed one.
williamr@2
   270
	Attachment files stored in the message store are deleted. Linked files and message entry 
williamr@2
   271
	attachments are not deleted, this is left to the caller to do if required.
williamr@2
   272
	
williamr@2
   273
	@param aParam The array index position of the attachment to be removed.
williamr@2
   274
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   275
	*/
williamr@2
   276
	virtual void RemoveAttachmentL(TInt aIndex, TRequestStatus& aStatus) = 0;
williamr@2
   277
	
williamr@2
   278
	/**
williamr@2
   279
	Removes the attachment from the message entry.
williamr@2
   280
	
williamr@2
   281
	This changes the array index values of all the attachments after the removed one.
williamr@2
   282
	Attachment files stored in the message store are deleted. Linked files and message entry 
williamr@2
   283
	attachments are not deleted, this is left to the caller to do if required.
williamr@2
   284
	
williamr@2
   285
	@param aParam The array index position of the attachment to be removed.
williamr@2
   286
	@leave KErrAccessDenied If attachment manager is in read-only mode.
williamr@2
   287
	@leave KErrNotFound If an attachment with the specified attachment Id is not found.
williamr@2
   288
	*/
williamr@2
   289
	virtual void RemoveAttachmentL(TMsvAttachmentId aId, TRequestStatus& aStatus) = 0;
williamr@2
   290
	
williamr@2
   291
	/**
williamr@2
   292
	Cancels the last asynchronous operation that was requested.
williamr@2
   293
	
williamr@2
   294
	Allows callers to cancel the last asynchronous operation. This will have no effect
williamr@2
   295
	if an asynchronous is not waiting to complete.
williamr@2
   296
	*/
williamr@2
   297
	virtual void CancelRequest() = 0;
williamr@2
   298
	};
williamr@2
   299
williamr@2
   300
#endif // __MMSVATTACHMENTMANAGER_H__