15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <f32file.h> |
18 #include <f32file.h> |
19 #include <s32file.h> |
19 #include <s32file.h> |
|
20 #include <centralrepository.h> |
20 #include "CIndexingManager.h" |
21 #include "CIndexingManager.h" |
21 #include "HarvesterServerLogger.h" |
22 #include "HarvesterServerLogger.h" |
22 #include "CBlacklistMgr.h" |
23 #include "CBlacklistMgr.h" |
23 #include "contentinfomgr.h" |
24 #include "contentinfomgr.h" |
24 #include "ccontentinfo.h" |
25 #include "ccontentinfo.h" |
46 // default difference in RunL calls with additional buffer. |
47 // default difference in RunL calls with additional buffer. |
47 const TInt KMaxTimeDifference = 1 + KDefaultWaitTimeInMinutes; |
48 const TInt KMaxTimeDifference = 1 + KDefaultWaitTimeInMinutes; |
48 //constants for enable and disable status |
49 //constants for enable and disable status |
49 const TInt KEnable = 1; |
50 const TInt KEnable = 1; |
50 const TInt KDisable = 0; |
51 const TInt KDisable = 0; |
|
52 |
|
53 const TUid KCPIXHSrepoUidMenu = {0x2001f6fb}; |
|
54 |
|
55 //Length of uid string in cenrep |
|
56 const TInt KuidStringLength = 8; |
51 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
52 // CHarvesterServer::NewL() |
58 // CHarvesterServer::NewL() |
53 // ----------------------------------------------------------------------------- |
59 // ----------------------------------------------------------------------------- |
54 // |
60 // |
55 CIndexingManager* CIndexingManager::NewL() |
61 CIndexingManager* CIndexingManager::NewL() |
320 { |
328 { |
321 TUid uid = infoArray[i]->ImplementationUid(); // Create the plug-ins |
329 TUid uid = infoArray[i]->ImplementationUid(); // Create the plug-ins |
322 TInt version = infoArray[i]->Version(); |
330 TInt version = infoArray[i]->Version(); |
323 //FFLOGSTRING2( "CFastFindHarvesterPluginControl:: PLUGINS UID %x", uid ); |
331 //FFLOGSTRING2( "CFastFindHarvesterPluginControl:: PLUGINS UID %x", uid ); |
324 plugin = NULL; |
332 plugin = NULL; |
325 TBool pluginblacklisted = EFalse; |
|
326 |
333 |
327 pluginblacklisted = iBlacklistMgr->FindL( uid , version ); |
334 UpdateContentInfoDbL( infoArray[i]->DisplayName() ); |
|
335 TBool loadplugin = ETrue; |
|
336 //status of plugin in blacklist table |
|
337 TBool pluginblacklisted = iBlacklistMgr->FindL( uid, version); |
|
338 //status of plugin in unload table |
|
339 TBool loadstatus = iBlacklistMgr->FindfromUnloadListL( uid ); |
|
340 //Check the Uid in both the tables of the blacklist db |
|
341 if ( loadstatus || pluginblacklisted ) |
|
342 loadplugin = EFalse; |
328 |
343 |
329 TBool iscontentfound = iContentInfoMgr->FindL( infoArray[i]->DisplayName() ); |
344 if ( loadstatus ) |
|
345 { |
|
346 //Found in unload list.Update the indexing and blacklist status in contentinfo DB |
|
347 iContentInfoMgr->UpdatePluginIndexStatusL( infoArray[i]->DisplayName() , KDisable ); |
|
348 iContentInfoMgr->UpdateBlacklistStatusL( infoArray[i]->DisplayName() , KDisable ); |
|
349 } |
|
350 if ( pluginblacklisted ) |
|
351 //Update the blacklist status in content info db |
|
352 iContentInfoMgr->UpdateBlacklistStatusL( infoArray[i]->DisplayName() , KEnable ); |
330 |
353 |
331 if( !iscontentfound ) |
354 if ( loadplugin ) |
332 { |
|
333 //Add the content details to database |
|
334 CContentInfo* contentinfo = CContentInfo::NewL(); |
|
335 contentinfo->SetNameL( infoArray[i]->DisplayName() ); |
|
336 contentinfo->SetBlacklistStatus( KEnable ); |
|
337 contentinfo->SetIndexStatus( KEnable ); |
|
338 iContentInfoMgr->AddL( contentinfo ); |
|
339 delete contentinfo; |
|
340 } |
|
341 else |
|
342 { |
|
343 iContentInfoMgr->UpdateBlacklistStatusL( infoArray[i]->DisplayName() , KEnable ); |
|
344 } |
|
345 |
|
346 if ( !pluginblacklisted ) |
|
347 { |
355 { |
348 // Plugin is not black listed. Add it to database and try to load the plugin |
356 // Plugin is not black listed. Add it to database and try to load the plugin |
349 iBlacklistMgr->AddL( uid , version ); |
357 iBlacklistMgr->AddL( uid , version ); |
350 OstTrace1( TRACE_NORMAL, CINDEXINGMANAGER_LOADPLUGINSL, "CIndexingManager::LoadPluginsL;Plugin with uid=%x is added to DB", uid.iUid ); |
358 OstTrace1( TRACE_NORMAL, CINDEXINGMANAGER_LOADPLUGINSL, "CIndexingManager::LoadPluginsL;Plugin with uid=%x is added to DB", uid.iUid ); |
351 CPIXLOGSTRING2("CIndexingManager::LoadPluginsL(): Plugin with uid = %x is added to database", uid.iUid); |
359 CPIXLOGSTRING2("CIndexingManager::LoadPluginsL(): Plugin with uid = %x is added to database", uid.iUid); |
612 // Commit and cleanup |
620 // Commit and cleanup |
613 wr.CommitL(); |
621 wr.CommitL(); |
614 CleanupStack::PopAndDestroy(2, &file); |
622 CleanupStack::PopAndDestroy(2, &file); |
615 } |
623 } |
616 |
624 |
|
625 // ----------------------------------------------------------------------------- |
|
626 // CIndexingManager::UpdateContentInfoDbL() |
|
627 // ----------------------------------------------------------------------------- |
|
628 // |
|
629 void CIndexingManager::UpdateContentInfoDbL( const TDesC& aPluginName) |
|
630 { |
|
631 OstTraceFunctionEntry0( CINDEXINGMANAGER_UPDATECONTENTINFODBL_ENTRY ); |
|
632 TBool iscontentfound = iContentInfoMgr->FindL( aPluginName ); |
|
633 |
|
634 if( !iscontentfound ) |
|
635 { |
|
636 //Add the content details to database |
|
637 CContentInfo* contentinfo = CContentInfo::NewL(); |
|
638 contentinfo->SetNameL( aPluginName ); |
|
639 contentinfo->SetBlacklistStatus( KEnable ); |
|
640 contentinfo->SetIndexStatus( KEnable ); |
|
641 iContentInfoMgr->AddL( contentinfo ); |
|
642 delete contentinfo; |
|
643 } |
|
644 else |
|
645 { |
|
646 iContentInfoMgr->UpdateBlacklistStatusL( aPluginName , KEnable ); |
|
647 } |
|
648 OstTraceFunctionExit0( CINDEXINGMANAGER_UPDATECONTENTINFODBL_EXIT ); |
|
649 } |
|
650 |
|
651 // ----------------------------------------------------------------------------- |
|
652 // CIndexingManager::UpdateUnloadList() |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 void CIndexingManager::UpdateUnloadListL() |
|
656 { |
|
657 OstTraceFunctionEntry0( CINDEXINGMANAGER_UPDATEUNLOADLISTL_ENTRY ); |
|
658 CPIXLOGSTRING("CIndexingManager::UpdateUnloadList : Start"); |
|
659 //Read the list of Uid's from the cenrep and update blacklist database |
|
660 //Open the unload list common repository |
|
661 CRepository* unloadrepo = NULL; |
|
662 TRAPD( cerror , unloadrepo = CRepository::NewL( KCPIXHSrepoUidMenu )); |
|
663 if ( cerror != KErrNone) |
|
664 return; |
|
665 RArray<TUint32> uidlist; |
|
666 //Read all the key list |
|
667 TInt error = unloadrepo->FindL( 0, 0, uidlist); |
|
668 if ( error == KErrNone ) |
|
669 { |
|
670 TBuf<KuidStringLength> temp; |
|
671 //get the Uid of each and every plugin and add it to blacklist database |
|
672 TInt count = uidlist.Count(); |
|
673 for (int i = 0; i < count; i++ ) |
|
674 { |
|
675 TUid uid; |
|
676 TInt64 value; |
|
677 unloadrepo->Get( uidlist[i], temp ); |
|
678 TLex uidvalue(temp); |
|
679 TInt xerr = uidvalue.Val( value,EHex ); |
|
680 uid.iUid = value; |
|
681 (void)iBlacklistMgr->AddtoUnloadListL( uid ); |
|
682 } |
|
683 } |
|
684 CPIXLOGSTRING("CIndexingManager::UpdateUnloadList : End"); |
|
685 OstTraceFunctionExit0( CINDEXINGMANAGER_UPDATEUNLOADLISTL_EXIT ); |
|
686 } |