|
1 /* |
|
2 * Copyright (c) 2005-2007 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 * Profile plug-in publisher |
|
16 * |
|
17 */ |
|
18 |
|
19 #include <ecom/ecom.h> |
|
20 #include <LiwServiceHandler.h> |
|
21 #include <aipluginsettings.h> |
|
22 |
|
23 |
|
24 #include "wrtdata.h" |
|
25 #include "wrtdatapluginconst.h" |
|
26 #include "wrtdataobserver.h" |
|
27 #include "wrtdataplugin.h" |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 // --------------------------------------------------------------------------- |
|
31 // Symbian 2nd phase constructor can leave |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 CWrtData* CWrtData::NewL(CWrtDataPlugin* aPlugin) |
|
35 { |
|
36 CWrtData* self = new (ELeave) CWrtData(); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(aPlugin); |
|
39 CleanupStack::Pop( self ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 // --------------------------------------------------------------------------- |
|
44 // Default constructor |
|
45 // --------------------------------------------------------------------------- |
|
46 // |
|
47 CWrtData::CWrtData() |
|
48 { |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // Symbian 2nd phase constructor can leave |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void CWrtData::ConstructL(CWrtDataPlugin* aPlugin) |
|
56 { |
|
57 iPlugin = aPlugin; |
|
58 iCommandName = HBufC8::NewL( KWRTContentValueMaxLength ); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Destructor |
|
63 // Deletes all data created to heap |
|
64 // --------------------------------------------------------------------------- |
|
65 // |
|
66 CWrtData::~CWrtData() |
|
67 { |
|
68 if( iCommandName ) |
|
69 { |
|
70 delete iCommandName; |
|
71 iCommandName = NULL; |
|
72 } |
|
73 if(iObserver) |
|
74 { |
|
75 TRAP_IGNORE(iObserver->ReleaseL() ); |
|
76 delete iObserver; |
|
77 iObserver = NULL; |
|
78 } |
|
79 if( iInterface ) |
|
80 { |
|
81 iInterface->Close(); |
|
82 iInterface = NULL; |
|
83 } |
|
84 if( iServiceHandler ) |
|
85 { |
|
86 iServiceHandler->Reset(); |
|
87 delete iServiceHandler; |
|
88 iServiceHandler = NULL; |
|
89 } |
|
90 if ( iContentId ) |
|
91 { |
|
92 delete iContentId; |
|
93 iContentId = NULL; |
|
94 } |
|
95 iMenuItems.ResetAndDestroy(); |
|
96 iMenuTriggers.ResetAndDestroy(); |
|
97 // not owned |
|
98 iPlugin = NULL; |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // ConfigureL |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 void CWrtData::ConfigureL(RAiSettingsItemArray& aConfigurations ) |
|
106 { |
|
107 HBufC8* serviceName = HBufC8::NewLC( KWRTContentValueMaxLength ); |
|
108 HBufC8* interfaceName = HBufC8::NewLC( KWRTContentValueMaxLength ); |
|
109 |
|
110 // Interface name |
|
111 RCriteriaArray criteriaArray; |
|
112 |
|
113 TInt count = aConfigurations.Count(); |
|
114 |
|
115 for(TInt i = 0;i<count;i++) |
|
116 { |
|
117 MAiPluginConfigurationItem& confItem = ( aConfigurations[i] )->AiPluginConfigurationItem(); |
|
118 // if owner is plugin then it (key,value) is for plugin configurations items |
|
119 if(confItem.Owner() == KPlugin()) |
|
120 { |
|
121 if(confItem.Name() == KService()) |
|
122 { |
|
123 serviceName->Des().Copy(confItem.Value()); |
|
124 } |
|
125 else if( confItem.Name() == KInterface() ) |
|
126 { |
|
127 interfaceName->Des().Copy(confItem.Value()); |
|
128 } |
|
129 else if( confItem.Name() == KCommand() ) |
|
130 { |
|
131 iCommandName->Des().Copy(confItem.Value()); |
|
132 } |
|
133 else if( confItem.Name() == KMenuItem16() ) |
|
134 { |
|
135 iMenuItems.AppendL( confItem.Value().AllocL() ); |
|
136 } |
|
137 else if( confItem.Name() == KPubData() ) |
|
138 { |
|
139 iContentId = confItem.Value().AllocL(); |
|
140 } |
|
141 } |
|
142 } |
|
143 |
|
144 if( !( serviceName->Des().Length() >= 0 && interfaceName->Des().Length() >= 0 |
|
145 && iCommandName->Des().Length() >= 0 ) ) |
|
146 { |
|
147 // No service to offer without plugin configurations |
|
148 User::Leave( KErrNotSupported ); |
|
149 } |
|
150 |
|
151 iServiceHandler = CLiwServiceHandler::NewL(); |
|
152 |
|
153 // for convenience keep pointers to Service Handler param lists |
|
154 CLiwGenericParamList* inParamList = &iServiceHandler->InParamListL(); |
|
155 CLiwGenericParamList* outParamList = &iServiceHandler->OutParamListL(); |
|
156 |
|
157 CLiwCriteriaItem* criteriaItem = CLiwCriteriaItem::NewLC( KLiwCmdAsStr, *interfaceName , *serviceName ); |
|
158 criteriaItem->SetServiceClass( TUid::Uid( KLiwClassBase ) ); |
|
159 criteriaArray.AppendL( criteriaItem ); |
|
160 |
|
161 |
|
162 // attach Liw criteria |
|
163 iServiceHandler->AttachL( criteriaArray ); |
|
164 iServiceHandler->ExecuteServiceCmdL( *criteriaItem, *inParamList, *outParamList ); |
|
165 |
|
166 CleanupStack::PopAndDestroy(criteriaItem); |
|
167 criteriaArray.Reset(); |
|
168 |
|
169 // extract CPS interface from output params |
|
170 TInt pos( 0 ); |
|
171 outParamList->FindFirst( pos, *interfaceName ); |
|
172 if( pos != KErrNotFound ) |
|
173 { |
|
174 //iInterface is MLiwInterface* |
|
175 iInterface = (*outParamList)[pos].Value().AsInterface(); |
|
176 User::LeaveIfNull( iInterface ); |
|
177 } |
|
178 else |
|
179 { |
|
180 User::Leave( KErrNotFound ); |
|
181 } |
|
182 inParamList->Reset(); |
|
183 outParamList->Reset(); |
|
184 CleanupStack::PopAndDestroy( interfaceName ); |
|
185 CleanupStack::PopAndDestroy( serviceName ); |
|
186 |
|
187 //Gets the menu items from the publisher registry |
|
188 GetMenuItemsL(); |
|
189 |
|
190 iObserver = CWrtDataObserver::NewL( iInterface, this ); |
|
191 } |
|
192 |
|
193 // --------------------------------------------------------------------------- |
|
194 // GetMenuItemsL |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 void CWrtData::GetMenuItemsL() |
|
198 { |
|
199 if(iInterface) |
|
200 { |
|
201 TInt confindex( 0 ); |
|
202 |
|
203 CLiwDefaultMap *outDataMap = CLiwDefaultMap::NewLC(); |
|
204 CLiwDefaultMap* filter = CreateFilterLC( ); |
|
205 //append filter to input param |
|
206 ExecuteCommandL( filter, outDataMap, KPubData ); |
|
207 CleanupStack::PopAndDestroy( filter ); |
|
208 |
|
209 TLiwVariant variant; |
|
210 TInt pos = outDataMap->FindL( KMenuItems, variant ) ; |
|
211 |
|
212 if ( pos ) |
|
213 { |
|
214 CLiwDefaultMap *menuMap = CLiwDefaultMap::NewLC(); |
|
215 variant.Get( *menuMap ); |
|
216 for ( TInt i = 0; i < menuMap->Count(); i++) |
|
217 { |
|
218 menuMap->FindL(menuMap->AtL(i), variant ); |
|
219 HBufC8* value = HBufC8::NewL( KWRTContentValueMaxLength ); |
|
220 CleanupStack::PushL( value ); |
|
221 TPtr8 valPtr = value->Des(); |
|
222 variant.Get( valPtr); |
|
223 if ( valPtr.Length() > 0 ) |
|
224 { |
|
225 iMenuTriggers.AppendL( value ); |
|
226 CleanupStack::Pop( value ); |
|
227 HBufC16* triggerName = HBufC16::NewLC( KWRTContentNameMaxLength ); |
|
228 triggerName->Des().Copy( menuMap->AtL(i) ); |
|
229 iMenuItems.AppendL( triggerName ); |
|
230 CleanupStack::Pop( triggerName ); |
|
231 } |
|
232 else |
|
233 { |
|
234 CleanupStack::PopAndDestroy( value ); |
|
235 } |
|
236 variant.Reset(); |
|
237 } |
|
238 CleanupStack::PopAndDestroy( menuMap ); |
|
239 } |
|
240 variant.Reset(); |
|
241 CleanupStack::PopAndDestroy( outDataMap ); |
|
242 } |
|
243 } |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // CreateFilterL |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 CLiwDefaultMap* CWrtData::CreateFilterLC() |
|
250 { |
|
251 CLiwDefaultMap* filter = CLiwDefaultMap::NewLC(); |
|
252 filter->InsertL( KPublisherId, TLiwVariant( KWRTPublisher )); |
|
253 filter->InsertL( KContentType, TLiwVariant( KTemplateWidget )); |
|
254 filter->InsertL( KContentId, TLiwVariant( iContentId )); |
|
255 return filter; |
|
256 } |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // HasMenuItem |
|
260 // --------------------------------------------------------------------------- |
|
261 // |
|
262 TBool CWrtData::HasMenuItem(const TDesC16& aMenuItem ) |
|
263 { |
|
264 TBool found = EFalse; |
|
265 for (TInt i = 0; i < iMenuItems.Count(); i++ ) |
|
266 { |
|
267 if( aMenuItem == iMenuItems[i] ) |
|
268 { |
|
269 found = ETrue; |
|
270 break; |
|
271 } |
|
272 } |
|
273 return found; |
|
274 } |
|
275 |
|
276 // --------------------------------------------------------------------------- |
|
277 // PublishAllL |
|
278 // --------------------------------------------------------------------------- |
|
279 // |
|
280 void CWrtData::PublishAllL( MAiContentObserver* aObserver ) |
|
281 { |
|
282 PublishL( aObserver ); |
|
283 } |
|
284 |
|
285 // --------------------------------------------------------------------------- |
|
286 // PublishL |
|
287 // --------------------------------------------------------------------------- |
|
288 // |
|
289 void CWrtData::PublishL( MAiContentObserver* aObserver ) |
|
290 { |
|
291 CLiwDefaultMap *outDataMap = CLiwDefaultMap::NewLC(); |
|
292 //Create filter criteria for requested entries in form of LIW map: |
|
293 CLiwDefaultMap* filter = CreateFilterLC(); |
|
294 ExecuteCommandL( filter, outDataMap, KCpData ); |
|
295 CleanupStack::PopAndDestroy( filter ); |
|
296 TInt id = KErrNotFound; |
|
297 TLiwVariant variant; |
|
298 if ( outDataMap->FindL( KImage1, variant ) ) |
|
299 { |
|
300 TInt handle = KErrBadHandle; |
|
301 TUint uintHandle = 0; |
|
302 TPtrC16 valPtr; |
|
303 if ( variant.Get( uintHandle ) ) |
|
304 { |
|
305 handle = uintHandle; |
|
306 } |
|
307 else if ( !variant.Get( handle ) ) |
|
308 { |
|
309 handle = KErrBadHandle; |
|
310 } |
|
311 // read as a image handle |
|
312 if( handle == KErrBadHandle ) |
|
313 { |
|
314 // no handle, so read as image path |
|
315 variant.Get( valPtr ); |
|
316 iPlugin->PublishImageL(aObserver, EImage1, valPtr ); |
|
317 } |
|
318 else |
|
319 { |
|
320 TInt maskHandle = KErrBadHandle; |
|
321 //Look for image mask |
|
322 if ( outDataMap->FindL( KImageMask, variant ) ) |
|
323 { |
|
324 variant.Get( maskHandle ); |
|
325 } |
|
326 iPlugin->PublishImageL(aObserver, EImage1, handle, maskHandle ); |
|
327 } |
|
328 } |
|
329 |
|
330 variant.Reset(); |
|
331 CleanupStack::PopAndDestroy( outDataMap ); |
|
332 } |
|
333 |
|
334 // --------------------------------------------------------------------------- |
|
335 // ExecuteCommandL |
|
336 // --------------------------------------------------------------------------- |
|
337 // |
|
338 void CWrtData::ExecuteCommandL(CLiwDefaultMap* aInFilter, CLiwDefaultMap* aOutDataMap, const TDesC16& aRegistry ) |
|
339 { |
|
340 CLiwGenericParamList* inParamList = &iServiceHandler->InParamListL(); |
|
341 CLiwGenericParamList* outParamList = &iServiceHandler->OutParamListL(); |
|
342 |
|
343 TLiwGenericParam type( KType, TLiwVariant( aRegistry ) ); |
|
344 inParamList->AppendL( type ); |
|
345 |
|
346 //append filter to input param |
|
347 TLiwGenericParam item( KFilter, TLiwVariant( aInFilter )); |
|
348 inParamList->AppendL( item ); |
|
349 |
|
350 // execute service.It is assumed that iInterface is already initiatedd |
|
351 if(iInterface) |
|
352 { |
|
353 iInterface->ExecuteCmdL( *iCommandName, *inParamList, *outParamList); |
|
354 } |
|
355 else |
|
356 { |
|
357 User::Leave( KErrNotSupported ); |
|
358 } |
|
359 type.Reset(); |
|
360 item.Reset(); |
|
361 inParamList->Reset(); |
|
362 |
|
363 //extracts data map |
|
364 TInt pos = 0; |
|
365 outParamList->FindFirst( pos, KResults ); |
|
366 if( pos != KErrNotFound ) |
|
367 // results present |
|
368 { |
|
369 //extract iterator on results list |
|
370 TLiwVariant variant = (*outParamList)[pos].Value(); |
|
371 CLiwIterable* iterable = variant.AsIterable(); |
|
372 iterable->Reset(); |
|
373 |
|
374 //get next result |
|
375 if( iterable->NextL( variant ) ) |
|
376 { |
|
377 //extract content map |
|
378 CLiwDefaultMap *map = CLiwDefaultMap::NewLC(); |
|
379 variant.Get( *map ); |
|
380 if( map->FindL( KDataMap, variant) ) |
|
381 { |
|
382 variant.Get( *aOutDataMap ); |
|
383 } |
|
384 CleanupStack::PopAndDestroy( map ); |
|
385 } |
|
386 iterable->Reset(); |
|
387 variant.Reset(); |
|
388 } |
|
389 outParamList->Reset(); |
|
390 } |
|
391 |
|
392 // --------------------------------------------------------------------------- |
|
393 // ExecuteActionL |
|
394 // --------------------------------------------------------------------------- |
|
395 // |
|
396 void CWrtData::ExecuteActionL(const TDesC& aObjectId, const TDesC& aTrigger ) |
|
397 { |
|
398 HBufC8* triggerName = HBufC8::NewLC( KWRTContentNameMaxLength ); |
|
399 |
|
400 CLiwGenericParamList* inParamList = &iServiceHandler->InParamListL(); |
|
401 CLiwGenericParamList* outParamList = &iServiceHandler->OutParamListL(); |
|
402 CLiwDefaultMap* filter = NULL; |
|
403 TInt confindex (0); |
|
404 |
|
405 triggerName->Des().Copy(aTrigger); |
|
406 if ( aObjectId == KPubData ) |
|
407 { |
|
408 // this trigger belongs to publisher registery. |
|
409 // in such case it is assumed that all the items in the widgets |
|
410 // belongs to same publisher, type and id. |
|
411 TLiwGenericParam cptype( KType, TLiwVariant( KPubData ) ); |
|
412 inParamList->AppendL( cptype ); |
|
413 cptype.Reset(); |
|
414 // use the first item configuration to create the filter |
|
415 filter = CreateFilterLC(); |
|
416 } |
|
417 else |
|
418 { |
|
419 if ( aObjectId == KMenuItem16 ) |
|
420 { |
|
421 TInt pos = KErrNotFound; |
|
422 for (TInt i = 0; i < iMenuItems.Count(); i++) |
|
423 { |
|
424 if ( aTrigger == iMenuItems[i] ) |
|
425 { |
|
426 pos = i; |
|
427 break; |
|
428 } |
|
429 } |
|
430 if( pos == KErrNotFound ) |
|
431 { |
|
432 // No such menu items |
|
433 CleanupStack::PopAndDestroy( triggerName ); |
|
434 return; |
|
435 } |
|
436 triggerName->Des().Copy( iMenuTriggers[pos]->Des() ); |
|
437 filter = CreateFilterLC(); |
|
438 } |
|
439 else |
|
440 { |
|
441 //Create filter criteria for requested entries in form of LIW map: |
|
442 filter = CreateFilterLC(); |
|
443 } |
|
444 //append type to inparam list |
|
445 TLiwGenericParam cptype( KType, TLiwVariant( KCpData ) ); |
|
446 inParamList->AppendL( cptype ); |
|
447 cptype.Reset(); |
|
448 } |
|
449 |
|
450 filter->InsertL( KActionTrigger, TLiwVariant( triggerName->Des() ) ); |
|
451 //append filter to input param |
|
452 TLiwGenericParam item( KFilter, TLiwVariant( filter ) ); |
|
453 inParamList->AppendL( item ); |
|
454 iInterface->ExecuteCmdL( KExecuteAction, *inParamList, *outParamList ); |
|
455 |
|
456 CleanupStack::PopAndDestroy( filter ); |
|
457 CleanupStack::PopAndDestroy( triggerName ); |
|
458 item.Reset(); |
|
459 |
|
460 inParamList->Reset(); |
|
461 outParamList->Reset(); |
|
462 |
|
463 } |
|
464 |
|
465 // --------------------------------------------------------------------------- |
|
466 // RegisterL |
|
467 // --------------------------------------------------------------------------- |
|
468 // |
|
469 void CWrtData::RegisterL() |
|
470 { |
|
471 CLiwDefaultMap* filter = CreateFilterLC(); |
|
472 filter->InsertL( KOperation, TLiwVariant( KAddUpdateDelete ) ); |
|
473 iObserver->RegisterL(filter); |
|
474 CleanupStack::PopAndDestroy( filter ); |
|
475 } |
|
476 |
|
477 // --------------------------------------------------------------------------- |
|
478 // RefreshL |
|
479 // --------------------------------------------------------------------------- |
|
480 // |
|
481 void CWrtData::RefreshL( TDesC& aPublisher, TDesC& aContentType, |
|
482 TDesC& aContentId, TDesC& aOperation ) |
|
483 { |
|
484 if ( aPublisher == KWRTPublisher() && aContentType == KTemplateWidget() |
|
485 && aContentId == iContentId ) |
|
486 { |
|
487 iPlugin->RefreshL( aOperation); |
|
488 } |
|
489 } |
|
490 |
|
491 // --------------------------------------------------------------------------- |
|
492 // IsPluginActive |
|
493 // --------------------------------------------------------------------------- |
|
494 // |
|
495 TBool CWrtData::IsPluginActive() |
|
496 { |
|
497 return iPlugin->IsActive(); |
|
498 } |
|
499 |
|
500 // --------------------------------------------------------------------------- |
|
501 // PublisherStatusL |
|
502 // --------------------------------------------------------------------------- |
|
503 // |
|
504 void CWrtData::ChangePublisherStatusL(const TDesC& aStatus) |
|
505 { |
|
506 if( iContentId == NULL ) |
|
507 { |
|
508 return; |
|
509 } |
|
510 HBufC8* triggerName = HBufC8::NewLC(KWRTContentNameMaxLength); |
|
511 triggerName->Des().Copy(aStatus); |
|
512 |
|
513 CLiwGenericParamList* inParamList = &iServiceHandler->InParamListL(); |
|
514 CLiwGenericParamList* outParamList = &iServiceHandler->OutParamListL(); |
|
515 |
|
516 TLiwGenericParam type( KType, TLiwVariant( KPubData ) ); |
|
517 inParamList->AppendL( type ); |
|
518 |
|
519 CLiwDefaultMap* filter = CreateFilterLC(); |
|
520 filter->InsertL(KActionTrigger, TLiwVariant(triggerName->Des()) ); |
|
521 |
|
522 TLiwGenericParam item( KFilter, TLiwVariant( filter )); |
|
523 inParamList->AppendL( item ); |
|
524 |
|
525 if(iInterface) |
|
526 { |
|
527 iInterface->ExecuteCmdL( KExecuteAction, *inParamList, *outParamList); |
|
528 } |
|
529 else |
|
530 { |
|
531 User::Leave( KErrNotSupported ); |
|
532 } |
|
533 CleanupStack::PopAndDestroy( filter ); |
|
534 |
|
535 inParamList->Reset(); |
|
536 outParamList->Reset(); |
|
537 CleanupStack::PopAndDestroy( triggerName ); |
|
538 } |
|
539 |
|
540 // --------------------------------------------------------------------------- |
|
541 // ResumeL |
|
542 // --------------------------------------------------------------------------- |
|
543 // |
|
544 void CWrtData::ResumeL() |
|
545 { |
|
546 ChangePublisherStatusL( KResume ); |
|
547 } |
|
548 |
|
549 // --------------------------------------------------------------------------- |
|
550 // SuspendL |
|
551 // --------------------------------------------------------------------------- |
|
552 // |
|
553 void CWrtData::SuspendL() |
|
554 { |
|
555 ChangePublisherStatusL( KSuspend ); |
|
556 } |
|
557 |
|
558 // --------------------------------------------------------------------------- |
|
559 // ActivateL |
|
560 // --------------------------------------------------------------------------- |
|
561 // |
|
562 void CWrtData::ActivateL() |
|
563 { |
|
564 ChangePublisherStatusL( KActive ); |
|
565 } |
|
566 |
|
567 // --------------------------------------------------------------------------- |
|
568 // DeActivateL |
|
569 // --------------------------------------------------------------------------- |
|
570 // |
|
571 void CWrtData::DeActivateL() |
|
572 { |
|
573 ChangePublisherStatusL( KDeActive ); |
|
574 } |
|
575 |
|
576 // --------------------------------------------------------------------------- |
|
577 // OnLineL |
|
578 // --------------------------------------------------------------------------- |
|
579 // |
|
580 void CWrtData::OnLineL() |
|
581 { |
|
582 ChangePublisherStatusL( KOnLine ); |
|
583 } |
|
584 |
|
585 // --------------------------------------------------------------------------- |
|
586 // offLineL |
|
587 // --------------------------------------------------------------------------- |
|
588 // |
|
589 void CWrtData::OffLineL() |
|
590 { |
|
591 ChangePublisherStatusL( KOffLine ); |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------------------------- |
|
595 // InActiveL |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 void CWrtData::InActiveL() |
|
599 { |
|
600 ChangePublisherStatusL( KInActive ); |
|
601 } |
|
602 |
|
603 // --------------------------------------------------------------------------- |
|
604 // UpdatePublisherStatusL |
|
605 // --------------------------------------------------------------------------- |
|
606 // |
|
607 void CWrtData::UpdatePublisherStatusL() |
|
608 { |
|
609 // Resent the plugin status to publisher |
|
610 ActivateL(); |
|
611 if ( iPlugin->IsActive() ) |
|
612 { |
|
613 ResumeL(); |
|
614 } |
|
615 else |
|
616 { |
|
617 SuspendL(); |
|
618 } |
|
619 // forward the network status if it uses. |
|
620 if ( iPlugin->NetworkStatus() == CWrtDataPlugin::EOnline ) |
|
621 { |
|
622 OnLineL(); |
|
623 } |
|
624 else if ( iPlugin->NetworkStatus() == CWrtDataPlugin::EOffline ) |
|
625 { |
|
626 OffLineL(); |
|
627 } |
|
628 } |
|
629 |
|
630 // --------------------------------------------------------------------------- |
|
631 // ResolveSkinItemId |
|
632 // --------------------------------------------------------------------------- |
|
633 // |
|
634 TBool CWrtData::ResolveSkinIdAndMifId( const TDesC& aPath, TAknsItemID& aItemId, |
|
635 TInt& abitmapId, TInt& aMaskId, TDes& aFilename ) |
|
636 { |
|
637 // Syntax: skin( <major> <minor> ):mif(filename bimapId maskId) |
|
638 TInt error = KErrNotFound; |
|
639 TInt pos = aPath.FindF( KSkin ); |
|
640 if( pos != KErrNotFound ) |
|
641 { |
|
642 // Skip skin token |
|
643 pos += KSkin().Length(); |
|
644 |
|
645 // Initialize lexer |
|
646 TLex lex( aPath.Mid( pos ) ); |
|
647 lex.SkipSpace(); |
|
648 |
|
649 // Check left parenthesis |
|
650 if (lex.Get() == KLeftParenthesis ) |
|
651 { |
|
652 //lex.SkipSpace(); |
|
653 |
|
654 TInt majorId( 0 ); |
|
655 TInt minorId( 0 ); |
|
656 |
|
657 // Resolve major id |
|
658 error = lex.Val( majorId ); |
|
659 |
|
660 // Resolve minor id |
|
661 lex.SkipSpace(); |
|
662 error |= lex.Val( minorId ); |
|
663 |
|
664 // initilize skin item id object |
|
665 aItemId.Set( majorId, minorId ); |
|
666 } |
|
667 } |
|
668 |
|
669 if( (error == KErrNone && aPath.FindF( KColon ) != KErrNotFound ) |
|
670 || ( error == KErrNotFound ) ) |
|
671 { |
|
672 error = KErrNotFound; |
|
673 pos = aPath.FindF( KMif ); |
|
674 if ( pos != KErrNotFound ) |
|
675 { |
|
676 pos += KMif().Length(); |
|
677 // Initialize lexer |
|
678 TLex lex( aPath.Mid( pos ) ); |
|
679 lex.SkipSpace(); |
|
680 |
|
681 // Check left parenthesis |
|
682 if (lex.Get() == KLeftParenthesis ) |
|
683 { |
|
684 lex.SkipSpaceAndMark(); |
|
685 lex.SkipCharacters(); |
|
686 // Resolve MifFile name |
|
687 aFilename.Copy(lex.MarkedToken()); |
|
688 if( aFilename.Length()!= 0) |
|
689 { |
|
690 // Resolve bitmap id |
|
691 lex.SkipSpace(); |
|
692 error = lex.Val( abitmapId ); |
|
693 |
|
694 // Resolve mask id |
|
695 // dont return error if it is not found, that is ok |
|
696 lex.SkipSpace(); |
|
697 lex.Val( aMaskId ); |
|
698 } |
|
699 else |
|
700 { |
|
701 error = KErrNotFound; |
|
702 } |
|
703 } |
|
704 } |
|
705 } |
|
706 return (error == KErrNone ); |
|
707 } |