|
1 /* |
|
2 * Copyright (c) 2007-2009 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: MRUI field build plugin extension implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "CESMRFieldBuilderPluginExtension.h" |
|
19 |
|
20 //<cmail> |
|
21 #include "esmrdef.h" |
|
22 //</cmail> |
|
23 #include "tesmrentryfield.h" |
|
24 #include "mesmrresponseobserver.h" |
|
25 #include "cesmrattendeefield.h" |
|
26 #include "cesmrtrackingfieldlabel.h" |
|
27 #include "cesmrtrackstatus.h" |
|
28 #include "cesmrviewerattachmentsfield.h" |
|
29 #include "cesmrviewerattendeesfield.h" |
|
30 #include "cesmrresponsefield.h" |
|
31 #include "cesmrresponsereadyfield.h" |
|
32 #include "cesmrviewerfromfield.h" |
|
33 |
|
34 #include <CalenInterimUtils2.h> |
|
35 |
|
36 // DEBUG |
|
37 #include "emailtrace.h" |
|
38 |
|
39 // ======== MEMBER FUNCTIONS ======== |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CESMRFieldBuilderPluginExtension::CESMRFieldBuilderPluginExtension |
|
43 // ----------------------------------------------------------------------------- |
|
44 // |
|
45 CESMRFieldBuilderPluginExtension::CESMRFieldBuilderPluginExtension() : |
|
46 iESMRStaticAccessed(EFalse) |
|
47 { |
|
48 FUNC_LOG; |
|
49 //do nothing |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // CESMRFieldBuilderPluginExtension::~CESMRFieldBuilderPluginExtension |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CESMRFieldBuilderPluginExtension::~CESMRFieldBuilderPluginExtension() |
|
57 { |
|
58 FUNC_LOG; |
|
59 if(iESMRStaticAccessed) |
|
60 { |
|
61 iESMRStatic.Close(); |
|
62 } |
|
63 } |
|
64 |
|
65 // ---------------------------------------------------------------------------- |
|
66 // CESMRFieldBuilderPluginExtension::ExtensionL |
|
67 // ---------------------------------------------------------------------------- |
|
68 // |
|
69 TAny* CESMRFieldBuilderPluginExtension::ExtensionL( TUid /*aExtensionUid*/ ) |
|
70 { |
|
71 FUNC_LOG; |
|
72 MESMRBuilderExtension* capa = static_cast<MESMRBuilderExtension*>( this ); |
|
73 return capa; |
|
74 } |
|
75 |
|
76 // ---------------------------------------------------------------------------- |
|
77 // CESMRFieldBuilderPluginExtension::ExtensionL |
|
78 // ---------------------------------------------------------------------------- |
|
79 // |
|
80 TBool CESMRFieldBuilderPluginExtension::CFSMailBoxCapabilityL( |
|
81 EMRCFSMailBoxCapability aCapa ) |
|
82 { |
|
83 FUNC_LOG; |
|
84 iESMRStatic.ConnectL(); |
|
85 iESMRStaticAccessed = ETrue; |
|
86 |
|
87 TBool response(EFalse); |
|
88 |
|
89 if (aCapa == EMRCFSAttendeeStatus) |
|
90 { |
|
91 response = iESMRStatic.DefaultFSMailBoxL().HasCapability( |
|
92 EFSMBoxCapaMeetingRequestAttendeeStatus ); |
|
93 } |
|
94 |
|
95 return response; |
|
96 } |
|
97 |
|
98 // ---------------------------------------------------------------------------- |
|
99 // CESMRFieldBuilderPluginExtension::MRCanBeOriginateedL |
|
100 // ---------------------------------------------------------------------------- |
|
101 // |
|
102 TBool CESMRFieldBuilderPluginExtension::MRCanBeOriginateedL( |
|
103 TBool aForceResetDefaultMRMailbox ) |
|
104 { |
|
105 FUNC_LOG; |
|
106 TBool retValue( EFalse ); |
|
107 |
|
108 iESMRStatic.ConnectL(); |
|
109 iESMRStaticAccessed = ETrue; |
|
110 |
|
111 CCalenInterimUtils2* calUtils2 = CCalenInterimUtils2::NewL(); |
|
112 CleanupStack::PushL( calUtils2 ); |
|
113 if ( calUtils2->MRViewersEnabledL() ) |
|
114 { |
|
115 TRAPD( err, |
|
116 iESMRStatic.DefaultFSMailBoxL( aForceResetDefaultMRMailbox ) ); |
|
117 |
|
118 if ( KErrNone == err ) |
|
119 { |
|
120 // If can fetch the default FS mailbox --> |
|
121 // We are able to originate MR as well. |
|
122 retValue = ETrue; |
|
123 } |
|
124 } |
|
125 |
|
126 CleanupStack::PopAndDestroy( calUtils2 ); |
|
127 calUtils2 = NULL; |
|
128 |
|
129 return retValue; |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // CESMRFieldBuilderPluginExtension::NewL |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 CESMRFieldBuilderPluginExtension* CESMRFieldBuilderPluginExtension::NewL() |
|
137 { |
|
138 FUNC_LOG; |
|
139 CESMRFieldBuilderPluginExtension* self = |
|
140 new (ELeave) CESMRFieldBuilderPluginExtension; |
|
141 CleanupStack::PushL(self); |
|
142 self->ConstructL(); |
|
143 CleanupStack::Pop(self); |
|
144 return self; |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CESMRFieldBuilderPluginExtension::ConstructL |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 void CESMRFieldBuilderPluginExtension::ConstructL() |
|
152 { |
|
153 FUNC_LOG; |
|
154 //do nothing |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CESMRFieldBuilderPluginExtension::FieldBuilderL |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 MESMRFieldBuilder* CESMRFieldBuilderPluginExtension::FieldBuilderL() |
|
162 { |
|
163 FUNC_LOG; |
|
164 return this; |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CESMRFieldBuilderPluginExtension::CreateEditorFieldL |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 CESMRField* CESMRFieldBuilderPluginExtension::CreateEditorFieldL( |
|
172 MESMRFieldValidator* /*aValidator*/, |
|
173 TESMREntryField aField ) |
|
174 { |
|
175 FUNC_LOG; |
|
176 CESMRField* field = NULL; |
|
177 switch ( aField.iFieldId ) |
|
178 { |
|
179 case EESMRFieldAttendee: |
|
180 { |
|
181 field = CESMRAttendeeField::NewL( CCalAttendee::EReqParticipant ); |
|
182 break; |
|
183 } |
|
184 case EESMRFieldOptAttendee: |
|
185 { |
|
186 field = CESMRAttendeeField::NewL( CCalAttendee::EOptParticipant ); |
|
187 break; |
|
188 } |
|
189 default: |
|
190 { |
|
191 User::Leave( KErrArgument ); |
|
192 } |
|
193 } |
|
194 return field; |
|
195 } |
|
196 |
|
197 // ----------------------------------------------------------------------------- |
|
198 // CESMRFieldBuilderPluginExtension::CreateViewerFieldL |
|
199 // ----------------------------------------------------------------------------- |
|
200 // |
|
201 CESMRField* CESMRFieldBuilderPluginExtension::CreateViewerFieldL( |
|
202 MESMRResponseObserver* aResponseObserver, |
|
203 TESMREntryField aField, |
|
204 TBool /*aResponseReady*/ ) |
|
205 { |
|
206 FUNC_LOG; |
|
207 CESMRField* field = NULL; |
|
208 switch ( aField.iFieldId ) |
|
209 { |
|
210 case EESMRFieldAttachments: |
|
211 { |
|
212 field = CESMRViewerAttachmentsField::NewL(); |
|
213 } |
|
214 break; |
|
215 case EESMRFieldAttendee: |
|
216 { |
|
217 field = CESMRViewerAttendeesField::NewL( CCalAttendee::EReqParticipant ); |
|
218 break; |
|
219 } |
|
220 case EESMRFieldOptAttendee: |
|
221 { |
|
222 field = CESMRViewerAttendeesField::NewL( CCalAttendee::EOptParticipant ); |
|
223 break; |
|
224 } |
|
225 case EESMRFieldResponseArea: |
|
226 { |
|
227 field = CESMRResponseField::NewL( aResponseObserver ); |
|
228 break; |
|
229 } |
|
230 case EESMRFieldResponseReadyArea: |
|
231 { |
|
232 field = CESMRResponseReadyField::NewL( aResponseObserver ); |
|
233 break; |
|
234 } |
|
235 case EESMRFieldOrganizer: |
|
236 { |
|
237 field = CESMRViewerFromField::NewL(); |
|
238 break; |
|
239 } |
|
240 case EESMRFieldReqTrack: |
|
241 { |
|
242 field = CESMRTrackingFieldLabel::NewL(CCalAttendee::EReqParticipant ); |
|
243 break; |
|
244 } |
|
245 case EESMRFieldOptTrack: |
|
246 { |
|
247 field = CESMRTrackingFieldLabel::NewL(CCalAttendee::EOptParticipant ); |
|
248 break; |
|
249 } |
|
250 case EESMRTrackStatus: |
|
251 { |
|
252 field = CESMRTrackStatus::NewL(); |
|
253 break; |
|
254 } |
|
255 default: |
|
256 { |
|
257 User::Leave( KErrArgument ); |
|
258 } |
|
259 } |
|
260 // Set field mode |
|
261 field->SetFieldMode( EESMRFieldModeView ); |
|
262 |
|
263 return field; |
|
264 } |
|
265 //EOF |
|
266 |