24 |
24 |
25 #include "wrtharvesterconst.h" |
25 #include "wrtharvesterconst.h" |
26 #include <widgetregistryconstants.h> |
26 #include <widgetregistryconstants.h> |
27 #include <wrtharvester.rsg> |
27 #include <wrtharvester.rsg> |
28 |
28 |
29 #include <ecom/implementationproxy.h> |
29 #include <implementationproxy.h> |
30 |
30 |
31 #include <LiwServiceHandler.h> |
31 #include <LiwServiceHandler.h> |
32 #include <LiwVariant.h> |
32 #include <LiwVariant.h> |
33 #include <LiwGenericParam.h> |
33 #include <LiwGenericParam.h> |
34 #include <e32property.h> //Publish & Subscribe |
34 #include <e32property.h> //Publish & Subscribe |
47 #include <data_caging_path_literals.hrh> |
47 #include <data_caging_path_literals.hrh> |
48 |
48 |
49 // CONSTANTS |
49 // CONSTANTS |
50 _LIT( KResourceFileName, "\\resource\\wrtharvester.rsc" ); |
50 _LIT( KResourceFileName, "\\resource\\wrtharvester.rsc" ); |
51 _LIT( KResourceDir, "Z:wrtharvester.rsc" ); |
51 _LIT( KResourceDir, "Z:wrtharvester.rsc" ); |
52 _LIT( KUid, "uid"); |
|
53 _LIT( K0x, "0x"); |
|
54 _LIT( KOpenPar, "("); |
|
55 _LIT( KClosePar, ")"); |
|
56 _LIT8( KWidgetIcon, "widget_icon"); |
|
57 |
52 |
58 /** |
53 /** |
59 * Utility class to show the prompt for platform security access. |
54 * Utility class to show the prompt for platform security access. |
60 * |
55 * |
61 * The class exists only to provide platform security access prompt |
56 * The class exists only to provide platform security access prompt |
232 iWidgetUsbListener = CWrtUsbHandler::NewL( this, iFs ); |
227 iWidgetUsbListener = CWrtUsbHandler::NewL( this, iFs ); |
233 |
228 |
234 iWidgetUsbListener->Start(); |
229 iWidgetUsbListener->Start(); |
235 SetMSMode(0); |
230 SetMSMode(0); |
236 |
231 |
237 iCanAccessRegistry = ETrue; |
|
238 iReinstallingWidget = EFalse; |
|
239 |
|
240 |
|
241 TFileName resourceFileName; |
232 TFileName resourceFileName; |
242 TParse parse; |
233 TParse parse; |
243 Dll::FileName (resourceFileName); |
234 Dll::FileName (resourceFileName); |
244 parse.Set(KResourceFileName, &resourceFileName, NULL); |
235 parse.Set(KResourceFileName, &resourceFileName, NULL); |
245 resourceFileName = parse.FullName(); |
236 resourceFileName = parse.FullName(); |
285 iWidgetStateArray.ResetAll(); |
276 iWidgetStateArray.ResetAll(); |
286 delete iWidgetUIListener; |
277 delete iWidgetUIListener; |
287 delete iWidgetRegListener; |
278 delete iWidgetRegListener; |
288 delete iWidgetMMCListener; |
279 delete iWidgetMMCListener; |
289 delete iWidgetUsbListener; |
280 delete iWidgetUsbListener; |
290 if(iAsyncCallBack) |
|
291 { |
|
292 iAsyncCallBack->Cancel(); |
|
293 } |
|
294 delete iAsyncCallBack; |
|
295 iAsyncCallBack = NULL; |
|
296 iUid.Close(); |
|
297 iWidgetOperations.Close(); |
281 iWidgetOperations.Close(); |
298 iHSWidgets.ResetAndDestroy(); |
282 iHSWidgets.ResetAndDestroy(); |
299 iApaSession.Close(); |
283 iApaSession.Close(); |
300 } |
284 } |
301 |
285 |
399 // |
383 // |
400 // ---------------------------------------------------------------------------- |
384 // ---------------------------------------------------------------------------- |
401 // |
385 // |
402 void CWrtHarvester::UpdatePublishersL() |
386 void CWrtHarvester::UpdatePublishersL() |
403 { |
387 { |
404 if(iReinstallingWidget) |
|
405 { |
|
406 iReinstallingWidget = EFalse; |
|
407 return; |
|
408 } |
|
409 iRegistryAccess.WidgetInfosL( iWidgetInfo ); |
388 iRegistryAccess.WidgetInfosL( iWidgetInfo ); |
410 RemoveObsoletePublishersL(); |
389 RemoveObsoletePublishersL(); |
411 |
390 |
412 for( TInt i = iWidgetInfo.Count() - 1; i >= 0; --i ) |
391 for( TInt i = iWidgetInfo.Count() - 1; i >= 0; --i ) |
413 { |
392 { |
522 TBool networkAccess = CheckNetworkAccessL( wrtInfo.iUid ); |
501 TBool networkAccess = CheckNetworkAccessL( wrtInfo.iUid ); |
523 |
502 |
524 __UHEAP_MARK; |
503 __UHEAP_MARK; |
525 TInt id( KErrNotFound ); |
504 TInt id( KErrNotFound ); |
526 if( iCPSInterface ) |
505 if( iCPSInterface ) |
527 { |
506 { |
528 TBuf<10> uid(wrtInfo.iUid.Name()); // [12345678] |
|
529 uid.Delete(0,1); // 12345678] |
|
530 uid.Delete( uid.Length()-1, 1); // 12345678 |
|
531 TBuf<50> wrtuid; |
|
532 wrtuid.Append(KUid); // uid |
|
533 wrtuid.Append(KOpenPar); // uid( |
|
534 wrtuid.Append(K0x); // uid(0x |
|
535 wrtuid.Append(uid ); // uid(0x12345678 |
|
536 wrtuid.Append(KClosePar); // uid(0x12345678) |
|
537 |
|
538 CLiwGenericParamList* inparam( CLiwGenericParamList::NewLC() ); |
507 CLiwGenericParamList* inparam( CLiwGenericParamList::NewLC() ); |
539 CLiwGenericParamList* outparam( CLiwGenericParamList::NewLC() ); |
508 CLiwGenericParamList* outparam( CLiwGenericParamList::NewLC() ); |
540 |
509 |
541 TLiwGenericParam type( KType, TLiwVariant( KPubData )); |
510 TLiwGenericParam type( KType, TLiwVariant( KPubData )); |
542 inparam->AppendL( type ); |
511 inparam->AppendL( type ); |
546 |
515 |
547 // Create the data map for publisher registry |
516 // Create the data map for publisher registry |
548 cpdatamap->InsertL( KPublisherId, TLiwVariant( KWRTPublisher )); |
517 cpdatamap->InsertL( KPublisherId, TLiwVariant( KWRTPublisher )); |
549 cpdatamap->InsertL( KContentType, TLiwVariant( KTemplatedWidget )); |
518 cpdatamap->InsertL( KContentType, TLiwVariant( KTemplatedWidget )); |
550 cpdatamap->InsertL( KContentId, TLiwVariant( wrtInfo.iBundleId )); |
519 cpdatamap->InsertL( KContentId, TLiwVariant( wrtInfo.iBundleId )); |
551 |
|
552 // Widget info map |
520 // Widget info map |
553 CLiwDefaultMap* widgetInfo = CLiwDefaultMap::NewLC(); |
521 CLiwDefaultMap* widgetInfo = CLiwDefaultMap::NewLC(); |
554 widgetInfo->InsertL( KTemplateType, TLiwVariant( KTemplateName )); |
522 widgetInfo->InsertL( KTemplateType, TLiwVariant( KTemplateName )); |
555 widgetInfo->InsertL( KWidgetName, TLiwVariant( wrtInfo.iDisplayName )); |
523 widgetInfo->InsertL( KWidgetName, TLiwVariant( wrtInfo.iDisplayName )); |
556 widgetInfo->InsertL( KWidgetIcon, TLiwVariant( wrtuid)); // uid(0x12345678) This is the expected format |
524 datamap->InsertL( KWidgetInfo , TLiwVariant( widgetInfo )); |
557 |
525 CleanupStack::PopAndDestroy( widgetInfo ); |
558 datamap->InsertL( KWidgetInfo , TLiwVariant( widgetInfo )); |
526 |
559 CleanupStack::PopAndDestroy( widgetInfo ); |
527 // Take dynamic menu items into use |
560 |
528 if (networkAccess) |
561 // Take dynamic menu items into use |
529 { |
562 if (networkAccess) |
530 CLiwDefaultMap* mapMenu = CLiwDefaultMap::NewLC(); |
563 { |
531 mapMenu->InsertL( KItemOnlineOffline, TLiwVariant( KMyActionName )); |
564 CLiwDefaultMap* mapMenu = CLiwDefaultMap::NewLC(); |
532 datamap->InsertL( KMenuItems, TLiwVariant( mapMenu )); |
565 mapMenu->InsertL( KItemOnlineOffline, TLiwVariant( KMyActionName )); |
533 CleanupStack::PopAndDestroy(mapMenu); |
566 datamap->InsertL( KMenuItems, TLiwVariant( mapMenu )); |
534 } |
567 CleanupStack::PopAndDestroy(mapMenu); |
|
568 } |
|
569 |
535 |
570 cpdatamap->InsertL( KDataMap, TLiwVariant(datamap) ); |
536 cpdatamap->InsertL( KDataMap, TLiwVariant(datamap) ); |
571 |
537 |
572 // Create the action map for publisher registry |
538 // Create the action map for publisher registry |
573 actionmap = CLiwDefaultMap::NewLC(); |
539 actionmap = CLiwDefaultMap::NewLC(); |
827 void CWrtHarvester::QueueResumeL( TUid& aUid ) |
793 void CWrtHarvester::QueueResumeL( TUid& aUid ) |
828 { |
794 { |
829 RWidgetRegistryClientSession session; |
795 RWidgetRegistryClientSession session; |
830 CleanupClosePushL( session ); |
796 CleanupClosePushL( session ); |
831 User::LeaveIfError( session.Connect() ); |
797 User::LeaveIfError( session.Connect() ); |
832 TBool preInstalled = *(session.GetWidgetPropertyValueL( aUid, EPreInstalled ) ); |
798 if ( session.IsBlanketPermGranted ( aUid ) == EBlanketUnknown && !iDialogShown ) |
833 |
|
834 // Set blanket permission to true for pre-installed widgets |
|
835 if ( preInstalled ) |
|
836 { |
|
837 session.SetBlanketPermissionL( aUid, EBlanketTrue ); |
|
838 } |
|
839 |
|
840 if ( session.IsBlanketPermGranted ( aUid ) == EBlanketUnknown && !iDialogShown |
|
841 && iCanAccessRegistry ) |
|
842 { |
799 { |
843 iDialogShown = ETrue; |
800 iDialogShown = ETrue; |
844 AllowPlatformAccessL( aUid ); |
801 AllowPlatformAccessL( aUid ); |
845 } |
802 } |
846 else if(session.IsBlanketPermGranted ( aUid ) == EBlanketUnknown) |
803 else if(!iDialogShown) |
847 { |
|
848 iUid.Append(aUid); |
|
849 } |
|
850 else |
|
851 { |
804 { |
852 QueueOperationL( WidgetResume, aUid ); |
805 QueueOperationL( WidgetResume, aUid ); |
853 } |
806 } |
854 CleanupStack::PopAndDestroy( &session ); |
807 CleanupStack::PopAndDestroy( &session ); |
855 } |
808 } |
923 User::LeaveIfError( session.Connect() ); |
876 User::LeaveIfError( session.Connect() ); |
924 TBool networkAccess = *(session.GetWidgetPropertyValueL( aUid, EAllowNetworkAccess ) ); |
877 TBool networkAccess = *(session.GetWidgetPropertyValueL( aUid, EAllowNetworkAccess ) ); |
925 CleanupStack::PopAndDestroy( &session ); |
878 CleanupStack::PopAndDestroy( &session ); |
926 |
879 |
927 return networkAccess; |
880 return networkAccess; |
928 } |
|
929 // ---------------------------------------------------------------------------- |
|
930 // |
|
931 // ---------------------------------------------------------------------------- |
|
932 // |
|
933 TInt CWrtHarvester::DeleteCallback(TAny* aPtr) |
|
934 { |
|
935 CWrtHarvester* self = (CWrtHarvester*)aPtr; |
|
936 self->QueueResumeL(self->iUid[0]); |
|
937 self->iUid.Remove(0); |
|
938 delete self->iAsyncCallBack; |
|
939 self->iAsyncCallBack = NULL; |
|
940 return 0; |
|
941 } |
|
942 |
|
943 // ---------------------------------------------------------------------------- |
|
944 // |
|
945 // ---------------------------------------------------------------------------- |
|
946 // |
|
947 void CWrtHarvester::DialogShown() |
|
948 { |
|
949 iDialogShown = EFalse; |
|
950 if(iUid.Count()) |
|
951 { |
|
952 iAsyncCallBack = new (ELeave) CAsyncCallBack(TCallBack(DeleteCallback,this),CActive::EPriorityUserInput); |
|
953 iAsyncCallBack->CallBack(); |
|
954 } |
|
955 } |
881 } |
956 |
882 |
957 // ---------------------------------------------------------------------------- |
883 // ---------------------------------------------------------------------------- |
958 // |
884 // |
959 // ---------------------------------------------------------------------------- |
885 // ---------------------------------------------------------------------------- |