|
1 /* |
|
2 * Copyright (c) 2002-2007 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 * State machine -based operation for restoring message's attachments. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CMSGMAILRESTOREATTASOP_H |
|
22 #define CMSGMAILRESTOREATTASOP_H |
|
23 |
|
24 // INCLUDES |
|
25 #include "cmsgmailbaseop.h" |
|
26 #include <msvapi.h> |
|
27 |
|
28 // DATA TYPES |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MMsvAttachmentManager; |
|
32 class CMsgMailRestoreAttaOp; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * State machine -based operation for restoring message's attachments. |
|
37 * This operation involves restoring each individual attachments, and |
|
38 * furthermore initialization and finalization phase. |
|
39 */ |
|
40 NONSHARABLE_CLASS( CMsgMailRestoreAttasOp ) : public CMsgMailBaseOp |
|
41 { |
|
42 protected: |
|
43 |
|
44 enum TLaunchState |
|
45 { |
|
46 EInitialize = EFirstFreeState, // initialize operation |
|
47 ERestoreAtta, // restore single atta |
|
48 EFinalize // finalize entire operation |
|
49 }; |
|
50 |
|
51 public: // Constructors and destructor |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * @param aDocument Editor's document |
|
56 */ |
|
57 static CMsgMailRestoreAttasOp* NewL( |
|
58 CMsgMailEditorDocument& aDocument ); |
|
59 |
|
60 /** |
|
61 * Destructor. Cancels operation. |
|
62 */ |
|
63 ~CMsgMailRestoreAttasOp(); |
|
64 |
|
65 public: // API |
|
66 |
|
67 /** |
|
68 * Method for querying the number of all attachments involved in |
|
69 * this operation, including any discarded attachments. |
|
70 * To get correct result this method should be called once the |
|
71 * operation has completed. |
|
72 * @return count of all attachments, i.e. |
|
73 */ |
|
74 TInt CountAllAttas() const; |
|
75 |
|
76 /** |
|
77 * Method for querying the number of attachments that were |
|
78 * removed due to DRM restrictions. |
|
79 * To get correct result this method should be called once the |
|
80 * operation has completed. |
|
81 * @return count of removed DRM restricted attachments |
|
82 */ |
|
83 TInt CountDRMAttas() const; |
|
84 |
|
85 /** |
|
86 * Method for querying the number of invalid attachments. This |
|
87 * number does not include DRM attachments. |
|
88 * To get correct result this method should be called once the |
|
89 * operation has completed. |
|
90 * @return count of removed invalid attachments |
|
91 */ |
|
92 TInt CountInvalidAttas() const; |
|
93 |
|
94 protected: // from CMsgMailBaseOp |
|
95 |
|
96 void SetNextState(); |
|
97 |
|
98 void HandleStateActionL(); |
|
99 |
|
100 void HandleOperationCancel(); |
|
101 |
|
102 TBool HandleStateActionError( TInt aError ); |
|
103 |
|
104 private: // Implementation |
|
105 |
|
106 void InitializeL(); |
|
107 |
|
108 void RestoreAttaL(); |
|
109 |
|
110 void Finalize(); |
|
111 |
|
112 private: |
|
113 |
|
114 /** |
|
115 * Constructor. |
|
116 * @param aDocument Editor's document |
|
117 */ |
|
118 CMsgMailRestoreAttasOp( CMsgMailEditorDocument& aDocument ); |
|
119 |
|
120 /** |
|
121 * By default Symbian 2nd phase constructor is private. |
|
122 */ |
|
123 void ConstructL(); |
|
124 |
|
125 private: |
|
126 |
|
127 // Count of all attachments, including discarded attachments |
|
128 TInt iAllAttaCount; |
|
129 |
|
130 // Count of DRM restricted files |
|
131 TInt iDRMAttaCount; |
|
132 |
|
133 // Count of invalid attachments (excluding DRM problems) |
|
134 TInt iInvalidAttaCount; |
|
135 |
|
136 // Index for iterating attachment manager's attachments |
|
137 TInt iIndex; |
|
138 |
|
139 // Attachment manager, not own |
|
140 MMsvAttachmentManager* iManager; |
|
141 |
|
142 // Currently restored attachment, own |
|
143 CMsgMailRestoreAttaOp* iRestoreOneAtta; |
|
144 }; |
|
145 |
|
146 #endif // CMSGMAILRESTOREATTASOP_H |
|
147 |
|
148 // End of File |