|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation of CCmPluginEmbDestination |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cmdestinationimpl.h" |
|
19 #include "cmpluginembdestination.h" |
|
20 #include "datamobilitycommsdattypes.h" |
|
21 #include "cmmanagerimpl.h" |
|
22 #include "cmlogger.h" |
|
23 #include <ecom/ecom.h> // For REComSession |
|
24 #include <StringLoader.h> |
|
25 #include <cmpluginembdestinationui.rsg> |
|
26 #include <data_caging_path_literals.hrh> |
|
27 #include <cmmanager.rsg> |
|
28 #include <bautils.h> |
|
29 |
|
30 using namespace CMManager; |
|
31 using namespace CommsDat; |
|
32 |
|
33 _LIT( KPluginEmbDestinationDataResDirAndFileName, |
|
34 "z:cmpluginembdestinationui.rsc" ); |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CCmPluginEmbDestination::NewL() |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CCmPluginEmbDestination* CCmPluginEmbDestination::NewL( |
|
41 TCmPluginInitParam* aInitParam ) |
|
42 { |
|
43 CCmPluginEmbDestination* self = |
|
44 new( ELeave ) CCmPluginEmbDestination( aInitParam ); |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL(); |
|
47 CleanupStack::Pop( self ); |
|
48 |
|
49 return self; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // CCmPluginEmbDestination::~CCmPluginEmbDestination() |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CCmPluginEmbDestination::~CCmPluginEmbDestination() |
|
57 { |
|
58 RemoveResourceFile( KPluginEmbDestinationDataResDirAndFileName ); |
|
59 |
|
60 if(iDestination) |
|
61 { |
|
62 delete iDestination; |
|
63 iDestination = NULL; |
|
64 } |
|
65 |
|
66 CLOG_CLOSE; |
|
67 } |
|
68 |
|
69 // ---------------------------------------------------------------------------- |
|
70 // CCmPluginEmbDestination::CreateInstanceL |
|
71 // ---------------------------------------------------------------------------- |
|
72 // |
|
73 CCmPluginBaseEng* |
|
74 CCmPluginEmbDestination::CreateInstanceL( TCmPluginInitParam& aInitParam ) const |
|
75 { |
|
76 CCmPluginEmbDestination* self = new( ELeave ) CCmPluginEmbDestination( &aInitParam ); |
|
77 CleanupStack::PushL( self ); |
|
78 self->ConstructL(); |
|
79 CleanupStack::Pop( self ); |
|
80 |
|
81 return self; |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CCmPluginEmbDestination::CCmPluginEmbDestination() |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 CCmPluginEmbDestination::CCmPluginEmbDestination( |
|
89 TCmPluginInitParam* aInitParam ) |
|
90 : CCmPluginBaseEng( aInitParam ) |
|
91 { |
|
92 CLOG_CREATE; |
|
93 |
|
94 iBearerType = KUidEmbeddedDestination; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CCmPluginEmbDestination::ConstructL() |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void CCmPluginEmbDestination::ConstructL() |
|
102 { |
|
103 // Nothing is needed from CCmPluginBaseEng. |
|
104 AddResourceFileL( KPluginEmbDestinationDataResDirAndFileName ); |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CCmPluginEmbDestination::GetIntAttributeL() |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 TUint32 |
|
112 CCmPluginEmbDestination::GetIntAttributeL( const TUint32 aAttribute ) const |
|
113 { |
|
114 LOGGER_ENTERFN( "CCmPluginEmbDestination::GetIntAttributeL" ); |
|
115 |
|
116 TUint32 retVal( 0 ); |
|
117 |
|
118 switch( aAttribute ) |
|
119 { |
|
120 case ECmBearerType: |
|
121 { |
|
122 retVal = iBearerType; |
|
123 } |
|
124 break; |
|
125 |
|
126 case ECmId: |
|
127 { |
|
128 retVal = iCmId; |
|
129 } |
|
130 break; |
|
131 |
|
132 case ECmIapId: |
|
133 { |
|
134 User::Leave(KErrNotSupported); |
|
135 } |
|
136 break; |
|
137 |
|
138 case ECmBearerIcon: |
|
139 { |
|
140 retVal = (TUint32)iDestination->IconL(); |
|
141 } |
|
142 break; |
|
143 |
|
144 case ECmDefaultPriority: |
|
145 case ECmDefaultUiPriority: |
|
146 { |
|
147 retVal = KDataMobilitySelectionPolicyPriorityWildCard; |
|
148 } |
|
149 break; |
|
150 |
|
151 case ECmExtensionLevel: |
|
152 { |
|
153 retVal = KExtensionBaseLevel; |
|
154 } |
|
155 break; |
|
156 |
|
157 case ECmInvalidAttribute: |
|
158 { |
|
159 retVal = 0; |
|
160 } |
|
161 break; |
|
162 |
|
163 case ECmLoadResult: |
|
164 { |
|
165 retVal = iLoadResult; |
|
166 } |
|
167 break; |
|
168 |
|
169 default: |
|
170 { |
|
171 User::Leave( KErrNotSupported ); |
|
172 } |
|
173 break; |
|
174 } |
|
175 |
|
176 return retVal; |
|
177 } |
|
178 |
|
179 // --------------------------------------------------------------------------- |
|
180 // CCmPluginEmbDestination::GetBoolAttributeL() |
|
181 // --------------------------------------------------------------------------- |
|
182 // |
|
183 TBool CCmPluginEmbDestination::GetBoolAttributeL( const TUint32 aAttribute ) const |
|
184 { |
|
185 LOGGER_ENTERFN( "CCmPluginEmbDestination::GetBoolAttributeL" ); |
|
186 |
|
187 TBool retVal( EFalse ); |
|
188 |
|
189 switch( aAttribute ) |
|
190 { |
|
191 case ECmDestination: |
|
192 { |
|
193 retVal = ETrue; |
|
194 } |
|
195 break; |
|
196 |
|
197 case ECmCoverage: |
|
198 { |
|
199 retVal = EFalse; |
|
200 } |
|
201 break; |
|
202 |
|
203 case ECmProtected: |
|
204 { |
|
205 if( iDestination->ProtectionLevel() == EProtLevel1 || |
|
206 iDestination->ProtectionLevel() == EProtLevel2 ) |
|
207 { |
|
208 retVal = ETrue; |
|
209 } |
|
210 else |
|
211 { |
|
212 retVal = EFalse; |
|
213 } |
|
214 } |
|
215 break; |
|
216 |
|
217 case ECmHidden: |
|
218 { |
|
219 retVal = iDestination->IsHidden(); |
|
220 } |
|
221 break; |
|
222 |
|
223 case ECmBearerHasUi: |
|
224 case ECmAddToAvailableList: |
|
225 { |
|
226 retVal = EFalse; |
|
227 } |
|
228 break; |
|
229 |
|
230 case ECmVirtual: |
|
231 { |
|
232 retVal = ETrue; |
|
233 } |
|
234 break; |
|
235 |
|
236 case ECmIPv6Supported: |
|
237 { |
|
238 retVal = CCmPluginBaseEng::GetBoolAttributeL( aAttribute ); |
|
239 } |
|
240 break; |
|
241 |
|
242 case ECmIsLinked: |
|
243 { |
|
244 retVal = EFalse; |
|
245 } |
|
246 break; |
|
247 |
|
248 case ECmConnected: |
|
249 { |
|
250 retVal = iDestination->IsConnectedL(); |
|
251 } |
|
252 break; |
|
253 |
|
254 default: |
|
255 { |
|
256 User::Leave( KErrNotSupported ); |
|
257 } |
|
258 break; |
|
259 } |
|
260 |
|
261 return retVal; |
|
262 } |
|
263 |
|
264 // --------------------------------------------------------------------------- |
|
265 // CCmPluginEmbDestination::GetStringAttributeL() |
|
266 // --------------------------------------------------------------------------- |
|
267 // |
|
268 HBufC* |
|
269 CCmPluginEmbDestination::GetStringAttributeL( const TUint32 aAttribute ) const |
|
270 { |
|
271 LOGGER_ENTERFN( "CCmPluginEmbDestination::GetStringAttributeL" ); |
|
272 |
|
273 HBufC* retVal = NULL; |
|
274 |
|
275 switch( aAttribute ) |
|
276 { |
|
277 case ECmName: |
|
278 { |
|
279 RFs fs; |
|
280 CleanupClosePushL<RFs>( fs ); |
|
281 User::LeaveIfError( fs.Connect() ); |
|
282 |
|
283 // There may not be a UI context yet.... |
|
284 TFileName resourceFile; |
|
285 _LIT( KDriveZ, "z:" ); |
|
286 resourceFile.Append( KDriveZ ); |
|
287 resourceFile.Append( KDC_RESOURCE_FILES_DIR ); |
|
288 _LIT( KCmmResFileName, "cmmanager.rsc" ); |
|
289 resourceFile.Append( KCmmResFileName ); |
|
290 BaflUtils::NearestLanguageFile( fs, resourceFile ); |
|
291 |
|
292 RResourceFile rf; |
|
293 CleanupClosePushL<RResourceFile>( rf ); |
|
294 rf.OpenL( fs, resourceFile ); |
|
295 rf.ConfirmSignatureL( 0 ); |
|
296 HBufC8* readBuffer = rf.AllocReadLC( R_QTN_NETW_CONSET_EMBEDDED_DEST ); |
|
297 const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(), |
|
298 ( readBuffer->Length() + 1 ) >> 1 ); |
|
299 HBufC16* textBuffer=HBufC16::NewL( ptrReadBuffer.Length() ); |
|
300 CleanupStack::PushL( textBuffer ); |
|
301 *textBuffer=ptrReadBuffer; |
|
302 |
|
303 TPtr format = textBuffer->Des(); |
|
304 _LIT(KPercentS,"%S"); |
|
305 _LIT(KPercentU,"%U"); |
|
306 TInt puPos = format.Find(KPercentU); |
|
307 if ( puPos >= 0 ) |
|
308 { |
|
309 format.Replace( puPos, |
|
310 static_cast<TDesC>(KPercentS).Length(), KPercentS ); |
|
311 } |
|
312 HBufC* desName = iDestination->NameLC(); |
|
313 TPtr16 destName = desName->Des(); |
|
314 retVal = HBufC::NewL( format.Length() + destName.Length() ); |
|
315 retVal->Des().Format(format, &destName); |
|
316 |
|
317 CleanupStack::PopAndDestroy( desName ); |
|
318 CleanupStack::PopAndDestroy( textBuffer ); |
|
319 CleanupStack::PopAndDestroy( readBuffer ); |
|
320 CleanupStack::PopAndDestroy(); //rf |
|
321 CleanupStack::PopAndDestroy(); //fs |
|
322 } |
|
323 break; |
|
324 |
|
325 default: |
|
326 { |
|
327 User::Leave( KErrNotSupported ); |
|
328 } |
|
329 } |
|
330 |
|
331 return retVal; |
|
332 } |
|
333 |
|
334 // --------------------------------------------------------------------------- |
|
335 // CCmPluginEmbDestination::GetString8AttributeL |
|
336 // --------------------------------------------------------------------------- |
|
337 // |
|
338 HBufC8* |
|
339 CCmPluginEmbDestination::GetString8AttributeL( const TUint32 aAttribute ) const |
|
340 { |
|
341 LOGGER_ENTERFN( "CCmPluginEmbDestination::GetString8AttributeL" ); |
|
342 |
|
343 switch( aAttribute ) |
|
344 { |
|
345 default: |
|
346 { |
|
347 User::Leave( KErrNotSupported ); |
|
348 } |
|
349 break; |
|
350 } |
|
351 |
|
352 // dead code |
|
353 return NULL; |
|
354 } |
|
355 |
|
356 // --------------------------------------------------------------------------- |
|
357 // CCmPluginEmbDestination::SetBoolAttributeL() |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 void CCmPluginEmbDestination::SetBoolAttributeL( const TUint32 aAttribute, |
|
361 TBool /*aValue*/ ) |
|
362 { |
|
363 LOGGER_ENTERFN( "CCmPluginEmbDestination::SetBoolAttributeL" ); |
|
364 |
|
365 switch( aAttribute ) |
|
366 { |
|
367 case ECmProtected: |
|
368 case ECmHidden: |
|
369 break; |
|
370 |
|
371 default: |
|
372 { |
|
373 User::Leave( KErrNotSupported ); |
|
374 } |
|
375 } |
|
376 } |
|
377 |
|
378 // --------------------------------------------------------------------------- |
|
379 // CCmPluginEmbDestination::SetStringAttributeL() |
|
380 // --------------------------------------------------------------------------- |
|
381 // |
|
382 void CCmPluginEmbDestination::SetStringAttributeL( const TUint32 aAttribute, |
|
383 const TDesC16& ) |
|
384 { |
|
385 LOGGER_ENTERFN( "CCmPluginEmbDestination::SetStringAttributeL" ); |
|
386 |
|
387 switch( aAttribute ) |
|
388 { |
|
389 case ECmName: |
|
390 { |
|
391 User::Leave( KErrNotSupported ); |
|
392 } |
|
393 break; |
|
394 |
|
395 default: |
|
396 { |
|
397 User::Leave( KErrNotSupported ); |
|
398 } |
|
399 } |
|
400 } |
|
401 |
|
402 // --------------------------------------------------------------------------- |
|
403 // CCmPluginEmbDestination::CanHandleIapIdL() |
|
404 // --------------------------------------------------------------------------- |
|
405 // |
|
406 TBool CCmPluginEmbDestination::CanHandleIapIdL( TUint32 /*aIapId*/ ) const |
|
407 { |
|
408 LOGGER_ENTERFN( "CCmPluginEmbDestination::CanHandleIapIdL" ); |
|
409 |
|
410 // Embedded Destination cannot handle any IAP id. |
|
411 return EFalse; |
|
412 } |
|
413 |
|
414 // --------------------------------------------------------------------------- |
|
415 // CCmPluginEmbDestination::CanHandleIapIdL() |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
|
418 TBool |
|
419 CCmPluginEmbDestination::CanHandleIapIdL( CCDIAPRecord* /*aIapRecord*/ ) const |
|
420 { |
|
421 LOGGER_ENTERFN( "CCmPluginEmbDestination::CanHandleIapIdL" ); |
|
422 |
|
423 // Embedded Destination cannot handle any IAP id. |
|
424 return EFalse; |
|
425 } |
|
426 |
|
427 // --------------------------------------------------------------------------- |
|
428 // ?description_if_needed |
|
429 // --------------------------------------------------------------------------- |
|
430 // |
|
431 CCmDestinationImpl* CCmPluginEmbDestination::Destination() const |
|
432 { |
|
433 LOGGER_ENTERFN( "CCmPluginEmbDestination::Destination" ); |
|
434 |
|
435 return iDestination; |
|
436 } |
|
437 |
|
438 // --------------------------------------------------------------------------- |
|
439 // ?description_if_needed |
|
440 // --------------------------------------------------------------------------- |
|
441 // |
|
442 void CCmPluginEmbDestination::UpdateL() |
|
443 { |
|
444 LOGGER_ENTERFN( "CCmPluginEmbDestination::UpdateL" ); |
|
445 |
|
446 iDestination->UpdateL(); |
|
447 } |
|
448 |
|
449 // --------------------------------------------------------------------------- |
|
450 // Delete embedded destination. |
|
451 // --------------------------------------------------------------------------- |
|
452 // |
|
453 TBool CCmPluginEmbDestination::DeleteL( TBool aForced, |
|
454 TBool aOneRefAllowed ) |
|
455 { |
|
456 LOGGER_ENTERFN( "CCmPluginEmbDestination::DeleteL" ); |
|
457 |
|
458 (void)aForced; |
|
459 (void)aOneRefAllowed; |
|
460 |
|
461 // Embedded destination cannot be deleted. |
|
462 return EFalse; |
|
463 } |
|
464 |
|
465 // --------------------------------------------------------------------------- |
|
466 // ?description_if_needed |
|
467 // --------------------------------------------------------------------------- |
|
468 // |
|
469 void CCmPluginEmbDestination::LoadL( TUint32 aCmId) |
|
470 { |
|
471 LOGGER_ENTERFN( "CCmPluginEmbDestination::LoadL" ); |
|
472 |
|
473 if (!iDestination) |
|
474 { |
|
475 iCmId = aCmId; |
|
476 iDestination = iCmMgr.DestinationL( aCmId ); |
|
477 } |
|
478 } |
|
479 |
|
480 // --------------------------------------------------------------------------- |
|
481 // ?description_if_needed |
|
482 // --------------------------------------------------------------------------- |
|
483 // |
|
484 void CCmPluginEmbDestination::CreateNewL() |
|
485 { |
|
486 LOGGER_ENTERFN( "CCmPluginEmbDestination::CreateNewL" ); |
|
487 } |
|
488 |
|
489 // --------------------------------------------------------------------------- |
|
490 // CCmPluginEmbDestination::RunSettingsL() |
|
491 // --------------------------------------------------------------------------- |
|
492 // |
|
493 TInt CCmPluginEmbDestination::RunSettingsL() |
|
494 { |
|
495 LOGGER_ENTERFN( "CCmPluginEmbDestination::RunSettingsL" ); |
|
496 |
|
497 return 0; |
|
498 } |
|
499 |
|
500 // --------------------------------------------------------------------------- |
|
501 // CCmPluginEmbDestination::InitializeWithUiL() |
|
502 // --------------------------------------------------------------------------- |
|
503 // |
|
504 TBool CCmPluginEmbDestination::InitializeWithUiL( |
|
505 TBool /*aManuallyConfigure*/ ) |
|
506 { |
|
507 LOGGER_ENTERFN( "CCmPluginEmbDestination::InitializeWithUiL" ); |
|
508 |
|
509 // Has no UI |
|
510 return ETrue; |
|
511 } |
|
512 |
|
513 // --------------------------------------------------------------------------- |
|
514 // CCmPluginEmbDestination::IsMultipleReferencedL() |
|
515 // --------------------------------------------------------------------------- |
|
516 // |
|
517 TBool CCmPluginEmbDestination::IsMultipleReferencedL() |
|
518 { |
|
519 LOGGER_ENTERFN( "CCmPluginEmbDestination::IsMultipleReferencedL" ); |
|
520 |
|
521 return EFalse; |
|
522 } |
|
523 |
|
524 // --------------------------------------------------------------------------- |
|
525 // CCmPluginEmbDestination::LoadServiceSettingL() |
|
526 // --------------------------------------------------------------------------- |
|
527 // |
|
528 void CCmPluginEmbDestination::LoadServiceSettingL() |
|
529 { |
|
530 LOGGER_ENTERFN( "CCmPluginEmbDestination::LoadServiceSettingL" ); |
|
531 |
|
532 User::Leave( KErrNotSupported ); |
|
533 } |
|
534 |
|
535 // --------------------------------------------------------------------------- |
|
536 // CCmPluginEmbDestination::LoadBearerRecordL() |
|
537 // --------------------------------------------------------------------------- |
|
538 // |
|
539 void CCmPluginEmbDestination::LoadBearerSettingL() |
|
540 { |
|
541 LOGGER_ENTERFN( "CCmPluginEmbDestination::LoadBearerSettingL" ); |
|
542 |
|
543 User::Leave( KErrNotSupported ); |
|
544 } |
|
545 |
|
546 // --------------------------------------------------------------------------- |
|
547 // CCmPluginEmbDestination::CreateNewServiceRecordL() |
|
548 // --------------------------------------------------------------------------- |
|
549 // |
|
550 void CCmPluginEmbDestination::CreateNewServiceRecordL() |
|
551 { |
|
552 LOGGER_ENTERFN( "CCmPluginEmbDestination::CreateNewServiceRecordL" ); |
|
553 |
|
554 User::Leave( KErrNotSupported ); |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------------------------- |
|
558 // CCmPluginEmbDestination::CreateNewBearerRecordL() |
|
559 // --------------------------------------------------------------------------- |
|
560 // |
|
561 void CCmPluginEmbDestination::CreateNewBearerRecordL() |
|
562 { |
|
563 LOGGER_ENTERFN( "CCmPluginEmbDestination::CreateNewBearerRecordL" ); |
|
564 |
|
565 User::Leave( KErrNotSupported ); |
|
566 } |
|
567 |
|
568 // --------------------------------------------------------------------------- |
|
569 // CCmPluginEmbDestination::ServiceRecordIdLC() |
|
570 // --------------------------------------------------------------------------- |
|
571 // |
|
572 void CCmPluginEmbDestination::ServiceRecordIdLC( HBufC* &/*aBearerName*/, |
|
573 TUint32& /*aRecordId*/) |
|
574 { |
|
575 LOGGER_ENTERFN( "CCmPluginEmbDestination::ServiceRecordIdLC" ); |
|
576 |
|
577 User::Leave( KErrNotSupported ); |
|
578 } |
|
579 |
|
580 // --------------------------------------------------------------------------- |
|
581 // CCmPluginEmbDestination::BearerRecordIdLC() |
|
582 // --------------------------------------------------------------------------- |
|
583 // |
|
584 void CCmPluginEmbDestination::BearerRecordIdLC( HBufC* &/*aBearerName*/, |
|
585 TUint32& /*aRecordId*/) |
|
586 { |
|
587 LOGGER_ENTERFN( "CCmPluginEmbDestination::BearerRecordIdLC" ); |
|
588 |
|
589 User::Leave( KErrNotSupported ); |
|
590 } |
|
591 |
|
592 // --------------------------------------------------------------------------- |
|
593 // CCmPluginEmbDestination::CopyAdditionalDataL |
|
594 // --------------------------------------------------------------------------- |
|
595 // |
|
596 void CCmPluginEmbDestination::CopyAdditionalDataL( CCmPluginBaseEng* /*aDestInst*/ ) const |
|
597 { |
|
598 LOGGER_ENTERFN( "CCmPluginEmbDestination::CopyAdditionalDataL" ); |
|
599 |
|
600 User::Leave( KErrNotSupported ); |
|
601 } |
|
602 |
|
603 // --------------------------------------------------------------------------- |
|
604 // CCmPluginEmbDestination::CreateCopyL |
|
605 // --------------------------------------------------------------------------- |
|
606 // |
|
607 CCmPluginBaseEng* CCmPluginEmbDestination::CreateCopyL() const |
|
608 { |
|
609 LOGGER_ENTERFN( "CCmPluginEmbDestination::CreateCopyL" ); |
|
610 |
|
611 User::Leave(KErrNotSupported); |
|
612 return NULL; |
|
613 } |
|
614 |
|
615 // --------------------------------------------------------------------------- |
|
616 // CCmPluginEmbDestination::IsLinkedToSnap |
|
617 // --------------------------------------------------------------------------- |
|
618 // |
|
619 TBool CCmPluginEmbDestination::IsLinkedToSnap( TUint32 aSnapId ) |
|
620 { |
|
621 LOGGER_ENTERFN( "CCmPluginEmbDestination::IsLinkedToSnap" ); |
|
622 |
|
623 return ( aSnapId == iDestination->Id() ); |
|
624 } |