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