|
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: State machine -based operation for fetching files as attachments. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMSGMAILFETCHFILEOP_H |
|
21 #define CMSGMAILFETCHFILEOP_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "cmsgmailbaseop.h" |
|
25 #include <MsgAttachmentUtils.h> |
|
26 #include <akninputblock.h> |
|
27 |
|
28 // DATA TYPES |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CMsgMailRestoreSuperOp; |
|
32 class MMsvAttachmentManager; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * State machine -based operation for fetching files as attachments. |
|
37 * This operation consinsts of file selection query, adding attachments |
|
38 * and performing restore operation for all attachments. |
|
39 */ |
|
40 NONSHARABLE_CLASS( CMsgMailFetchFileOp ) : public CMsgMailBaseOp, |
|
41 public MAknInputBlockCancelHandler |
|
42 { |
|
43 protected: |
|
44 |
|
45 enum TLaunchState |
|
46 { |
|
47 ESelectFiles = EFirstFreeState, // user selects files to attach |
|
48 EAddAttas, // add attachments to message |
|
49 ERestoreAllAttas, // performs full restore, updates mime types etc. |
|
50 EFinalize // finalize operation |
|
51 }; |
|
52 |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 * @aFetchType attachment type |
|
58 * @param aDocument Editor's document |
|
59 */ |
|
60 static CMsgMailFetchFileOp* NewL( |
|
61 MsgAttachmentUtils::TMsgAttachmentFetchType aFetchType, |
|
62 CMsgMailEditorDocument& aDocument ); |
|
63 |
|
64 /** |
|
65 * Destructor. Cancels operation. |
|
66 */ |
|
67 ~CMsgMailFetchFileOp(); |
|
68 |
|
69 protected: // from CMsgMailBaseOp |
|
70 |
|
71 void SetNextState(); |
|
72 |
|
73 void HandleStateActionL(); |
|
74 |
|
75 void HandleOperationCancel(); |
|
76 |
|
77 public: // from MAknInputBlockCancelHandler |
|
78 |
|
79 void AknInputBlockCancel(); |
|
80 |
|
81 private: // Implementation |
|
82 |
|
83 void SelectFilesL(); |
|
84 |
|
85 void AddAttasL(); |
|
86 |
|
87 void RestoreAllAttasL(); |
|
88 |
|
89 void FinalizeL(); |
|
90 |
|
91 void AddMultipleAttachmentsL( CDesCArray& aAttachments, |
|
92 CMsgMailEditorDocument& aDocument, |
|
93 TRequestStatus& aStatus ) const; |
|
94 |
|
95 void AddSingleAttachmentL( const TDesC& aAttachmentName, |
|
96 CMsgMailEditorDocument& aDocument, |
|
97 TRequestStatus& aStatus ) const; |
|
98 |
|
99 private: |
|
100 |
|
101 /** |
|
102 * Constructor. |
|
103 * @aFetchType attachment type |
|
104 * @param aDocument Editor's document |
|
105 */ |
|
106 CMsgMailFetchFileOp( |
|
107 MsgAttachmentUtils::TMsgAttachmentFetchType aFetchType, |
|
108 CMsgMailEditorDocument& aDocument ); |
|
109 |
|
110 /** |
|
111 * By default Symbian 2nd phase constructor is private. |
|
112 */ |
|
113 void ConstructL(); |
|
114 |
|
115 private: |
|
116 |
|
117 // number of attachments that were selected by the user to be fetched |
|
118 TInt iFetchCount; |
|
119 |
|
120 // attached file type |
|
121 MsgAttachmentUtils::TMsgAttachmentFetchType iFetchType; |
|
122 |
|
123 // 1st alternative, fetched file name when single item is fetched |
|
124 TFileName iFileName; |
|
125 |
|
126 // Attachment manager, not own |
|
127 MMsvAttachmentManager* iManager; |
|
128 |
|
129 // 2nd alternative, file names when multiple items are fetched, own |
|
130 CDesCArray* iFetchArray; |
|
131 |
|
132 // Operation for adding attachments, own |
|
133 CMsgMailRestoreSuperOp* iRestoreSuperOp; |
|
134 |
|
135 // Own. Input blocker to prevent user interaction during process |
|
136 CAknInputBlock* iBlocker; |
|
137 }; |
|
138 |
|
139 #endif // CMSGMAILFETCHFILEOP_H |
|
140 |
|
141 // End of File |