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 * Class CIrMtmUiData |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "irmtmuidata.h" |
|
22 #include "irmtmui.h" |
|
23 #include <irmsgtypeuid.h> |
|
24 #include <mtclbase.h> |
|
25 #include <msvuids.h> |
|
26 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
27 #include <mtmdef.hrh> //kuidmtmquerymaxbodysizevalue etc |
|
28 #else |
|
29 #include <mtmdef.hrh> //kuidmtmquerymaxbodysizevalue etc |
|
30 #include <mtmuidsdef.hrh> //kuidmtmquerymaxbodysizevalue etc |
|
31 #endif |
|
32 #include <Obexutils.rsg> |
|
33 #include <MtmExtendedCapabilities.hrh> |
|
34 #include <obexutilsmessagehandler.h> |
|
35 #include "debug.h" |
|
36 |
|
37 //CONSTANTS |
|
38 const TInt KIrMtmUiDataMsgEditorAppValue = 0x00000000; |
|
39 |
|
40 // ================= MEMBER FUNCTIONS ======================= |
|
41 |
|
42 // Two-phased constructor. |
|
43 CIrMtmUiData* CIrMtmUiData::NewL(CRegisteredMtmDll& aRegisteredDll) |
|
44 { |
|
45 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CIrMtmUiData\t" ) ); |
|
46 CIrMtmUiData* self=new(ELeave) CIrMtmUiData(aRegisteredDll); |
|
47 CleanupStack::PushL(self); |
|
48 self->ConstructL(); |
|
49 CleanupStack::Pop(self); |
|
50 return self; |
|
51 } |
|
52 |
|
53 // Symbian OS default constructor can leave. |
|
54 void CIrMtmUiData::ConstructL() |
|
55 { |
|
56 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ConstructL\t" ) ); |
|
57 CBaseMtmUiData::ConstructL(); |
|
58 TObexUtilsMessageHandler::CreateDefaultMtmServiceL(KUidMsgTypeIrUID); |
|
59 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ConstructL done\t" ) ); |
|
60 } |
|
61 |
|
62 // C++ default constructor can NOT contain any code, that |
|
63 // might leave. |
|
64 // |
|
65 CIrMtmUiData::CIrMtmUiData(CRegisteredMtmDll& aRegisteredDll) |
|
66 : CBaseMtmUiData(aRegisteredDll) |
|
67 { |
|
68 } |
|
69 |
|
70 |
|
71 // Destructor |
|
72 CIrMtmUiData::~CIrMtmUiData() |
|
73 { |
|
74 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ~CIrMtmUiData\t" ) ); |
|
75 } |
|
76 |
|
77 |
|
78 // --------------------------------------------------------- |
|
79 // OperationSupportedL(...) |
|
80 // No Ir-specific operations added to MS menu. |
|
81 // --------------------------------------------------------- |
|
82 // |
|
83 TInt CIrMtmUiData::OperationSupportedL( |
|
84 TInt /*aOperationId*/, |
|
85 const TMsvEntry& /*aContext*/) const |
|
86 { |
|
87 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: OperationSupportedL\t" ) ); |
|
88 return TObexUtilsUiLayer::OperationNotSupported(); |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------- |
|
92 // QueryCapability(...) |
|
93 // MTM query capability |
|
94 // --------------------------------------------------------- |
|
95 // |
|
96 TInt CIrMtmUiData::QueryCapability( |
|
97 TUid aCapability, |
|
98 TInt& aResponse ) const |
|
99 { |
|
100 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: QueryCapability\t" ) ); |
|
101 switch( aCapability.iUid ) |
|
102 { |
|
103 // --- Supported valued capabilities --- |
|
104 case KUidMtmQueryMaxBodySizeValue: |
|
105 { |
|
106 aResponse = KMaxTInt; |
|
107 break; |
|
108 } |
|
109 case KUidMtmQueryMaxTotalMsgSizeValue: |
|
110 { |
|
111 aResponse = KMaxTInt; |
|
112 break; |
|
113 } |
|
114 case KUidMsvMtmQueryEditorUidValue: |
|
115 { |
|
116 aResponse = KIrMtmUiDataMsgEditorAppValue; |
|
117 break; |
|
118 } |
|
119 case KUidMsvMtmQuerySupportLinks: |
|
120 { |
|
121 aResponse = ETrue; |
|
122 break; |
|
123 } |
|
124 case KUidMtmQuerySupportAttachmentsValue: |
|
125 case KUidMtmQueryCanSendMsgValue: |
|
126 { |
|
127 break; |
|
128 } |
|
129 case KUidMtmQuerySupportedBodyValue: |
|
130 default: |
|
131 { |
|
132 return KErrNotSupported; |
|
133 } |
|
134 } |
|
135 return KErrNone; |
|
136 } |
|
137 |
|
138 // --------------------------------------------------------- |
|
139 // CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon(...) |
|
140 // Handles received msg icon. |
|
141 // --------------------------------------------------------- |
|
142 // |
|
143 const CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon( |
|
144 const TMsvEntry& aContext, |
|
145 TInt /*aStateFlags*/) const |
|
146 |
|
147 { |
|
148 TInt icon = TObexUtilsUiLayer::ContextIcon( aContext, EInfrared ); |
|
149 return *iIconArrays->At( icon/2 ); |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------- |
|
153 // PopulateArraysL() |
|
154 // Populates bitmap array |
|
155 // --------------------------------------------------------- |
|
156 // |
|
157 void CIrMtmUiData::PopulateArraysL() |
|
158 { |
|
159 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: PopulateArraysL\t" ) ); |
|
160 |
|
161 TObexUtilsUiLayer::CreateIconsL( KUidMsgTypeIrUID, iIconArrays ); |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------- |
|
165 // GetResourceFileName(TFileName& aFileName) const |
|
166 // Gives resource filename. |
|
167 // --------------------------------------------------------- |
|
168 // |
|
169 void CIrMtmUiData::GetResourceFileName(TFileName& aFileName) const |
|
170 { |
|
171 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: GetResourceFileName\t" ) ); |
|
172 aFileName = KObexUtilsFileDrive; |
|
173 aFileName += KDC_RESOURCE_FILES_DIR; |
|
174 aFileName += KObexUtilsResourceFileName; |
|
175 } |
|
176 |
|
177 // --------------------------------------------------------- |
|
178 // CanCreateEntryL(...) |
|
179 // Checks if it is possible to create entry. |
|
180 // --------------------------------------------------------- |
|
181 // |
|
182 TBool CIrMtmUiData::CanCreateEntryL( |
|
183 const TMsvEntry& aParent, |
|
184 TMsvEntry& aNewEntry, |
|
185 TInt& aReasonResourceId ) const |
|
186 { |
|
187 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanCreateEntryL\t" ) ); |
|
188 aReasonResourceId = 0; |
|
189 if( CheckEntry( aNewEntry ) ) |
|
190 { |
|
191 // --- Can create messages in local folders --- |
|
192 return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue ); |
|
193 } |
|
194 // --- Can't create other types --- |
|
195 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
196 return EFalse; |
|
197 } |
|
198 |
|
199 // --------------------------------------------------------- |
|
200 // CanOpenEntryL(...) |
|
201 // Checks if it is possible to open entry. |
|
202 // --------------------------------------------------------- |
|
203 // |
|
204 TBool CIrMtmUiData::CanOpenEntryL( |
|
205 const TMsvEntry& aContext, |
|
206 TInt& aReasonResourceId ) const |
|
207 { |
|
208 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanOpenEntryL\t" ) ); |
|
209 if( CheckEntry( aContext ) ) |
|
210 { |
|
211 if( aContext.iType.iUid == KUidMsvMessageEntryValue ) |
|
212 { |
|
213 aReasonResourceId = 0; |
|
214 return ETrue; |
|
215 } |
|
216 } |
|
217 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
218 return EFalse; |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------- |
|
222 // CanCloseEntryL(...) |
|
223 // Checks if it is possible to close entry. |
|
224 // --------------------------------------------------------- |
|
225 // |
|
226 TBool CIrMtmUiData::CanCloseEntryL( |
|
227 const TMsvEntry& aContext, |
|
228 TInt& aReasonResourceId ) const |
|
229 { |
|
230 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanCloseEntryL\t" ) ); |
|
231 if( CheckEntry( aContext ) ) |
|
232 { |
|
233 if( aContext.iType.iUid == KUidMsvServiceEntryValue ) |
|
234 { |
|
235 aReasonResourceId = 0; |
|
236 return ETrue; |
|
237 } |
|
238 } |
|
239 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
240 return EFalse; |
|
241 } |
|
242 |
|
243 // --------------------------------------------------------- |
|
244 // CanViewEntryL(...) |
|
245 // Checks if it is possible to view entry. |
|
246 // --------------------------------------------------------- |
|
247 // |
|
248 TBool CIrMtmUiData::CanViewEntryL( |
|
249 const TMsvEntry& aContext, |
|
250 TInt& aReasonResourceId ) const |
|
251 { |
|
252 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanViewEntryL\t" ) ); |
|
253 if( CheckEntry( aContext ) ) |
|
254 { |
|
255 if( aContext.iType.iUid == KUidMsvMessageEntryValue ) |
|
256 { |
|
257 aReasonResourceId = 0; |
|
258 return ETrue; |
|
259 } |
|
260 } |
|
261 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
262 return EFalse; |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------- |
|
266 // CanEditEntryL(...) |
|
267 // Checks if it is possible to edit entry. |
|
268 // --------------------------------------------------------- |
|
269 // |
|
270 TBool CIrMtmUiData::CanEditEntryL( |
|
271 const TMsvEntry& aContext, |
|
272 TInt& aReasonResourceId ) const |
|
273 { |
|
274 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanEditEntryL\t" ) ); |
|
275 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
276 if( CheckEntry( aContext ) ) |
|
277 { |
|
278 if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || |
|
279 ( aContext.iType.iUid == KUidMsvFolderEntryValue ) ) |
|
280 { |
|
281 aReasonResourceId=0; |
|
282 return ETrue; |
|
283 } |
|
284 } |
|
285 return EFalse; |
|
286 } |
|
287 |
|
288 // --------------------------------------------------------- |
|
289 // CanDeleteServiceL(...) |
|
290 // Checks if it is possible to delete service. |
|
291 // --------------------------------------------------------- |
|
292 // |
|
293 TBool CIrMtmUiData::CanDeleteServiceL( |
|
294 const TMsvEntry& /*aService*/, |
|
295 TInt& aReasonResourceId ) const |
|
296 { |
|
297 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanDeleteServiceL\t" ) ); |
|
298 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
299 return EFalse; |
|
300 } |
|
301 |
|
302 // --------------------------------------------------------- |
|
303 // CanDeleteFromEntryL(...) |
|
304 // Checks if it is possible to delete from entry. |
|
305 // --------------------------------------------------------- |
|
306 // |
|
307 TBool CIrMtmUiData::CanDeleteFromEntryL( |
|
308 const TMsvEntry& /*aContext*/, |
|
309 TInt& aReasonResourceId ) const |
|
310 { |
|
311 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
312 return EFalse; |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------- |
|
316 // CanCopyMoveToEntryL(...) |
|
317 // Checks if it is possible to move to entry. |
|
318 // --------------------------------------------------------- |
|
319 // |
|
320 TBool CIrMtmUiData::CanCopyMoveToEntryL( |
|
321 const TMsvEntry& /*aContext*/, |
|
322 TInt& aReasonResourceId ) const |
|
323 { |
|
324 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
325 return EFalse; |
|
326 } |
|
327 |
|
328 // --------------------------------------------------------- |
|
329 // CanCopyMoveFromEntryL(...) |
|
330 // Checks if it is possible to move from entry. |
|
331 // --------------------------------------------------------- |
|
332 // |
|
333 TBool CIrMtmUiData::CanCopyMoveFromEntryL( |
|
334 const TMsvEntry& /*aContext*/, |
|
335 TInt& aReasonResourceId ) const |
|
336 { |
|
337 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
338 return EFalse; |
|
339 } |
|
340 |
|
341 // --------------------------------------------------------- |
|
342 // CanReplyToEntryL(...) |
|
343 // Checks if it is possible to reply to entry. |
|
344 // --------------------------------------------------------- |
|
345 // |
|
346 TBool CIrMtmUiData::CanReplyToEntryL( |
|
347 const TMsvEntry& /*aContext*/, |
|
348 TInt& aReasonResourceId ) const |
|
349 { |
|
350 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
351 return EFalse; // Not Ok to do |
|
352 } |
|
353 |
|
354 // --------------------------------------------------------- |
|
355 // CanForwardEntryL(...) |
|
356 // Checks if it is possible to forward entry. |
|
357 // --------------------------------------------------------- |
|
358 // |
|
359 TBool CIrMtmUiData::CanForwardEntryL( |
|
360 const TMsvEntry& /*aContext*/, |
|
361 TInt& aReasonResourceId ) const |
|
362 { |
|
363 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
364 return EFalse; // Not Ok to do |
|
365 } |
|
366 |
|
367 // --------------------------------------------------------- |
|
368 // CheckEntry(...) |
|
369 // Checks is the entry valid. |
|
370 // --------------------------------------------------------- |
|
371 // |
|
372 TBool CIrMtmUiData::CheckEntry(const TMsvEntry& aContext) const |
|
373 { |
|
374 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CheckEntry\t" ) ); |
|
375 return( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) && |
|
376 ( aContext.iMtm == KUidMsgTypeIrUID ) ); |
|
377 } |
|
378 |
|
379 // --------------------------------------------------------- |
|
380 // CanCancelL(...) |
|
381 // Checks if it is possible to cancel entry. |
|
382 // --------------------------------------------------------- |
|
383 // |
|
384 TBool CIrMtmUiData::CanCancelL( |
|
385 const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const |
|
386 { |
|
387 // No way of sending a message from the outbox, so no need to cancel. |
|
388 aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); |
|
389 return EFalse; |
|
390 } |
|
391 |
|
392 // --------------------------------------------------------- |
|
393 // StatusTextL(...) |
|
394 // Returns status text when sending message(outbox). |
|
395 // --------------------------------------------------------- |
|
396 // |
|
397 HBufC* CIrMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const |
|
398 { |
|
399 FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: StatusTextL\t" ) ); |
|
400 TBuf<80> buffer; |
|
401 TInt resourceId = R_IR_SEND_PROGRESS_SENDING; |
|
402 TObexUtilsUiLayer::ReadResourceL( buffer, resourceId ); |
|
403 HBufC* ptr; |
|
404 ptr = buffer.AllocL(); |
|
405 return ptr; |
|
406 } |
|
407 |
|
408 // End of File |
|