# HG changeset patch # User hgs # Date 1281336821 -19800 # Node ID e918432ddd92650aa95ee1722f45fa8258c8aadc # Parent df6898e696c655352f700465c09b1898b96f949f 201031 diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/applications/group/applicationsplugin.mmp --- a/harvesterplugins/applications/group/applicationsplugin.mmp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/applications/group/applicationsplugin.mmp Mon Aug 09 12:23:41 2010 +0530 @@ -46,7 +46,7 @@ LIBRARY cpixsearchclient.lib LIBRARY apgrfx.lib //for RApaLsSession LIBRARY apparc.lib //for TApaAppInfo -LIBRARY widgetregistryclient.lib +//LIBRARY widgetregistryclient.lib LIBRARY centralrepository.lib //for CRepository // For logging diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/applications/inc/applicationsplugin.h --- a/harvesterplugins/applications/inc/applicationsplugin.h Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/applications/inc/applicationsplugin.h Mon Aug 09 12:23:41 2010 +0530 @@ -23,7 +23,7 @@ #include #include //RApaLsSession #include //Notification -#include +//#include #include "delayedcallback.h" class CCPixIndexer; @@ -72,7 +72,7 @@ * @return void * Leaves in case of error. */ - void AddWidgetInfoL( CSearchDocument* aDocument, TUid aUid ); + //void AddWidgetInfoL( CSearchDocument* aDocument, TUid aUid ); /* * @description Returns true if applicaiton with uid aUid hidden, false otherwise @@ -86,7 +86,7 @@ CCPixIndexer* iIndexer; // CPix database. Owned. RApaLsSession iApplicationServerSession; //to get application info. CApaAppListNotifier* iNotifier; //Owned. - RWidgetRegistryClientSession iWidgetRegistry; //to get widget info. + //RWidgetRegistryClientSession iWidgetRegistry; //to get widget info. CRepository* iHiddenApplicationsRepository; #ifdef __PERFORMANCE_DATA diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/applications/src/applicationsplugin.cpp --- a/harvesterplugins/applications/src/applicationsplugin.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/applications/src/applicationsplugin.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -23,7 +23,7 @@ #include #include //#include //for KCRUidMenu -#include // EBundleDisplayName +//#include // EBundleDisplayName #include #include #include "OstTraceDefinitions.h" @@ -81,7 +81,7 @@ if (iAsynchronizer) iAsynchronizer->CancelCallback(); iApplicationServerSession.Close(); - iWidgetRegistry.Close(); + //iWidgetRegistry.Close(); //delete iHiddenApplicationsRepository; delete iAsynchronizer; delete iNotifier; @@ -94,7 +94,7 @@ iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle ); iNotifier = CApaAppListNotifier::NewL( this, CActive::EPriorityHigh ); //iHiddenApplicationsRepository = CRepository::NewL( KHiddenAppRepositoryUid ); - User::LeaveIfError( iWidgetRegistry.Connect() ); + //User::LeaveIfError( iWidgetRegistry.Connect() ); } // ----------------------------------------------------------------------------- @@ -124,7 +124,8 @@ iAsynchronizer->Start( 0, this, KHarvestingDelay ); } -// ----------------------------------------------------------------------------- +//Removing Widget Registry support +/* ----------------------------------------------------------------------------- void CApplicationsPlugin::AddWidgetInfoL( CSearchDocument* aDocument, TUid aUid ) { TBuf temp;//we can reuse this. @@ -145,7 +146,7 @@ OstTraceExt1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;DisplayName=%S", &temp ); CPIXLOGSTRING2("AddApplicationInfo(): DisplayName = %S ", &temp ); - } + }*/ // ----------------------------------------------------------------------------- //This need not be a member function. @@ -248,10 +249,11 @@ document->AddExcerptL(excerptPtr); CleanupStack::PopAndDestroy(excerpt); #endif - if( iWidgetRegistry.IsWidget( aAppInfo.iUid ) ) + + /*if( iWidgetRegistry.IsWidget( aAppInfo.iUid ) ) //Widget support AddWidgetInfoL( document, aAppInfo.iUid ); - else - AddApplicationInfoL( document, aAppInfo ); + else*/ + AddApplicationInfoL( document, aAppInfo ); TRAPD( error, iIndexer->AddL( *document ) ); if( KErrNone == error ) diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/contacts/src/ccontactsplugin.cpp --- a/harvesterplugins/contacts/src/ccontactsplugin.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/contacts/src/ccontactsplugin.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -310,16 +310,38 @@ if (! (findpos < 0) || (findpos >= aFieldSet.Count() ) ) { CContactItemField& additionalField = aFieldSet[ findpos ]; - CContactTextField* fieldText = additionalField.TextStorage(); - if ( fieldText && fieldText->Text() != KNullDesC ) - { - TInt currentSize = iExcerpt->Size(); - TInt newSize = currentSize + fieldText->Text().Size() + 1; - iExcerpt = iExcerpt->ReAllocL(newSize); - TPtr ptr = iExcerpt->Des(); - ptr.Append(fieldText->Text()); - ptr.Append(KExcerptDelimiter); - } + TInt newfieldsize = 0; + if( additionalField.StorageType() == KStorageTypeDateTime) + { + CContactDateField* fieldDate = additionalField.DateTimeStorage(); + if (fieldDate) + { + TBuf<30> dateString; + fieldDate->Time().FormatL(dateString, KTimeFormat); + TInt currentSize = iExcerpt->Size(); + TInt newSize = currentSize + dateString.Size()+ 1; + iExcerpt = iExcerpt->ReAllocL(newSize); + TPtr ptr = iExcerpt->Des(); + ptr.Append(dateString); + ptr.Append(KExcerptDelimiter); + } + + } + else + { + CContactTextField* fieldText = additionalField.TextStorage(); + if (fieldText && fieldText->Text() != KNullDesC ) + { + TInt currentSize = iExcerpt->Size(); + TInt newSize = currentSize + fieldText->Text().Size() + 1; + iExcerpt = iExcerpt->ReAllocL(newSize); + TPtr ptr = iExcerpt->Des(); + ptr.Append(fieldText->Text()); + ptr.Append(KExcerptDelimiter); + } + } + + } } @@ -391,7 +413,7 @@ AddFieldL( *index_item, fieldSet, KUidContactFieldFamilyName, KContactsFamilyNameField, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField:: EIndexFreeText ); #endif AddFieldToDocumentAndExcerptL( *index_item, fieldSet, KUidContactFieldPhoneNumber, KContactsPhoneNumberField ); - AddFieldToDocumentAndExcerptL( *index_item, fieldSet, KUidContactFieldEMail, KContactsEMailField ); + AddFieldToDocumentAndExcerptL( *index_item, fieldSet, KUidContactFieldEMail, KContactsEMailField, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText ); AddFieldToDocumentAndExcerptL( *index_item, fieldSet, KUidContactFieldSIPID, KContactsSIPIDField ); AddFieldToDocumentAndExcerptL( *index_item, fieldSet, KUidContactFieldCompanyName, KContactsCompanyNameField, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText ); AddFieldToDocumentAndExcerptL( *index_item, fieldSet, KUidContactFieldJobTitle, KContactsJobTitleField, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText ); diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/file/inc/cfileplugin.h --- a/harvesterplugins/file/inc/cfileplugin.h Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/file/inc/cfileplugin.h Mon Aug 09 12:23:41 2010 +0530 @@ -79,6 +79,12 @@ * @aExt file extention */ TBool IsFileTypeMedia(const TDesC& aExt); + + /** + * RemoveFileDatabaseL deletes the database file from the requested drive + * @aDrive drive number + */ + void RemoveFileDatabaseL(TDriveNumber aDrive); public: // diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/file/src/cfileplugin.cpp --- a/harvesterplugins/file/src/cfileplugin.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/file/src/cfileplugin.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -41,8 +41,9 @@ namespace { _LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\"); +_LIT(KIndexingDBPath,"indexing\\indexdb"); _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); - +_LIT(KfileDBPath, "\\root\\file"); _LIT(KPathFolder, "\\root\\file\\folder"); _LIT(KPathFileContent, "\\root\\file\\content"); _LIT(KFileBaseAppClassContent, "root file content"); @@ -51,6 +52,7 @@ _LIT(KFilePluginColon, ":"); _LIT(KNameField, "Name"); _LIT(KExtensionField, "Extension"); +_LIT(KIsFolderField, "IsFolder"); _LIT(KMimeTypeFile, FILE_MIMETYPE); _LIT(KMimeTypeFolder , FOLDER_MIMETYPE); _LIT(KMimeTypeField , CPIX_MIMETYPE_FIELD); @@ -273,7 +275,12 @@ // Check if already exists if (iIndexer[aMedia] && iFolderIndexer[aMedia]) return; - + //remove the database incase of memory card insertion before harvesting + if (aForceReharvest) + { + RemoveFileDatabaseL(aMedia); + } + // Add Notifications paths prior to opening IndexDB. AddNotificationPathsL(aMedia); @@ -649,8 +656,10 @@ { index_item->AddFieldL(KExtensionField, KNullDesC); index_item->AddFieldL(KMimeTypeField, KMimeTypeFolder, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); - } - + } + TBuf<2> Isfolder; + Isfolder.AppendNum(aIsDir); + index_item->AddFieldL(KIsFolderField, Isfolder, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); //Only content to be added to exceprt field. See appclass-hierarchy.txt //Add excerpt field //index_item->AddExcerptL(aFilePath); @@ -659,6 +668,28 @@ return index_item; } +void CFilePlugin::RemoveFileDatabaseL(TDriveNumber aDrive) + { + RFs aFs; + User::LeaveIfError( aFs.Connect() ); + TChar drive; + TInt err = aFs.DriveToChar((TDriveNumber)aDrive,drive); + if ( err == KErrNone ) + { + TBuf folderpath; + folderpath.Append(drive); + folderpath.Append(KFilePluginColon); + folderpath.Append(KCPixSearchServerPrivateDirectory); + folderpath.Append(KIndexingDBPath); + folderpath.Append(KfileDBPath); + CFileMan* FileMan = CFileMan::NewL(aFs); + if ( FileMan ) + FileMan->Delete( folderpath ); + delete FileMan; + } + aFs.Close(); + } + #ifdef __PERFORMANCE_DATA void CFilePlugin::UpdatePerformaceDataL(TDriveNumber aDriveNumber) { diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/file/src/cmmcmonitor.cpp --- a/harvesterplugins/file/src/cmmcmonitor.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/file/src/cmmcmonitor.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -133,7 +133,34 @@ { OstTraceFunctionEntry0( CMMCMONITOR_STARTMONITORING_ENTRY ); CPIXLOGSTRING("ENTER CMMCMonitor::StartMonitoring"); - TRAP_IGNORE( RunL() ); // Need to TRAP this rather than use RunError + iProperty.Subscribe( iStatus ); + SetActive(); + User::LeaveIfError( iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus ) ); + + for ( TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++ ) + { + const TBool foundMmc = MmcStatus( driveNumber ); + if ( !foundMmc ) + { + continue; + } + + // This drive has been recognized as MMC. + TDriveNumber drv = TDriveNumber( driveNumber ); + + TUint drvStatus( 0 ); + + const TInt err = DriveInfo::GetDriveStatus( *iFsSession, driveNumber, drvStatus ); + if ( err ) + { + continue; // should not happen + } + + if ( drvStatus & DriveInfo::EDrivePresent ) + { + iFilePlugin.MountL(drv, EFalse); + } + } CPIXLOGSTRING("END CMMCMonitor::StartMonitoring"); OstTraceFunctionExit0( CMMCMONITOR_STARTMONITORING_EXIT ); return ETrue; @@ -242,7 +269,7 @@ OstTrace0( TRACE_NORMAL, DUP2_CMMCMONITOR_RUNL, "CMMCMonitor::RunL insert event" ); CPIXLOGSTRING("CMMCMonitor::RunL insert event"); // Mount MMC and force reharvest - iFilePlugin.MountL(drv, EFalse); //dont force reharvest + iFilePlugin.MountL(drv, ETrue); } else { diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/audio/group/audioplugin.mmp --- a/harvesterplugins/media/audio/group/audioplugin.mmp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/audio/group/audioplugin.mmp Mon Aug 09 12:23:41 2010 +0530 @@ -56,6 +56,10 @@ LIBRARY bafl.lib // For logging LIBRARY flogger.lib + +// For enabling Highlighter +//MACRO USE_HIGHLIGHTER + //Enable this macro to get harvester performance data //MACRO __PERFORMANCE_DATA EXPORTUNFROZEN diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp --- a/harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -112,6 +112,12 @@ CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText); AddToFieldExcerptL(textProperty->Value());//Add artist to excerpt } +#ifdef USE_HIGHLIGHTER + //Get the media file extension and store + TBuf extension; + GetExtension(aObject.Uri(),extension); + AddToFieldExcerptL(extension); +#endif CMdEPropertyDef& albumPropDef = aObjectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty ); if(aObject.Property( albumPropDef, property )!= KErrNotFound) { diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/image/group/imageplugin.mmp --- a/harvesterplugins/media/image/group/imageplugin.mmp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/image/group/imageplugin.mmp Mon Aug 09 12:23:41 2010 +0530 @@ -56,6 +56,10 @@ // For logging LIBRARY flogger.lib + +// For enabling Highlighter +//MACRO USE_HIGHLIGHTER + //Enable this macro to get harvester performance data //MACRO __PERFORMANCE_DATA EXPORTUNFROZEN diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/image/src/cpixmediaimagedoc.cpp --- a/harvesterplugins/media/image/src/cpixmediaimagedoc.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/image/src/cpixmediaimagedoc.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -107,6 +107,12 @@ AddToFieldExcerptL(textProperty->Value()); } +#ifdef USE_HIGHLIGHTER + //Get the media file extension and store + TBuf extension; + GetExtension(aObject.Uri(),extension); + AddToFieldExcerptL(extension); +#endif //Get user comment field CMdEPropertyDef& commentPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCommentProperty ); if(aObject.Property( commentPropDef, property )!= KErrNotFound) diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/mediautils/inc/cpixdocfetcher.h --- a/harvesterplugins/media/mediautils/inc/cpixdocfetcher.h Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/mediautils/inc/cpixdocfetcher.h Mon Aug 09 12:23:41 2010 +0530 @@ -29,6 +29,21 @@ class CMdEObject; class CMdEObjectDef; +#define CPIX_MIMETYPE_FIELD L"_mimetype" +#define LCPIX_MIMETYPE_FIELD L"_mimetype" +const TInt KInitialExcerptLength = 5; +const TInt KStartPosition = 2; //Start position of absolute path +const TInt KDrivePosition = 0; //Drive position in object Uri +const TInt KMaxMediaLength = 14; +const TInt KMaxExtLength = 5; +//To unsigned decimal representation as UIds are out of range for signed decimal +_LIT(KFormat, "%u"); +_LIT(KNameField, "Name"); +_LIT(KMediaIdField, "MediaId"); +_LIT(KExtensionField, "Extension"); +_LIT(KExcerptDelimiter, " "); + + class CCPIXDocFetcher : public CBase { public: diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/mediautils/inc/cpixindexerutils.h --- a/harvesterplugins/media/mediautils/inc/cpixindexerutils.h Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/mediautils/inc/cpixindexerutils.h Mon Aug 09 12:23:41 2010 +0530 @@ -144,6 +144,14 @@ * @param TDriveNumber aMedia drive */ void RemoveUnmountedDrive(TDriveNumber aMedia); + + /* + * Remove unmounted drive database + * @param TDriveNumber aMedia drive + * @param TDesC& aPath path of database + */ + void RemoveUnmountedDatabaseL(TDriveNumber aMedia, const TDesC& aPath); + private: RArray iMountedDrives; //Array of mounted drives CCPixIndexer *iIndexer[EDriveZ + 1];//Array of all Indexers diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp --- a/harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -25,19 +25,6 @@ #include #include "harvesterserverlogger.h" -#define CPIX_MIMETYPE_FIELD L"_mimetype" -#define LCPIX_MIMETYPE_FIELD L"_mimetype" -const TInt KInitialExcerptLength = 5; -const TInt KStartPosition = 2; //Start position of absolute path -const TInt KDrivePosition = 0; //Drive position in object Uri -const TInt KMaxMediaLength = 14; -const TInt KMaxExtLength = 5; -//To unsigned decimal representation as UIds are out of range for signed decimal -_LIT(KFormat, "%u"); -_LIT(KNameField, "Name"); -_LIT(KMediaIdField, "MediaId"); -_LIT(KExtensionField, "Extension"); -_LIT(KExcerptDelimiter, " "); // ----------------------------------------------------------------------------- // CCPIXDocFetcher::NewL() diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/mediautils/src/cpixindexerutils.cpp --- a/harvesterplugins/media/mediautils/src/cpixindexerutils.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/mediautils/src/cpixindexerutils.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -28,6 +28,7 @@ // local declarations and functions namespace { _LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\"); +_LIT(KIndexingDBPath,"indexing\\indexdb"); _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); _LIT(KAtSign, "@"); @@ -276,6 +277,8 @@ } if(IsDriveCanbeMountedL(aMedia)) { + //clean the existing database if any + RemoveUnmountedDatabaseL(aMedia,aPath); // Form the baseappclass for this media TBuf baseAppClass; FormBaseAppClass(TDriveNumber(aMedia), aBaseAppClassGeneric,baseAppClass); @@ -467,4 +470,30 @@ return iMountedDrives; } +// ----------------------------------------------------------------------------- +// CCPixIndexerUtils::RemoveUnmountedDatabase() +// ----------------------------------------------------------------------------- +// +void CCPixIndexerUtils::RemoveUnmountedDatabaseL(TDriveNumber aMedia, const TDesC& aPath) + { + RFs aFs; + User::LeaveIfError( aFs.Connect() ); + TChar drive; + TInt err = aFs.DriveToChar((TDriveNumber)aMedia,drive); + if ( err == KErrNone ) + { + TBuf folderpath; + folderpath.Append(drive); + folderpath.Append(KColon); + folderpath.Append(KCPixSearchServerPrivateDirectory); + folderpath.Append(KIndexingDBPath); + folderpath.Append(aPath); + CFileMan* FileMan = CFileMan::NewL(aFs); + if ( FileMan ) + FileMan->Delete( folderpath ); + delete FileMan; + } + aFs.Close(); + } + //End of file diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/video/group/videoplugin.mmp --- a/harvesterplugins/media/video/group/videoplugin.mmp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/video/group/videoplugin.mmp Mon Aug 09 12:23:41 2010 +0530 @@ -56,6 +56,10 @@ // For logging LIBRARY flogger.lib + +// For enabling Highlighter +//MACRO USE_HIGHLIGHTER + //Enable this macro to get harvester performance data //MACRO __PERFORMANCE_DATA EXPORTUNFROZEN diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/media/video/src/cpixmediavideodoc.cpp --- a/harvesterplugins/media/video/src/cpixmediavideodoc.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/media/video/src/cpixmediavideodoc.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -106,6 +106,12 @@ CMdETextProperty* textProperty = ( CMdETextProperty* ) property; if( textProperty->Value().Compare(KNullDesC) > 0 )AddToFieldExcerptL(name); //Add name to excerpt field } +#ifdef USE_HIGHLIGHTER + //Get the media file extension and store + TBuf extension; + GetExtension(aObject.Uri(),extension); + AddToFieldExcerptL(extension); +#endif //URI and Excerpt is done add additional properties here diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/messaging/email/inc/cemailplugin.h --- a/harvesterplugins/messaging/email/inc/cemailplugin.h Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/messaging/email/inc/cemailplugin.h Mon Aug 09 12:23:41 2010 +0530 @@ -105,6 +105,10 @@ RFs iFs; //Email fecther from Qt Module QEmailFetcher* iQEmailFetcher; + //for unit testing. + #ifdef HARVESTERPLUGINTESTER_FRIEND + friend class CHarvesterPluginTester; + #endif #ifdef __PERFORMANCE_DATA TTime iStartTime; TTime iCompleteTime; diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/notes/src/notesplugin.cpp --- a/harvesterplugins/notes/src/notesplugin.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/notes/src/notesplugin.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -55,6 +55,7 @@ //Reference from CPix calender harvester plugin. _LIT(KNotesTimeFormat,"%04d %02d %02d %02d %02d"); +_LIT(KExcerptDelimiter, " "); // --------------------------------------------------------------------------- // CNotesPlugin::NewL // --------------------------------------------------------------------------- @@ -360,10 +361,12 @@ //For notes, no content is expected in excerpt for now. //See appclass-hierarchy.txt for details. #ifdef USE_HIGHLIGHTER - TInt excerptLength = entry->DescriptionL().Length(); + TInt excerptLength = entry->DescriptionL().Length() + 1 + dateString.Length(); HBufC* excerpt = HBufC::NewLC(excerptLength); TPtr excerptDes = excerpt->Des(); excerptDes.Append(entry->DescriptionL()); + excerptDes.Append(KExcerptDelimiter); + excerptDes.Append(dateString); index_item->AddExcerptL(*excerpt); CleanupStack::PopAndDestroy(excerpt); #endif diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/tsrc/harvesterplugintester/conf/harvesterplugintester.cfg --- a/harvesterplugins/tsrc/harvesterplugintester/conf/harvesterplugintester.cfg Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/tsrc/harvesterplugintester/conf/harvesterplugintester.cfg Mon Aug 09 12:23:41 2010 +0530 @@ -609,3 +609,17 @@ foobar TestHandleEmailDoc delete foobar [Endtest] + +[Test] +title TestEmailBaseappclass +create HarvesterPluginTester foobar +foobar TestEmailBaseappclass +delete foobar +[Endtest] + +[Test] +title TestEmailHandleDoc +create HarvesterPluginTester foobar +foobar TestEmailHandleDoc +delete foobar +[Endtest] diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/tsrc/harvesterplugintester/inc/harvesterplugintester.h --- a/harvesterplugins/tsrc/harvesterplugintester/inc/harvesterplugintester.h Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/tsrc/harvesterplugintester/inc/harvesterplugintester.h Mon Aug 09 12:23:41 2010 +0530 @@ -303,6 +303,10 @@ virtual TInt TestHandleEmailDocL( CStifItemParser& aItem ); + virtual TInt TestEmailBaseappclassL( CStifItemParser& aItem ); + + virtual TInt TestEmailHandleDocL( CStifItemParser& aItem ); + virtual TInt TestQualifiedBaseAppClassL( CStifItemParser& ); virtual TAny TestHandleMsgMovedL( CStifItemParser& ); diff -r df6898e696c6 -r e918432ddd92 harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintesterblocks.cpp --- a/harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintesterblocks.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintesterblocks.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -173,6 +173,8 @@ ENTRY( "TestImageNoIndexer",CHarvesterPluginTester::TestImageNoIndexerL ), ENTRY( "TestStartEmailPlugin",CHarvesterPluginTester::TestStartEmailPluginL ), ENTRY( "TestHandleEmailDoc",CHarvesterPluginTester::TestHandleEmailDocL ), + ENTRY( "TestEmailBaseappclass",CHarvesterPluginTester::TestEmailBaseappclassL ), + ENTRY( "TestEmailHandleDoc",CHarvesterPluginTester::TestEmailHandleDocL ), //ADD NEW ENTRY HERE // [test cases entries] - Do not remove }; @@ -2181,8 +2183,11 @@ iLog->Log( KExample ); CEmailPlugin* emailPlugin = CEmailPlugin::NewL(); CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); - emailPlugin->StartPluginL(); //Calls Add + emailPlugin->StartPluginL(); + iPluginTester->SetWaitTime( (TTimeIntervalMicroSeconds32)5000000 ); emailPlugin->StartHarvestingL( KEmailAppBasePath ); + emailPlugin->HarvestingCompleted(); + iPluginTester->iWaitForHarvester->Start(); delete emailPlugin; delete iPluginTester; doLog( iLog, KErrNone, KNoErrorString ); @@ -2198,14 +2203,63 @@ // Print to log file iLog->Log( KExample ); CEmailPlugin* emailPlugin = CEmailPlugin::NewL(); - CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); + CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); + TRAPD(err , emailPlugin->StartPluginL()); CSearchDocument* doc = prepareemaildocument(); - TRAPD(err , emailPlugin->HandleDocumentL( doc , ECPixAddAction)); - iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. + TRAP(err , emailPlugin->HandleDocumentL( doc , ECPixAddAction)); + TRAP(err , emailPlugin->HandleDocumentL( doc , ECPixRemoveAction)); + //iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. + delete doc; delete emailPlugin; delete iPluginTester; doLog( iLog, err, KNoErrorString ); return err; } +TInt CHarvesterPluginTester::TestEmailBaseappclassL( CStifItemParser& /*aItem*/ ) + { + _LIT( KHarvesterPluginTester, "HarvesterPluginTester: %S" ); + _LIT( KExample, "In TestEmailBaseappclassL" ); + TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample ); + + TDriveNumber drive ( EDriveA ); + _LIT( appcls1 ,"@c:root msg email" ); + _LIT( appcls2 ,"@*:root msg email" ); + _LIT( appcls3 ,"d:root msg email" ); + CEmailPlugin* emailPlugin = CEmailPlugin::NewL(); + CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); + TRAPD(err , emailPlugin->StartPluginL()); + TRAP(err, emailPlugin->StartHarvestingL(appcls1)); + delete emailPlugin->iIndexer[EDriveC]; + emailPlugin->iIndexer[EDriveC] = NULL; + TRAP(err, emailPlugin->StartHarvestingL(appcls1)); + TRAP(err, emailPlugin->StartHarvestingL(appcls2)); + TRAP(err, emailPlugin->StartHarvestingL(appcls3)); + delete emailPlugin; + delete iPluginTester; + return err; + } + +TInt CHarvesterPluginTester::TestEmailHandleDocL( CStifItemParser& /*aItem*/ ) + { + _LIT( KHarvesterPluginTester, "HarvesterPluginTester: %S" ); + _LIT( KExample, "In TestEmailHandleDocL" ); + TestModuleIf().Printf( 0, KHarvesterPluginTester, KExample ); + CEmailPlugin* emailPlugin = CEmailPlugin::NewL(); + CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( emailPlugin ); + CSearchDocument* doc = prepareemaildocument(); + TRAPD(err , emailPlugin->StartPluginL()); + TRAP(err, emailPlugin->StartHarvestingL( KEmailAppBasePath )); + delete emailPlugin->iIndexer[EDriveC]; + TRAP(err,emailPlugin->HandleDocumentL(doc,ECPixRemoveAction)); + TRAP(err,emailPlugin->HandleDocumentL(doc,ECPixAddAction)); + emailPlugin->MountL(EDriveC); + TRAP(err,emailPlugin->HandleDocumentL(doc,ECPixAddAction)); + TRAP(err,emailPlugin->HandleDocumentL(doc,ECPixUpdateAction)); + delete doc; + delete emailPlugin; + delete iPluginTester; + return err; + } + // [End of File] - Do not remove diff -r df6898e696c6 -r e918432ddd92 searchui/bwins/searchindevicehandleru.def --- a/searchui/bwins/searchindevicehandleru.def Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/bwins/searchindevicehandleru.def Mon Aug 09 12:23:41 2010 +0530 @@ -6,21 +6,24 @@ ?isPrepared@InDeviceHandler@@QAE_NXZ @ 5 NONAME ; bool InDeviceHandler::isPrepared(void) ?handleAsyncSearchResult@InDeviceHandler@@IAEXHH@Z @ 6 NONAME ; void InDeviceHandler::handleAsyncSearchResult(int, int) ?qt_metacast@InDeviceHandler@@UAEPAXPBD@Z @ 7 NONAME ; void * InDeviceHandler::qt_metacast(char const *) - ?cancelLastSearch@InDeviceHandler@@QAEXXZ @ 8 NONAME ; void InDeviceHandler::cancelLastSearch(void) - ?getDocumentAsyncAtIndex@InDeviceHandler@@QAEXH@Z @ 9 NONAME ; void InDeviceHandler::getDocumentAsyncAtIndex(int) - ?metaObject@InDeviceHandler@@UBEPBUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const * InDeviceHandler::metaObject(void) const - ??_EInDeviceHandler@@UAE@I@Z @ 11 NONAME ; InDeviceHandler::~InDeviceHandler(unsigned int) - ?qt_metacall@InDeviceHandler@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 12 NONAME ; int InDeviceHandler::qt_metacall(enum QMetaObject::Call, int, void * *) - ?handleSearchResult@InDeviceHandler@@IAEXHH@Z @ 13 NONAME ; void InDeviceHandler::handleSearchResult(int, int) - ?tr@InDeviceHandler@@SA?AVQString@@PBD0H@Z @ 14 NONAME ; class QString InDeviceHandler::tr(char const *, char const *, int) - ??1InDeviceHandler@@UAE@XZ @ 15 NONAME ; InDeviceHandler::~InDeviceHandler(void) - ?trUtf8@InDeviceHandler@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString InDeviceHandler::trUtf8(char const *, char const *) - ?tr@InDeviceHandler@@SA?AVQString@@PBD0@Z @ 17 NONAME ; class QString InDeviceHandler::tr(char const *, char const *) - ?trUtf8@InDeviceHandler@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString InDeviceHandler::trUtf8(char const *, char const *, int) - ?getStaticMetaObject@InDeviceHandler@@SAABUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const & InDeviceHandler::getStaticMetaObject(void) - ?handleDocument@InDeviceHandler@@IAEXHPAVCpixDocument@@@Z @ 20 NONAME ; void InDeviceHandler::handleDocument(int, class CpixDocument *) - ?getSearchResultCount@InDeviceHandler@@QAEHXZ @ 21 NONAME ; int InDeviceHandler::getSearchResultCount(void) - ?searchAsync@InDeviceHandler@@QAEXVQString@@0@Z @ 22 NONAME ; void InDeviceHandler::searchAsync(class QString, class QString) - ?staticMetaObject@InDeviceHandler@@2UQMetaObject@@B @ 23 NONAME ; struct QMetaObject const InDeviceHandler::staticMetaObject - ?getSearchResult@InDeviceHandler@@AAEXHH@Z @ 24 NONAME ; void InDeviceHandler::getSearchResult(int, int) + ?getBatchDocumentAsyncAtIndex@InDeviceHandler@@QAEXHH@Z @ 8 NONAME ; void InDeviceHandler::getBatchDocumentAsyncAtIndex(int, int) + ?cancelLastSearch@InDeviceHandler@@QAEXXZ @ 9 NONAME ; void InDeviceHandler::cancelLastSearch(void) + ?getDocumentAsyncAtIndex@InDeviceHandler@@QAEXH@Z @ 10 NONAME ; void InDeviceHandler::getDocumentAsyncAtIndex(int) + ?metaObject@InDeviceHandler@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * InDeviceHandler::metaObject(void) const + ??_EInDeviceHandler@@UAE@I@Z @ 12 NONAME ; InDeviceHandler::~InDeviceHandler(unsigned int) + ?qt_metacall@InDeviceHandler@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13 NONAME ; int InDeviceHandler::qt_metacall(enum QMetaObject::Call, int, void * *) + ?getBatchDocumentAsync@InDeviceHandler@@AAEXHHPAPAVCpixDocument@@@Z @ 14 NONAME ; void InDeviceHandler::getBatchDocumentAsync(int, int, class CpixDocument * *) + ?handleSearchResult@InDeviceHandler@@IAEXHH@Z @ 15 NONAME ; void InDeviceHandler::handleSearchResult(int, int) + ?tr@InDeviceHandler@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString InDeviceHandler::tr(char const *, char const *, int) + ??1InDeviceHandler@@UAE@XZ @ 17 NONAME ; InDeviceHandler::~InDeviceHandler(void) + ?trUtf8@InDeviceHandler@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString InDeviceHandler::trUtf8(char const *, char const *) + ?handleBatchDocument@InDeviceHandler@@IAEXHHPAPAVCpixDocument@@@Z @ 19 NONAME ; void InDeviceHandler::handleBatchDocument(int, int, class CpixDocument * *) + ?tr@InDeviceHandler@@SA?AVQString@@PBD0@Z @ 20 NONAME ; class QString InDeviceHandler::tr(char const *, char const *) + ?trUtf8@InDeviceHandler@@SA?AVQString@@PBD0H@Z @ 21 NONAME ; class QString InDeviceHandler::trUtf8(char const *, char const *, int) + ?getStaticMetaObject@InDeviceHandler@@SAABUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const & InDeviceHandler::getStaticMetaObject(void) + ?handleDocument@InDeviceHandler@@IAEXHPAVCpixDocument@@@Z @ 23 NONAME ; void InDeviceHandler::handleDocument(int, class CpixDocument *) + ?getSearchResultCount@InDeviceHandler@@QAEHXZ @ 24 NONAME ; int InDeviceHandler::getSearchResultCount(void) + ?searchAsync@InDeviceHandler@@QAEXVQString@@0@Z @ 25 NONAME ; void InDeviceHandler::searchAsync(class QString, class QString) + ?staticMetaObject@InDeviceHandler@@2UQMetaObject@@B @ 26 NONAME ; struct QMetaObject const InDeviceHandler::staticMetaObject + ?getSearchResult@InDeviceHandler@@AAEXHH@Z @ 27 NONAME ; void InDeviceHandler::getSearchResult(int, int) diff -r df6898e696c6 -r e918432ddd92 searchui/eabi/searchindevicehandleru.def --- a/searchui/eabi/searchindevicehandleru.def Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/eabi/searchindevicehandleru.def Mon Aug 09 12:23:41 2010 +0530 @@ -12,15 +12,18 @@ _ZN15InDeviceHandler18getDocumentAtIndexEi @ 11 NONAME _ZN15InDeviceHandler18handleSearchResultEii @ 12 NONAME _ZN15InDeviceHandler19getStaticMetaObjectEv @ 13 NONAME - _ZN15InDeviceHandler20getSearchResultCountEv @ 14 NONAME - _ZN15InDeviceHandler23getDocumentAsyncAtIndexEi @ 15 NONAME - _ZN15InDeviceHandler23handleAsyncSearchResultEii @ 16 NONAME - _ZN15InDeviceHandlerC1Ev @ 17 NONAME - _ZN15InDeviceHandlerC2Ev @ 18 NONAME - _ZN15InDeviceHandlerD0Ev @ 19 NONAME - _ZN15InDeviceHandlerD1Ev @ 20 NONAME - _ZN15InDeviceHandlerD2Ev @ 21 NONAME - _ZNK15InDeviceHandler10metaObjectEv @ 22 NONAME - _ZTI15InDeviceHandler @ 23 NONAME - _ZTV15InDeviceHandler @ 24 NONAME + _ZN15InDeviceHandler19handleBatchDocumentEiiPP12CpixDocument @ 14 NONAME + _ZN15InDeviceHandler20getSearchResultCountEv @ 15 NONAME + _ZN15InDeviceHandler21getBatchDocumentAsyncEiiPP12CpixDocument @ 16 NONAME + _ZN15InDeviceHandler23getDocumentAsyncAtIndexEi @ 17 NONAME + _ZN15InDeviceHandler23handleAsyncSearchResultEii @ 18 NONAME + _ZN15InDeviceHandler28getBatchDocumentAsyncAtIndexEii @ 19 NONAME + _ZN15InDeviceHandlerC1Ev @ 20 NONAME + _ZN15InDeviceHandlerC2Ev @ 21 NONAME + _ZN15InDeviceHandlerD0Ev @ 22 NONAME + _ZN15InDeviceHandlerD1Ev @ 23 NONAME + _ZN15InDeviceHandlerD2Ev @ 24 NONAME + _ZNK15InDeviceHandler10metaObjectEv @ 25 NONAME + _ZTI15InDeviceHandler @ 26 NONAME + _ZTV15InDeviceHandler @ 27 NONAME diff -r df6898e696c6 -r e918432ddd92 searchui/indevicehandler/inc/indevicehandler.h --- a/searchui/indevicehandler/inc/indevicehandler.h Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/indevicehandler/inc/indevicehandler.h Mon Aug 09 12:23:41 2010 +0530 @@ -34,7 +34,6 @@ class CpixSearcher; class CpixDocument; - SEARCH_CLASS(SearchInDeviceHandlerTest) /** @@ -78,6 +77,12 @@ */ void handleDocument(int aError, CpixDocument* aDoc); + /** + * Signalled when user requests for the result item in batch + * error and result item will be returned + */ + void handleBatchDocument(int aError, int aCount, CpixDocument** aDoc); + private slots: /** @@ -97,6 +102,16 @@ */ void getDocumentAsync(int aError, CpixDocument* aDocument); + /** + * slot connects to CpixSearcher to get the result item + * @since S60 ?S60_version. + * @param aError error code. + * @param aCount number of result item. + * @param aDocument array of Documents + */ + void getBatchDocumentAsync(int aError, int aCount, + CpixDocument** aDocument); + public: /** @@ -113,7 +128,13 @@ */ void getDocumentAsyncAtIndex(int aIndex); - + /** + * returns the result item asynchronously. + * @since S60 ?S60_version. + * @param aIndex index + * @param aCount number of result item + */ + void getBatchDocumentAsyncAtIndex(int aIndex, int aCount); /** * initate the search asynchronously. @@ -163,7 +184,7 @@ */ int mSearchResultCount; -SEARCH_FRIEND_CLASS (SearchInDeviceHandlerTest) + SEARCH_FRIEND_CLASS (SearchInDeviceHandlerTest) }; #endif //INDEVICEHANDLER_H diff -r df6898e696c6 -r e918432ddd92 searchui/indevicehandler/src/indevicehandler.cpp --- a/searchui/indevicehandler/src/indevicehandler.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/indevicehandler/src/indevicehandler.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -34,11 +34,17 @@ { if (mSearchInterface) { + disconnect(mSearchInterface, SIGNAL(handleSearchResults(int,int)), + this, SLOT(getSearchResult(int,int))); + disconnect(mSearchInterface, + SIGNAL(handleDocument(int,CpixDocument*)), this, + SLOT(getDocumentAsync(int,CpixDocument*))); + disconnect(mSearchInterface, + SIGNAL(handleDocument(int,CpixDocument*)), this, + SLOT(getDocumentAsync(int,CpixDocument*))); delete mSearchInterface; - } } - // --------------------------------------------------------------------------- // InDeviceHandler::getSearchResult(int aError, int estimatedResultCount) // aError: error code @@ -47,7 +53,6 @@ // void InDeviceHandler::getSearchResult(int aError, int estimatedResultCount) { - qDebug() << aError << estimatedResultCount; mSearchResultCount = estimatedResultCount; emit handleAsyncSearchResult(aError, estimatedResultCount); } @@ -62,6 +67,17 @@ emit handleDocument(aError, aDocument); } // --------------------------------------------------------------------------- +// InDeviceHandler::getBatchDocumentAsync(int aError, CpixDocument* aDocument) +// aError: error code +// aDocument: holding the result item +// --------------------------------------------------------------------------- +// +void InDeviceHandler::getBatchDocumentAsync(int aError, int aCount, + CpixDocument** aDocument) + { + emit handleBatchDocument(aError, aCount, aDocument); + } +// --------------------------------------------------------------------------- // InDeviceHandler::getDocumentAtIndex(int aIndex) // aIndex: item index to be found // --------------------------------------------------------------------------- @@ -85,7 +101,6 @@ return doc; } - // --------------------------------------------------------------------------- // InDeviceHandler::getSearchResultCount() // gets the number of hits @@ -114,7 +129,27 @@ return; } } - + } +// --------------------------------------------------------------------------- +// InDeviceHandler::getBatchDocumentAsyncAtIndex +// aIndex : index of item to be found async +// aCount : number of result items +// --------------------------------------------------------------------------- +// +void InDeviceHandler::getBatchDocumentAsyncAtIndex(int aIndex, int aCount) + { + if (mSearchInterface) + { + try + { + mSearchInterface->batchdocumentAsync(aIndex, aCount); + } + catch (...) + { + // handle the exception + return; + } + } } // --------------------------------------------------------------------------- // InDeviceHandler::searchAsync @@ -148,7 +183,6 @@ void InDeviceHandler::cancelLastSearch() { if (mSearchInterface) - { try { @@ -183,31 +217,17 @@ else { mSearchInterface = CpixSearcher::newInstance("root", - DEFAULT_SEARCH_FIELD); + DEFAULT_SEARCH_FIELD); } if (mSearchInterface) { - try - { - mSearchInterface->connect(mSearchInterface, - SIGNAL(handleSearchResults(int,int)), this, - SLOT(getSearchResult(int,int))); - } - catch (...) - { - // handle the exception - } - - try - { - mSearchInterface->connect(mSearchInterface, - SIGNAL(handleDocument(int,CpixDocument*)), this, - SLOT(getDocumentAsync(int,CpixDocument*))); - } - catch (...) - { - // handle the exception - } + connect(mSearchInterface, SIGNAL(handleSearchResults(int,int)), this, + SLOT(getSearchResult(int,int))); + connect(mSearchInterface, SIGNAL(handleDocument(int,CpixDocument*)), + this, SLOT(getDocumentAsync(int,CpixDocument*))); + connect(mSearchInterface, + SIGNAL(handleBatchDocuments(int,int,CpixDocument**)), this, + SLOT(getBatchDocumentAsync(int,int,CpixDocument**))); } } @@ -222,7 +242,5 @@ { return true; } - return false; - } diff -r df6898e696c6 -r e918432ddd92 searchui/runtimeproviders/searchruntimeprovider/inc/searchruntime.h --- a/searchui/runtimeproviders/searchruntimeprovider/inc/searchruntime.h Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/runtimeproviders/searchruntimeprovider/inc/searchruntime.h Mon Aug 09 12:23:41 2010 +0530 @@ -89,24 +89,11 @@ private: /** - * Creates gui service parts - * @since S60 ?S60_version. - */ - void createGuiServiceParts(); - - /** * Creates states * @since S60 ?S60_version. */ void createStates(); -private: - - /** - * Window to visualize scene - */ - HbMainWindow *mWindow; - SEARCH_FRIEND_CLASS (SearchRuntimeProviderTest) }; diff -r df6898e696c6 -r e918432ddd92 searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp --- a/searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -24,7 +24,6 @@ #include #include #include -#include #define hbApp qobject_cast(qApp) @@ -40,9 +39,8 @@ // --------------------------------------------------------------------------- // SearchRuntime::SearchRuntime(QObject* aParent) : - QStateMachine(aParent), mWindow(0) + QStateMachine(aParent) { - createGuiServiceParts(); createStates(); } @@ -52,8 +50,6 @@ // SearchRuntime::~SearchRuntime() { - delete mWindow; - // delete mStateMachine; } // --------------------------------------------------------------------------- @@ -73,24 +69,12 @@ { emit stopped(); } - -// --------------------------------------------------------------------------- -// SearchRuntime::createGuiServiceParts() -// --------------------------------------------------------------------------- -// -void SearchRuntime::createGuiServiceParts() - { - mWindow = new HbMainWindow(); - mWindow->show(); - } - // --------------------------------------------------------------------------- // SearchRuntime::createStates() // --------------------------------------------------------------------------- // void SearchRuntime::createStates() { - SearchStateProvider stateProvider; QFinalState* finalState = new QFinalState(); @@ -143,13 +127,13 @@ connect(wizardSettingState, SIGNAL(publishSelectedCategory(int,bool)), wizardProgressiveState, SLOT(getSettingCategory(int,bool))); - + connect(wizardSettingState, SIGNAL(publishISProviderIcon(int,HbIcon)), wizardProgressiveState, SLOT(slotISProvidersIcon(int,HbIcon))); connect(wizardProgressiveState, SIGNAL(inDeviceSearchQuery(QString)), wizardOnlineState, SLOT(slotIndeviceQuery(QString))); - + connect(wizardProgressiveState, SIGNAL(launchLink(int,QString)), wizardOnlineState, SLOT(slotlaunchLink(int,QString))); @@ -189,5 +173,4 @@ connect(this, SIGNAL(started()), SLOT(handleStateMachineStarted())); connect(this, SIGNAL(stopped()), SLOT(handleStateMachineStopped())); connect(this, SIGNAL(finished()), SLOT(handleStateMachineStopped())); - } diff -r df6898e696c6 -r e918432ddd92 searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h --- a/searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h Mon Aug 09 12:23:41 2010 +0530 @@ -144,12 +144,20 @@ */ void constructHandlers(); + InDeviceHandler* constructHandlers(int mDatabase); + /** * setting the categories . * @since S60 ?S60_version. */ void setSelectedCategories(); - + + /** + * parse the result documents. + * @since S60 ?S60_version. + */ + void parseDocument(CpixDocument* aDoc); + public slots: /** @@ -169,6 +177,15 @@ void onGetDocumentComplete(int aError, CpixDocument* aDoc); /** + * slot connects to CSearchHandler to get the result item asynchronously + * @since S60 ?S60_version. + * @param aError error code. + * @param aDoc result item + */ + void onGetBatchDocumentComplete(int aError, int aCount, + CpixDocument** aDoc); + + /** * slot connects to list view to launch the respective application * @since S60 ?S60_version. * @param aIndex index of the activated item. @@ -252,7 +269,6 @@ * @since S60 ?S60_version. */ void slotPrepareResultIcons(); - private: /** @@ -492,6 +508,9 @@ SearchUiLoader* mUiLoader; bool mStateStatus; + + bool mValidateHandlerCreation; + #ifdef OST_TRACE_COMPILER_IN_USE QTime m_totalSearchUiTime; QTime m_categorySearchUiTime; @@ -502,7 +521,7 @@ long m_getDocumentCatergoryTimeAccumulator; #endif -SEARCH_FRIEND_CLASS (SearchStateProviderTest) + SEARCH_FRIEND_CLASS (SearchStateProviderTest) }; diff -r df6898e696c6 -r e918432ddd92 searchui/stateproviders/searchstateprovider/inc/searchuiloader.h --- a/searchui/stateproviders/searchstateprovider/inc/searchuiloader.h Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/stateproviders/searchstateprovider/inc/searchuiloader.h Mon Aug 09 12:23:41 2010 +0530 @@ -20,15 +20,14 @@ #include "search_global.h" #include #include - +#include class HbDocumentLoader; class HbView; class HbListWidget; class HbSearchPanel; class TsTaskSettings; -class HbMainWindow; +class SearchMainWindow; class HbShrinkingVkbHost; - SEARCH_CLASS( SearchStateProviderTest) class SearchUiLoader : public QObject @@ -76,7 +75,13 @@ * Slot to send the application to background fake exit * @since S60 ?S60_version. */ - void slotsendtobackground(); + void slotsendtobackground(); + + /** + * Slot to open vkb + * @since S60 ?S60_version. + */ + void slotbringvkb(); public: @@ -105,14 +110,7 @@ HbSearchPanel* SearchPanel() { return mSearchPanel; - } - - /** - * Function to listen the applicaition foreground event - * @param aUid Unique app Id. - */ - bool eventFilter(QObject *, QEvent *); - + } private: /** * Constructor. @@ -172,15 +170,55 @@ /** * application main window */ - HbMainWindow* mMainWindow; + SearchMainWindow* mMainWindow; /** * vkbhost to resize the result screen * Own. */ HbShrinkingVkbHost* mVirtualKeyboard; + + /** + * flag to validate fake exit + * Own. + */ + bool mBringtoForground; private: -SEARCH_FRIEND_CLASS ( SearchStateProviderTest) + SEARCH_FRIEND_CLASS ( SearchStateProviderTest) }; +class SearchMainWindow : public HbMainWindow + { +Q_OBJECT +public: + /** + * Constructor. + * @since S60 ?S60_version. + */ + SearchMainWindow() + { + connect(this, SIGNAL(viewReady()), this, SLOT(slotViewReady())); + } + /** + * Function capture the focusin event + * @param event . + */ + void focusInEvent(QFocusEvent * event) + { + Q_UNUSED(event); + slotViewReady(); + } +public slots: + /** + * Slot to send the application to background fake exit + * @since S60 ?S60_version. + */ + void slotViewReady(); +signals: + /** + * signal to send the notification for vkb + * @since S60 ?S60_version. + */ + void bringvkb(); + }; #endif //SEARCH_CONTROLLER_H diff -r df6898e696c6 -r e918432ddd92 searchui/stateproviders/searchstateprovider/inc/settingswidget.h --- a/searchui/stateproviders/searchstateprovider/inc/settingswidget.h Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/stateproviders/searchstateprovider/inc/settingswidget.h Mon Aug 09 12:23:41 2010 +0530 @@ -248,9 +248,9 @@ bool mchangestate; OnlineHandler *mInternetHandler; - // QStringList mServiceProviders; + QMap mServiceProviders; -SEARCH_FRIEND_CLASS (SearchStateProviderTest) + SEARCH_FRIEND_CLASS (SearchStateProviderTest) }; #endif diff -r df6898e696c6 -r e918432ddd92 searchui/stateproviders/searchstateprovider/src/searchonlinestate.cpp --- a/searchui/stateproviders/searchstateprovider/src/searchonlinestate.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/stateproviders/searchstateprovider/src/searchonlinestate.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -40,15 +40,13 @@ SearchOnlineState::SearchOnlineState(QState *parent) : QState(parent), mMainWindow(NULL), mView(NULL), mSearchPanel(NULL) { - + mUiLoader = SearchUiLoader::instance(); mInternetHandler = new OnlineHandler(); mSearchReady = true; mIndeviceQueryAvailable = false; mMainWindow = hbInstance->allMainWindows().at(0); - mUiLoader = SearchUiLoader::instance(); - mView = mUiLoader->View(); mListView = mUiLoader->ListWidget(); mSearchPanel = mUiLoader->SearchPanel(); diff -r df6898e696c6 -r e918432ddd92 searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp --- a/searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -56,6 +56,8 @@ #define hbApp qobject_cast(qApp) const int totalcategories_normalreason = 10; const int totalcategories_activityreasonreason = 13; +const int intial_iteration = 3; +const int batch_iteration = 20; // --------------------------------------------------------------------------- // SearchProgressiveState::SearchProgressiveState // --------------------------------------------------------------------------- @@ -63,13 +65,12 @@ QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), mSearchHandler(NULL), mNotesEditor(0), mAiwMgr(0), mRequest(0) { + mUiLoader = SearchUiLoader::instance(); mMainWindow = hbInstance->allMainWindows().at(0); mAiwMgr = new XQApplicationManager; - mUiLoader = SearchUiLoader::instance(); - mView = mUiLoader->View(); mListView = mUiLoader->ListWidget(); mSearchPanel = mUiLoader->SearchPanel(); @@ -136,7 +137,10 @@ //Prepare the icons,listen of theme change connect(hbInstance->theme(), SIGNAL(changeFinished()), this, SLOT(slotPrepareResultIcons())); - slotPrepareResultIcons(); + slotPrepareResultIcons(); + + // creating the handler if it is not prepared, useful when user try to create before + mValidateHandlerCreation = false; } // --------------------------------------------------------------------------- // SearchProgressiveState::~SearchProgressiveState @@ -169,79 +173,9 @@ { categories = totalcategories_activityreasonreason; } - InDeviceHandler* handler = NULL; for (int i = 0; i < categories; i++) { - handler = new InDeviceHandler(); - switch (i) - { - case 0: - { - handler->setCategory(""); - break; - } - case 1: - { - handler->setCategory("contact"); - break; - } - case 2: - { - handler->setCategory("media"); - break; - } - case 3: - { - handler->setCategory("msg"); - break; - } - case 4: - { - handler->setCategory("msg email"); - break; - } - case 5: - { - handler->setCategory("calendar"); - break; - } - case 6: - { - handler->setCategory("notes"); - break; - } - case 7: - { - handler->setCategory("applications"); - break; - } - case 8: - { - handler->setCategory("file"); - break; - } - case 9: - { - handler->setCategory("bookmark"); - break; - } - case 10: - { - handler->setCategory("media image"); - break; - } - case 11: - { - handler->setCategory("media audio"); - break; - } - case 12: - { - handler->setCategory("media video"); - break; - } - } - mSearchHandlerList.append(handler); + mSearchHandlerList.append(constructHandlers(i)); } } // --------------------------------------------------------------------------- @@ -275,6 +209,7 @@ } if (loadSettings) { + // to get the intial settings form delimeter emit switchProToSettingsState(); loadSettings = false; } @@ -292,7 +227,7 @@ { QState::onExit(event); mStateStatus = false; - deActivateSignals(); + deActivateSignals(); } // --------------------------------------------------------------------------- // SearchProgressiveState::activateSignals @@ -307,6 +242,10 @@ connect(mSearchHandlerList.at(i), SIGNAL(handleDocument(int,CpixDocument*)), this, SLOT(onGetDocumentComplete(int,CpixDocument*))); + connect(mSearchHandlerList.at(i), + SIGNAL(handleBatchDocument(int,int,CpixDocument**)), this, + SLOT(onGetBatchDocumentComplete(int,int,CpixDocument**))); + } if (mListView) { @@ -335,6 +274,9 @@ disconnect(mSearchHandlerList.at(i), SIGNAL(handleDocument(int,CpixDocument*)), this, SLOT(onGetDocumentComplete(int,CpixDocument*))); + disconnect(mSearchHandlerList.at(i), + SIGNAL(handleBatchDocument(int,int,CpixDocument**)), this, + SLOT(onGetBatchDocumentComplete(int,int,CpixDocument**))); } if (mListView) { @@ -383,203 +325,54 @@ void SearchProgressiveState::onGetDocumentComplete(int aError, CpixDocument* aDoc) { - PERF_CAT_GETDOC_TIME_ACCUMULATE - if (aDoc == NULL || aError != 0) + if (aError) return; - QString secondrow = aDoc->excerpt(); - QString firstrow; - HbListWidgetItem* listitem = new HbListWidgetItem(); - - if (aDoc->baseAppClass().contains("contact")) - { - QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); - if (docsList.value(0, "").length()) - { - firstrow.append(docsList.at(0)); - } - if (docsList.value(1, "").length()) - { - if (firstrow.length()) - firstrow.append(" "); - firstrow.append(docsList.at(1)); - } - if (firstrow.length() == 0) - { - firstrow = hbTrId("txt_phob_dblist_unnamed"); - } - listitem->setData(mIconArray.at(0), Qt::DecorationRole); - } - else if (aDoc->baseAppClass().contains("audio")) - { - QStringList audioList = filterDoc(aDoc, "Title", "MediaId"); - if (audioList.value(0, "").length()) - { - firstrow.append(audioList.at(0)); - } - if (firstrow.length() == 0) - { - firstrow = hbTrId("txt_mus_dblist_val_unknown4"); - } - listitem->setData(mIconArray.at(1), Qt::DecorationRole); - if (audioList.value(1, "").length()) - { - listitem->setData(audioList.at(1), Qt::UserRole + 2); - } - } - else if (aDoc->baseAppClass().contains("video")) - { - QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); - if (videoList.value(0, "").length()) - { - firstrow.append(videoList.at(0)); - } - if (firstrow.length() == 0 && videoList.value(2, "").length()) - { - firstrow.append(videoList.at(2)); - } - listitem->setData(mIconArray.at(2), Qt::DecorationRole); - if (videoList.value(1, "").length()) - { - listitem->setData(videoList.at(1), Qt::UserRole + 2); - } - } - else if (aDoc->baseAppClass().contains("image")) - { - QStringList imageList = filterDoc(aDoc, "Name", "MediaId"); - if (imageList.value(0, "").length()) - { - firstrow.append(imageList.at(0)); - } - listitem->setData(mIconArray.at(3), Qt::DecorationRole); - if (imageList.value(1, "").length()) - { - listitem->setData(imageList.at(1), Qt::UserRole + 2); - } - } - else if (aDoc->baseAppClass().contains("msg email")) - { - QStringList emailList = filterDoc(aDoc, "Sender", "MailBoxId", - "FolderId"); - firstrow.append(emailList.at(0)); - listitem->setData(emailList.at(1), Qt::UserRole + 2); - listitem->setData(emailList.at(2), Qt::UserRole + 3); - listitem->setData(mIconArray.at(5), Qt::DecorationRole); - } - else if (aDoc->baseAppClass().contains("msg")) - { - QStringList msgList = filterDoc(aDoc, "Folder", "To", "From"); - if (msgList.value(0).contains("Inbox")) - { - firstrow.append(msgList.at(2)); - } - else - { - if (msgList.value(1, "").length()) - firstrow.append(msgList.at(1)); - } - listitem->setData(mIconArray.at(4), Qt::DecorationRole); - } - else if (aDoc->baseAppClass().contains("calendar")) - { - firstrow.append(filterDoc(aDoc, "Summary")); - if (firstrow.length() == 0) - { - firstrow = hbTrId("txt_calendar_preview_unnamed"); - } - listitem->setData(mIconArray.at(6), Qt::DecorationRole); - } - else if (aDoc->baseAppClass().contains("notes")) - { - firstrow.append(filterDoc(aDoc, "Memo")); - if (firstrow.length() == 0) - { - firstrow = hbTrId("txt_notes_dblist_unnamed"); - } - listitem->setData(mIconArray.at(7), Qt::DecorationRole); - } - else if (aDoc->baseAppClass().contains("applications")) - { - firstrow.append(filterDoc(aDoc, "Name")); - bool ok; - TRAP_IGNORE(listitem->setData(getAppIconFromAppIdL(TUid::Uid(aDoc->docId().toInt( - &ok, 16))), Qt::DecorationRole)); - } - else if (aDoc->baseAppClass().contains("bookmark")) - { - firstrow.append(filterDoc(aDoc, "Name")); - if (firstrow.length() == 0) - { - firstrow = "UnKnown"; - } - listitem->setData(secondrow, Qt::UserRole + 2); - listitem->setData(mIconArray.at(8), Qt::DecorationRole); - } - else if (aDoc->baseAppClass().contains("file folder")) - { - bool ok; - QStringList fileList = filterDoc(aDoc, "Name", "IsFolder", - "Extension"); - firstrow = fileList.at(0); - if (fileList.at(1).toInt(&ok) == 1) // folder result icon map - { - listitem->setData(mIconArray.at(13), Qt::DecorationRole); - } - else - { - if (fileList.at(2).contains("sis", Qt::CaseInsensitive) - || fileList.at(1).contains("sisx", Qt::CaseInsensitive)) - { - listitem->setData(mIconArray.at(10), Qt::DecorationRole); - } - else if (fileList.at(2).contains("java", Qt::CaseInsensitive) - || fileList.at(2).contains("jar", Qt::CaseInsensitive) - || fileList.at(2).contains("jad", Qt::CaseInsensitive)) - { - listitem->setData(mIconArray.at(11), Qt::DecorationRole); - } - else if (fileList.at(2).contains("swf", Qt::CaseInsensitive)) - { - listitem->setData(mIconArray.at(12), Qt::DecorationRole); - } - else - { - listitem->setData(mIconArray.at(14), Qt::DecorationRole); - } - } - } - else if (aDoc->baseAppClass().contains("file")) - { - QStringList fileList = filterDoc(aDoc, "Name", "Extension"); - firstrow = fileList.at(0); - if (firstrow.length() == 0) - firstrow = aDoc->baseAppClass(); - if (fileList.at(1).contains("txt", Qt::CaseInsensitive)) - { - listitem->setData(mIconArray.at(9), Qt::DecorationRole); - } - else - { - listitem->setData(mIconArray.at(14), Qt::DecorationRole); - } - } - listitem->setText(firstrow); - listitem->setSecondaryText(secondrow); - listitem->setData(aDoc->docId(), Qt::UserRole); - listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); - mListView->addItem(listitem); - + parseDocument(aDoc); mResultparser++; if (mResultparser < mResultcount) { PERF_CAT_GETDOC_TIME_RESTART - mSearchHandler->getDocumentAsyncAtIndex(mResultparser); + if (mResultparser < intial_iteration) + { + mSearchHandler->getDocumentAsyncAtIndex(mResultparser); + } + else + { + mSearchHandler->getBatchDocumentAsyncAtIndex(mResultparser, + batch_iteration); + } } else { PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG searchOnCategory(mSearchString); } + } +// --------------------------------------------------------------------------- +// SearchProgressiveState::onGetDocumentComplete +// --------------------------------------------------------------------------- +void SearchProgressiveState::onGetBatchDocumentComplete(int aError, + int aCount, CpixDocument** aDoc) + { + if (aError) + return; + for (int i = 0; i < aCount; i++) + { + parseDocument(aDoc[i]); + } delete aDoc; + mResultparser += aCount; + if (mResultparser < mResultcount) + { + PERF_CAT_GETDOC_TIME_RESTART + mSearchHandler->getBatchDocumentAsyncAtIndex(mResultparser, + batch_iteration); + } + else + { + PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG + searchOnCategory(mSearchString); + } } // --------------------------------------------------------------------------- // SearchProgressiveState::getSettingCategory @@ -594,7 +387,8 @@ void SearchProgressiveState::openResultitem(HbListWidgetItem * item) { if (item == NULL) - return;PERF_RESULT_ITEM_LAUNCH_TIME_RESTART + return; + PERF_RESULT_ITEM_LAUNCH_TIME_RESTART QList args; bool t; mRequest = NULL; @@ -611,7 +405,7 @@ { PERF_RESULT_ITEM_FOR_LAUNCHING("bookmark") QDesktopServices::openUrl(item->data(Qt::UserRole + 2).toString()); -PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") + PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") } else if (item->data(Qt::UserRole + 1).toString().contains("calendar")) @@ -619,10 +413,10 @@ QDir pluginDir = QDir(QString("z:/resource/qt/plugins/calendar")); QPluginLoader *calAgandaViewerPluginLoader = new QPluginLoader( pluginDir.absoluteFilePath(QString( - "agendaeventviewerplugin.qtplugin"))); + "agendaeventviewerplugin.qtplugin"))); calAgandaViewerPluginInstance = qobject_cast< - EventViewerPluginInterface *> ( + EventViewerPluginInterface *> ( calAgandaViewerPluginLoader->instance()); connect(calAgandaViewerPluginInstance, SIGNAL(viewingCompleted()), @@ -635,7 +429,7 @@ else if (item->data(Qt::UserRole + 1).toString().contains("applications")) { PERF_RESULT_ITEM_FOR_LAUNCHING("applications") - TRAP_IGNORE(LaunchApplicationL(TUid::Uid((item->data(Qt::UserRole)).toString().toInt(&t, 16)))); + TRAP_IGNORE(LaunchApplicationL(TUid::Uid((item->data(Qt::UserRole)).toString().toUInt(&t, 16)))); PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG("") } else if (item->data(Qt::UserRole + 1).toString().contains("file")) @@ -663,7 +457,7 @@ else if (item->data(Qt::UserRole + 1).toString().contains("notes")) { PERF_RESULT_ITEM_FOR_LAUNCHING("notes") - if(mNotesEditor) + if (mNotesEditor) { mNotesEditor->edit(item->data(Qt::UserRole).toInt()); } @@ -677,7 +471,8 @@ "viewMessage(QVariant,QVariant,QVariant)", true); args << item->data(Qt::UserRole + 2).toULongLong(&t) << item->data( - Qt::UserRole + 3).toULongLong(&t) << item->data(Qt::UserRole).toULongLong(&t); + Qt::UserRole + 3).toULongLong(&t) + << item->data(Qt::UserRole).toULongLong(&t); } else if (item->data(Qt::UserRole + 1).toString().contains("msg")) { @@ -688,9 +483,9 @@ int uid = (item->data(Qt::UserRole)).toInt(&t); args << uid; } - else if(item->data(Qt::UserRole + 1).toString().contains("links")) + else if (item->data(Qt::UserRole + 1).toString().contains("links")) { - emit launchLink((item->data(Qt::UserRole)).toInt(&t),mOriginalString); + emit launchLink((item->data(Qt::UserRole)).toInt(&t), mOriginalString); } if (mRequest) { @@ -722,7 +517,7 @@ void SearchProgressiveState::handleOk(const QVariant& var) { Q_UNUSED(var); -PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") + PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") } // --------------------------------------------------------------------------- // SearchProgressiveState::handleError @@ -779,7 +574,7 @@ void SearchProgressiveState::searchOnCategory(const QString aKeyword) { #ifdef OST_TRACE_COMPILER_IN_USE - if( mDatabasecount != 0 ) + if (mDatabasecount != 0) {//Search just started. PERF_CAT_UI_ENDLOG } @@ -872,6 +667,26 @@ { PERF_CAT_TOTAL_TIME_RESTART mOriginalString = aKeyword.trimmed(); + + if (!mValidateHandlerCreation) + { + for (int i = 0; i < mSearchHandlerList.count(); i++) + { + /* ignoring bookmark to getrid of unnecesary check as bookmark support is withdrawn + * keeping perfomance into consideration, otherwise not + */ + if (!mSearchHandlerList.at(i)->isPrepared() && (i != 9)) + { + constructHandlers(i); + mValidateHandlerCreation = false; + } + else + { + mValidateHandlerCreation = true; + } + } + } + for (int i = 0; i < mSearchHandlerList.count(); i++) { mSearchHandlerList.at(i)->cancelLastSearch(); @@ -884,12 +699,9 @@ { mDatabasecount = 0; mLinkindex = 0; - //Prefix query mSearchString = "$prefix(\""; mSearchString += mOriginalString; mSearchString += "\")"; - /*mSearchString = mOriginalString; - mSearchString.append('*');*/ searchOnCategory(mSearchString); } } @@ -1321,7 +1133,7 @@ CleanupStack::PopAndDestroy(&appArcSession); } CleanupStack::PopAndDestroy(&wsSession); -PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") + PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") } // --------------------------------------------------------------------------- // SearchProgressiveState::_viewingCompleted @@ -1330,14 +1142,13 @@ { if (calAgandaViewerPluginInstance) calAgandaViewerPluginInstance->deleteLater(); -PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") + PERF_RESULT_ITEM_LAUNCH_TIME_ENDLOG ("") } // --------------------------------------------------------------------------- // SearchProgressiveState::viewReady // --------------------------------------------------------------------------- void SearchProgressiveState::viewReady() { - if (hbApp) { if (hbApp->activateReason() == Hb::ActivationReasonActivity) @@ -1357,7 +1168,8 @@ if (searchKey.length() > 0) mSearchPanel->setCriteria(searchKey); } - }PERF_APP_LAUNCH_END("SearchAppplication View is ready"); + } + PERF_APP_LAUNCH_END("SearchAppplication View is ready"); emit applicationReady(); } // --------------------------------------------------------------------------- @@ -1455,3 +1267,271 @@ mSearchPanel->setCriteria(searchKey); } } +// --------------------------------------------------------------------------- +// SearchProgressiveState::parseDocument +// --------------------------------------------------------------------------- +void SearchProgressiveState::parseDocument(CpixDocument* aDoc) + { + PERF_CAT_GETDOC_TIME_ACCUMULATE + if (aDoc == NULL) + return; + QString secondrow = aDoc->excerpt(); + QString firstrow; + HbListWidgetItem* listitem = new HbListWidgetItem(); + + if (aDoc->baseAppClass().contains("contact")) + { + QStringList docsList = filterDoc(aDoc, "GivenName", "FamilyName"); + if (docsList.value(0, "").length()) + { + firstrow.append(docsList.at(0)); + } + if (docsList.value(1, "").length()) + { + if (firstrow.length()) + firstrow.append(" "); + firstrow.append(docsList.at(1)); + } + if (firstrow.length() == 0) + { + firstrow = hbTrId("txt_phob_dblist_unnamed"); + } + listitem->setData(mIconArray.at(0), Qt::DecorationRole); + } + else if (aDoc->baseAppClass().contains("audio")) + { + QStringList audioList = filterDoc(aDoc, "Title", "MediaId"); + if (audioList.value(0, "").length()) + { + firstrow.append(audioList.at(0)); + } + if (firstrow.length() == 0) + { + firstrow = hbTrId("txt_mus_dblist_val_unknown4"); + } + listitem->setData(mIconArray.at(1), Qt::DecorationRole); + if (audioList.value(1, "").length()) + { + listitem->setData(audioList.at(1), Qt::UserRole + 2); + } + } + else if (aDoc->baseAppClass().contains("video")) + { + QStringList videoList = filterDoc(aDoc, "Title", "MediaId", "Name"); + if (videoList.value(0, "").length()) + { + firstrow.append(videoList.at(0)); + } + if (firstrow.length() == 0 && videoList.value(2, "").length()) + { + firstrow.append(videoList.at(2)); + } + listitem->setData(mIconArray.at(2), Qt::DecorationRole); + if (videoList.value(1, "").length()) + { + listitem->setData(videoList.at(1), Qt::UserRole + 2); + } + } + else if (aDoc->baseAppClass().contains("image")) + { + QStringList imageList = filterDoc(aDoc, "Name", "MediaId"); + if (imageList.value(0, "").length()) + { + firstrow.append(imageList.at(0)); + } + listitem->setData(mIconArray.at(3), Qt::DecorationRole); + if (imageList.value(1, "").length()) + { + listitem->setData(imageList.at(1), Qt::UserRole + 2); + } + } + else if (aDoc->baseAppClass().contains("msg email")) + { + QStringList emailList = filterDoc(aDoc, "Sender", "MailBoxId", + "FolderId"); + firstrow.append(emailList.at(0)); + listitem->setData(emailList.at(1), Qt::UserRole + 2); + listitem->setData(emailList.at(2), Qt::UserRole + 3); + listitem->setData(mIconArray.at(5), Qt::DecorationRole); + } + else if (aDoc->baseAppClass().contains("msg")) + { + QStringList msgList = filterDoc(aDoc, "Folder", "To", "From"); + if (msgList.value(0).contains("Inbox")) + { + firstrow.append(msgList.at(2)); + } + else + { + if (msgList.value(1, "").length()) + firstrow.append(msgList.at(1)); + } + listitem->setData(mIconArray.at(4), Qt::DecorationRole); + } + else if (aDoc->baseAppClass().contains("calendar")) + { + firstrow.append(filterDoc(aDoc, "Summary")); + if (firstrow.length() == 0) + { + firstrow = hbTrId("txt_calendar_preview_unnamed"); + } + listitem->setData(mIconArray.at(6), Qt::DecorationRole); + } + else if (aDoc->baseAppClass().contains("notes")) + { + firstrow.append(filterDoc(aDoc, "Memo")); + if (firstrow.length() == 0) + { + firstrow = hbTrId("txt_notes_dblist_unnamed"); + } + listitem->setData(mIconArray.at(7), Qt::DecorationRole); + } + else if (aDoc->baseAppClass().contains("applications")) + { + firstrow.append(filterDoc(aDoc, "Name")); + bool ok; + TRAP_IGNORE(listitem->setData(getAppIconFromAppIdL(TUid::Uid(aDoc->docId().toUInt( + &ok, 16))), Qt::DecorationRole)); + } + else if (aDoc->baseAppClass().contains("bookmark")) + { + firstrow.append(filterDoc(aDoc, "Name")); + if (firstrow.length() == 0) + { + firstrow = "UnKnown"; + } + listitem->setData(secondrow, Qt::UserRole + 2); + listitem->setData(mIconArray.at(8), Qt::DecorationRole); + } + else if (aDoc->baseAppClass().contains("file folder")) + { + bool ok; + QStringList fileList = filterDoc(aDoc, "Name", "IsFolder", + "Extension"); + firstrow = fileList.at(0); + if (fileList.at(1).toInt(&ok) == 1) // folder result icon map + + { + listitem->setData(mIconArray.at(13), Qt::DecorationRole); + } + else + { + if (fileList.at(2).contains("sis", Qt::CaseInsensitive) + || fileList.at(1).contains("sisx", Qt::CaseInsensitive)) + { + listitem->setData(mIconArray.at(10), Qt::DecorationRole); + } + else if (fileList.at(2).contains("java", Qt::CaseInsensitive) + || fileList.at(2).contains("jar", Qt::CaseInsensitive) + || fileList.at(2).contains("jad", Qt::CaseInsensitive)) + { + listitem->setData(mIconArray.at(11), Qt::DecorationRole); + } + else if (fileList.at(2).contains("swf", Qt::CaseInsensitive)) + { + listitem->setData(mIconArray.at(12), Qt::DecorationRole); + } + else + { + listitem->setData(mIconArray.at(14), Qt::DecorationRole); + } + } + } + else if (aDoc->baseAppClass().contains("file")) + { + QStringList fileList = filterDoc(aDoc, "Name", "Extension"); + firstrow = fileList.at(0); + if (firstrow.length() == 0) + firstrow = aDoc->baseAppClass(); + if (fileList.at(1).contains("txt", Qt::CaseInsensitive)) + { + listitem->setData(mIconArray.at(9), Qt::DecorationRole); + } + else + { + listitem->setData(mIconArray.at(14), Qt::DecorationRole); + } + } + listitem->setText(firstrow); + listitem->setSecondaryText(secondrow); + listitem->setData(aDoc->docId(), Qt::UserRole); + listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); + mListView->addItem(listitem); + + delete aDoc; + } + +InDeviceHandler* SearchProgressiveState::constructHandlers(int mDatabase) + { + InDeviceHandler* handler = NULL; + handler = new InDeviceHandler(); + switch (mDatabase) + { + case 0: + { + handler->setCategory(""); + break; + } + case 1: + { + handler->setCategory("contact"); + break; + } + case 2: + { + handler->setCategory("media"); + break; + } + case 3: + { + handler->setCategory("msg"); + break; + } + case 4: + { + handler->setCategory("msg email"); + break; + } + case 5: + { + handler->setCategory("calendar"); + break; + } + case 6: + { + handler->setCategory("notes"); + break; + } + case 7: + { + handler->setCategory("applications"); + break; + } + case 8: + { + handler->setCategory("file"); + break; + } + case 9: + { + // handler->setCategory("bookmark"); + break; + } + case 10: + { + handler->setCategory("media image"); + break; + } + case 11: + { + handler->setCategory("media audio"); + break; + } + case 12: + { + handler->setCategory("media video"); + break; + } + } + return handler; + } diff -r df6898e696c6 -r e918432ddd92 searchui/stateproviders/searchstateprovider/src/searchuiloader.cpp --- a/searchui/stateproviders/searchstateprovider/src/searchuiloader.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/stateproviders/searchstateprovider/src/searchuiloader.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -28,6 +28,8 @@ #include #include #include +#include + const char *SEARCHSTATEPROVIDER_DOCML = ":/xml/searchstateprovider.docml"; const char *TOC_VIEW = "tocView"; const char *TUT_SEARCHPANEL_WIDGET = "searchPanel"; @@ -40,7 +42,8 @@ // SearchUiLoader::SearchUiLoader // --------------------------------------------------------------------------- SearchUiLoader::SearchUiLoader() : - mDocumentLoader(NULL), mView(NULL), mListWidget(NULL), mSearchPanel(NULL),mClient(NULL) + mDocumentLoader(NULL), mView(NULL), mListWidget(NULL), + mSearchPanel(NULL), mClient(NULL), mMainWindow(NULL) { bool ok = false; @@ -96,24 +99,24 @@ mSearchPanel->setCancelEnabled(false); } - mMainWindow = hbInstance->allMainWindows().at(0); + mMainWindow = new SearchMainWindow(); + connect(mMainWindow, SIGNAL(bringvkb()), this, SLOT(slotbringvkb())); + HbAction *action = new HbAction(Hb::DoneNaviAction); connect(action, SIGNAL(triggered()), this, SLOT(slotsendtobackground())); mView->setNavigationAction(action); + mVirtualKeyboard = new HbShrinkingVkbHost(mView); - QCoreApplication::instance()->installEventFilter(this); + + mBringtoForground = true; } // --------------------------------------------------------------------------- // SearchUiLoader::~SearchUiLoader // --------------------------------------------------------------------------- SearchUiLoader::~SearchUiLoader() { - QCoreApplication::instance()->removeEventFilter(this); - - if (mDocumentLoader) - { - delete mDocumentLoader; - } + delete mMainWindow; + delete mDocumentLoader; delete mClient; } // --------------------------------------------------------------------------- @@ -127,20 +130,33 @@ mListWidget->clear(); mSearchPanel->setCriteria(QString()); mMainWindow->lower(); + mBringtoForground = true; } // --------------------------------------------------------------------------- -// SearchUiLoader::event +// SearchUiLoader::slotbringvkb // --------------------------------------------------------------------------- -bool SearchUiLoader::eventFilter(QObject *obj, QEvent *event) +void SearchUiLoader::slotbringvkb() { - if (event->type() == QEvent::ApplicationActivate) + if (mBringtoForground) { if (!mClient) mClient = new TsTaskSettings; mClient->setVisibility(true); - if (!(mListWidget->count())) - mSearchPanel->setFocus(); - return true; + mSearchPanel->setFocus(); + QInputContext *ic = qApp->inputContext(); + if (ic) + { + mBringtoForground = false; + QEvent *event = new QEvent(QEvent::RequestSoftwareInputPanel); + ic->filterEvent(event); + delete event; + } } - return QObject::eventFilter(obj, event); } +// --------------------------------------------------------------------------- +// SearchMainWindow::slotViewReady +// --------------------------------------------------------------------------- +void SearchMainWindow::slotViewReady() + { + emit bringvkb(); + } diff -r df6898e696c6 -r e918432ddd92 searchui/stateproviders/searchstateprovider/src/settingswidget.cpp --- a/searchui/stateproviders/searchstateprovider/src/settingswidget.cpp Mon Jul 26 12:45:04 2010 +0530 +++ b/searchui/stateproviders/searchstateprovider/src/settingswidget.cpp Mon Aug 09 12:23:41 2010 +0530 @@ -15,6 +15,7 @@ * */ #include "settingswidget.h" +#include "onlinehandler.h" #include #include #include @@ -38,7 +39,7 @@ #include #include #include -#include "onlinehandler.h" + const char *DELIMETER_DOCML = ":/xml/delimeterscreen.docml"; const char *DIALOG = "dialog"; const char *DATAFORM = "dataForm"; @@ -56,14 +57,12 @@ { mDeviceMapping.append(false); } - mDeviceCategoryRefList = (QStringList() << "first" << "second" << "third" << "fourth" << "fifth" << "sixth" << "seventh" << "eigth"); mchangestate = true; mInstialize = true; isInternetSelected = false; - storeDefaultSettings(); } //---------------------------------------------------------------------------------------------------------------------------- @@ -83,7 +82,6 @@ { widget = mDocumentLoader->findWidget(DIALOG); Q_ASSERT_X(ok && (widget != 0), "DIALOG", "invalid view"); - popup = qobject_cast (widget); } if (!dataform) @@ -100,7 +98,6 @@ { signalMapper = new QSignalMapper(this); } - createGui(); } //---------------------------------------------------------------------------------------------------------------------------- @@ -236,6 +233,7 @@ connect(mradiolist, SIGNAL(itemSelected(int)), this, SLOT(slotitemSelected(int))); } + setActionVisibility(); } //---------------------------------------------------------------------------------------------------------------------------- //SettingsWidget::preparecategories() @@ -244,15 +242,27 @@ void SettingsWidget::preparecategories() { // read form database - QString mConnectionName("cpixcontentinfo.sq"); - QString mDatabaseName("c:\\Private\\2001f6fb\\cpixcontentinfo.sq"); + + mDeviceListDisplay.clear(); + mCategoryList.clear(); + mDeviceMapping.clear(); + for (int i = 0; i < 8; i++) + { + mDeviceMapping.append(false); + } + mCategoryDbMapping.clear(); + + QString mConnectionName(QString::fromUtf16(KContentInfoFileName().Ptr(), + KContentInfoFileName().Length())); + QString mDatabaseName(QString::fromUtf16(KCIDBPath().Ptr(), + KCIDBPath().Length()) + "\\" + mConnectionName); QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", mConnectionName); db.setDatabaseName(mDatabaseName); QSqlQuery query(QSqlDatabase::database(mConnectionName)); - QString statement = "SELECT NAME FROM table1"; - + QString statement = QString("SELECT * FROM ") + QString::fromUtf16( + KContentInfoTableName().Ptr(), KContentInfoTableName().Length()); query.prepare(statement); query.exec(); while (query.next()) @@ -267,7 +277,6 @@ { mCategoryDbMapping.insert(category_name, true); } - qDebug() << "string db= " << category_name; } db.close(); @@ -283,8 +292,6 @@ mCategoryDbMapping.insert("Bookmarks", true); mCategoryDbMapping.insert("Files", true); */ - // mCategoryDbMapping.insert("email", true); // to remove once email starts working - mDeviceListDisplay.append(hbTrId("txt_search_list_select_all")); mDeviceMapping.insert(0, true); @@ -293,46 +300,39 @@ mDeviceMapping.insert(1, true); mDeviceListDisplay.append(hbTrId("txt_search_list_contatcs")); } - if (mCategoryDbMapping.value("Audios") || mCategoryDbMapping.value( "Images") || mCategoryDbMapping.value("Videos")) { mDeviceListDisplay.append(hbTrId("txt_search_list_media")); mDeviceMapping.insert(2, true); } - if (mCategoryDbMapping.value("Messages") || mCategoryDbMapping.value( "email")) { mDeviceListDisplay.append(hbTrId("txt_search_list_messagemail")); mDeviceMapping.insert(3, true); } - if (mCategoryDbMapping.value("Calendar") || mCategoryDbMapping.value( "Notes")) { mDeviceListDisplay.append(hbTrId("txt_search_list_calendarnotes")); mDeviceMapping.insert(4, true); } - if (mCategoryDbMapping.value("Applications")) { mDeviceListDisplay.append(hbTrId("txt_search_list_applications")); mDeviceMapping.insert(5, true); } - if (mCategoryDbMapping.value("Bookmarks")) { mDeviceListDisplay.append(hbTrId("txt_search_list_bookmarks")); mDeviceMapping.insert(6, true); } - if (mCategoryDbMapping.value("Files")) { mDeviceListDisplay.append(hbTrId("txt_search_list_all_other_files")); mDeviceMapping.insert(7, true); } - // internetCategoryList = (QStringList() << "Google" << "Bing" << "Yahoo"); if (mServiceProviders.count()) { @@ -344,7 +344,6 @@ mCategoryList = (QStringList() << hbTrId("txt_search_list_device")); } } - //---------------------------------------------------------------------------------------------------------------------------- //SettingsWidget::~SettingsWidget() // @@ -352,17 +351,13 @@ SettingsWidget::~SettingsWidget() { delete signalMapper; - //delete popup; - //delete dataform; delete mModel; - //delete mradiolist; mDeviceCheckBoxList.clear(); mInternetCheckBoxList.clear(); mModelItemList.clear(); mActions.clear(); delete mDocumentLoader; delete mInternetHandler; - //delete popup; } //---------------------------------------------------------------------------------------------------------------------------- //SettingsWidget::launchSettingWidget() @@ -375,6 +370,17 @@ initialize(); mInstialize = false; } + if (mDeviceListDisplay.count() != 7) + { + preparecategories(); + q_currentIndexChanged(mSelectedScope); + QDir dir; + dir.remove(SETTINGS_INI_PATH); + storeDefaultSettings(); + } + // refresh the screen to top + QModelIndex index = mModel->index(0, 0); + dataform->scrollTo(index); comboBox->setCurrentIndex(mSelectedScope); loadDeviceSettings(); setActionVisibility(); @@ -392,17 +398,21 @@ if (mDeviceCheckBoxList.at(i)->checkState() == Qt::Checked) { noItemSelected = false; + break; } } if (!isInternetSelected) { mActions.at(0)->setVisible(true); - if (noItemSelected) { mActions.at(0)->setVisible(false); } } + else + { + mActions.at(0)->setVisible(true); + } } //---------------------------------------------------------------------------------------------------------------------------- //SettingsWidget::itemChecked( int selectedIndex) @@ -515,10 +525,8 @@ appSettings.setValue(mDeviceCategoryRefList.at(i), 0); emit selectedItemCategory(i, false); } - } } - } //---------------------------------------------------------------------------------------------------------------------------- //void SettingsWidget::loadBaseSettings() @@ -547,7 +555,6 @@ { value = appSettings.value(mDeviceCategoryRefList.at(i), 1).toInt(); - if (mDeviceMapping.count() && mDeviceCheckBoxList.count() && mDeviceMapping.at(i)) { @@ -564,7 +571,6 @@ value ? (emit selectedItemCategory(i, true)) : (emit selectedItemCategory(i, false)); - } } } @@ -577,7 +583,6 @@ loadBaseSettings(); return isInternetSelected; } - //---------------------------------------------------------------------------------------------------------------------------- //void SettingsWidget::storeDefaultSettings() // @@ -594,15 +599,27 @@ appSettings.setValue(mDeviceCategoryRefList.at(i), 1); } } +//---------------------------------------------------------------------------------------------------------------------------- +//void SettingsWidget::slotproviderDetails() +// +//---------------------------------------------------------------------------------------------------------------------------- void SettingsWidget::slotproviderDetails(QString name, HbIcon icon, int id) { mServiceProviders.insert(id, name); emit ISProvidersIcon(icon, id); } +//---------------------------------------------------------------------------------------------------------------------------- +//void SettingsWidget::slotdefaultProvider() +// +//---------------------------------------------------------------------------------------------------------------------------- void SettingsWidget::slotdefaultProvider(const int value) { mSelectedProvider = value; } +//---------------------------------------------------------------------------------------------------------------------------- +//void SettingsWidget::slotitemSelected() +// +//---------------------------------------------------------------------------------------------------------------------------- void SettingsWidget::slotitemSelected(int value) { QMapIterator i(mServiceProviders); @@ -618,6 +635,10 @@ selectedindex++; } } +//---------------------------------------------------------------------------------------------------------------------------- +//void SettingsWidget::loadIS() +// +//---------------------------------------------------------------------------------------------------------------------------- void SettingsWidget::loadIS() { if (!mInternetHandler)