|
1 /* |
|
2 * Copyright (c) 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: Resolving meeting request method asynchronoysly |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "emailtrace.h" |
|
21 #include "cesmricalvieweremailasynccmd.h" |
|
22 |
|
23 //<cmail> |
|
24 #include "esmricalvieweropcodes.hrh" |
|
25 #include <calsession.h> |
|
26 #include "cfsmailclient.h" |
|
27 //</cmail> |
|
28 #include <calentry.h> |
|
29 |
|
30 #include "cesmrmrinfoicalretriever.h" |
|
31 #include "cesmrimapicalretriever.h" |
|
32 |
|
33 /// Unnamed namespace for local definitions |
|
34 namespace { |
|
35 |
|
36 #ifdef _DEBUG |
|
37 |
|
38 // Panic literal |
|
39 _LIT( KESMRIcalViewerEmailAsyncCmd, "ESMRIcalViewerEmailAsyncCmd" ); |
|
40 |
|
41 /** Panic codes */ |
|
42 enum TESMRIcalViewerEmailAsyncCmdPanic |
|
43 { |
|
44 EInvalidCommandId = 0 //Invalid command id |
|
45 }; |
|
46 |
|
47 void Panic( TESMRIcalViewerEmailAsyncCmdPanic aPanic ) |
|
48 { |
|
49 User::Panic( KESMRIcalViewerEmailAsyncCmd, aPanic ); |
|
50 } |
|
51 |
|
52 #endif // _DEBUG |
|
53 |
|
54 } // namespace |
|
55 |
|
56 // ======== MEMBER FUNCTIONS ======== |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CESMRIcalViewerEmailAsyncCmd::CESMRIcalViewerEmailAsyncCmd |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CESMRIcalViewerEmailAsyncCmd::CESMRIcalViewerEmailAsyncCmd( |
|
63 TESMRIcalViewerOperationType aOperation, |
|
64 CCalSession& aCalSession, |
|
65 MESMRIcalViewerCallback& aCallback ) |
|
66 : CESMRIcalViewerAsyncCommand( EESMREmailCommand, aCalSession ), |
|
67 iOperation( aOperation), |
|
68 iCallback( aCallback ) |
|
69 { |
|
70 FUNC_LOG; |
|
71 //do nothing |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CESMRIcalViewerResponseToMRCmd::~CESMRIcalViewerEmailAsyncCmd |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 CESMRIcalViewerEmailAsyncCmd::~CESMRIcalViewerEmailAsyncCmd() |
|
79 { |
|
80 FUNC_LOG; |
|
81 CancelCommand(); |
|
82 } |
|
83 |
|
84 // ----------------------------------------------------------------------------- |
|
85 // CESMRIcalViewerEmailAsyncCmd::NewL |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 CESMRIcalViewerEmailAsyncCmd* CESMRIcalViewerEmailAsyncCmd::NewL( |
|
89 TESMRIcalViewerOperationType aOperation, |
|
90 CCalSession& aCalSession, |
|
91 MESMRIcalViewerCallback& aCallback ) |
|
92 { |
|
93 FUNC_LOG; |
|
94 CESMRIcalViewerEmailAsyncCmd* self = |
|
95 new (ELeave) CESMRIcalViewerEmailAsyncCmd( |
|
96 aOperation, |
|
97 aCalSession, |
|
98 aCallback ); |
|
99 |
|
100 CleanupStack::PushL( self ); |
|
101 self->ConstructL(); |
|
102 CleanupStack::Pop( self ); |
|
103 return self; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CESMRIcalViewerEmailAsyncCmd::ConstructL |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 void CESMRIcalViewerEmailAsyncCmd::ConstructL() |
|
111 { |
|
112 FUNC_LOG; |
|
113 BaseConstructL(); |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CESMRIcalViewerEmailAsyncCmd::OperationCompleted |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CESMRIcalViewerEmailAsyncCmd::OperationCompleted( |
|
121 MESMRIcalViewerObserver::TIcalViewerOperationResult aResult ) |
|
122 { |
|
123 FUNC_LOG; |
|
124 __ASSERT_DEBUG( aResult.iOpType == iOperation, Panic( EInvalidCommandId) ); |
|
125 |
|
126 // Dispatch completion message to observer |
|
127 Observer()->OperationCompleted( aResult ); |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CESMRIcalViewerEmailAsyncCmd::OperationError |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 void CESMRIcalViewerEmailAsyncCmd::OperationError( |
|
135 MESMRIcalViewerObserver::TIcalViewerOperationResult aResult ) |
|
136 { |
|
137 FUNC_LOG; |
|
138 __ASSERT_DEBUG( aResult.iOpType == iOperation, Panic( EInvalidCommandId) ); |
|
139 |
|
140 // Dispatch completion message to observer |
|
141 Observer()->OperationError( aResult ); |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // CESMRIcalViewerEmailAsyncCmd::ExecuteAsyncCommandL |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 void CESMRIcalViewerEmailAsyncCmd::ExecuteAsyncCommandL() |
|
149 { |
|
150 FUNC_LOG; |
|
151 switch ( iOperation ) |
|
152 { |
|
153 case EESMRCmdOpenAttachment://fallthrough |
|
154 case EESMRCmdOpenAttachmentView://fallthrough |
|
155 // <cmail> |
|
156 case EESMRCmdDownloadAttachment://fallthrough |
|
157 case EESMRCmdDownloadAllAttachments://fallthrough |
|
158 case EESMRCmdSaveAttachment://fallthrough |
|
159 case EESMRCmdSaveAllAttachments://fallthrough |
|
160 // </cmail> |
|
161 case EESMRCmdMailDelete://fallthrough |
|
162 case EESMRCmdMailForwardAsMessage://fallthrough |
|
163 case EESMRCmdMailMoveMessage://fallthrough |
|
164 case EESMRCmdMailCopyMessage://fallthrough |
|
165 case EESMRCmdMailComposeMessage://fallthrough |
|
166 case EESMRCmdMailMessageDetails://fallthrough |
|
167 case EESMRCmdMailPreviousMessage://fallthrough |
|
168 case EESMRCmdMailNextMessage://fallthrough |
|
169 case EESMRCmdMailMoveMessageToDrafts://fallthrough |
|
170 case EESMRCmdDownloadManager://fallthrough |
|
171 case EESMRCmdMailReply://fallthrough |
|
172 case EESMRCmdMailReplyAll://fallthrough |
|
173 { |
|
174 iCallback.ProcessAsyncCommandL( |
|
175 iOperation, |
|
176 *Message(), |
|
177 this ); |
|
178 } |
|
179 break; |
|
180 |
|
181 default: |
|
182 __ASSERT_DEBUG( EFalse, Panic(EInvalidCommandId) ); |
|
183 break; |
|
184 } |
|
185 } |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CESMRIcalViewerEmailAsyncCmd::CancelAsyncCommand |
|
189 // ----------------------------------------------------------------------------- |
|
190 // |
|
191 void CESMRIcalViewerEmailAsyncCmd::CancelAsyncCommand() |
|
192 { |
|
193 FUNC_LOG; |
|
194 // No cancellation necessary |
|
195 } |
|
196 |
|
197 // EOF |
|
198 |