|
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 * CBtMtmUi class |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "btmtmui.h" |
|
22 #include "btmtmuidebug.h" |
|
23 |
|
24 //#include <obexmtmuilayer.h> |
|
25 #ifdef NO101APPDEPFIXES |
|
26 #include <MuiuMsvProgressReporterOperation.h> |
|
27 #endif //NO101APPDEPFIXES |
|
28 |
|
29 #ifdef NO101APPDEPFIXES_NEW |
|
30 #include <app/btcmtm.h> |
|
31 #endif //NO101APPDEPFIXES_NEW |
|
32 |
|
33 #include <mtmuidef.hrh> |
|
34 #include <mtclreg.h> |
|
35 #include <obexutilsuilayer.h> |
|
36 #include <Obexutils.rsg> |
|
37 #include <msvuids.h> |
|
38 #include <msvids.h> |
|
39 #include <obexconstants.h> |
|
40 |
|
41 |
|
42 // CONSTANTS |
|
43 #ifdef NO101APPDEPFIXES |
|
44 const TInt KBtMtmUiToFromFieldBuffer = 80; |
|
45 const TInt KBtMtmUiConnectionTimeout = 20000000; |
|
46 const TInt KBtMtmUiConnectionPutTimeout = 0; |
|
47 const TInt KBtMtmUiObexPort = 1; |
|
48 const TInt KBtMtmUiAddressMaxLength = 3; |
|
49 #endif //NO101APPDEPFIXES |
|
50 |
|
51 // ENUMS |
|
52 enum TBtMtmAsyncCmds |
|
53 { |
|
54 EBtMtmCmdSend |
|
55 }; |
|
56 |
|
57 // ================= MEMBER FUNCTIONS ======================= |
|
58 |
|
59 // C++ default constructor can NOT contain any code, that |
|
60 // might leave. |
|
61 // |
|
62 CBtMtmUi::CBtMtmUi( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ) |
|
63 : CBaseMtmUi( aBaseMtm, aRegisteredMtmDll ) |
|
64 { |
|
65 FLOG( _L( "[CBtMtmUi] CBtMtmUi: CBtMtmUi\t" ) ); |
|
66 } |
|
67 |
|
68 // Two-phased constructor. |
|
69 CBtMtmUi* CBtMtmUi::NewL( CBaseMtm& aBaseMtm, CRegisteredMtmDll& aRegisteredMtmDll ) |
|
70 { |
|
71 FLOG( _L( "[CBtMtmUi] CBtMtmUi: NewL\t" ) ); |
|
72 CBtMtmUi* self = new( ELeave ) CBtMtmUi( aBaseMtm, aRegisteredMtmDll ); |
|
73 CleanupStack::PushL( self ); |
|
74 self->ConstructL(); |
|
75 CleanupStack::Pop( self ); |
|
76 return self; |
|
77 } |
|
78 |
|
79 // Destructor |
|
80 CBtMtmUi::~CBtMtmUi() |
|
81 { |
|
82 FLOG( _L( "[CBtMtmUi] CBtMtmUi: ~CBtMtmUi\t" ) ); |
|
83 delete iClientRegistry; |
|
84 } |
|
85 |
|
86 // Symbian OS default constructor can leave. |
|
87 void CBtMtmUi::ConstructL() |
|
88 { |
|
89 FLOG( _L( "[CBtMtmUi] CBtMtmUi: ConstructL\t" ) ); |
|
90 CBaseMtmUi::ConstructL(); |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------- |
|
94 // GetResourceFileName(...) |
|
95 // return progress status. |
|
96 // --------------------------------------------------------- |
|
97 // |
|
98 void CBtMtmUi::GetResourceFileName( TFileName& aFileName ) const |
|
99 { |
|
100 FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetResourceFileName\t" ) ); |
|
101 aFileName = KObexUtilsFileDrive; |
|
102 aFileName += KDC_RESOURCE_FILES_DIR; |
|
103 aFileName += KObexUtilsResourceFileName; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------- |
|
107 // QueryCapability(TUid aCapability, TInt& aResponse) |
|
108 // return capability of mtm. |
|
109 // --------------------------------------------------------- |
|
110 // |
|
111 TInt CBtMtmUi::QueryCapability(TUid aCapability, TInt& aResponse) |
|
112 { |
|
113 // Querying of menu availablility is done in syni. |
|
114 FLOG( _L( "[CBtMtmUi] CBtMtmUi: QueryCapability\t" ) ); |
|
115 if( aCapability.iUid == KUidMsvMtmUiQueryCanPrintMsgValue ) |
|
116 { |
|
117 aResponse = ETrue; |
|
118 return KErrNone; |
|
119 } |
|
120 return CBaseMtmUi::QueryCapability( aCapability, aResponse ); |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------- |
|
124 // InvokeSyncFunctionL(...) |
|
125 // Invoke sync -function from BaseMTM. |
|
126 // --------------------------------------------------------- |
|
127 // |
|
128 void CBtMtmUi::InvokeSyncFunctionL( TInt aFunctionId, |
|
129 const CMsvEntrySelection& aSelection, |
|
130 TDes8& aParameter ) |
|
131 { |
|
132 FLOG( _L( "[CBtMtmUi] CBtMtmUi: InvokeSyncFunctionL\t" ) ); |
|
133 CBaseMtmUi::InvokeSyncFunctionL( aFunctionId, aSelection, aParameter ); |
|
134 } |
|
135 |
|
136 |
|
137 // --------------------------------------------------------- |
|
138 // CreateL(...) |
|
139 // Entry creation forbidden. |
|
140 // --------------------------------------------------------- |
|
141 // |
|
142 CMsvOperation* CBtMtmUi::CreateL( const TMsvEntry& /*aEntry*/, |
|
143 CMsvEntry& /*aParent*/, |
|
144 TRequestStatus& /*aStatus*/ ) |
|
145 { |
|
146 FLOG( _L( "[CBtMtmUi] CBtMtmUi: CreateL\t" ) ); |
|
147 // Entries created through utility functions. |
|
148 User::Leave( KErrNotSupported ); |
|
149 // Return value is needed for removing compilation errors |
|
150 return NULL; |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------- |
|
154 // OpenL(TRequestStatus& aStatus) |
|
155 // handles opening entry. |
|
156 // --------------------------------------------------------- |
|
157 // |
|
158 CMsvOperation* CBtMtmUi::OpenL( TRequestStatus& aStatus ) |
|
159 { |
|
160 FLOG( _L( "[CBtMtmUi] CBtMtmUi: OpenL\t" ) ); |
|
161 const TMsvEntry& context = iBaseMtm.Entry().Entry(); |
|
162 const TUid type( context.iType ); |
|
163 if( ( type == KUidMsvMessageEntry ) && |
|
164 ( ( context.Parent() == KMsvSentEntryIdValue ) |
|
165 ||( context.Parent() == KMsvGlobalInBoxIndexEntryIdValue ) ) ) |
|
166 { |
|
167 // Message is in the sent folder, so can't be edited |
|
168 return ViewL( aStatus ); |
|
169 } |
|
170 return EditL( aStatus ); |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 // OpenL(...) |
|
175 // handles opening entry using selection. |
|
176 // --------------------------------------------------------- |
|
177 // |
|
178 CMsvOperation* CBtMtmUi::OpenL( TRequestStatus& aStatus, |
|
179 const CMsvEntrySelection& aSelection ) |
|
180 { |
|
181 iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); |
|
182 return OpenL( aStatus ); |
|
183 } |
|
184 |
|
185 // --------------------------------------------------------- |
|
186 // CloseL(TRequestStatus& aStatus) |
|
187 // Closes entry. |
|
188 // --------------------------------------------------------- |
|
189 // |
|
190 CMsvOperation* CBtMtmUi::CloseL( TRequestStatus& aStatus ) |
|
191 { |
|
192 FLOG( _L( "[CBtMtmUi] CBtMtmUi: CloseL\t" ) ); |
|
193 CMsvCompletedOperation* op = CMsvCompletedOperation::NewL( Session(), |
|
194 Type(), |
|
195 KNullDesC8, |
|
196 KMsvLocalServiceIndexEntryId, |
|
197 aStatus); |
|
198 return op; |
|
199 } |
|
200 |
|
201 // --------------------------------------------------------- |
|
202 // CloseL(TRequestStatus& aStatus) |
|
203 // Closes entry using selection. |
|
204 // --------------------------------------------------------- |
|
205 // |
|
206 CMsvOperation* CBtMtmUi::CloseL( |
|
207 TRequestStatus& aStatus, |
|
208 const CMsvEntrySelection& aSelection) |
|
209 { |
|
210 iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); |
|
211 return CloseL( aStatus ); |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------- |
|
215 // EditL(...) |
|
216 // Handles message sending using selection. |
|
217 // --------------------------------------------------------- |
|
218 // |
|
219 CMsvOperation* CBtMtmUi::EditL( TRequestStatus& aStatus, const CMsvEntrySelection& aSelection ) |
|
220 { |
|
221 FLOG( _L( "[BtMtmUi] CBtMtmUi: EditL 1 \t" ) ); |
|
222 iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); |
|
223 return EditL( aStatus ); |
|
224 } |
|
225 |
|
226 // --------------------------------------------------------- |
|
227 // EditL(TRequestStatus& aStatus) |
|
228 // Handles message sending over Bluetooth. |
|
229 // --------------------------------------------------------- |
|
230 // |
|
231 CMsvOperation* CBtMtmUi::EditL( TRequestStatus& aStatus ) |
|
232 { |
|
233 FLOG( _L( "[BtMtmUi] CBtMtmUi: EditL 2 \t" ) ); |
|
234 switch( iBaseMtm.Entry().Entry().iType.iUid ) |
|
235 { |
|
236 case KUidMsvMessageEntryValue: |
|
237 { |
|
238 if( iBaseMtm.Entry().Entry().Parent() != KMsvDraftEntryId && |
|
239 iBaseMtm.Entry().Entry().Parent() != KMsvGlobalOutBoxIndexEntryId ) |
|
240 { |
|
241 // Edit/"use" entries in the Inbox |
|
242 return LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session() ); |
|
243 } |
|
244 #ifdef NO101APPDEPFIXES |
|
245 else |
|
246 { |
|
247 TInt resourceId; |
|
248 HBufC* password = HBufC::NewL(1); |
|
249 CleanupStack::PushL( password ); // 1st push |
|
250 BaseMtm().LoadMessageL(); |
|
251 |
|
252 TBTDevAddr address; |
|
253 |
|
254 CBtClientMtm::SBtcCmdSendParams sendparams; |
|
255 sendparams.iTimeouts.iConnectTimeout = KBtMtmUiConnectionTimeout; |
|
256 sendparams.iTimeouts.iPutTimeout = KBtMtmUiConnectionPutTimeout; |
|
257 sendparams.iRemoteObexPort = KBtMtmUiObexPort; |
|
258 sendparams.iConnectPassword = password; |
|
259 |
|
260 iDiscovery = CBTEngDiscovery::NewL(this); |
|
261 CBTDevice* iDevice = CBTDevice::NewL( ); |
|
262 |
|
263 |
|
264 if ( iDiscovery->SearchRemoteDevice( iDevice ) == KErrNone ) |
|
265 { |
|
266 TInt retVal=0; |
|
267 iWaiter.Start(); |
|
268 |
|
269 if ( iState ==KErrNone) |
|
270 { |
|
271 address = iDevice->BDAddr(); |
|
272 FLOG( _L( "[BtMtmUi] CBtMtmUi:SearchRemoteChannelL \t" ) ); |
|
273 retVal = iDiscovery->RemoteProtocolChannelQuery(address, TUUID(KBTSdpObjectPush)); |
|
274 if(retVal == KErrNone) |
|
275 { |
|
276 iWaiter.Start(); |
|
277 } |
|
278 } |
|
279 if ( retVal != KErrNone ||iState != KErrNone ) |
|
280 { |
|
281 resourceId = R_BT_DEV_NOT_AVAIL; |
|
282 TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); |
|
283 CleanupStack::PopAndDestroy(3); // BtDevice, BtConnection, password |
|
284 return CMsvCompletedOperation::NewL( |
|
285 Session(), |
|
286 Type(), |
|
287 KNullDesC8, |
|
288 KMsvLocalServiceIndexEntryId, |
|
289 aStatus ); |
|
290 } |
|
291 sendparams.iRemoteObexPort = iClientChannel; |
|
292 |
|
293 TPtrC8 ptr8 = address.Des(); |
|
294 TBuf16<KBtMtmUiAddressMaxLength> convertedaddress16;//48 bits |
|
295 // Bt address conversion |
|
296 TInt i; |
|
297 for( i=0; i<3; i++ ) |
|
298 { |
|
299 TUint16 word = ptr8[( i*2 )+1]; |
|
300 word = ( TUint16 )( word << 8 ); |
|
301 word = ( TUint16 )( word + ptr8[i*2] ); |
|
302 convertedaddress16.Append( &word, 1 ); |
|
303 } |
|
304 |
|
305 BaseMtm().AddAddresseeL( convertedaddress16 ); |
|
306 } |
|
307 else |
|
308 { |
|
309 CleanupStack::PopAndDestroy(3); // BtDevice, BTConnection, password |
|
310 FLOG( _L( "[BTMTMUI] CBtMtmUi:CMsvCompletedOperation NewL\t" ) ); |
|
311 return CMsvCompletedOperation::NewL( |
|
312 Session(), |
|
313 Type(), |
|
314 KNullDesC8, |
|
315 KMsvLocalServiceIndexEntryId, |
|
316 aStatus ); |
|
317 } |
|
318 |
|
319 CMsvEntrySelection* sel = new( ELeave ) CMsvEntrySelection(); |
|
320 CleanupStack::PushL( sel ); // 4th push |
|
321 sel->AppendL( BaseMtm().Entry().EntryId() ); |
|
322 |
|
323 CMsvOperationWait* waiter = CMsvOperationWait::NewLC(); // 5th push |
|
324 |
|
325 TBuf<KBtMtmUiToFromFieldBuffer> toFrom; |
|
326 resourceId = R_BT_SEND_OUTBOX_SENDING; |
|
327 TObexUtilsUiLayer::ReadResourceL( toFrom, resourceId ); |
|
328 |
|
329 BaseMtm().SaveMessageL(); |
|
330 |
|
331 TMsvEntry newTEntry( iBaseMtm.Entry().Entry() ); |
|
332 newTEntry.iDetails.Set( toFrom ); |
|
333 newTEntry.SetVisible( ETrue ); |
|
334 newTEntry.SetInPreparation( ETrue ); |
|
335 |
|
336 iBaseMtm.Entry().ChangeL( newTEntry ); |
|
337 |
|
338 CMsvEntry* entry = |
|
339 BaseMtm().Session().GetEntryL( KMsvDraftEntryId ); |
|
340 |
|
341 CleanupStack::PushL( entry ); // 6th push |
|
342 |
|
343 CMsvOperation* moveOp = entry->MoveL( |
|
344 *sel, |
|
345 KMsvGlobalOutBoxIndexEntryId, |
|
346 waiter->iStatus ); |
|
347 |
|
348 CleanupStack::PopAndDestroy( entry ); |
|
349 |
|
350 waiter->Start(); |
|
351 CActiveScheduler::Start(); |
|
352 delete moveOp; |
|
353 |
|
354 CMsvProgressReporterOperation* reporter |
|
355 = CMsvProgressReporterOperation::NewL( Session(), aStatus ); |
|
356 CleanupStack::PushL( reporter ); // 6th push |
|
357 |
|
358 TPckgBuf<CBtClientMtm::SBtcCmdSendParams> paramBuf( sendparams ); |
|
359 |
|
360 CMsvOperation* op = BaseMtm().InvokeAsyncFunctionL( |
|
361 EBtMtmCmdSend, |
|
362 *sel, |
|
363 paramBuf, |
|
364 reporter->RequestStatus() ); |
|
365 |
|
366 // ownership of op transfered to reporter |
|
367 reporter->SetOperationL( op ); |
|
368 |
|
369 aStatus = KRequestPending; |
|
370 |
|
371 CleanupStack::Pop( reporter ); |
|
372 CleanupStack::PopAndDestroy(3); // waiter, sel, password |
|
373 return reporter; |
|
374 } |
|
375 #endif //NO101APPDEPFIXES |
|
376 } |
|
377 case KUidMsvServiceEntryValue: |
|
378 case KUidMsvAttachmentEntryValue: |
|
379 case KUidMsvFolderEntryValue: |
|
380 { |
|
381 User::Leave( KErrNotSupported ); |
|
382 } |
|
383 default: |
|
384 { |
|
385 break; |
|
386 } |
|
387 } |
|
388 |
|
389 CMsvCompletedOperation* op = CMsvCompletedOperation::NewL( |
|
390 Session(), |
|
391 Type(), |
|
392 KNullDesC8, |
|
393 KMsvLocalServiceIndexEntryId, |
|
394 aStatus ); |
|
395 aStatus = KRequestPending; |
|
396 return op; |
|
397 } |
|
398 |
|
399 // --------------------------------------------------------- |
|
400 // ViewL(TRequestStatus& aStatus) |
|
401 // Handles viewing of received object. |
|
402 // --------------------------------------------------------- |
|
403 // |
|
404 CMsvOperation* CBtMtmUi::ViewL( TRequestStatus& aStatus ) |
|
405 { |
|
406 FLOG( _L( "[CBtMtmUi] CBtMtmUi: ViewL\t" ) ); |
|
407 return LaunchEditorApplicationL( aStatus, iBaseMtm.Entry().Session() ); |
|
408 } |
|
409 |
|
410 // --------------------------------------------------------- |
|
411 // ViewL(...) |
|
412 // Handles viewing of received object using selection. |
|
413 // --------------------------------------------------------- |
|
414 // |
|
415 CMsvOperation* CBtMtmUi::ViewL( TRequestStatus& aStatus, |
|
416 const CMsvEntrySelection& aSelection ) |
|
417 { |
|
418 FLOG( _L( "[CBtMtmUi] CBtMtmUi: ViewL 1\t" ) ); |
|
419 iBaseMtm.Entry().SetEntryL( aSelection.At(0) ); |
|
420 return ViewL( aStatus ); |
|
421 } |
|
422 |
|
423 // --------------------------------------------------------- |
|
424 // CopyFromL(...) |
|
425 // Not supported. |
|
426 // --------------------------------------------------------- |
|
427 // |
|
428 CMsvOperation* CBtMtmUi::CopyFromL( const CMsvEntrySelection& /*aSelection*/, |
|
429 TMsvId /*aTargetId*/, |
|
430 TRequestStatus& /*aStatus*/ ) |
|
431 { |
|
432 User::Leave( KErrNotSupported ); |
|
433 // Return value is needed for removing compilation errors |
|
434 return NULL; |
|
435 } |
|
436 |
|
437 // --------------------------------------------------------- |
|
438 // MoveFromL(...) |
|
439 // Not supported. |
|
440 // --------------------------------------------------------- |
|
441 // |
|
442 CMsvOperation* CBtMtmUi::MoveFromL( const CMsvEntrySelection& /*aSelection*/, |
|
443 TMsvId /*aTargetId*/, |
|
444 TRequestStatus& /*aStatus*/ ) |
|
445 { |
|
446 User::Leave( KErrNotSupported ); |
|
447 // Return value is needed for removing compilation errors |
|
448 return NULL; |
|
449 } |
|
450 |
|
451 // --------------------------------------------------------- |
|
452 // MoveToL(...) |
|
453 // Not supported. |
|
454 // --------------------------------------------------------- |
|
455 // |
|
456 CMsvOperation* CBtMtmUi::MoveToL( const CMsvEntrySelection& /*aSelection*/, |
|
457 TRequestStatus& /*aStatus*/) |
|
458 { |
|
459 User::Leave( KErrNotSupported ); |
|
460 // Return value is needed for removing compilation errors |
|
461 return NULL; |
|
462 } |
|
463 |
|
464 // --------------------------------------------------------- |
|
465 // CopyToL(...) |
|
466 // Not supported. |
|
467 // --------------------------------------------------------- |
|
468 // |
|
469 CMsvOperation* CBtMtmUi::CopyToL( const CMsvEntrySelection& /*aSelection*/, |
|
470 TRequestStatus& /*aStatus*/) |
|
471 { |
|
472 User::Leave( KErrNotSupported ); |
|
473 // Return value is needed for removing compilation errors |
|
474 return NULL; |
|
475 } |
|
476 |
|
477 // --------------------------------------------------------- |
|
478 // DisplayProgressSummary(const TDesC8& aProgress) const |
|
479 // calls leaving DisplayProgressSummaryL -function and |
|
480 // traps the error. |
|
481 // --------------------------------------------------------- |
|
482 // |
|
483 TInt CBtMtmUi::DisplayProgressSummary( const TDesC8& aProgress ) const |
|
484 { |
|
485 TInt retVal = KErrNone; |
|
486 TRAP( retVal, retVal = DisplayProgressSummaryL( aProgress ) ); |
|
487 return retVal; |
|
488 } |
|
489 |
|
490 // --------------------------------------------------------- |
|
491 // DisplayProgressSummary(const TDesC8& aProgress) const |
|
492 // calls leaving DisplayProgressSummaryL -function and |
|
493 // traps the error. |
|
494 // --------------------------------------------------------- |
|
495 // |
|
496 TInt CBtMtmUi::DisplayProgressSummaryL( const TDesC8& aProgress ) const |
|
497 { |
|
498 #ifndef NO101APPDEPFIXES_NEW |
|
499 (void) aProgress; |
|
500 #endif //NO101APPDEPFIXES_NEW |
|
501 |
|
502 #ifdef NO101APPDEPFIXES_NEW |
|
503 FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL\t" ) ); |
|
504 TInt resourceId; |
|
505 if( ( !aProgress.Length() ) || ( aProgress.Size() == sizeof( TMsvLocalOperationProgress ) ) ) |
|
506 { |
|
507 // Probably a CMsvCompletedOperation |
|
508 return KErrCancel; |
|
509 } |
|
510 TPckgBuf<TObexMtmProgress> paramPack; |
|
511 paramPack.Copy( aProgress ); |
|
512 TObexMtmProgress& progress = paramPack(); |
|
513 |
|
514 const TObexMtmProgress::TSendState progressType = progress.iSendState; |
|
515 const TInt error = progress.iError; |
|
516 if ( error == KErrInUse ) |
|
517 { |
|
518 resourceId = R_BT_DEV_NOT_AVAIL; |
|
519 TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); |
|
520 return KErrNone; |
|
521 } |
|
522 |
|
523 switch( progressType ) |
|
524 { |
|
525 case TObexMtmProgress::EDisconnected: |
|
526 { |
|
527 FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: EDisconnected\t" ) ); |
|
528 // Allowed to send again. |
|
529 resourceId = R_BT_DATA_SENT; |
|
530 TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); |
|
531 break; |
|
532 } |
|
533 case TObexMtmProgress::ESendError: |
|
534 { |
|
535 FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendError\t" ) ); |
|
536 if( error == KErrIrObexClientNoDevicesFound ) |
|
537 { |
|
538 resourceId = R_BT_DEV_NOT_AVAIL; |
|
539 TObexUtilsUiLayer::ShowInformationNoteL( resourceId ); |
|
540 } |
|
541 else |
|
542 { |
|
543 resourceId = R_BT_FAILED_TO_SEND; |
|
544 TObexUtilsUiLayer::ShowErrorNoteL( resourceId ); |
|
545 } |
|
546 break; |
|
547 } |
|
548 case TObexMtmProgress::ESendComplete: |
|
549 { |
|
550 FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendComplete\t" ) ); |
|
551 break; |
|
552 } |
|
553 case TObexMtmProgress::EInitialise: |
|
554 case TObexMtmProgress::EConnect: |
|
555 case TObexMtmProgress::EConnectAttemptComplete: |
|
556 case TObexMtmProgress::ESendObject: |
|
557 case TObexMtmProgress::ESendNextObject: |
|
558 { |
|
559 FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: ESendObject\t" ) ); |
|
560 return KErrCancel; |
|
561 } |
|
562 case TObexMtmProgress::EUserCancelled: |
|
563 { |
|
564 FLOG( _L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: EUserCancelled\t" ) ); |
|
565 return KErrCancel; |
|
566 } |
|
567 default: |
|
568 { |
|
569 FTRACE( FPrint(_L( "[CBtMtmUi] CBtMtmUi:DisplayProgressSummaryL: Default\t %d" ), progressType ) ); |
|
570 return KErrCancel; |
|
571 } |
|
572 } |
|
573 #endif //NO101APPDEPFIXES_NEW |
|
574 return KErrNone; |
|
575 } |
|
576 |
|
577 |
|
578 // --------------------------------------------------------- |
|
579 // GetProgress(...) |
|
580 // return progress status. |
|
581 // --------------------------------------------------------- |
|
582 // |
|
583 TInt CBtMtmUi::GetProgress( const TDesC8& aProgress, |
|
584 TBuf<EProgressStringMaxLen>& aReturnString, |
|
585 TInt& aTotalEntryCount, |
|
586 TInt& aEntriesDone, |
|
587 TInt& aCurrentEntrySize, |
|
588 TInt& aCurrentBytesTrans ) const |
|
589 { |
|
590 #ifndef NO101APPDEPFIXES_NEW |
|
591 (void) aProgress; |
|
592 (void) aReturnString; |
|
593 (void) aTotalEntryCount; |
|
594 (void) aEntriesDone; |
|
595 (void) aCurrentEntrySize; |
|
596 (void) aCurrentBytesTrans; |
|
597 #endif //NO101APPDEPFIXES_NEW |
|
598 |
|
599 #ifdef NO101APPDEPFIXES_NEW |
|
600 TInt resourceId; |
|
601 |
|
602 FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetProgress\t" ) ); |
|
603 TPckgBuf<TObexMtmProgress> paramPack; |
|
604 paramPack.Copy( aProgress ); |
|
605 TObexMtmProgress& progress = paramPack(); |
|
606 const TObexMtmProgress::TSendState progressType = progress.iSendState; |
|
607 aTotalEntryCount = progress.iTotalEntryCount; |
|
608 aEntriesDone = progress.iEntriesDone; |
|
609 aCurrentEntrySize = progress.iCurrentEntrySize; |
|
610 aCurrentBytesTrans = progress.iCurrentBytesTrans; |
|
611 |
|
612 if( aTotalEntryCount > 1 ) // This is for progress bar multisending |
|
613 { |
|
614 aCurrentEntrySize = 0; |
|
615 } |
|
616 |
|
617 switch( progressType ) |
|
618 { |
|
619 case TObexMtmProgress::ENullOp: |
|
620 case TObexMtmProgress::ESendError: |
|
621 { |
|
622 aReturnString = KNullDesC; |
|
623 break; |
|
624 } |
|
625 case TObexMtmProgress::EInitialise: |
|
626 case TObexMtmProgress::EConnect: |
|
627 case TObexMtmProgress::EConnectAttemptComplete: |
|
628 { |
|
629 resourceId = R_BT_CONNECTING; |
|
630 TRAPD( retVal, TObexUtilsUiLayer::ReadResourceL( aReturnString, resourceId ) ); |
|
631 retVal=retVal; //avoid warning |
|
632 // Leave causes progress note to be empty. Not fatal |
|
633 break; |
|
634 } |
|
635 case TObexMtmProgress::ESendObject: |
|
636 case TObexMtmProgress::ESendNextObject: |
|
637 case TObexMtmProgress::ESendComplete: |
|
638 { |
|
639 resourceId = R_BT_SENDING_DATA; |
|
640 TRAPD( retVal, TObexUtilsUiLayer::ReadResourceL( aReturnString, resourceId ) ); |
|
641 // Leave causes progress note to be empty. Not fatal |
|
642 retVal=retVal; //avoid warning |
|
643 break; |
|
644 } |
|
645 case TObexMtmProgress::EDisconnected: |
|
646 { |
|
647 break; |
|
648 } |
|
649 default: |
|
650 { |
|
651 return KErrCancel; |
|
652 } |
|
653 } |
|
654 FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetProgress Done\t" ) ); |
|
655 #endif //NO101APPDEPFIXES_NEW |
|
656 return KErrNone; |
|
657 } |
|
658 |
|
659 // --------------------------------------------------------- |
|
660 // LaunchEditorApplicationL(...) |
|
661 // Launch viewer for selected object. The first is object's |
|
662 // recognition(document handler). |
|
663 // --------------------------------------------------------- |
|
664 // |
|
665 CMsvOperation* CBtMtmUi::LaunchEditorApplicationL( TRequestStatus& aStatus, |
|
666 CMsvSession& aSession) |
|
667 { |
|
668 FLOG( _L( "[CommonMtmUi] CBtMtmUi: LaunchEditorApplicationL\t" ) ); |
|
669 CMsvEntry* message; |
|
670 message = &iBaseMtm.Entry(); |
|
671 return TObexUtilsUiLayer::LaunchEditorApplicationOperationL( aSession, message, aStatus ); |
|
672 } |
|
673 |
|
674 // --------------------------------------------------------- |
|
675 // GetClientMtmLC(TUid aMtmType) |
|
676 // Handles MTM registration. |
|
677 // --------------------------------------------------------- |
|
678 // |
|
679 CBaseMtm* CBtMtmUi::GetClientMtmLC( TUid aMtmType ) |
|
680 { |
|
681 FLOG( _L( "[CBtMtmUi] CBtMtmUi: GetClientMtmLC\t" ) ); |
|
682 if( !iClientRegistry ) |
|
683 { |
|
684 iClientRegistry = CClientMtmRegistry::NewL( Session() ); |
|
685 } |
|
686 CBaseMtm* mtm = iClientRegistry->NewMtmL( aMtmType ); |
|
687 CleanupStack::PushL( mtm ); |
|
688 return mtm; |
|
689 } |
|
690 |
|
691 // --------------------------------------------------------- |
|
692 // DeleteFromL(TUid aMtmType) |
|
693 // passes entry selection to Base for deletion. |
|
694 // --------------------------------------------------------- |
|
695 // |
|
696 CMsvOperation* CBtMtmUi::DeleteFromL( const CMsvEntrySelection& aSelection, |
|
697 TRequestStatus& aStatus ) |
|
698 { |
|
699 return CBaseMtmUi::DeleteFromL( aSelection, aStatus ); |
|
700 } |
|
701 |
|
702 // --------------------------------------------------------- |
|
703 // DeleteServiceL(...) |
|
704 // has no service, just complete it. |
|
705 // --------------------------------------------------------- |
|
706 // |
|
707 CMsvOperation* CBtMtmUi::DeleteServiceL( const TMsvEntry& /*aService*/, |
|
708 TRequestStatus& aStatus) |
|
709 { |
|
710 return CMsvCompletedOperation::NewL( |
|
711 Session(), |
|
712 Type(), |
|
713 KNullDesC8, |
|
714 KMsvLocalServiceIndexEntryId, |
|
715 aStatus); |
|
716 } |
|
717 |
|
718 // --------------------------------------------------------- |
|
719 // ReplyL(...) |
|
720 // Reply is forbidden. |
|
721 // --------------------------------------------------------- |
|
722 // |
|
723 CMsvOperation* CBtMtmUi::ReplyL( TMsvId /*aDestination*/, |
|
724 TMsvPartList /*aPartlist*/, |
|
725 TRequestStatus& /*aCompletionStatus*/ ) |
|
726 { |
|
727 User::Leave( KErrNotSupported ); |
|
728 // Return value is needed for removing compilation errors |
|
729 return NULL; |
|
730 } |
|
731 |
|
732 // --------------------------------------------------------- |
|
733 // ForwardL(...) |
|
734 // Forward is forbidden. |
|
735 // --------------------------------------------------------- |
|
736 // |
|
737 CMsvOperation* CBtMtmUi::ForwardL( TMsvId /*aDestination*/, |
|
738 TMsvPartList /*aPartList*/, |
|
739 TRequestStatus& /*aCompletionStatus*/ ) |
|
740 { |
|
741 User::Leave( KErrNotSupported ); |
|
742 // Return value is needed for removing compilation errors |
|
743 return NULL; |
|
744 } |
|
745 |
|
746 // --------------------------------------------------------- |
|
747 // CancelL(...) |
|
748 // No MS way of sending a message from the outbox, so no need to cancel. |
|
749 // Just complete it. |
|
750 // --------------------------------------------------------- |
|
751 // |
|
752 CMsvOperation* CBtMtmUi::CancelL( TRequestStatus& aStatus, |
|
753 const CMsvEntrySelection& /*aSelection*/) |
|
754 { |
|
755 return CMsvCompletedOperation::NewL( |
|
756 Session(), |
|
757 Type(), |
|
758 KNullDesC8, |
|
759 KMsvLocalServiceIndexEntryId, |
|
760 aStatus, |
|
761 KErrNone); |
|
762 } |
|
763 |
|
764 // ----------------------------------------------------------------------------- |
|
765 // CBtMtmUi::ServiceSearchComplete |
|
766 // ----------------------------------------------------------------------------- |
|
767 // |
|
768 void CBtMtmUi::ServiceSearchComplete( const RSdpRecHandleArray& /*aResult*/, |
|
769 TUint /*aTotalRecordsCount*/, TInt /*aErr */) |
|
770 { |
|
771 } |
|
772 |
|
773 // ----------------------------------------------------------------------------- |
|
774 // CBtMtmUi::AttributeSearchComplete( |
|
775 // ----------------------------------------------------------------------------- |
|
776 // |
|
777 void CBtMtmUi::AttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, |
|
778 const RSdpResultArray& aAttr, |
|
779 TInt aErr ) |
|
780 { |
|
781 iState=aErr; |
|
782 if (aErr==KErrNone) |
|
783 { |
|
784 RSdpResultArray results=aAttr; |
|
785 iDiscovery->ParseRfcommChannel(results,iClientChannel); |
|
786 } |
|
787 iWaiter.AsyncStop(); |
|
788 } |
|
789 // ----------------------------------------------------------------------------- |
|
790 // CBtMtmUi::ServiceAttributeSearchComplete |
|
791 // ----------------------------------------------------------------------------- |
|
792 // |
|
793 void CBtMtmUi::ServiceAttributeSearchComplete( TSdpServRecordHandle /*aHandle*/, |
|
794 const RSdpResultArray& /*aAttr*/, |
|
795 TInt /*aErr*/ ) |
|
796 { |
|
797 } |
|
798 // ----------------------------------------------------------------------------- |
|
799 // CBtMtmUi::DeviceSearchComplete |
|
800 // ----------------------------------------------------------------------------- |
|
801 // |
|
802 void CBtMtmUi::DeviceSearchComplete( CBTDevice* /*aDevice*/, TInt aErr ) |
|
803 { |
|
804 iState=aErr; |
|
805 iWaiter.AsyncStop(); |
|
806 } |
|
807 |
|
808 // End of File |