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