|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Copies/Moves message store from source drive to target drive |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #if !defined(__MCESETTINGSMOVEMSGS_H__) |
|
22 #define __MCESETTINGSMOVEMSGS_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <msvstd.h> |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 const TInt KMsgTransHndlrPriority=0; |
|
31 const TInt KMsgTransTimerPriority=0; |
|
32 const TInt KCopyBufSize=0x1000; |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CMceMessageTransHandler; |
|
36 class CMsvSession; |
|
37 class CMsvOperation; |
|
38 |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 class MMceMsgTransHandlerObserver |
|
43 { |
|
44 public: |
|
45 |
|
46 virtual void CopyCompleteL(TInt aErr) = 0; |
|
47 |
|
48 /** |
|
49 * Called when message store transfer is complete |
|
50 */ |
|
51 virtual void TransferCompleteL(TInt aErr)=0; |
|
52 |
|
53 /** |
|
54 * Called when message store transfer cannot be cancelled |
|
55 */ |
|
56 virtual void DisableCancelL()=0; |
|
57 }; |
|
58 |
|
59 |
|
60 // |
|
61 // CMceMessageTransHandler - active object used to transfer the message store |
|
62 // |
|
63 class CEkmsDocument; |
|
64 class CMceMessageTransHandler : public CActive |
|
65 { |
|
66 public: |
|
67 ~CMceMessageTransHandler(); |
|
68 static CMceMessageTransHandler* NewL( MMceMsgTransHandlerObserver& aOwner, |
|
69 CMsvSession* aSession, |
|
70 TInt aTargetDrive, |
|
71 TInt aSourceDrive, |
|
72 TBool aDeleteCopiedStore ); |
|
73 |
|
74 /** |
|
75 * Sets operation |
|
76 * Must only be called once during the lifetime of a CMsvSingleOpWatcher |
|
77 * object. |
|
78 */ |
|
79 void SetOperation( CMsvOperation* aOperation ); |
|
80 |
|
81 /** |
|
82 * Returns reference to the operation |
|
83 */ |
|
84 IMPORT_C CMsvOperation& Operation() const; |
|
85 |
|
86 /** |
|
87 * Display progress in main thread |
|
88 */ |
|
89 TInt ProgressL() const; |
|
90 |
|
91 /** |
|
92 * Called by the framework if RunL() leaves |
|
93 */ |
|
94 TInt RunError( TInt ); |
|
95 |
|
96 protected: |
|
97 /** |
|
98 * Cancels transfer thread |
|
99 */ |
|
100 virtual void DoCancel(); |
|
101 |
|
102 /** |
|
103 * Calls TransferCompleteL and sets message drive on the message server |
|
104 */ |
|
105 virtual void RunL(); |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * C++ constructor |
|
111 */ |
|
112 CMceMessageTransHandler( MMceMsgTransHandlerObserver& aOwner, |
|
113 CMsvSession* aSession, |
|
114 TInt aTargetDrive, |
|
115 TInt aSourceDrive, |
|
116 TBool aDeleteCopiedStore ); |
|
117 |
|
118 /** |
|
119 * Create transfer thread and delete thread |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 TInt ProgressErrorL() const; |
|
124 |
|
125 enum TTransHandlerState |
|
126 { |
|
127 EStateCopying, |
|
128 EStateDeleting, |
|
129 }; |
|
130 |
|
131 private: |
|
132 MMceMsgTransHandlerObserver& iOwner; |
|
133 CMsvSession* iSession; // not owed by this class. |
|
134 CMsvOperation* iOperation; |
|
135 TDriveUnit iTargetDrive; // The target drive for the copied message store |
|
136 TDriveUnit iSourceDrive; // The source drive of the message store |
|
137 TBool iDeleteCopiedStore; // True if the contents of the original store is to be deleted |
|
138 TTransHandlerState iState; |
|
139 }; |
|
140 |
|
141 #endif // __MCESETTINGSMOVEMSGS_H__ |
|
142 |
|
143 // End of file |