|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Declaration of the CImCaf class |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalTechnology |
|
21 */ |
|
22 |
|
23 #ifndef CIMCAF_H |
|
24 #define CIMCAF_H |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <caf/importfile.h> |
|
28 #include <caf/supplier.h> |
|
29 #include <caf/supplieroutputfile.h> |
|
30 #include <caf/metadataarray.h> |
|
31 #include <caf/metadata.h> |
|
32 #include <caf/caferr.h> |
|
33 #include <msventry.h> |
|
34 #include <msvstore.h> |
|
35 #include <cmsvattachment.h> |
|
36 #include <mmsvattachmentmanagersync.h> |
|
37 #include <mmsvattachmentmanager.h> |
|
38 |
|
39 #include <imcvtext.h> |
|
40 #include <imutdll.h> |
|
41 |
|
42 using namespace ContentAccess; |
|
43 |
|
44 /** |
|
45 Content Access Framework (CAF) Wrapper class. |
|
46 Provides encapsulation of the CAF functionality required by email MTMs. |
|
47 The in source documentation refers to a CAF session. The following pseudocode |
|
48 clarifies the concept of a CAF session. |
|
49 @code |
|
50 BEGIN |
|
51 WHILE processing email MIME sections |
|
52 Receive MIME header Content-Type |
|
53 Pass to CAF with RegisterL(Content-Type) |
|
54 IF Registered() |
|
55 Add MIME header metadata to CImCaf class using AddToMetaDataL(metadata) |
|
56 ENDIF |
|
57 Detect start of MIME data section |
|
58 If CAF Registered() |
|
59 //BEGIN CAF session |
|
60 PrepareProcessingL() |
|
61 Create file handle for attachment write |
|
62 GetSuggestedAttachmentFileName(filename) |
|
63 StartProcessing(filename,filepath,file handle) |
|
64 WriteData() // Undecoded 1-N buffers in state machine |
|
65 Detect end of MIME data section |
|
66 WriteDataComplete() |
|
67 EndProcessingL() |
|
68 //END CAF Session |
|
69 ELSE |
|
70 Default behaviour |
|
71 ENDIF |
|
72 ENDWHILE |
|
73 END |
|
74 @endcode |
|
75 @internalComponent |
|
76 */ |
|
77 class CImCaf : public CBase |
|
78 { |
|
79 public: |
|
80 IMPORT_C CImCaf(RFs& aFs); |
|
81 IMPORT_C virtual ~CImCaf(); |
|
82 IMPORT_C void RegisterL(const TDesC8& aMimeLine); |
|
83 IMPORT_C void Deregister(); |
|
84 IMPORT_C void AddToMetaDataL(const TDesC8& aMimeLine); |
|
85 IMPORT_C void AddToMetaDataL(const TDesC8& aField, const TDesC8& aData); |
|
86 IMPORT_C void EndProcessingL(); |
|
87 IMPORT_C void PrepareProcessingL(); |
|
88 IMPORT_C TInt WriteData(const TDesC8& aData); |
|
89 IMPORT_C TBool Registered() const; |
|
90 IMPORT_C TBool Processing() const; |
|
91 IMPORT_C TInt GetSuggestedAttachmentFileName(TDes& aFileName) const; |
|
92 IMPORT_C void StartProcessing(const TDesC& aDefaultAttachmentFileName,const TDesC& aAttachmentFilePath,CMsvServerEntry& aServerEntry,RFile& aStartFile); |
|
93 |
|
94 private: |
|
95 void NewFileL(); |
|
96 void WriteDataCompleteL(); |
|
97 private: |
|
98 /** A CAF class instance. Initialised prior to data write */ |
|
99 CImportFile* iImportFile; |
|
100 /** A CAF class instance. Used to register Content-type with CAF */ |
|
101 CSupplier* iSupplier; |
|
102 /** Store for the MIME Content-type */ |
|
103 HBufC8* iContentType; |
|
104 /** A CAF class instance. Stores MIME header attribute/value pairs. Appended by AddToMetaData() */ |
|
105 CMetaDataArray* iMetaData; |
|
106 /** Points to the Attachment Entry in use for the current CAF session.Initialised by StartProcessing() */ |
|
107 CMsvServerEntry* iServerEntry; |
|
108 /** Stores the filepath for the current CAF session. Initialised by StartProcessing()*/ |
|
109 TBuf<KMaxPath> iAttachmentFilePath; |
|
110 /** If open, handle is used for the next attachment file required by CAF. Initialised by StartProcessing() */ |
|
111 RFile iAttachmentFile; |
|
112 /** The localised default filename . Initialised by StartProcessing() */ |
|
113 TPtrC iDefaultAttachmentFileName; |
|
114 /** Reference to instantiators file server session */ |
|
115 RFs& iFsSession; |
|
116 }; |
|
117 |
|
118 #endif // CIMCAF_H |