|
1 // Copyright (c) 2008-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 // |
|
15 |
|
16 #ifndef __CMESSAGECONVERTERMANAGER_H__ |
|
17 #define __CMESSAGECONVERTERMANAGER_H__ |
|
18 |
|
19 // Header files |
|
20 #include <e32base.h>// CBase |
|
21 #include <e32std.h> // TBuf |
|
22 #include "f32file.h" |
|
23 #include "msvdbadapter.h" |
|
24 #include "msvmessagedbadapter.h" |
|
25 |
|
26 |
|
27 |
|
28 // fwd declarations |
|
29 class CMsvVersion0Version1Converter; |
|
30 class CMsvVersion1Version2Converter; |
|
31 class CMsvDBAdapter; |
|
32 |
|
33 |
|
34 //constants |
|
35 const TUid KUidMsvSmsMtm = { 0x1000102c }; |
|
36 const TUid KUidMsgTypePOP3 = {0x10001029}; // 268439593 |
|
37 const TUid KUidMsgTypeIMAP4 = {0x1000102A}; // 268439594 |
|
38 const TUid KUidMsgTypeSMTP = {0x10001028}; // 268439592 |
|
39 |
|
40 //Literals |
|
41 _LIT(KIndexFilePath,"\\Private\\1000484b\\Mail2\\Index"); |
|
42 |
|
43 |
|
44 /** |
|
45 TConversionResumeStatus |
|
46 A structure having fields as member variables that are required to mainatin and communicate |
|
47 caonversion status information |
|
48 |
|
49 @internalAll |
|
50 @released |
|
51 */ |
|
52 struct TConversionResumeStatus |
|
53 { |
|
54 TMsvId lastId; |
|
55 TMsvId serviceId; |
|
56 TInt sourceVersion; |
|
57 TInt targetVersion; |
|
58 TUid mtmId; |
|
59 TInt remainingCount; |
|
60 }; |
|
61 |
|
62 /** |
|
63 MMsvMessageStoreConverter |
|
64 A pure virtual class that acts a base class for different version message store conversion |
|
65 classes. Any class that converts messages from one verion to another must inherit from this. |
|
66 |
|
67 @internalAll |
|
68 @released |
|
69 */ |
|
70 class MMsvMessageStoreConverter |
|
71 { |
|
72 public: |
|
73 virtual void ConvertMessageStoreL() = 0; |
|
74 virtual ~MMsvMessageStoreConverter() |
|
75 { |
|
76 }; |
|
77 }; |
|
78 |
|
79 |
|
80 /** |
|
81 CMessageConverterManager |
|
82 This class manages the conversion of message store from one version to another. |
|
83 Starts a new conversion or resumes a conversion from the last point. |
|
84 Owns and initiates conversion of version 0 and version 1 message store. |
|
85 |
|
86 @internalAll |
|
87 @released |
|
88 */ |
|
89 NONSHARABLE_CLASS (CMessageConverterManager) : public CBase |
|
90 { |
|
91 public: |
|
92 static CMessageConverterManager* NewL(TDriveNumber aDriveNumber); |
|
93 static TInt StartConversion(TAny* aDrive); |
|
94 ~CMessageConverterManager(); |
|
95 void DoConversionL() ; |
|
96 |
|
97 private: |
|
98 CMessageConverterManager(TDriveNumber aDriveNumber); |
|
99 void ConstructL(); |
|
100 TBool ResumeConversionL(); |
|
101 void InitialiseMessageStoreConversionL(); |
|
102 void RemoveIndexFileL(TDriveNumber aDrive); |
|
103 void RollBackVersion0Version1ConversionL(); |
|
104 void RollBackVersion1Version2ConversionL(); |
|
105 private: |
|
106 RFs ifsSession; |
|
107 CMsvDBAdapter* iDbAdapter; |
|
108 CMsvMessageDBAdapter* iMessageDbAdapter; |
|
109 CMsvVersion0Version1Converter* iIndexFileConverter; |
|
110 CMsvVersion1Version2Converter* iMessageConverter; |
|
111 |
|
112 TDriveNumber iDrive; |
|
113 TInt iConversionVersion; |
|
114 TConversionResumeStatus iResumeStatus; |
|
115 TBool iConversionResume; |
|
116 TBool iConversionTablePresent; |
|
117 TBuf<64> iFilePath; |
|
118 TFileName iDBFileName; |
|
119 TInt iInitialVersion; |
|
120 TInt iDeleteDatabase; |
|
121 |
|
122 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
123 friend class CTestMessageConverterManager; |
|
124 #endif |
|
125 }; |
|
126 |
|
127 #endif // __CMESSAGECONVERTERMANAGER_H__ |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |