# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1272879135 -10800 # Node ID 208a4ba3894cc95c1cd7c36bc9e685e35002b492 # Parent ccd0fd43f247f89ee21df8355c646dac1929c0d0 Revision: 201015 Kit: 201018 diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/applications/data/2001a9d7.rss --- a/harvesterplugins/applications/data/2001a9d7.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/applications/data/2001a9d7.rss Mon May 03 12:32:15 2010 +0300 @@ -37,7 +37,7 @@ { implementation_uid = 0x2001A9D7; version_no = 1; - display_name = "CPix Applications plugin"; + display_name = "Applications"; default_data = "CPiX Applications Plugin"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/applications/group/applicationsplugin.mmp --- a/harvesterplugins/applications/group/applicationsplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/applications/group/applicationsplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -28,7 +28,7 @@ SOURCE applicationsplugin.cpp SOURCE tproxy.cpp -USERINCLUDE ../inc +USERINCLUDE ../inc ../traces APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/applications/inc/applicationsplugin.h --- a/harvesterplugins/applications/inc/applicationsplugin.h Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/applications/inc/applicationsplugin.h Mon May 03 12:32:15 2010 +0300 @@ -23,7 +23,7 @@ #include #include //RApaLsSession #include //Notification -#include +#include #include "delayedcallback.h" class CCPixIndexer; diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/applications/src/applicationsplugin.cpp --- a/harvesterplugins/applications/src/applicationsplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/applications/src/applicationsplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -23,8 +23,14 @@ #include #include //#include //for KCRUidMenu -#include // EBundleDisplayName +#include // EBundleDisplayName #include +#include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "applicationspluginTraces.h" +#endif + //Hidden applications //#define KHiddenAppRepositoryUid KCRUidMenu @@ -47,9 +53,11 @@ // ----------------------------------------------------------------------------- CApplicationsPlugin* CApplicationsPlugin::NewL() { + OstTraceFunctionEntry0( CAPPLICATIONSPLUGIN_NEWL_ENTRY ); CPIXLOGSTRING("CApplicationsPlugin::NewL()"); CApplicationsPlugin* instance = CApplicationsPlugin::NewLC(); CleanupStack::Pop(instance); + OstTraceFunctionExit0( CAPPLICATIONSPLUGIN_NEWL_EXIT ); return instance; } @@ -124,12 +132,14 @@ iWidgetRegistry.GetWidgetPath( aUid, temp ); aDocument->AddFieldL(KApplicationFieldAbsolutePath, temp, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); CPIXLOGSTRING2("AddApplicationInfo(): PATH = %S ", &temp); + OstTraceExt1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;PATH=%S", &temp ); //GetWidgetPropertyValueL returns CWidgetPropertyValue* which in turn has an operator to convert to TDesC aDocument->AddFieldL(KApplicationFieldCaption, *(iWidgetRegistry.GetWidgetPropertyValueL( aUid, EBundleDisplayName )), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); iWidgetRegistry.GetWidgetBundleName( aUid, temp ); aDocument->AddExcerptL( temp ); + OstTraceExt1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL, "CApplicationsPlugin::AddWidgetInfoL;DisplayName=%S", &temp ); CPIXLOGSTRING2("AddApplicationInfo(): DisplayName = %S ", &temp ); } @@ -143,6 +153,8 @@ aDocument->AddFieldL(KApplicationFieldCaption, aAppInfo.iShortCaption, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); aDocument->AddFieldL(KApplicationFieldAbsolutePath, aAppInfo.iFullName, CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); aDocument->AddExcerptL( aAppInfo.iCaption ); + OstTraceExt2( TRACE_NORMAL, _ADDAPPLICATIONINFOL, "::AddApplicationInfoL;UID=%S;PATH=%S", &docidString, &aAppInfo.iFullName ); + OstTraceExt2( TRACE_NORMAL, DUP1__ADDAPPLICATIONINFOL, "::AddApplicationInfoL;Excerpt=%S;Caption=%S", &aAppInfo.iCaption, &aAppInfo.iShortCaption ); CPIXLOGSTRING3("AddApplicationInfo(): UID = %S, PATH = %S ", &docidString, &aAppInfo.iFullName ); CPIXLOGSTRING3("AddApplicationInfo(): Excerpt = %S, Caption = %S ", &aAppInfo.iCaption, &aAppInfo.iShortCaption ); @@ -154,9 +166,12 @@ //Application should not have 'hidden' capability. TBool ret( EFalse ); TApaAppCapabilityBuf cap; + OstTrace1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "CApplicationsPlugin::IsAppHiddenL;UID=%d", aUid ); CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): UID = %d", aUid ); if ( iApplicationServerSession.GetAppCapability(cap, aUid) == KErrNone ) { + OstTraceState0( STATE_DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "GetCapability returned KErrNone", "" ); + CPIXLOGSTRING("CApplicationsPlugin::IsAppHidden(): GetCapability returned KErrNone"); ret = cap().iAppIsHidden; } @@ -177,6 +192,7 @@ // } // CleanupStack::PopAndDestroy( uidString ); // } + OstTrace1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL, "CApplicationsPlugin::IsAppHiddenL;Return Value=%d", &ret ); CPIXLOGSTRING2("CApplicationsPlugin::IsAppHidden(): %d", &ret); return ret; @@ -204,10 +220,12 @@ TRAPD( error, iIndexer->AddL( *document ) ); if( KErrNone == error ) { + OstTrace0( TRACE_NORMAL, CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::CreateApplicationsIndexItemL : No Error" ); CPIXLOGSTRING("CApplicationsPlugin::CreateApplicationsIndexItemL(): No Error" ); } else { + OstTrace1( TRACE_NORMAL, DUP1_CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML, "CApplicationsPlugin::CreateApplicationsIndexItemL;Error=%d", error ); CPIXLOGSTRING2("CApplicationsPlugin::CreateApplicationsIndexItemL(): Error = %d", error ); } CleanupStack::PopAndDestroy( document ); @@ -249,6 +267,8 @@ // ----------------------------------------------------------------------------- void CApplicationsPlugin::HandleAppListEvent( TInt aEvent ) { + OstTraceFunctionEntry0( CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT_ENTRY ); + OstTrace1( TRACE_NORMAL, CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT, "CApplicationsPlugin::HandleAppListEvent;Event=%d", aEvent ); CPIXLOGSTRING2("CApplicationsPlugin::HandleAppListEvent: Start with Event = %d", aEvent ); if( aEvent == EAppListChanged ) { @@ -259,6 +279,7 @@ TRAP_IGNORE( StartHarvestingL( KNullDesC ) ); //simply reharvest } CPIXLOGSTRING("CApplicationsPlugin::HandleAppListEvent: Exit" ); + OstTraceFunctionExit0( CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT_EXIT ); } #ifdef __PERFORMANCE_DATA diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/applications/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/applications/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/applications/traces/applicationspluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/applications/traces/applicationspluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,232 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __APPLICATIONSPLUGINTRACES_H__ +#define __APPLICATIONSPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2001a9d7 + +#define CAPPLICATIONSPLUGIN_NEWL_ENTRY 0x8a0001 +#define CAPPLICATIONSPLUGIN_NEWL_EXIT 0x8a0002 +#define CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT_ENTRY 0x8a0003 +#define CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT_EXIT 0x8a0004 +#define CAPPLICATIONSPLUGIN_ADDWIDGETINFOL 0x860001 +#define DUP1_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL 0x860002 +#define _ADDAPPLICATIONINFOL 0x860003 +#define DUP1__ADDAPPLICATIONINFOL 0x860004 +#define CAPPLICATIONSPLUGIN_ISAPPHIDDENL 0x860005 +#define DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL 0x860006 +#define CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML 0x860007 +#define DUP1_CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML 0x860008 +#define CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT 0x860009 +#define STATE_DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL 0x870001 + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC16& aParam1 ) + { + TBool retval; + TInt size = aParam1.Size(); + // BTrace assumes that parameter size is atleast 4 bytes + if (size % 4 == 0) + { + TUint8* ptr = ( TUint8* )aParam1.Ptr(); + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + else + { + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + if (size > KOstMaxDataLength) + { + size = KOstMaxDataLength; + } + TInt sizeAligned = ( size + 3 ) & ~3; + memcpy( ptr, aParam1.Ptr(), size ); + ptr += size; + // Fillers are written to get 32-bit alignment + while ( size++ < sizeAligned ) + { + *ptr++ = 0; + } + ptr -= sizeAligned; + size = sizeAligned; + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + return retval; + } +#endif + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen2( TUint32 aTraceID, const TDesC16& aParam1, const TDesC16& aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TInt length = 0; + // Check that parameter lenght is not too long + TInt length1 = aParam1.Size(); + if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned1 = ( length1 + 3 ) & ~3; + if (lengthAligned1 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned1; + } + // Check that parameter lenght is not too long + TInt length2 = aParam2.Size(); + if ((length + length2 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length2 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned2 = ( length2 + 3 ) & ~3; + if (lengthAligned2 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned2; + } + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + // Set length to zero and calculate it againg + // when adding parameters + length = 0; + if (length1 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam1.Ptr(), length1 ); + ptr += length1; + // Fillers are written to get 32-bit alignment + while ( length1++ < lengthAligned1 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned1; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + if (length2 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length2 / (aParam2.Size() / aParam2.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam2.Ptr(), length2 ); + ptr += length2; + // Fillers are written to get 32-bit alignment + while ( length2++ < lengthAligned2 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned2; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + ptr -= length; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); + } + return retval; + } +#endif + + +inline TBool OstTraceGen2( TUint32 aTraceID, const TDesC8& aParam1, const TDesC8& aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TInt length = 0; + // Check that parameter lenght is not too long + TInt length1 = aParam1.Size(); + if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned1 = ( length1 + 3 ) & ~3; + if (lengthAligned1 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned1; + } + // Check that parameter lenght is not too long + TInt length2 = aParam2.Size(); + if ((length + length2 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length2 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned2 = ( length2 + 3 ) & ~3; + if (lengthAligned2 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned2; + } + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + // Set length to zero and calculate it againg + // when adding parameters + length = 0; + if (length1 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam1.Ptr(), length1 ); + ptr += length1; + // Fillers are written to get 32-bit alignment + while ( length1++ < lengthAligned1 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned1; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + if (length2 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length2 / (aParam2.Size() / aParam2.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam2.Ptr(), length2 ); + ptr += length2; + // Fillers are written to get 32-bit alignment + while ( length2++ < lengthAligned2 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned2; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + ptr -= length; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); + } + return retval; + } + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/applications/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/applications/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,18 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[GROUP]TRACE_STATE=0x87 +[TRACE]TRACE_FLOW[0x8A]_CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT_ENTRY=0x3 +[TRACE]TRACE_FLOW[0x8A]_CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT_EXIT=0x4 +[TRACE]TRACE_FLOW[0x8A]_CAPPLICATIONSPLUGIN_NEWL_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CAPPLICATIONSPLUGIN_NEWL_EXIT=0x2 +[TRACE]TRACE_NORMAL[0x86]_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL=0x1 +[TRACE]TRACE_NORMAL[0x86]_CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML=0x7 +[TRACE]TRACE_NORMAL[0x86]_CAPPLICATIONSPLUGIN_HANDLEAPPLISTEVENT=0x9 +[TRACE]TRACE_NORMAL[0x86]_CAPPLICATIONSPLUGIN_ISAPPHIDDENL=0x5 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CAPPLICATIONSPLUGIN_ADDWIDGETINFOL=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CAPPLICATIONSPLUGIN_CREATEAPPLICATIONSINDEXITEML=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP1__ADDAPPLICATIONINFOL=0x4 +[TRACE]TRACE_NORMAL[0x86]__ADDAPPLICATIONINFOL=0x3 +[TRACE]TRACE_STATE[0x87]_STATE_DUP1_CAPPLICATIONSPLUGIN_ISAPPHIDDENL=0x1 diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/bookmarks/data/2001a9d3.rss --- a/harvesterplugins/bookmarks/data/2001a9d3.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/bookmarks/data/2001a9d3.rss Mon May 03 12:32:15 2010 +0300 @@ -36,7 +36,7 @@ { implementation_uid = 0x2001A9D3; version_no = 1; - display_name = "Bookmars harvester plugin"; + display_name = "Bookmarks"; default_data = "Bookmarks"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/bookmarks/group/bookmarksplugin.mmp --- a/harvesterplugins/bookmarks/group/bookmarksplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/bookmarks/group/bookmarksplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -27,7 +27,7 @@ SOURCE bookmarksplugin.cpp SOURCE tproxy.cpp -USERINCLUDE ../inc +USERINCLUDE ../inc ../traces APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/bookmarks/inc/bookmarksplugin.h --- a/harvesterplugins/bookmarks/inc/bookmarksplugin.h Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/bookmarks/inc/bookmarksplugin.h Mon May 03 12:32:15 2010 +0300 @@ -21,9 +21,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include "common.h" #include "delayedcallback.h" diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/bookmarks/src/bookmarksplugin.cpp --- a/harvesterplugins/bookmarks/src/bookmarksplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/bookmarks/src/bookmarksplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -17,8 +17,8 @@ #include "bookmarksplugin.h" -#include -#include +#include +#include #include #include //For parsing URL names. @@ -26,6 +26,11 @@ #include "common.h" #include "csearchdocument.h" #include "ccpixindexer.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "bookmarkspluginTraces.h" +#endif + /** The milliseconds delay between harvesting chunks. */ const TInt KHarvestingDelay = 1000; @@ -99,10 +104,12 @@ // ----------------------------------------------------------------------------- void CBookmarksPlugin::StartHarvestingL( const TDesC& /*aMedia*/ ) { + OstTrace0( TRACE_NORMAL, CBOOKMARKSPLUGIN_STARTHARVESTINGL, "StartHarvestingL: resetting database" ); CPIXLOGSTRING("StartHarvestingL: resetting database"); iIndexer->ResetL();//reset any indexes if exist already iCurrentIndex = 0; //Initialize to zero as it is started iFavouritesDb.Count( iCurrentCount ); + OstTrace1( TRACE_NORMAL, DUP1_CBOOKMARKSPLUGIN_STARTHARVESTINGL, "StartHarvestingL::Current count=%d", iCurrentCount ); CPIXLOGSTRING2("StartHarvestingL::Current count = %d.", iCurrentCount); //Get all the UID list from current database //GetUids() appends items to the list. So, reset it first. @@ -128,6 +135,7 @@ break; //Create index item + OstTraceExt2( TRACE_NORMAL, CBOOKMARKSPLUGIN_DELAYEDCALLBACKL, "CBookmarksPlugin::DelayedCallbackL;Harvesting id=%d;BookmarkUid=%d", iCurrentIndex, iArrUidsCurrentBookmarkList->At(iCurrentIndex) ); CPIXLOGSTRING3("CBookmarksPlugin::DelayedCallbackL(): Harvesting id=%d, BookmarkUid = %d.", iCurrentIndex, iArrUidsCurrentBookmarkList->At(iCurrentIndex) ); //Create new bookmark document and add CreateBookmarksIndexItemL(iArrUidsCurrentBookmarkList->At(iCurrentIndex),ECPixAddAction); @@ -137,8 +145,10 @@ if( iAsynchronizer && (iCurrentIndex < iCurrentCount) ) { // Launch the next RunL + OstTrace1( TRACE_NORMAL, DUP1_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL, "CBookmarksPlugin::DelayedCallbackL;scheduling item count=%d", iCurrentIndex ); CPIXLOGSTRING2("CBookmarksPlugin::DelayedCallbackL(): scheduling item count: %d.", iCurrentIndex ); iAsynchronizer->Start(0, this, KHarvestingDelay); + OstTrace1( TRACE_NORMAL, DUP2_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL, "CBookmarksPlugin::DelayedCallbackL;DONE scheduling item count=%d", iCurrentIndex ); CPIXLOGSTRING2("CBookmarksPlugin::DelayedCallbackL(): DONE scheduling item count: %d.", iCurrentIndex ); } else @@ -149,6 +159,7 @@ UpdatePerformaceDataL(); #endif iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone); + OstTrace0( TRACE_NORMAL, DUP3_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL, "CBookmarksPlugin::DelayedCallbackL(): Harvesting complete" ); CPIXLOGSTRING("CBookmarksPlugin::DelayedCallbackL(): Harvesting complete"); } } @@ -175,6 +186,7 @@ */ void GetDomainNameL( const TDesC& aUrl, TPtrC& aDomain ) { + OstTraceExt1( TRACE_NORMAL, CBOOKMARKSPLUGIN_GETDOMAINNAMEL, "CBookmarksPlugin::GetDomainNameL();URL=%S", aUrl ); CPIXLOGSTRING2("CBookmarksPlugin::GetDomainNameL(): URL = %S", &aUrl ); //Convert to 8-bit descriptors. HBufC8* url8 = HBufC8::NewLC( aUrl.Length() ); @@ -231,15 +243,18 @@ aDomain.Set( *domain16 ); CleanupStack::Pop( domain16 ); CleanupStack::PopAndDestroy( url8 ); + OstTraceExt1( TRACE_NORMAL, DUP1_CBOOKMARKSPLUGIN_GETDOMAINNAMEL, "CBookmarksPlugin::GetDomainNameL();domain=%S", aDomain ); CPIXLOGSTRING2("CBookmarksPlugin::GetDomainNameL(): domain = %S", &aDomain ); } // ----------------------------------------------------------------------------- void CBookmarksPlugin::DoIndexingL(CFavouritesItem*& aItem, const TDesC& aDocidStr, TCPixActionType& aActionType) { + OstTraceFunctionEntry0( CBOOKMARKSPLUGIN_DOINDEXINGL_ENTRY ); CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Entering"); if(aItem->Type() == CFavouritesItem::EItem ) //Store only Items not folders { + OstTraceExt2( TRACE_NORMAL, CBOOKMARKSPLUGIN_DOINDEXINGL, "CBookmarksPlugin::DoIndexingL();url=%S;name=%S", (aItem->Url()), (aItem->Name()) ); CPIXLOGSTRING3("CBookmarksPlugin::DoIndexingL(): url = %S ,name = %S", &(aItem->Url()), &(aItem->Name())); CSearchDocument* index_item = CSearchDocument::NewLC(aDocidStr, _L(BOOKMARKAPPCLASS)); index_item->AddFieldL(KMimeTypeField, KMimeTypeBookmark, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); @@ -252,6 +267,7 @@ index_item->AddFieldL(KBookMarkUrl, aItem->Url(), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized); GetDomainNameL( aItem->Url(), domain ); index_item->AddFieldL(KBookMarkDomain, domain , CDocumentField::EStoreYes | CDocumentField::EIndexTokenized); + OstTraceExt1( TRACE_NORMAL, DUP1_CBOOKMARKSPLUGIN_DOINDEXINGL, "CBookmarksPlugin::DoIndexingL();domain=%S", domain ); CPIXLOGSTRING2("CBookmarksPlugin::DoIndexingL(): domain = %S", &domain ); } //Add Excerpt as it is must have field. What should be excerpt in bookmarks ? @@ -267,17 +283,22 @@ TRAPD(err, iIndexer->AddL(*index_item)); if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP2_CBOOKMARKSPLUGIN_DOINDEXINGL, "CBookmarksPlugin::DoIndexingL(): Added." ); CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Added."); } else { + OstTrace1( TRACE_NORMAL, DUP3_CBOOKMARKSPLUGIN_DOINDEXINGL, "CBookmarksPlugin::DoIndexingL();Error %d in adding", err ); CPIXLOGSTRING2("CBookmarksPlugin::DoIndexingL(): Error %d in adding.", err); } + OstTrace0( TRACE_NORMAL, DUP4_CBOOKMARKSPLUGIN_DOINDEXINGL, "CBookmarksPlugin::DoIndexingL(): Logic complete" ); CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Logic complete"); CleanupStack::PopAndDestroy( index_item ); + OstTrace0( TRACE_NORMAL, DUP5_CBOOKMARKSPLUGIN_DOINDEXINGL, "CBookmarksPlugin::DoIndexingL(): Pop complete complete" ); CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Pop complete complete"); } CPIXLOGSTRING("CBookmarksPlugin::DoIndexingL(): Returning"); + OstTraceFunctionExit0( CBOOKMARKSPLUGIN_DOINDEXINGL_EXIT ); } // ----------------------------------------------------------------------------- @@ -286,6 +307,7 @@ //@sai: CTC: Will never be null in normal usecase. Needs to be present for UTs. if( !iIndexer ) return; + OstTrace1( TRACE_NORMAL, CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML, "CBookmarksPlugin::CreateBookmarkIndexItemL();aBookMarkUid=%d", aBookMarkUid ); CPIXLOGSTRING2("CBookmarksPlugin::CreateBookmarkIndexItemL(): aBookMarkUid = %d ", aBookMarkUid ); // creating CSearchDocument object with unique ID for this application TBuf<20> docid_str; @@ -293,6 +315,7 @@ //Add or update actions. CFavouritesItem* item = CFavouritesItem::NewLC(); TInt err = iFavouritesDb.Get(aBookMarkUid,*item); + OstTrace1( TRACE_NORMAL, DUP1_CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML, "CBookmarksPlugin::CreateBookmarkIndexItemL();DB Get error=%d", err ); CPIXLOGSTRING2("CBookmarksPlugin::CreateBookmarkIndexItemL(): DB Get error = %d ", err ); //@sai: CTC: did not ever get 'false' for this check. Since this is a private function, // we cannot UT this with an invalid bookmarkUid. @@ -301,6 +324,7 @@ CleanupStack::PopAndDestroy(item); return; } + OstTrace1( TRACE_NORMAL, DUP2_CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML, "CBookmarksPlugin::CreateBookmarkIndexItemL();item->Type()=%d", item->Type() ); CPIXLOGSTRING2("CBookmarksPlugin::CreateBookmarkIndexItemL(): item->Type() = %d ", item->Type() ); DoIndexingL(item, docid_str, aActionType); //add to / update index CleanupStack::PopAndDestroy(item); @@ -317,9 +341,11 @@ { if( iAsynchronizer->CallbackPending() ) { + OstTrace0( TRACE_NORMAL, CBOOKMARKSPLUGIN_HANDLEFAVOURITESDBEVENTL, "HandleFavouritesDbEventL: Cancelling callback" ); CPIXLOGSTRING("HandleFavouritesDbEventL: Cancelling callback"); iAsynchronizer->CancelCallback(); //first cancel any ongoing harvesting. } + OstTrace0( TRACE_NORMAL, DUP1_CBOOKMARKSPLUGIN_HANDLEFAVOURITESDBEVENTL, "HandleFavouritesDbEventL: calling StartHarvestingL" ); CPIXLOGSTRING("HandleFavouritesDbEventL: calling StartHarvestingL"); StartHarvestingL( KNullDesC ); } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/bookmarks/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/bookmarks/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/bookmarks/traces/bookmarkspluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/bookmarks/traces/bookmarkspluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,192 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __BOOKMARKSPLUGINTRACES_H__ +#define __BOOKMARKSPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2001a9d3 + +#define CBOOKMARKSPLUGIN_STARTHARVESTINGL 0x860001 +#define DUP1_CBOOKMARKSPLUGIN_STARTHARVESTINGL 0x860002 +#define CBOOKMARKSPLUGIN_DELAYEDCALLBACKL 0x860003 +#define DUP1_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL 0x860004 +#define DUP2_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL 0x860005 +#define DUP3_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL 0x860006 +#define CBOOKMARKSPLUGIN_GETDOMAINNAMEL 0x860007 +#define DUP1_CBOOKMARKSPLUGIN_GETDOMAINNAMEL 0x860008 +#define CBOOKMARKSPLUGIN_DOINDEXINGL 0x860009 +#define DUP1_CBOOKMARKSPLUGIN_DOINDEXINGL 0x86000a +#define DUP2_CBOOKMARKSPLUGIN_DOINDEXINGL 0x86000b +#define DUP3_CBOOKMARKSPLUGIN_DOINDEXINGL 0x86000c +#define DUP4_CBOOKMARKSPLUGIN_DOINDEXINGL 0x86000d +#define DUP5_CBOOKMARKSPLUGIN_DOINDEXINGL 0x86000e +#define CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML 0x86000f +#define DUP1_CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML 0x860010 +#define DUP2_CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML 0x860011 +#define CBOOKMARKSPLUGIN_HANDLEFAVOURITESDBEVENTL 0x860012 +#define DUP1_CBOOKMARKSPLUGIN_HANDLEFAVOURITESDBEVENTL 0x860013 +#define CBOOKMARKSPLUGIN_DOINDEXINGL_ENTRY 0x8a0001 +#define CBOOKMARKSPLUGIN_DOINDEXINGL_EXIT 0x8a0002 + + +inline TBool OstTraceGen2( TUint32 aTraceID, TInt aParam1, TInt aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TUint8 data[ 8 ]; + TUint8* ptr = data; + *( ( TInt* )ptr ) = aParam1; + ptr += sizeof ( TInt ); + *( ( TInt* )ptr ) = aParam2; + ptr += sizeof ( TInt ); + ptr -= 8; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 ); + } + return retval; + } + +inline TBool OstTraceGen2( TUint32 aTraceID, TInt32 aParam1, TInt32 aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TUint8 data[ 8 ]; + TUint8* ptr = data; + *( ( TInt* )ptr ) = aParam1; + ptr += sizeof ( TInt ); + *( ( TInt* )ptr ) = aParam2; + ptr += sizeof ( TInt ); + ptr -= 8; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, 8 ); + } + return retval; + } + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC16& aParam1 ) + { + TBool retval; + TInt size = aParam1.Size(); + // BTrace assumes that parameter size is atleast 4 bytes + if (size % 4 == 0) + { + TUint8* ptr = ( TUint8* )aParam1.Ptr(); + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + else + { + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + if (size > KOstMaxDataLength) + { + size = KOstMaxDataLength; + } + TInt sizeAligned = ( size + 3 ) & ~3; + memcpy( ptr, aParam1.Ptr(), size ); + ptr += size; + // Fillers are written to get 32-bit alignment + while ( size++ < sizeAligned ) + { + *ptr++ = 0; + } + ptr -= sizeAligned; + size = sizeAligned; + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + return retval; + } +#endif + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen2( TUint32 aTraceID, const TDesC16& aParam1, const TDesC16& aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TInt length = 0; + // Check that parameter lenght is not too long + TInt length1 = aParam1.Size(); + if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned1 = ( length1 + 3 ) & ~3; + if (lengthAligned1 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned1; + } + // Check that parameter lenght is not too long + TInt length2 = aParam2.Size(); + if ((length + length2 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length2 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned2 = ( length2 + 3 ) & ~3; + if (lengthAligned2 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned2; + } + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + // Set length to zero and calculate it againg + // when adding parameters + length = 0; + if (length1 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam1.Ptr(), length1 ); + ptr += length1; + // Fillers are written to get 32-bit alignment + while ( length1++ < lengthAligned1 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned1; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + if (length2 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length2 / (aParam2.Size() / aParam2.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam2.Ptr(), length2 ); + ptr += length2; + // Fillers are written to get 32-bit alignment + while ( length2++ < lengthAligned2 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned2; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + ptr -= length; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); + } + return retval; + } +#endif + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/bookmarks/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/bookmarks/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,24 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_FLOW[0x8A]_CBOOKMARKSPLUGIN_DOINDEXINGL_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CBOOKMARKSPLUGIN_DOINDEXINGL_EXIT=0x2 +[TRACE]TRACE_NORMAL[0x86]_CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML=0xf +[TRACE]TRACE_NORMAL[0x86]_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL=0x3 +[TRACE]TRACE_NORMAL[0x86]_CBOOKMARKSPLUGIN_DOINDEXINGL=0x9 +[TRACE]TRACE_NORMAL[0x86]_CBOOKMARKSPLUGIN_GETDOMAINNAMEL=0x7 +[TRACE]TRACE_NORMAL[0x86]_CBOOKMARKSPLUGIN_HANDLEFAVOURITESDBEVENTL=0x12 +[TRACE]TRACE_NORMAL[0x86]_CBOOKMARKSPLUGIN_STARTHARVESTINGL=0x1 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML=0x10 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL=0x4 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CBOOKMARKSPLUGIN_DOINDEXINGL=0xa +[TRACE]TRACE_NORMAL[0x86]_DUP1_CBOOKMARKSPLUGIN_GETDOMAINNAMEL=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CBOOKMARKSPLUGIN_HANDLEFAVOURITESDBEVENTL=0x13 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CBOOKMARKSPLUGIN_STARTHARVESTINGL=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CBOOKMARKSPLUGIN_CREATEBOOKMARKSINDEXITEML=0x11 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL=0x5 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CBOOKMARKSPLUGIN_DOINDEXINGL=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP3_CBOOKMARKSPLUGIN_DELAYEDCALLBACKL=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CBOOKMARKSPLUGIN_DOINDEXINGL=0xc +[TRACE]TRACE_NORMAL[0x86]_DUP4_CBOOKMARKSPLUGIN_DOINDEXINGL=0xd +[TRACE]TRACE_NORMAL[0x86]_DUP5_CBOOKMARKSPLUGIN_DOINDEXINGL=0xe diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/calendar/data/2001f704.rss --- a/harvesterplugins/calendar/data/2001f704.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/calendar/data/2001f704.rss Mon May 03 12:32:15 2010 +0300 @@ -37,7 +37,7 @@ { implementation_uid = 0x2001F704; version_no = 1; - display_name = "CPix Search Calendar plugin"; + display_name = "Calendar"; default_data = "Calendar"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/calendar/group/calendarplugin.mmp --- a/harvesterplugins/calendar/group/calendarplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/calendar/group/calendarplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -28,7 +28,7 @@ SOURCE ccalendarplugin.cpp SOURCE tproxy.cpp -USERINCLUDE ../inc +USERINCLUDE ../inc ../traces APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/calendar/src/ccalendarplugin.cpp --- a/harvesterplugins/calendar/src/ccalendarplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/calendar/src/ccalendarplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -26,7 +26,12 @@ #include #include #include -#include // CleanupResetAndDestroyPushL +#include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ccalendarpluginTraces.h" +#endif + // CleanupResetAndDestroyPushL _LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD); _LIT(KMimeTypeCalendar, CALENDAR_MIMETYPE); @@ -213,6 +218,7 @@ if( entryArray.Count() > 0 ) { CCalEntry* entry = (CCalEntry*)entryArray[ 0 ]; + OstTrace1( TRACE_NORMAL, CCALENDARPLUGIN_DELAYEDCALLBACKL, "CCalendarPlugin::DelayedCallbackL();Harvesting id=%d", entry->LocalUidL() ); CPIXLOGSTRING2("CCalendarPlugin::DelayedCallbackL(): Harvesting id=%d.", entry->LocalUidL()); CreateEntryL( entry->LocalUidL(), ECPixAddAction ); } @@ -252,6 +258,7 @@ void CCalendarPlugin::CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems ) { const TInt count(aChangeItems.Count()); + OstTrace1( TRACE_NORMAL, CCALENDARPLUGIN_CALCHANGENOTIFICATION, "CCalendarPlugin::CalChangeNotification();changed item count=%d", count ); CPIXLOGSTRING2("CCalendarPlugin::CalChangeNotification(): changed item count =%d.", count); for( TInt i = 0; i < count; ++i ) { @@ -270,6 +277,7 @@ { case EChangeAdd: { + OstTrace1( TRACE_NORMAL, CCALENDARPLUGIN_HANDLECHANGEDENTRYL, "CCalendarPlugin::HandleChangedEntryL();Monitored add id=%d", changedEntry.iEntryId ); CPIXLOGSTRING2("CCalendarPlugin::HandleChangedEntryL(): Monitored add id=%d.", changedEntry.iEntryId); #ifdef __PERFORMANCE_DATA iStartTime.UniversalTime(); @@ -283,6 +291,7 @@ case EChangeDelete: { + OstTrace1( TRACE_NORMAL, DUP1_CCALENDARPLUGIN_HANDLECHANGEDENTRYL, "CCalendarPlugin::HandleChangedEntryL();Monitored delete id=%d", changedEntry.iEntryId ); CPIXLOGSTRING2("CCalendarPlugin::HandleChangedEntryL(): Monitored delete id=%d.", changedEntry.iEntryId); #ifdef __PERFORMANCE_DATA iStartTime.UniversalTime(); @@ -296,6 +305,7 @@ case EChangeModify: { + OstTrace1( TRACE_NORMAL, DUP2_CCALENDARPLUGIN_HANDLECHANGEDENTRYL, "CCalendarPlugin::HandleChangedEntryL();Monitored update id=%d", changedEntry.iEntryId ); CPIXLOGSTRING2("CCalendarPlugin::HandleChangedEntryL(): Monitored update id=%d.", changedEntry.iEntryId); #ifdef __PERFORMANCE_DATA iStartTime.UniversalTime(); @@ -313,6 +323,7 @@ */ case EChangeUndefined: { + OstTrace0( TRACE_NORMAL, DUP3_CCALENDARPLUGIN_HANDLECHANGEDENTRYL, "CCalendarPlugin::HandleChangedEntryL(): EChangeUndefined." ); CPIXLOGSTRING("CCalendarPlugin::HandleChangedEntryL(): EChangeUndefined."); // This event could be related to synchronization. // Mark harvesting as cancelled. @@ -342,6 +353,7 @@ if (!iIndexer) return; + OstTrace1( TRACE_NORMAL, CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Uid=%d", aLocalUid ); CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Uid = %d.", aLocalUid); // creating CSearchDocument object with unique ID for this application @@ -362,6 +374,7 @@ { CleanupStack::PopAndDestroy(entry); CleanupStack::PopAndDestroy(index_item); + OstTrace0( TRACE_NORMAL, DUP1_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Donot harvest Note item." ); CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Donot harvest Note item."); return; } @@ -413,10 +426,12 @@ TRAPD(err, iIndexer->AddL(*index_item)); if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP2_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Added." ); CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Added."); } else { + OstTrace1( TRACE_NORMAL, DUP3_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Error %d in adding", err ); CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in adding.", err); } } @@ -425,10 +440,12 @@ TRAPD(err, iIndexer->UpdateL(*index_item)); if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP4_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Updated." ); CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Updated."); } else { + OstTrace1( TRACE_NORMAL, DUP5_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Error %d in updating", err ); CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in updating.", err); } } @@ -439,10 +456,12 @@ TRAPD(err, iIndexer->DeleteL(docid_str)); if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP6_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Deleted." ); CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Deleted."); } else { + OstTrace1( TRACE_NORMAL, DUP7_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Error %d in deleting", err ); CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL(): Error %d in deleting.", err); } } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/calendar/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/calendar/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/calendar/traces/ccalendarpluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/calendar/traces/ccalendarpluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,28 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CCALENDARPLUGINTRACES_H__ +#define __CCALENDARPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2001f704 + +#define CCALENDARPLUGIN_DELAYEDCALLBACKL 0x860001 +#define CCALENDARPLUGIN_CALCHANGENOTIFICATION 0x860002 +#define CCALENDARPLUGIN_HANDLECHANGEDENTRYL 0x860003 +#define DUP1_CCALENDARPLUGIN_HANDLECHANGEDENTRYL 0x860004 +#define DUP2_CCALENDARPLUGIN_HANDLECHANGEDENTRYL 0x860005 +#define DUP3_CCALENDARPLUGIN_HANDLECHANGEDENTRYL 0x860006 +#define CCALENDARPLUGIN_CREATEENTRYL 0x860007 +#define DUP1_CCALENDARPLUGIN_CREATEENTRYL 0x860008 +#define DUP2_CCALENDARPLUGIN_CREATEENTRYL 0x860009 +#define DUP3_CCALENDARPLUGIN_CREATEENTRYL 0x86000a +#define DUP4_CCALENDARPLUGIN_CREATEENTRYL 0x86000b +#define DUP5_CCALENDARPLUGIN_CREATEENTRYL 0x86000c +#define DUP6_CCALENDARPLUGIN_CREATEENTRYL 0x86000d +#define DUP7_CCALENDARPLUGIN_CREATEENTRYL 0x86000e + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/calendar/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/calendar/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,16 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_NORMAL[0x86]_CCALENDARPLUGIN_CALCHANGENOTIFICATION=0x2 +[TRACE]TRACE_NORMAL[0x86]_CCALENDARPLUGIN_CREATEENTRYL=0x7 +[TRACE]TRACE_NORMAL[0x86]_CCALENDARPLUGIN_DELAYEDCALLBACKL=0x1 +[TRACE]TRACE_NORMAL[0x86]_CCALENDARPLUGIN_HANDLECHANGEDENTRYL=0x3 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CCALENDARPLUGIN_CREATEENTRYL=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CCALENDARPLUGIN_HANDLECHANGEDENTRYL=0x4 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CCALENDARPLUGIN_CREATEENTRYL=0x9 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CCALENDARPLUGIN_HANDLECHANGEDENTRYL=0x5 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CCALENDARPLUGIN_CREATEENTRYL=0xa +[TRACE]TRACE_NORMAL[0x86]_DUP3_CCALENDARPLUGIN_HANDLECHANGEDENTRYL=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CCALENDARPLUGIN_CREATEENTRYL=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP5_CCALENDARPLUGIN_CREATEENTRYL=0xc +[TRACE]TRACE_NORMAL[0x86]_DUP6_CCALENDARPLUGIN_CREATEENTRYL=0xd +[TRACE]TRACE_NORMAL[0x86]_DUP7_CCALENDARPLUGIN_CREATEENTRYL=0xe diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/contacts/data/2001f702.rss --- a/harvesterplugins/contacts/data/2001f702.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/contacts/data/2001f702.rss Mon May 03 12:32:15 2010 +0300 @@ -37,7 +37,7 @@ { implementation_uid = 0x2001F702; version_no = 1; - display_name = "CPix Search Contacts plugin"; + display_name = "Contacts"; default_data = "Contacts"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/contacts/group/contactsplugin.mmp --- a/harvesterplugins/contacts/group/contactsplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/contacts/group/contactsplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -29,7 +29,7 @@ SOURCE ccontactsplugin.cpp SOURCE tproxy.cpp -USERINCLUDE ../inc +USERINCLUDE ../inc ../traces APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/contacts/src/ccontactsplugin.cpp --- a/harvesterplugins/contacts/src/ccontactsplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/contacts/src/ccontactsplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -21,7 +21,12 @@ #include #include -#include +#include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "ccontactspluginTraces.h" +#endif + _LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD); _LIT(KMimeTypeContact, CONTACT_MIMETYPE); @@ -145,6 +150,7 @@ { case EContactDbObserverEventContactChanged: case EContactDbObserverEventGroupChanged: + OstTrace1( TRACE_NORMAL, DUP3_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL, "CContactsPlugin::HandleDatabaseEventL;Monitored update id=%d", aEvent.iContactId ); CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored update id=%d.", aEvent.iContactId); #ifdef __PERFORMANCE_DATA iStartTime.UniversalTime(); @@ -157,6 +163,7 @@ case EContactDbObserverEventContactDeleted: case EContactDbObserverEventGroupDeleted: + OstTrace1( TRACE_NORMAL, CCONTACTSPLUGIN_HANDLEDATABASEEVENTL, "CContactsPlugin::HandleDatabaseEventL();Monitored delete id=%d", aEvent.iContactId ); CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored delete id=%d.", aEvent.iContactId); #ifdef __PERFORMANCE_DATA iStartTime.UniversalTime(); @@ -169,6 +176,7 @@ case EContactDbObserverEventContactAdded: case EContactDbObserverEventGroupAdded: + OstTrace1( TRACE_NORMAL, DUP1_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL, "CContactsPlugin::HandleDatabaseEventL();Monitored add id=%d", aEvent.iContactId ); CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored add id=%d.", aEvent.iContactId); #ifdef __PERFORMANCE_DATA iStartTime.UniversalTime(); @@ -205,6 +213,7 @@ break; // Create index item + OstTrace1( TRACE_NORMAL, CCONTACTSPLUGIN_DELAYEDCALLBACKL, "CContactsPlugin::DelayedCallbackL();Harvesting id=%d", (*iContacts)[iCurrentIndex] ); CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Harvesting id=%d.", (*iContacts)[iCurrentIndex]); CreateContactIndexItemL((*iContacts)[iCurrentIndex], ECPixAddAction); iCurrentIndex++; @@ -301,6 +310,7 @@ if (!iIndexer) return; + OstTrace1( TRACE_NORMAL, CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL();aContentId=%d", aContentId ); CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): aContentId = %d ", aContentId ); // creating CSearchDocument object with unique ID for this application @@ -317,6 +327,7 @@ if( contact->Type() == KUidContactGroup ) { index_item->AddFieldL(KContactsGivenNameField, static_cast( contact )->GetGroupLabelL(), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized); + OstTraceExt1( TRACE_NORMAL, DUP1_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, ";Adding Contact Group=%S", ( static_cast( contact )->GetGroupLabelL() ) ); CPIXLOGSTRING2("Adding Contact Group %S", &( static_cast( contact )->GetGroupLabelL() ) ); index_item->AddExcerptL( static_cast( contact )->GetGroupLabelL() ); } @@ -381,10 +392,12 @@ TRAPD(err, iIndexer->AddL(*index_item)); if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP2_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL(): Added." ); CPIXLOGSTRING("CContactsPlugin::CreateContactIndexItemL(): Added."); } else { + OstTrace1( TRACE_NORMAL, DUP3_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL();Error %d in adding", err ); CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): Error %d in adding.", err); } } @@ -393,10 +406,12 @@ TRAPD(err, iIndexer->UpdateL(*index_item)); if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP4_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL(): Updated." ); CPIXLOGSTRING("CContactsPlugin::CreateContactIndexItemL(): Updated."); } else { + OstTrace1( TRACE_NORMAL, DUP5_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL();Error %d in updating", err ); CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): Error %d in updating.", err); } } @@ -408,10 +423,12 @@ TRAPD(err, iIndexer->DeleteL(docid_str)); if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP6_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL(): Deleted." ); CPIXLOGSTRING("CContactsPlugin::CreateContactIndexItemL(): Deleted."); } else { + OstTrace1( TRACE_NORMAL, DUP7_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL();Error %d in deleting", err ); CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): Error %d in deleting.", err); } } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/contacts/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/contacts/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/contacts/traces/ccontactspluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/contacts/traces/ccontactspluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,64 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CCONTACTSPLUGINTRACES_H__ +#define __CCONTACTSPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2001f702 + +#define DUP3_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL 0x860001 +#define CCONTACTSPLUGIN_HANDLEDATABASEEVENTL 0x860002 +#define DUP1_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL 0x860003 +#define CCONTACTSPLUGIN_DELAYEDCALLBACKL 0x860004 +#define CCONTACTSPLUGIN_CREATECONTACTINDEXITEML 0x860005 +#define DUP1_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML 0x860006 +#define DUP2_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML 0x860007 +#define DUP3_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML 0x860008 +#define DUP4_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML 0x860009 +#define DUP5_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML 0x86000a +#define DUP6_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML 0x86000b +#define DUP7_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML 0x86000c + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC16& aParam1 ) + { + TBool retval; + TInt size = aParam1.Size(); + // BTrace assumes that parameter size is atleast 4 bytes + if (size % 4 == 0) + { + TUint8* ptr = ( TUint8* )aParam1.Ptr(); + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + else + { + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + if (size > KOstMaxDataLength) + { + size = KOstMaxDataLength; + } + TInt sizeAligned = ( size + 3 ) & ~3; + memcpy( ptr, aParam1.Ptr(), size ); + ptr += size; + // Fillers are written to get 32-bit alignment + while ( size++ < sizeAligned ) + { + *ptr++ = 0; + } + ptr -= sizeAligned; + size = sizeAligned; + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + return retval; + } +#endif + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/contacts/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/contacts/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,14 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_NORMAL[0x86]_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML=0x5 +[TRACE]TRACE_NORMAL[0x86]_CCONTACTSPLUGIN_DELAYEDCALLBACKL=0x4 +[TRACE]TRACE_NORMAL[0x86]_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL=0x3 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML=0x7 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL=0x1 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML=0x9 +[TRACE]TRACE_NORMAL[0x86]_DUP5_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML=0xa +[TRACE]TRACE_NORMAL[0x86]_DUP6_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP7_CCONTACTSPLUGIN_CREATECONTACTINDEXITEML=0xc diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/data/2001f703.rss --- a/harvesterplugins/file/data/2001f703.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/data/2001f703.rss Mon May 03 12:32:15 2010 +0300 @@ -37,7 +37,7 @@ { implementation_uid = 0x2001F703; version_no = 1; - display_name = "CPix Search File plugin"; + display_name = "Files"; default_data = "File"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/fastfindfileserverplugin/group/fastfindfileserverplugin.mmp --- a/harvesterplugins/file/fastfindfileserverplugin/group/fastfindfileserverplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/fastfindfileserverplugin/group/fastfindfileserverplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -28,7 +28,7 @@ APP_LAYER_SYSTEMINCLUDE USERINCLUDE ../inc -USERINCLUDE ../../inc/monitorplugin +USERINCLUDE ../../inc/monitorplugin ../traces SOURCEPATH ../src SOURCE fastfindfileserverplugin.cpp diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/fastfindfileserverplugin/src/fastfindfileserverplugin.cpp --- a/harvesterplugins/file/fastfindfileserverplugin/src/fastfindfileserverplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/fastfindfileserverplugin/src/fastfindfileserverplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -18,6 +18,11 @@ #include #include "fastfindfileserverplugin.h" #include "harvesterlog.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "fastfindfileserverpluginTraces.h" +#endif + _LIT( KFastFindFileServerPlugin, "CPixFileServerPlugin" ); @@ -28,6 +33,7 @@ CFastFindFileServerPlugin::CFastFindFileServerPlugin() : iFormatDriveNumber( -1 ) { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_CFASTFINDFILESERVERPLUGIN, "CFastFindFileServerPlugin::CFastFindFileServerPlugin()" ); WRITELOG( "CFastFindFileServerPlugin::CFastFindFileServerPlugin()" ); } @@ -37,6 +43,7 @@ // CFastFindFileServerPlugin::~CFastFindFileServerPlugin() { + OstTrace0( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGIN_CFASTFINDFILESERVERPLUGIN, "CFastFindFileServerPlugin::~CFastFindFileServerPlugin()" ); WRITELOG( "CFastFindFileServerPlugin::~CFastFindFileServerPlugin()" ); TRAP_IGNORE( DisableL() ); @@ -61,6 +68,7 @@ // CFastFindFileServerPlugin* CFastFindFileServerPlugin::NewL() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_NEWL, "CFastFindFileServerPlugin::NewL()" ); WRITELOG( "CFastFindFileServerPlugin::NewL()" ); return new (ELeave) CFastFindFileServerPlugin; } @@ -71,6 +79,7 @@ // void CFastFindFileServerPlugin::InitialiseL() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_INITIALISEL, "CFastFindFileServerPlugin::InitializeL()" ); WRITELOG( "CFastFindFileServerPlugin::InitializeL()" ); User::LeaveIfError( iFsSession.Connect() ); } @@ -81,6 +90,7 @@ // void CFastFindFileServerPlugin::EnableL() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_ENABLEL, "CFastFindFileServerPlugin::EnableL()" ); WRITELOG( "CFastFindFileServerPlugin::EnableL()" ); User::LeaveIfError( RegisterIntercept(EFsFileCreate, EPostIntercept) ); User::LeaveIfError( RegisterIntercept(EFsFileRename, EPostIntercept) ); @@ -88,6 +98,8 @@ User::LeaveIfError( RegisterIntercept(EFsDelete, EPostIntercept) ); // User::LeaveIfError( RegisterIntercept(EFsFileReplace, EPostIntercept) ); User::LeaveIfError( RegisterIntercept(EFsReplace, EPostIntercept) ); + User::LeaveIfError( RegisterIntercept(EFsMkDir, EPostIntercept) ); + User::LeaveIfError( RegisterIntercept(EFsRmDir, EPostIntercept) ); // User::LeaveIfError( RegisterIntercept(EFsFileModified, EPostIntercept) ); User::LeaveIfError( RegisterIntercept(EFsFileSetModified, EPostIntercept) ); User::LeaveIfError( RegisterIntercept(EFsFileSubClose, EPostIntercept) ); @@ -106,6 +118,7 @@ // void CFastFindFileServerPlugin::DisableL() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_DISABLEL, "CFastFindFileServerPlugin::DisableL()" ); WRITELOG( "CFastFindFileServerPlugin::DisableL()" ); User::LeaveIfError( UnregisterIntercept(EFsFileCreate, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept(EFsFileRename, EPrePostIntercept) ); @@ -113,6 +126,8 @@ User::LeaveIfError( UnregisterIntercept(EFsDelete, EPrePostIntercept) ); // User::LeaveIfError( UnregisterIntercept(EFsFileReplace, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept(EFsReplace, EPrePostIntercept) ); + User::LeaveIfError( UnregisterIntercept(EFsMkDir, EPrePostIntercept) ); + User::LeaveIfError( UnregisterIntercept(EFsRmDir, EPrePostIntercept) ); // User::LeaveIfError( UnregisterIntercept(EFsFileModified, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept(EFsFileSetModified, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept(EFsFileSubClose, EPrePostIntercept) ); @@ -132,6 +147,7 @@ // void CFastFindFileServerPlugin::AddConnection() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_ADDCONNECTION, "CFastFindFileServerPlugin::AddConnection()" ); WRITELOG( "CFastFindFileServerPlugin::AddConnection()" ); ++iConnectionCount; @@ -143,6 +159,7 @@ // void CFastFindFileServerPlugin::RemoveConnection() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_REMOVECONNECTION, "CFastFindFileServerPlugin::RemoveConnection()" ); WRITELOG( "CFastFindFileServerPlugin::RemoveConnection()" ); --iConnectionCount; @@ -150,6 +167,7 @@ // remove notification request if this was last connection if ( iConnectionCount <= 0 ) { + OstTrace0( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGIN_REMOVECONNECTION, "CFastFindFileServerPlugin::RemoveConnection() last connection" ); WRITELOG( "CFastFindFileServerPlugin::RemoveConnection() last connection" ); iNotification = NULL; @@ -162,6 +180,7 @@ // TInt CFastFindFileServerPlugin::DoRequestL( TFsPluginRequest& aRequest ) { + OstTraceFunctionEntry0( CFASTFINDFILESERVERPLUGIN_DOREQUESTL_ENTRY ); TInt err = KErrNone; TInt function = aRequest.Function(); const TBool formatFunction = function == EFsFormatOpen || function == EFsFormatSubClose; @@ -172,9 +191,11 @@ if ( function == EFsFileSubClose && iCreatedFiles.Count() == 0 ) { + OstTraceFunctionExit0( CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } + OstTrace1( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL;Plugin function=%d", function ); WRITELOG1( "----- CFastFindFileServerPlugin::DoRequestL() - plugin function: %d -----", function ); TFileName fileName; @@ -185,8 +206,25 @@ if ( !formatFunction ) { GetName( &aRequest, fileName ); + OstTraceExt1( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL;Filename=%S", fileName ); WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - fileName: %S", &fileName ); } + + if ( function == EFsMkDir || function == EFsRmDir) + { + // This will return the folder path with trailing slash, remove it to match + // with the doc_id format + TFileName filePath; + GetPath(&aRequest, filePath); + if (filePath.Length() > 0) + { + TPtrC temppath( filePath.Left( filePath.Length() - 1 ) ); + fileName.Zero(); + fileName.Append(temppath); + } + OstTraceExt1( TRACE_NORMAL, DUP2_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL;Filename=%S", fileName ); + WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - fileName: %S", &fileName ); + } // get process id TUid processId = { 0 }; @@ -211,15 +249,20 @@ if ( function == EFsRename || function == EFsFileRename || function == EFsReplace ) { GetNewName( &aRequest, newFileName ); + OstTraceExt1( TRACE_NORMAL, DUP3_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL;New Filename=%S", newFileName ); WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - newFileName: %S", &newFileName ); if ( !CheckPath(newFileName) ) { + OstTrace0( TRACE_NORMAL, DUP4_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - path not supported" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - path not supported" ); + OstTraceFunctionExit0( DUP1_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } if ( !CheckAttribs(newFileName) ) { + OstTrace0( TRACE_NORMAL, DUP5_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - attribute check failed" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - attribute check failed" ); + OstTraceFunctionExit0( DUP2_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } } @@ -227,13 +270,17 @@ { if ( !CheckPath(fileName) ) { + OstTrace0( TRACE_NORMAL, DUP6_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - path not supported" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - path not supported" ); + OstTraceFunctionExit0( DUP3_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } if ( !CheckAttribs(fileName) ) { + OstTrace0( TRACE_NORMAL, DUP7_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - attribute check failed" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - attribute check failed" ); + OstTraceFunctionExit0( DUP4_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } } @@ -241,12 +288,14 @@ TInt fileEventType = EFastFindFileUnknown; TInt drvNumber = aRequest.DriveNumber(); + OstTrace1( TRACE_NORMAL, DUP8_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL;Drive Number=%d", drvNumber ); WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - drive number: %d", drvNumber ); switch( function ) { case EFsFileCreate: { + OstTrace0( TRACE_NORMAL, DUP9_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsFileCreate" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFileCreate" ); TFileName* fn = new (ELeave) TFileName; @@ -254,11 +303,13 @@ fn->Copy( fileName ); iCreatedFiles.Append( fn ); User::LeaveIfError( UnregisterIntercept(EFsFileSetModified, EPrePostIntercept) ); + OstTraceFunctionExit0( DUP5_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } case EFsFileSubClose: { + OstTrace0( TRACE_NORMAL, DUP10_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsFileSubClose" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFileSubClose" ); TBool found = EFalse; @@ -278,6 +329,7 @@ if ( !found ) { + OstTraceFunctionExit0( DUP6_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } } @@ -285,32 +337,38 @@ case EFsRename: { + OstTraceExt1( TRACE_NORMAL, DUP11_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsRenamed;New Filename=%S", newFileName ); WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - EFsRenamed, new file: %S", &newFileName ); fileEventType = EFastFindFileRenamed; } break; case EFsFileRename: + OstTraceExt1( TRACE_NORMAL, DUP12_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsFileRenamed;New Filename=%S", newFileName ); WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - EFsFileRenamed, new file: %S", &newFileName ); fileEventType = EFastFindFileRenamed; break; case EFsFileSetModified: + OstTrace0( TRACE_NORMAL, DUP13_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsFileModified" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFileModified" ); fileEventType = EFastFindFileModified; break; case EFsReplace: + OstTraceExt1( TRACE_NORMAL, DUP14_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsReplace;New Filename=%S", newFileName ); WRITELOG1( "CFastFindFileServerPlugin::DoRequestL() - EFsReplace, new file: %S", &newFileName ); fileEventType = EFastFindFileReplaced; break; case EFsDelete: + OstTrace0( TRACE_NORMAL, DUP15_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsDelete" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsDelete" ); fileEventType = EFastFindFileDeleted; break; case EFsFormatOpen: + OstTrace0( TRACE_NORMAL, DUP16_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsFormatOpen" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFormatOpen" ); // get the drive letter iFormatDriveNumber = drvNumber; @@ -320,9 +378,11 @@ break; case EFsFormatSubClose: + OstTrace0( TRACE_NORMAL, DUP17_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsFormatSubClose" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsFormatSubClose" ); if ( iFormatDriveNumber < 0 ) { + OstTraceFunctionExit0( DUP7_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } drvNumber = iFormatDriveNumber; @@ -333,14 +393,30 @@ processId.iUid = 1; } break; - + + case EFsMkDir: + OstTrace0( TRACE_NORMAL, DUP18_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsMkDir" ); + WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsMkDir" ); + fileEventType = EFastFindDirCreated; + + break; + + case EFsRmDir: + OstTrace0( TRACE_NORMAL, DUP19_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - EFsRmDir" ); + WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - EFsRmDir" ); + fileEventType = EFastFindDirDeleted; + break; + default: + OstTrace0( TRACE_NORMAL, DUP20_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - Unknown function" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - Unknown function" ); + OstTraceFunctionExit0( DUP8_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return KErrNone; } if ( iNotification ) { + OstTrace0( TRACE_NORMAL, DUP21_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - iNotification found" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - iNotification found" ); TFastFindFSPStatusPckg clientStatusBuf; TFastFindFSPStatus& clientStatus = clientStatusBuf(); @@ -356,10 +432,12 @@ TRAP( err, iNotification->WriteParam1L(clientStatusBuf) ); iNotification->Complete( err ); iNotification = NULL; + OstTrace0( TRACE_NORMAL, DUP22_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - iNotification complete" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - iNotification complete" ); } else // no notification ready, put in the queue { + OstTrace0( TRACE_NORMAL, DUP23_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - iNotification not found. Put in the queue" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - iNotification not found. Put in the queue" ); TFastFindFSPStatus* clientStatus = new (ELeave) TFastFindFSPStatus; @@ -374,10 +452,12 @@ iQueue.Append( clientStatus ); // owenership is transferred err = KErrNone; + OstTrace0( TRACE_NORMAL, DUP24_CFASTFINDFILESERVERPLUGIN_DOREQUESTL, "CFastFindFileServerPlugin::DoRequestL() - added to queue" ); WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - added to queue" ); } WRITELOG( "CFastFindFileServerPlugin::DoRequestL() - return" ); + OstTraceFunctionExit0( DUP9_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT ); return err; } @@ -409,6 +489,7 @@ CFastFindFileServerPluginConn* CFastFindFileServerPluginConn::NewL( CFastFindFileServerPlugin& aPlugin ) { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINCONN_NEWL, "CFastFindFileServerPluginConn::NewL()" ); WRITELOG( "CFastFindFileServerPluginConn::NewL()" ); return new (ELeave) CFastFindFileServerPluginConn( aPlugin ); } @@ -422,6 +503,7 @@ CFastFindFileServerPlugin& aPlugin ) : iPlugin( aPlugin ) { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINCONN_CFASTFINDFILESERVERPLUGINCONN, "CFastFindFileServerPluginConn::CFastFindFileServerPluginConn()" ); WRITELOG( "CFastFindFileServerPluginConn::CFastFindFileServerPluginConn()" ); iPlugin.AddConnection(); @@ -434,6 +516,7 @@ */ CFastFindFileServerPluginConn::~CFastFindFileServerPluginConn() { + OstTrace0( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGINCONN_CFASTFINDFILESERVERPLUGINCONN, "CFastFindFileServerPluginConn::~CFastFindFileServerPluginConn()" ); WRITELOG( "CFastFindFileServerPluginConn::~CFastFindFileServerPluginConn()" ); iPlugin.RemoveConnection(); @@ -445,6 +528,7 @@ // TInt CFastFindFileServerPluginConn::DoControl( CFsPluginConnRequest& aRequest ) { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINCONN_DOCONTROL, "CFastFindFileServerPluginConn::DoControl()" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl()" ); TInt err = KErrNotSupported; @@ -454,6 +538,7 @@ { case EFastFindFSPOpEnable: { + OstTrace0( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL, "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpEnable" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpEnable" ); TRAP( err, myPlugin.EnableL() ); break; @@ -461,6 +546,7 @@ case EFastFindFSPOpDisable: { + OstTrace0( TRACE_NORMAL, DUP2_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL, "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpDisable" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpDisable" ); TRAP( err, myPlugin.DisableL() ); break; @@ -468,6 +554,7 @@ default: { + OstTrace0( TRACE_NORMAL, DUP3_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL, "CFastFindFileServerPluginConn::DoControl() - Unknown Control" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl() - Unknown Control" ); break; } @@ -483,6 +570,7 @@ // void CFastFindFileServerPluginConn::DoRequest( CFsPluginConnRequest& aRequest ) { + OstTraceFunctionEntry0( CFASTFINDFILESERVERPLUGINCONN_DOREQUEST_ENTRY ); WRITELOG( "CFastFindFileServerPluginConn::DoRequest()" ); CFastFindFileServerPlugin& myPlugin = *(CFastFindFileServerPlugin*)Plugin(); @@ -490,6 +578,7 @@ { case EFastFindFSPOpRegisterNotification: { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINCONN_DOREQUEST, "CFastFindFileServerPluginConn::DoRequest() - EFastFindFSPOpRegisterNotification" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpRegisterNotification" ); TInt err = myPlugin.RegisterNotification( aRequest ); @@ -502,6 +591,7 @@ case EFastFindFSPOpAddNotificationPath: { + OstTrace0( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST, "CFastFindFileServerPluginConn::DoRequest() - EFastFindFSPOpAddNotificationPath" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpAddNotificationPath" ); TInt err = myPlugin.AddNotificationPath( aRequest ); aRequest.Complete( err ); @@ -510,6 +600,7 @@ case EFastFindFSPOpRemoveNotificationPath: { + OstTrace0( TRACE_NORMAL, DUP2_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST, "CFastFindFileServerPluginConn::DoRequest() - EFastFindFSPOpRemoveNotificationPath" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpRemoveNotificationPath" ); TInt err = myPlugin.RemoveNotificationPath( aRequest ); aRequest.Complete( err ); @@ -518,6 +609,7 @@ case EFastFindFSPOpAddIgnorePath: { + OstTrace0( TRACE_NORMAL, DUP3_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST, "CFastFindFileServerPluginConn::DoRequest() - EFastFindFSPOpAddIgnorePath" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpAddIgnorePath" ); TInt err = myPlugin.AddIgnorePath( aRequest ); aRequest.Complete( err ); @@ -526,12 +618,14 @@ case EFastFindFSPOpRemoveIgnorePath: { + OstTrace0( TRACE_NORMAL, DUP4_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST, "CFastFindFileServerPluginConn::DoRequest() - EFastFindFSPOpRemoveIgnorePath" ); WRITELOG( "CFastFindFileServerPluginConn::DoControl() - EFastFindFSPOpRemoveIgnorePath" ); TInt err = myPlugin.RemoveIgnorePath( aRequest ); aRequest.Complete( err ); break; } } + OstTraceFunctionExit0( CFASTFINDFILESERVERPLUGINCONN_DOREQUEST_EXIT ); } //----------------------------------------------------------------------------- @@ -540,6 +634,7 @@ // void CFastFindFileServerPluginConn::DoCancel( TInt /*aReqMask*/ ) { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINCONN_DOCANCEL, "CFastFindFileServerPluginConn::DoCancel()" ); WRITELOG( "CFastFindFileServerPluginConn::DoCancel()" ); iRequestQue.DoCancelAll( KErrCancel ); } @@ -550,6 +645,7 @@ // CFsPluginConn* CFastFindFileServerPlugin::NewPluginConnL() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_NEWPLUGINCONNL, "CFastFindFileServerPluginConn::NewPluginConnL()" ); WRITELOG( "CFastFindFileServerPluginConn::NewPluginConnL()" ); return CFastFindFileServerPluginConn::NewL( *this ); } @@ -560,6 +656,7 @@ // TInt CFastFindFileServerPlugin::RegisterNotification( CFsPluginConnRequest& aRequest ) { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_REGISTERNOTIFICATION, "CFastFindFileServerPlugin::RegisterNotification()" ); WRITELOG( "CFastFindFileServerPlugin::RegisterNotification()" ); if ( iNotification ) @@ -571,6 +668,7 @@ if ( iQueue.Count() > 0 ) { + OstTrace0( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGIN_REGISTERNOTIFICATION, "CFastFindFileServerPlugin::RegisterNotification() - item in queue" ); WRITELOG( "CFastFindFileServerPlugin::RegisterNotification() - item in queue" ); TFastFindFSPStatus* queueStatus = iQueue[0]; @@ -602,6 +700,7 @@ // TInt CFastFindFileServerPlugin::AddNotificationPath( CFsPluginConnRequest& aRequest ) { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_ADDNOTIFICATIONPATH, "CFastFindFileServerPlugin::AddNotificationPath()" ); WRITELOG( "CFastFindFileServerPlugin::AddNotificationPath()" ); TInt err = KErrNone; @@ -627,6 +726,7 @@ } } + OstTraceExt1( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGIN_ADDNOTIFICATIONPATH, "CFastFindFileServerPlugin::AddNotificationPath;add path=%S", status.iFileName ); WRITELOG1( "CFastFindFileServerPlugin::AddNotificationPath() - add path: %S", &status.iFileName ); TFileName* fn = new TFileName; @@ -654,6 +754,7 @@ // TInt CFastFindFileServerPlugin::RemoveNotificationPath( CFsPluginConnRequest& aRequest ) { + OstTraceFunctionEntry0( CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_ENTRY ); WRITELOG( "CFastFindFileServerPlugin::RemoveNotificationPath()" ); TInt err = KErrNone; @@ -662,6 +763,7 @@ if ( err != KErrNone ) { + OstTraceFunctionExit0( CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_EXIT ); return err; } @@ -677,6 +779,7 @@ TFileName* tf = iPaths[i]; if ( tf->Compare(status.iFileName) == 0 ) { + OstTraceExt1( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH, "CFastFindFileServerPlugin::RemoveNotificationPath;remove path=%S", status.iFileName ); WRITELOG1( "CFastFindFileServerPlugin::RemoveNotificationPath() - remove path: %S", &status.iFileName ); delete tf; tf = NULL; @@ -690,6 +793,7 @@ err = KErrNotFound; } + OstTraceFunctionExit0( DUP1_CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_EXIT ); return err; } @@ -699,6 +803,7 @@ // TInt CFastFindFileServerPlugin::AddIgnorePath( CFsPluginConnRequest& aRequest ) { + OstTraceFunctionEntry0( CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_ENTRY ); WRITELOG( "CFastFindFileServerPlugin::AddIgnorePath()" ); TInt err = KErrNone; @@ -707,6 +812,7 @@ if ( err != KErrNone ) { + OstTraceFunctionExit0( CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT ); return err; } @@ -722,11 +828,13 @@ TFileName* tf = iIgnorePaths[i]; if( tf->Compare(status.iFileName) == 0 ) { + OstTraceFunctionExit0( DUP1_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT ); return KErrNone; } } } + OstTraceExt1( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH, "CFastFindFileServerPlugin::AddIgnorePath;add path=%S", status.iFileName ); WRITELOG1( "CFastFindFileServerPlugin::AddIgnorePath() - add path: %S", &status.iFileName ); TFileName* fn = new TFileName; @@ -745,6 +853,7 @@ err = KErrNotFound; } + OstTraceFunctionExit0( DUP2_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT ); return err; } @@ -754,6 +863,7 @@ // TInt CFastFindFileServerPlugin::RemoveIgnorePath( CFsPluginConnRequest& aRequest ) { + OstTraceFunctionEntry0( CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_ENTRY ); WRITELOG( "CFastFindFileServerPlugin::RemoveIgnorePath()" ); TInt err = KErrNone; @@ -762,6 +872,7 @@ if ( err != KErrNone ) { + OstTraceFunctionExit0( CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_EXIT ); return err; } @@ -777,6 +888,7 @@ TFileName* tf = iIgnorePaths[i]; if ( tf->Compare(status.iFileName) == 0 ) { + OstTraceExt1( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH, "CFastFindFileServerPlugin::RemoveIgnorePath;remove path=%S", status.iFileName ); WRITELOG1( "CFastFindFileServerPlugin::RemoveIgnorePath() - remove path: %S", &status.iFileName ); delete tf; tf = NULL; @@ -790,6 +902,7 @@ err = KErrNotFound; } + OstTraceFunctionExit0( DUP1_CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_EXIT ); return err; } @@ -898,6 +1011,7 @@ // @internalComponent CFastFindFileServerPluginFactory::CFastFindFileServerPluginFactory() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINFACTORY_CFASTFINDFILESERVERPLUGINFACTORY, "CFastFindFileServerPluginFactory::CFastFindFileServerPluginFactory()" ); WRITELOG( "CFastFindFileServerPluginFactory::CFastFindFileServerPluginFactory()" ); } @@ -905,6 +1019,7 @@ // @internalComponent TInt CFastFindFileServerPluginFactory::Install() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINFACTORY_INSTALL, "CFastFindFileServerPluginFactory::Install()" ); WRITELOG( "CFastFindFileServerPluginFactory::Install()" ); iSupportedDrives = KPluginAutoAttach; @@ -914,6 +1029,7 @@ // @internalComponent TInt CFastFindFileServerPluginFactory::UniquePosition() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINFACTORY_UNIQUEPOSITION, "CFastFindFileServerPluginFactory::UniquePosition()" ); WRITELOG( "CFastFindFileServerPluginFactory::UniquePosition()" ); return( KFastFindFSPluginPosition ); } @@ -922,6 +1038,7 @@ // @internalComponent CFsPlugin* CFastFindFileServerPluginFactory::NewPluginL() { + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGINFACTORY_NEWPLUGINL, "CFastFindFileServerPluginFactory::NewPluginL()" ); WRITELOG( "CFastFindFileServerPluginFactory::NewPluginL()" ); return CFastFindFileServerPlugin::NewL(); } @@ -932,6 +1049,7 @@ { EXPORT_C CFsPluginFactory* CreateFileSystem() { + OstTrace0( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGINFACTORY_NEWPLUGINL, "CFastFindFileServerPluginFactory::CreateFileSystem" ); WRITELOG( "CFastFindFileServerPluginFactory::CreateFileSystem" ); return( new CFastFindFileServerPluginFactory() ); } @@ -958,6 +1076,8 @@ User::LeaveIfError( RegisterIntercept( EFsFileSize, EPreIntercept) ); User::LeaveIfError( RegisterIntercept( EFsFileRename, EPreIntercept) ); User::LeaveIfError( RegisterIntercept( EFsRename, EPreIntercept) ); + User::LeaveIfError( RegisterIntercept( EFsMkDir, EPrePostIntercept) ); + User::LeaveIfError( RegisterIntercept( EFsRmDir, EPrePostIntercept) ); User::LeaveIfError( RegisterIntercept( EFsFileOpen, EPreIntercept) ); User::LeaveIfError( RegisterIntercept( EFsFileTemp, EPreIntercept) ); User::LeaveIfError( RegisterIntercept( EFsFileUnLock, EPreIntercept) ); @@ -992,6 +1112,8 @@ User::LeaveIfError( UnregisterIntercept( EFsFileSize, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept( EFsFileRename, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept( EFsRename, EPrePostIntercept) ); + User::LeaveIfError( UnregisterIntercept( EFsMkDir, EPrePostIntercept) ); + User::LeaveIfError( UnregisterIntercept( EFsRmDir, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept( EFsFileOpen, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept( EFsFileTemp, EPrePostIntercept) ); User::LeaveIfError( UnregisterIntercept( EFsFileUnLock, EPrePostIntercept) ); @@ -1016,88 +1138,123 @@ switch ( aFunction ) { case EFsFileDuplicate: + OstTrace0( TRACE_NORMAL, CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileDuplicate" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileDuplicate" ); - break; - + break; case EFsFileCreate: + OstTrace0( TRACE_NORMAL, DUP1_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileCreate" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileCreate" ); break; case EFsFileWrite: + OstTrace0( TRACE_NORMAL, DUP2_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileWrite" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileWrite" ); break; case EFsFileFlush: + OstTrace0( TRACE_NORMAL, DUP3_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileFlush" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileFlush" ); break; case EFsFileSetAtt: + OstTrace0( TRACE_NORMAL, DUP4_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetAtt" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetAtt" ); break; case EFsFileChangeMode: + OstTrace0( TRACE_NORMAL, DUP5_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileChangeMode" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileChangeMode" ); break; case EFsDelete: + OstTrace0( TRACE_NORMAL, DUP6_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsDelete" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsDelete" ); break; case EFsFileAdopt: + OstTrace0( TRACE_NORMAL, DUP7_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileAdopt" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileAdopt" ); break; case EFsFileReplace: + OstTrace0( TRACE_NORMAL, DUP8_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileReplace" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileReplace" ); break; case EFsFileLock: + OstTrace0( TRACE_NORMAL, DUP9_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileLock" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileLock" ); break; case EFsFileSize: + OstTrace0( TRACE_NORMAL, DUP10_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSize" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSize" ); break; case EFsFileModified: + OstTrace0( TRACE_NORMAL, DUP11_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileModified" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileModified" ); break; case EFsFileRename: + OstTrace0( TRACE_NORMAL, DUP12_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileRename" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileRename" ); break; case EFsRename: + OstTrace0( TRACE_NORMAL, DUP13_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsRename" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsRename" ); - break; + break; + case EFsMkDir: + OstTrace0( TRACE_NORMAL, DUP14_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsMkDir" ); + WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsMkDir" ); + break; + case EFsRmDir: + OstTrace0( TRACE_NORMAL, DUP15_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsRmDir" ); + WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsRmDir" ); + break; case EFsFileOpen: + OstTrace0( TRACE_NORMAL, DUP16_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileOpen" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileOpen" ); break; case EFsFileTemp: + OstTrace0( TRACE_NORMAL, DUP17_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileTemp" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileTemp" ); break; case EFsFileUnLock: + OstTrace0( TRACE_NORMAL, DUP18_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileUnLock" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileUnLock" ); break; case EFsFileSetSize: + OstTrace0( TRACE_NORMAL, DUP19_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetSize" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetSize" ); break; case EFsFileSetModified: + OstTrace0( TRACE_NORMAL, DUP20_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetModified" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSetModified" ); break; case EFsFileDrive: + OstTrace0( TRACE_NORMAL, DUP21_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileDrive" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileDrive" ); break; case EFsReplace: + OstTrace0( TRACE_NORMAL, DUP22_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsReplace" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsReplace" ); break; case EFsFileSubClose: + OstTrace0( TRACE_NORMAL, DUP23_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSubClose" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSubClose" ); break; case EFsFileRead: + OstTrace0( TRACE_NORMAL, DUP24_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileRead" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileRead" ); break; case EFsFileSeek: + OstTrace0( TRACE_NORMAL, DUP25_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSeek" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSeek" ); break; case EFsFileAtt: + OstTrace0( TRACE_NORMAL, DUP26_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileAtt" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileAtt" ); break; case EFsFileSet: + OstTrace0( TRACE_NORMAL, DUP27_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSet" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileSet" ); break; case EFsFileName: + OstTrace0( TRACE_NORMAL, DUP28_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileName" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsFileName" ); break; case EFsDirOpen: + OstTrace0( TRACE_NORMAL, DUP29_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS, "CFastFindFileServerPlugin::PrintDebugEvents() - EFsDirOpen" ); WRITELOG( "CFastFindFileServerPlugin::PrintDebugEvents() - EFsDirOpen" ); break; default: diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/fastfindfileserverplugin/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/fastfindfileserverplugin/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/fastfindfileserverplugin/traces/fastfindfileserverpluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/fastfindfileserverplugin/traces/fastfindfileserverpluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,165 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __FASTFINDFILESERVERPLUGINTRACES_H__ +#define __FASTFINDFILESERVERPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2001f6fa + +#define CFASTFINDFILESERVERPLUGIN_CFASTFINDFILESERVERPLUGIN 0x860001 +#define DUP1_CFASTFINDFILESERVERPLUGIN_CFASTFINDFILESERVERPLUGIN 0x860002 +#define CFASTFINDFILESERVERPLUGIN_NEWL 0x860003 +#define CFASTFINDFILESERVERPLUGIN_INITIALISEL 0x860004 +#define CFASTFINDFILESERVERPLUGIN_ENABLEL 0x860005 +#define CFASTFINDFILESERVERPLUGIN_DISABLEL 0x860006 +#define CFASTFINDFILESERVERPLUGIN_ADDCONNECTION 0x860007 +#define CFASTFINDFILESERVERPLUGIN_REMOVECONNECTION 0x860008 +#define DUP1_CFASTFINDFILESERVERPLUGIN_REMOVECONNECTION 0x860009 +#define CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86000a +#define DUP1_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86000b +#define DUP2_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86000c +#define DUP3_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86000d +#define DUP4_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86000e +#define DUP5_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86000f +#define DUP6_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860010 +#define DUP7_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860011 +#define DUP8_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860012 +#define DUP9_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860013 +#define DUP10_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860014 +#define DUP11_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860015 +#define DUP12_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860016 +#define DUP13_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860017 +#define DUP14_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860018 +#define DUP15_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860019 +#define DUP16_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86001a +#define DUP17_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86001b +#define DUP18_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86001c +#define DUP19_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86001d +#define DUP20_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86001e +#define DUP21_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x86001f +#define DUP22_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860020 +#define DUP23_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860021 +#define DUP24_CFASTFINDFILESERVERPLUGIN_DOREQUESTL 0x860022 +#define CFASTFINDFILESERVERPLUGINCONN_NEWL 0x860023 +#define CFASTFINDFILESERVERPLUGINCONN_CFASTFINDFILESERVERPLUGINCONN 0x860024 +#define DUP1_CFASTFINDFILESERVERPLUGINCONN_CFASTFINDFILESERVERPLUGINCONN 0x860025 +#define CFASTFINDFILESERVERPLUGINCONN_DOCONTROL 0x860026 +#define DUP1_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL 0x860027 +#define DUP2_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL 0x860028 +#define DUP3_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL 0x860029 +#define CFASTFINDFILESERVERPLUGINCONN_DOREQUEST 0x86002a +#define DUP1_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST 0x86002b +#define DUP2_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST 0x86002c +#define DUP3_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST 0x86002d +#define DUP4_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST 0x86002e +#define CFASTFINDFILESERVERPLUGINCONN_DOCANCEL 0x86002f +#define CFASTFINDFILESERVERPLUGIN_NEWPLUGINCONNL 0x860030 +#define CFASTFINDFILESERVERPLUGIN_REGISTERNOTIFICATION 0x860031 +#define DUP1_CFASTFINDFILESERVERPLUGIN_REGISTERNOTIFICATION 0x860032 +#define CFASTFINDFILESERVERPLUGIN_ADDNOTIFICATIONPATH 0x860033 +#define DUP1_CFASTFINDFILESERVERPLUGIN_ADDNOTIFICATIONPATH 0x860034 +#define CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH 0x860035 +#define CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH 0x860036 +#define CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH 0x860037 +#define CFASTFINDFILESERVERPLUGINFACTORY_CFASTFINDFILESERVERPLUGINFACTORY 0x860038 +#define CFASTFINDFILESERVERPLUGINFACTORY_INSTALL 0x860039 +#define CFASTFINDFILESERVERPLUGINFACTORY_UNIQUEPOSITION 0x86003a +#define CFASTFINDFILESERVERPLUGINFACTORY_NEWPLUGINL 0x86003b +#define DUP1_CFASTFINDFILESERVERPLUGINFACTORY_NEWPLUGINL 0x86003c +#define CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86003d +#define DUP1_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86003e +#define DUP2_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86003f +#define DUP3_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860040 +#define DUP4_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860041 +#define DUP5_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860042 +#define DUP6_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860043 +#define DUP7_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860044 +#define DUP8_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860045 +#define DUP9_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860046 +#define DUP10_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860047 +#define DUP11_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860048 +#define DUP12_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860049 +#define DUP13_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86004a +#define DUP14_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86004b +#define DUP15_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86004c +#define DUP16_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86004d +#define DUP17_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86004e +#define DUP18_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86004f +#define DUP19_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860050 +#define DUP20_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860051 +#define DUP21_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860052 +#define DUP22_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860053 +#define DUP23_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860054 +#define DUP24_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860055 +#define DUP25_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860056 +#define DUP26_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860057 +#define DUP27_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860058 +#define DUP28_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x860059 +#define DUP29_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS 0x86005a +#define CFASTFINDFILESERVERPLUGIN_DOREQUESTL_ENTRY 0x8a0001 +#define CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a0002 +#define DUP1_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a0003 +#define DUP2_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a0004 +#define DUP3_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a0005 +#define DUP4_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a0006 +#define DUP5_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a0007 +#define DUP6_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a0008 +#define DUP7_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a0009 +#define DUP8_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a000a +#define DUP9_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT 0x8a000b +#define CFASTFINDFILESERVERPLUGINCONN_DOREQUEST_ENTRY 0x8a000c +#define CFASTFINDFILESERVERPLUGINCONN_DOREQUEST_EXIT 0x8a000d +#define CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_ENTRY 0x8a000e +#define CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_EXIT 0x8a000f +#define DUP1_CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_EXIT 0x8a0010 +#define CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_ENTRY 0x8a0011 +#define CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT 0x8a0012 +#define DUP1_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT 0x8a0013 +#define DUP2_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT 0x8a0014 +#define CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_ENTRY 0x8a0015 +#define CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_EXIT 0x8a0016 +#define DUP1_CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_EXIT 0x8a0017 + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC16& aParam1 ) + { + TBool retval; + TInt size = aParam1.Size(); + // BTrace assumes that parameter size is atleast 4 bytes + if (size % 4 == 0) + { + TUint8* ptr = ( TUint8* )aParam1.Ptr(); + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + else + { + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + if (size > KOstMaxDataLength) + { + size = KOstMaxDataLength; + } + TInt sizeAligned = ( size + 3 ) & ~3; + memcpy( ptr, aParam1.Ptr(), size ); + ptr += size; + // Fillers are written to get 32-bit alignment + while ( size++ < sizeAligned ) + { + *ptr++ = 0; + } + ptr -= sizeAligned; + size = sizeAligned; + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + return retval; + } +#endif + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/fastfindfileserverplugin/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/fastfindfileserverplugin/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,116 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST_ENTRY=0xc +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST_EXIT=0xd +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_ENTRY=0x11 +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT=0x12 +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0x2 +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_ENTRY=0x15 +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_EXIT=0x16 +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_ENTRY=0xe +[TRACE]TRACE_FLOW[0x8A]_CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_EXIT=0xf +[TRACE]TRACE_FLOW[0x8A]_DUP1_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT=0x13 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0x3 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH_EXIT=0x17 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH_EXIT=0x10 +[TRACE]TRACE_FLOW[0x8A]_DUP2_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH_EXIT=0x14 +[TRACE]TRACE_FLOW[0x8A]_DUP2_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0x4 +[TRACE]TRACE_FLOW[0x8A]_DUP3_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0x5 +[TRACE]TRACE_FLOW[0x8A]_DUP4_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0x6 +[TRACE]TRACE_FLOW[0x8A]_DUP5_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0x7 +[TRACE]TRACE_FLOW[0x8A]_DUP6_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0x8 +[TRACE]TRACE_FLOW[0x8A]_DUP7_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0x9 +[TRACE]TRACE_FLOW[0x8A]_DUP8_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0xa +[TRACE]TRACE_FLOW[0x8A]_DUP9_CFASTFINDFILESERVERPLUGIN_DOREQUESTL_EXIT=0xb +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINCONN_CFASTFINDFILESERVERPLUGINCONN=0x24 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINCONN_DOCANCEL=0x2f +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL=0x26 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST=0x2a +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINCONN_NEWL=0x23 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINFACTORY_CFASTFINDFILESERVERPLUGINFACTORY=0x38 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINFACTORY_INSTALL=0x39 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINFACTORY_NEWPLUGINL=0x3b +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGINFACTORY_UNIQUEPOSITION=0x3a +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_ADDCONNECTION=0x7 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_ADDIGNOREPATH=0x36 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_ADDNOTIFICATIONPATH=0x33 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_CFASTFINDFILESERVERPLUGIN=0x1 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_DISABLEL=0x6 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0xa +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_ENABLEL=0x5 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_INITIALISEL=0x4 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_NEWL=0x3 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_NEWPLUGINCONNL=0x30 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x3d +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_REGISTERNOTIFICATION=0x31 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_REMOVECONNECTION=0x8 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_REMOVEIGNOREPATH=0x37 +[TRACE]TRACE_NORMAL[0x86]_CFASTFINDFILESERVERPLUGIN_REMOVENOTIFICATIONPATH=0x35 +[TRACE]TRACE_NORMAL[0x86]_DUP10_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x14 +[TRACE]TRACE_NORMAL[0x86]_DUP10_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x47 +[TRACE]TRACE_NORMAL[0x86]_DUP11_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x15 +[TRACE]TRACE_NORMAL[0x86]_DUP11_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x48 +[TRACE]TRACE_NORMAL[0x86]_DUP12_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x16 +[TRACE]TRACE_NORMAL[0x86]_DUP12_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x49 +[TRACE]TRACE_NORMAL[0x86]_DUP13_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x17 +[TRACE]TRACE_NORMAL[0x86]_DUP13_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x4a +[TRACE]TRACE_NORMAL[0x86]_DUP14_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x18 +[TRACE]TRACE_NORMAL[0x86]_DUP14_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x4b +[TRACE]TRACE_NORMAL[0x86]_DUP15_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x19 +[TRACE]TRACE_NORMAL[0x86]_DUP15_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x4c +[TRACE]TRACE_NORMAL[0x86]_DUP16_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x1a +[TRACE]TRACE_NORMAL[0x86]_DUP16_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x4d +[TRACE]TRACE_NORMAL[0x86]_DUP17_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x1b +[TRACE]TRACE_NORMAL[0x86]_DUP17_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x4e +[TRACE]TRACE_NORMAL[0x86]_DUP18_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x1c +[TRACE]TRACE_NORMAL[0x86]_DUP18_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x4f +[TRACE]TRACE_NORMAL[0x86]_DUP19_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x1d +[TRACE]TRACE_NORMAL[0x86]_DUP19_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x50 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGINCONN_CFASTFINDFILESERVERPLUGINCONN=0x25 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL=0x27 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST=0x2b +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGINFACTORY_NEWPLUGINL=0x3c +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGIN_ADDNOTIFICATIONPATH=0x34 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGIN_CFASTFINDFILESERVERPLUGIN=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x3e +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGIN_REGISTERNOTIFICATION=0x32 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFASTFINDFILESERVERPLUGIN_REMOVECONNECTION=0x9 +[TRACE]TRACE_NORMAL[0x86]_DUP20_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x1e +[TRACE]TRACE_NORMAL[0x86]_DUP20_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x51 +[TRACE]TRACE_NORMAL[0x86]_DUP21_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x1f +[TRACE]TRACE_NORMAL[0x86]_DUP21_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x52 +[TRACE]TRACE_NORMAL[0x86]_DUP22_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x20 +[TRACE]TRACE_NORMAL[0x86]_DUP22_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x53 +[TRACE]TRACE_NORMAL[0x86]_DUP23_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x21 +[TRACE]TRACE_NORMAL[0x86]_DUP23_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x54 +[TRACE]TRACE_NORMAL[0x86]_DUP24_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x22 +[TRACE]TRACE_NORMAL[0x86]_DUP24_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x55 +[TRACE]TRACE_NORMAL[0x86]_DUP25_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x56 +[TRACE]TRACE_NORMAL[0x86]_DUP26_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x57 +[TRACE]TRACE_NORMAL[0x86]_DUP27_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x58 +[TRACE]TRACE_NORMAL[0x86]_DUP28_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x59 +[TRACE]TRACE_NORMAL[0x86]_DUP29_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x5a +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL=0x28 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST=0x2c +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0xc +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x3f +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFASTFINDFILESERVERPLUGINCONN_DOCONTROL=0x29 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST=0x2d +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0xd +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x40 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CFASTFINDFILESERVERPLUGINCONN_DOREQUEST=0x2e +[TRACE]TRACE_NORMAL[0x86]_DUP4_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0xe +[TRACE]TRACE_NORMAL[0x86]_DUP4_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x41 +[TRACE]TRACE_NORMAL[0x86]_DUP5_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0xf +[TRACE]TRACE_NORMAL[0x86]_DUP5_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x42 +[TRACE]TRACE_NORMAL[0x86]_DUP6_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x10 +[TRACE]TRACE_NORMAL[0x86]_DUP6_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x43 +[TRACE]TRACE_NORMAL[0x86]_DUP7_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x11 +[TRACE]TRACE_NORMAL[0x86]_DUP7_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x44 +[TRACE]TRACE_NORMAL[0x86]_DUP8_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x12 +[TRACE]TRACE_NORMAL[0x86]_DUP8_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x45 +[TRACE]TRACE_NORMAL[0x86]_DUP9_CFASTFINDFILESERVERPLUGIN_DOREQUESTL=0x13 +[TRACE]TRACE_NORMAL[0x86]_DUP9_CFASTFINDFILESERVERPLUGIN_PRINTDEBUGEVENTS=0x46 diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/group/fileplugin.mmp --- a/harvesterplugins/file/group/fileplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/group/fileplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -33,7 +33,7 @@ SOURCE cmmcmonitor.cpp USERINCLUDE ../inc -USERINCLUDE ../inc/monitorplugin +USERINCLUDE ../inc/monitorplugin ../traces APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/inc/cfileplugin.h --- a/harvesterplugins/file/inc/cfileplugin.h Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/inc/cfileplugin.h Mon May 03 12:32:15 2010 +0300 @@ -56,11 +56,29 @@ void StartHarvestingL(const TDesC& aQualifiedBaseAppClass); /** - * CreateFileIndexItemL sends a file for indexing + * CreateContentIndexItemL sends a file for indexing contents * @aFilename full path and filename of the file to be indexed * @aActionType action to be taken on the file */ - void CreateFileIndexItemL(const TDesC& aFilename, TCPixActionType aActionType); + void CreateContentIndexItemL(const TDesC& aFilename, TCPixActionType aActionType); + /** + * CreateFolderIndexItemL sends a folder/file for indexing + * @aFilename full path and filename of the file to be indexed + * @aActionType action to be taken on the file + */ + void CreateFolderFileIndexItemL(const TDesC& aFilename, TCPixActionType aActionType, TBool aIsDir = ETrue); +private: + /** + * CreateCpixDocumentL creates a document file + * @aFilePath full path of the file/folder to be indexed + */ + CSearchDocument* CreateCpixDocumentL(const TDesC& aFilePath, TBool aIsDir); + + /** + * IsFileTypeMedia checks for vaild extention type to be indexed + * @aExt file extention + */ + TBool IsFileTypeMedia(const TDesC& aExt); public: // @@ -105,7 +123,7 @@ * @aBaseAppClass return descriptor containing the baseAppClass * returns KErrNone on success or a standard error code */ - static TInt FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass); + static TInt FormBaseAppClass(TDriveNumber aMedia,const TDesC& aGenericAppClass, TDes& aBaseAppClass); /** @@ -113,7 +131,7 @@ * @param aMedia - The drive for which the path should be constructed. * returns pointer to the IndexDb path. */ - HBufC* DatabasePathLC(TDriveNumber aMedia); + HBufC* DatabasePathLC(TDriveNumber aMedia,const TDesC& aPath); protected: CFilePlugin(); @@ -122,6 +140,8 @@ private: // CPix database CCPixIndexer* iIndexer[EDriveZ+1]; // EDriveZ enum value is 25, so add 1. + + CCPixIndexer* iFolderIndexer[EDriveZ+1]; // File system session RFs iFs; @@ -134,8 +154,8 @@ CFileMonitor* iMonitor; // MMC monitor - CMMCMonitor* iMmcMonitor; - + CMMCMonitor* iMmcMonitor; + #ifdef __PERFORMANCE_DATA TTime iStartTime[26];// for the all drives TTime iCompleteTime; diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/inc/cfolderrenamedharvester.h --- a/harvesterplugins/file/inc/cfolderrenamedharvester.h Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/inc/cfolderrenamedharvester.h Mon May 03 12:32:15 2010 +0300 @@ -117,6 +117,8 @@ * @return ETrue, if ready. */ void SetNextRequest( TFileHarvesterState aState ); + + void HandleFolderRenameL(); private: // File plugin for observing diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/inc/monitorplugin/fastfindfileserverpluginclient.h --- a/harvesterplugins/file/inc/monitorplugin/fastfindfileserverpluginclient.h Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/inc/monitorplugin/fastfindfileserverpluginclient.h Mon May 03 12:32:15 2010 +0300 @@ -50,6 +50,8 @@ EFastFindFileDeleted, EFastFindDriveFormatted, EFastFindFileUnknown, + EFastFindDirCreated, + EFastFindDirDeleted, }; typedef TPckgBuf TFastFindFSPStatusPckg; diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/src/cfileharvester.cpp --- a/harvesterplugins/file/src/cfileharvester.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/src/cfileharvester.cpp Mon May 03 12:32:15 2010 +0300 @@ -24,6 +24,11 @@ // For Logging #include "harvesterserverlogger.h" #include "cfileharvester.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cfileharvesterTraces.h" +#endif + // CONSTANTS _LIT( KFileMask, "*.*" ); @@ -67,9 +72,11 @@ iFilePlugin( aFilePlugin ), iFs( aFs ) { + OstTraceFunctionEntry0( CFILEHARVESTER_CFILEHARVESTER_ENTRY ); CPIXLOGSTRING("ENTER CFileHarvester::CFileHarvester"); CActiveScheduler::Add( this ); CPIXLOGSTRING("END CFileHarvester::CFileHarvester"); + OstTraceFunctionExit0( CFILEHARVESTER_CFILEHARVESTER_EXIT ); } @@ -89,6 +96,7 @@ // void CFileHarvester::StartL( const TDriveNumber aDriveNumber ) { + OstTraceFunctionEntry0( CFILEHARVESTER_STARTL_ENTRY ); CPIXLOGSTRING("ENTER CFileHarvester::Start"); TFileName rootPath; @@ -100,6 +108,7 @@ iCurrentHarvestDrive = aDriveNumber; SetNextRequest( EHarvesterStartHarvest ); CPIXLOGSTRING("END CFileHarvester::Start"); + OstTraceFunctionExit0( CFILEHARVESTER_STARTL_EXIT ); } @@ -116,6 +125,7 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathSystem ); AddIgnorePathL( ignorePath ); + OstTraceExt1( TRACE_NORMAL, CFILEHARVESTER_ADDIGNOREPATHSL, "CFileHarvester::AddIgnorePathsL;AddIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath ); ignorePath.Zero(); @@ -125,6 +135,7 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathPrivate ); AddIgnorePathL( ignorePath ); + OstTraceExt1( TRACE_NORMAL, DUP1_CFILEHARVESTER_ADDIGNOREPATHSL, "CFileHarvester::AddIgnorePathsL;AddIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath ); ignorePath.Zero(); @@ -133,6 +144,7 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathMapsCities ); AddIgnorePathL( ignorePath ); + OstTraceExt1( TRACE_NORMAL, DUP2_CFILEHARVESTER_ADDIGNOREPATHSL, "CFileHarvester::AddIgnorePathsL;AddIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileHarvester::AddIgnorePathsL - AddIgnorePath: %S", &ignorePath ); } @@ -150,6 +162,7 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathSystem ); RemoveIgnorePath( ignorePath ); + OstTraceExt1( TRACE_NORMAL, CFILEHARVESTER_REMOVEIGNOREPATHS, "CFileHarvester::RemoveIgnorePaths;RemoveIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath ); ignorePath.Zero(); @@ -159,6 +172,7 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathPrivate ); RemoveIgnorePath( ignorePath ); + OstTraceExt1( TRACE_NORMAL, DUP1_CFILEHARVESTER_REMOVEIGNOREPATHS, "CFileHarvester::RemoveIgnorePaths;RemoveIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath ); ignorePath.Zero(); @@ -167,6 +181,7 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathMapsCities ); RemoveIgnorePath( ignorePath ); + OstTraceExt1( TRACE_NORMAL, DUP2_CFILEHARVESTER_REMOVEIGNOREPATHS, "CFileHarvester::RemoveIgnorePaths;RemoveIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileHarvester::RemoveIgnorePaths - RemoveIgnorePath: %S", &ignorePath ); } @@ -232,6 +247,7 @@ TFileName* tf = iIgnorePaths[i]; if ( tf->Compare(aIgnorePath) == 0 ) { + OstTraceExt1( TRACE_NORMAL, CFILEHARVESTER_REMOVEIGNOREPATH, "CFileHarvester::RemoveIgnorePath;remove path=%S", aIgnorePath ); CPIXLOGSTRING2( "CFileHarvester::RemoveIgnorePath() - remove path: %S", &aIgnorePath ); delete tf; tf = NULL; @@ -269,6 +285,7 @@ tempFileName.LowerCase(); if ( tempFileName.Find(*pathName) != KErrNotFound ) { + OstTrace0( TRACE_NORMAL, CFILEHARVESTER_CHECKPATH, "CFileHarvester::CheckPath() - is ignore path" ); CPIXLOGSTRING( "CFileHarvester::CheckPath() - is ignore path" ); return EFalse; } @@ -284,6 +301,7 @@ // void CFileHarvester::GetNextFolderL() { + OstTraceFunctionEntry0( CFILEHARVESTER_GETNEXTFOLDERL_ENTRY ); CPIXLOGSTRING("ENTER CFileHarvester::GetNextFolderL"); delete iDir; @@ -297,21 +315,25 @@ // if folder is in ignore path then skip it if ( !CheckPath( iDirscan->FullPath() ) ) { + OstTrace0( TRACE_NORMAL, CFILEHARVESTER_GETNEXTFOLDERL, "CFileHarvester::GetNextFolderL - IF EHarvesterStartHarvest" ); CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterStartHarvest"); SetNextRequest( EHarvesterStartHarvest ); } else { + OstTrace0( TRACE_NORMAL, DUP1_CFILEHARVESTER_GETNEXTFOLDERL, "CFileHarvester::GetNextFolderL - IF EHarvesterGetFileId" ); CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterGetFileId"); SetNextRequest( EHarvesterGetFileId ); } } else { + OstTrace0( TRACE_NORMAL, DUP2_CFILEHARVESTER_GETNEXTFOLDERL, "CFileHarvester::GetNextFolderL - IF EHarvesterIdle" ); CPIXLOGSTRING("CFileHarvester::GetNextFolderL - IF EHarvesterIdle"); SetNextRequest( EHarvesterIdleState ); } CPIXLOGSTRING("END CFileHarvester::GetNextFolderL"); + OstTraceFunctionExit0( CFILEHARVESTER_GETNEXTFOLDERL_EXIT ); } @@ -322,6 +344,7 @@ // void CFileHarvester::GetFileIdL() { + OstTraceFunctionEntry0( CFILEHARVESTER_GETFILEIDL_ENTRY ); CPIXLOGSTRING("ENTER CFileHarvester::GetFileId"); if( iCurrentIndex == 0 ) @@ -346,11 +369,21 @@ TEntry aEntry = (*iDir)[iCurrentIndex]; // Check if entry is a hidden or system file // if true -> continue until find something to index or have checked whole directory - if( !aEntry.IsHidden() && !aEntry.IsSystem() && !aEntry.IsDir() ) + // if the entry is a file, index both its filename and contents, for folder index the + // folder name + if( !aEntry.IsHidden() && !aEntry.IsSystem()) { TParse fileParser; fileParser.Set( iDirscan->FullPath(), &(*iDir)[iCurrentIndex].iName, NULL ); - iFilePlugin.CreateFileIndexItemL(fileParser.FullName(), ECPixAddAction); + if(aEntry.IsDir()) + { + iFilePlugin.CreateFolderFileIndexItemL(fileParser.FullName(), ECPixAddAction); + } + else + { + iFilePlugin.CreateContentIndexItemL(fileParser.FullName(), ECPixAddAction); + iFilePlugin.CreateFolderFileIndexItemL(fileParser.FullName(), ECPixAddAction, false); + } // TODO: If this is not TRAPPED, state machine breaks iStepNumber++; } @@ -374,6 +407,7 @@ SetNextRequest( EHarvesterStartHarvest ); } CPIXLOGSTRING("END CFileHarvester::GetFileId"); + OstTraceFunctionExit0( CFILEHARVESTER_GETFILEIDL_EXIT ); } @@ -383,6 +417,7 @@ // void CFileHarvester::DoCancel() { + OstTrace0( TRACE_NORMAL, CFILEHARVESTER_DOCANCEL, "CFileHarvester::DoCancel" ); CPIXLOGSTRING("CFileHarvester::DoCancel"); } @@ -393,6 +428,7 @@ // void CFileHarvester::RunL() { + OstTraceFunctionEntry0( CFILEHARVESTER_RUNL_ENTRY ); CPIXLOGSTRING("ENTER CFileHarvester::RunL"); // Simple Round-Robin scheduling. Deque(); @@ -422,6 +458,7 @@ break; } CPIXLOGSTRING("END CFileHarvester::RunL"); + OstTraceFunctionExit0( CFILEHARVESTER_RUNL_EXIT ); } @@ -431,6 +468,7 @@ // TInt CFileHarvester::RunError(TInt aError) { + OstTrace1( TRACE_NORMAL, CFILEHARVESTER_RUNERROR, "CFileHarvester::RunError;aError=%d", aError ); CPIXLOGSTRING2("CFileHarvester::RunError - aError: %d", aError ); iHarvestState = EHarvesterIdleState; iFilePlugin.HarvestingCompleted(iCurrentHarvestDrive, aError); @@ -444,6 +482,7 @@ // void CFileHarvester::SetNextRequest( TFileHarvesterState aState ) { + OstTrace0( TRACE_NORMAL, CFILEHARVESTER_SETNEXTREQUEST, "CFileHarvester::SetNextRequest" ); CPIXLOGSTRING("CFileHarvester::SetNextRequest"); if ( !IsActive() ) { diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/src/cfilemonitor.cpp --- a/harvesterplugins/file/src/cfilemonitor.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/src/cfilemonitor.cpp Mon May 03 12:32:15 2010 +0300 @@ -22,6 +22,11 @@ #include "cfilemonitor.h" #include "cfolderrenamedharvester.h" #include "harvesterserverlogger.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cfilemonitorTraces.h" +#endif + // ----------------------------------------------------------------------------- // CFileMonitor::NewL @@ -44,10 +49,12 @@ CActive(CActive::EPriorityStandard), iFilePlugin( aFilePlugin ) { + OstTraceFunctionEntry0( CFILEMONITOR_CFILEMONITOR_ENTRY ); CPIXLOGSTRING("ENTER CFileMonitor::CFileMonitor"); CActiveScheduler::Add(this); iFsSession = aFsSession; CPIXLOGSTRING("END CFileMonitor::CFileMonitor"); + OstTraceFunctionExit0( CFILEMONITOR_CFILEMONITOR_EXIT ); } // ----------------------------------------------------------------------------- @@ -79,6 +86,7 @@ // TInt CFileMonitor::RunError( TInt aError ) { + OstTrace1( TRACE_NORMAL, CFILEMONITOR_RUNERROR, "CFileMonitor::RunError;aError=%d", aError ); CPIXLOGSTRING2( "CFileMonitor::RunError %d", aError ); return KErrNone; } @@ -98,6 +106,7 @@ // void CFileMonitor::RunL() { + OstTraceFunctionEntry0( CFILEMONITOR_RUNL_ENTRY ); CPIXLOGSTRING("ENTER CFileMonitor::RunL"); Deque(); CActiveScheduler::Add( this ); @@ -118,15 +127,19 @@ * Rename of whole directory happens as change to every file in dir. * We get an event of every file in dir. */ + OstTrace1( TRACE_NORMAL, DUP1_CFILEMONITOR_RUNL, "CFileMonitor::RunL;status.iFileEventType=%d", status.iFileEventType ); CPIXLOGSTRING2("CFileMonitor::RunL, status.iFileEventType: %i", status.iFileEventType ); switch(status.iFileEventType) { case EFastFindFileCreated: { + OstTraceExt1( TRACE_NORMAL, DUP4_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileCreated old=%S", fileNameOld ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileCreated old = %S", &fileNameOld); + OstTraceExt1( TRACE_NORMAL, DUP2_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileCreated new=%S", fileNameNew ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileCreated new = %S", &fileNameNew); - // File creation (for example over PC suite) gives fileNameOld as the created files, fileNameOld is empty. - iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixAddAction); + // File creation (for example over PC suite) gives fileNameOld as the created files, fileNameOld is empty. + iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixAddAction); + iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixAddAction, false); } break; @@ -142,16 +155,21 @@ // new active object state into the CFileMonitor. User::After(50000); // 0.05 seconds + OstTraceExt1( TRACE_NORMAL, DUP3_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileModified old=%S", fileNameOld ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileModified old = %S", &fileNameOld); + OstTraceExt1( TRACE_NORMAL, DUP5_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileModified new=%S", fileNameNew ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileModified new = %S", &fileNameNew); // File copy, fileNameOld contains the file name, fileNameNew is empty - iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixUpdateAction); + iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixUpdateAction); + iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixUpdateAction, false); } break; case EFastFindFileRenamed: { + OstTraceExt1( TRACE_NORMAL, DUP6_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileRenamed old=%S", fileNameOld ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileRenamed old = %S", &fileNameOld); + OstTraceExt1( TRACE_NORMAL, DUP7_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileRenamed new=%S", fileNameNew ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileRenamed new = %S", &fileNameNew); TEntry entry; if ( iFsSession->Entry( fileNameNew, entry ) == KErrNone ) @@ -160,9 +178,11 @@ { if (fileNameOld.Length()>0 && fileNameOld.Compare(fileNameNew)!=0) { - iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixRemoveAction); + iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction); + iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, false); } - iFilePlugin.CreateFileIndexItemL(fileNameNew, ECPixUpdateAction); + iFilePlugin.CreateContentIndexItemL(fileNameNew, ECPixUpdateAction); + iFilePlugin.CreateFolderFileIndexItemL(fileNameNew, ECPixUpdateAction, false); } else { @@ -174,27 +194,49 @@ case EFastFindFileReplaced: { + OstTraceExt1( TRACE_NORMAL, DUP8_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileReplaced old=%S", fileNameOld ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileReplaced old = %S", &fileNameOld); + OstTraceExt1( TRACE_NORMAL, DUP9_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileReplaced new=%S", fileNameNew ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileReplaced new = %S", &fileNameNew); // File rename (funnily), fileNameOld contains the old file name, fileNameNew the new name if (fileNameOld.Length()>0 && fileNameOld.Compare(fileNameNew)!=0) - iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixRemoveAction); - iFilePlugin.CreateFileIndexItemL(fileNameNew, ECPixUpdateAction); + { + iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction); + iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, false); + } + iFilePlugin.CreateContentIndexItemL(fileNameNew, ECPixUpdateAction); + iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixUpdateAction, false); } break; case EFastFindFileDeleted: { + OstTraceExt1( TRACE_NORMAL, DUP10_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileDeleted old=%S", fileNameOld ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileDeleted old = %S", &fileNameOld); + OstTraceExt1( TRACE_NORMAL, DUP11_CFILEMONITOR_RUNL, "CFileMonitor::RunL;EFastFindFileDeleted new=%S", fileNameNew ); CPIXLOGSTRING2("CFileMonitor::RunL, EFastFindFileDeleted new = %S", &fileNameNew); // File delete, fileNameOld contains the name of the deleted file - iFilePlugin.CreateFileIndexItemL(fileNameOld, ECPixRemoveAction); + iFilePlugin.CreateContentIndexItemL(fileNameOld, ECPixRemoveAction); + iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction, false); } break; + + case EFastFindDirCreated: + { + iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixAddAction); + } + break; + case EFastFindDirDeleted: + { + iFilePlugin.CreateFolderFileIndexItemL(fileNameOld, ECPixRemoveAction); + } + break; default: { + OstTraceExt1( TRACE_NORMAL, DUP12_CFILEMONITOR_RUNL, "CFileMonitor::RunL;unknown event old=%S", fileNameOld ); CPIXLOGSTRING2("CFileMonitor::RunL, unknown event old = %S", &fileNameOld); + OstTraceExt1( TRACE_NORMAL, DUP13_CFILEMONITOR_RUNL, "CFileMonitor::RunL;unknown event new=%S", fileNameNew ); CPIXLOGSTRING2("CFileMonitor::RunL, unknown event new = %S", &fileNameNew); } break; @@ -202,7 +244,8 @@ ResetStatus(); iEngine.RegisterNotification(iPckg, iStatus); CPIXLOGSTRING("END CFileMonitor::RunL"); - SetActive(); + OstTraceFunctionExit0( CFILEMONITOR_RUNL_EXIT ); + SetActive(); } // ----------------------------------------------------------------------------- @@ -211,11 +254,13 @@ // TBool CFileMonitor::StartMonitoring() { - CPIXLOGSTRING("ENTER CFileMonitor::StartMonitoring") + OstTraceFunctionEntry0( CFILEMONITOR_STARTMONITORING_ENTRY ); + CPIXLOGSTRING("ENTER CFileMonitor::StartMonitoring"); if ( !IsActive() ) { - CPIXLOGSTRING("CFileMonitor::StartMonitoring - IF ") + OstTrace0( TRACE_NORMAL, CFILEMONITOR_STARTMONITORING, "CFileMonitor::StartMonitoring - IF" ); + CPIXLOGSTRING("CFileMonitor::StartMonitoring - IF "); iEngine.Enable(); ResetStatus(); iEngine.RegisterNotification( iPckg, iStatus ); @@ -224,6 +269,7 @@ CPIXLOGSTRING("END CFileMonitor::StartMonitoring"); + OstTraceFunctionExit0( CFILEMONITOR_STARTMONITORING_EXIT ); return ETrue; } @@ -233,6 +279,7 @@ // void CFileMonitor::ResetStatus() { + OstTrace0( TRACE_NORMAL, CFILEMONITOR_RESETSTATUS, "CFileMonitor::ResetStatus" ); CPIXLOGSTRING( "CFileMonitor::ResetStatus" ); TFastFindFSPStatus& status = iPckg(); @@ -250,16 +297,21 @@ // TInt CFileMonitor::Initialize() { + OstTraceFunctionEntry0( CFILEMONITOR_INITIALIZE_ENTRY ); CPIXLOGSTRING("ENTER CFileMonitor::Initialize"); TInt err = OpenEngine(); + OstTrace1( TRACE_NORMAL, CFILEMONITOR_INITIALIZE, "CFileMonitor::Initialize;OpenEngine=%d", err ); CPIXLOGSTRING2("CFileMonitor::Initialize - OpenEngine: %i", err ); if ( err != KErrNone ) { + OstTrace0( TRACE_NORMAL, DUP1_CFILEMONITOR_INITIALIZE, "CFileMonitor::Initialize if( err != KErrNone )" ); CPIXLOGSTRING("CFileMonitor::Initialize if( err != KErrNone ) "); + OstTraceFunctionExit0( CFILEMONITOR_INITIALIZE_EXIT ); return err; } CPIXLOGSTRING("END CFileMonitor::Initialize"); + OstTraceFunctionExit0( DUP1_CFILEMONITOR_INITIALIZE_EXIT ); return err; } @@ -298,6 +350,7 @@ notificationPath.Append( chr ); notificationPath.Append( KExcludePathSystem ); iEngine.AddIgnorePath( notificationPath ); + OstTraceExt1( TRACE_NORMAL, CFILEMONITOR_ADDNOTIFICATIONPATHSL, "CFileMonitor::AddNotificationPathsL;AddIgnorePath=%S", notificationPath ); CPIXLOGSTRING2("CFileMonitor::AddNotificationPathsL - AddIgnorePath: %S", ¬ificationPath ); notificationPath.Zero(); @@ -307,6 +360,7 @@ notificationPath.Append( chr ); notificationPath.Append( KExcludePathPrivate ); iEngine.AddIgnorePath( notificationPath ); + OstTraceExt1( TRACE_NORMAL, DUP1_CFILEMONITOR_ADDNOTIFICATIONPATHSL, "CFileMonitor::AddNotificationPathsL;AddIgnorePath=%S", notificationPath ); CPIXLOGSTRING2("CFileMonitor::AddNotificationPathsL - AddIgnorePath: %S", ¬ificationPath ); notificationPath.Zero(); @@ -315,12 +369,14 @@ notificationPath.Append( chr ); notificationPath.Append( KExcludePathMapsCities ); iEngine.AddIgnorePath( notificationPath ); + OstTraceExt1( TRACE_NORMAL, DUP2_CFILEMONITOR_ADDNOTIFICATIONPATHSL, "CFileMonitor::AddNotificationPathsL;AddIgnorePath=%S", notificationPath ); CPIXLOGSTRING2("CFileMonitor::AddNotificationPathsL - AddIgnorePath: %S", ¬ificationPath ); notificationPath.Zero(); User::LeaveIfError( PathInfo::GetRootPath( notificationPath, aDriveNumber ) ); iEngine.AddNotificationPath( notificationPath ); + OstTraceExt1( TRACE_NORMAL, DUP3_CFILEMONITOR_ADDNOTIFICATIONPATHSL, "CFileMonitor::AddNotificationPathsL;AddIgnorePath=%S", notificationPath ); CPIXLOGSTRING2("CFileMonitor::AddNotificationPathsL - AddNotificationPath: %S", ¬ificationPath ); } @@ -337,6 +393,7 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathSystem ); iEngine.RemoveIgnorePath( ignorePath ); + OstTraceExt1( TRACE_NORMAL, CFILEMONITOR_REMOVENOTIFICATIONPATHS, "CFileMonitor::RemoveNotificationPaths;RemoveIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileMonitor::RemoveNotificationPaths - RemoveIgnorePath: %S", &ignorePath ); ignorePath.Zero(); @@ -346,6 +403,7 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathPrivate ); iEngine.RemoveIgnorePath( ignorePath ); + OstTraceExt1( TRACE_NORMAL, DUP1_CFILEMONITOR_REMOVENOTIFICATIONPATHS, "CFileMonitor::RemoveNotificationPaths;RemoveIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileMonitor::RemoveNotificationPaths - RemoveIgnorePath: %S", &ignorePath ); ignorePath.Zero(); @@ -354,12 +412,14 @@ ignorePath.Append( chr ); ignorePath.Append( KExcludePathMapsCities ); iEngine.RemoveIgnorePath( ignorePath ); + OstTraceExt1( TRACE_NORMAL, DUP2_CFILEMONITOR_REMOVENOTIFICATIONPATHS, "CFileMonitor::RemoveNotificationPaths;RemoveIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileMonitor::RemoveNotificationPaths - RemoveIgnorePath: %S", &ignorePath ); ignorePath.Zero(); PathInfo::GetRootPath( ignorePath, aDriveNumber ); iEngine.RemoveNotificationPath( ignorePath ); + OstTraceExt1( TRACE_NORMAL, DUP3_CFILEMONITOR_REMOVENOTIFICATIONPATHS, "CFileMonitor::RemoveNotificationPaths;RemoveIgnorePath=%S", ignorePath ); CPIXLOGSTRING2("CFileMonitor::RemoveNotificationPaths - RemoveNotificationPath: %S", &ignorePath ); } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/src/cfileplugin.cpp --- a/harvesterplugins/file/src/cfileplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/src/cfileplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -30,6 +30,12 @@ #include #include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cfilepluginTraces.h" +#endif + + // local declarations and functions namespace { @@ -37,10 +43,19 @@ _LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\"); _LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); -_LIT(KPathTrailer, "\\root\\file"); -_LIT(KFileBaseAppClassGeneric, ":root file"); +_LIT(KPathFolder, "\\root\\file\\folder"); +_LIT(KPathFileContent, "\\root\\file\\content"); +_LIT(KFileBaseAppClassContent, "root file content"); +_LIT(KFileBaseAppClassFolder, "root file folder"); _LIT(KFilePluginAtSign, "@"); _LIT(KFilePluginColon, ":"); +_LIT(KNameField, "Name"); +_LIT(KExtensionField, "Extension"); +_LIT(KMimeTypeFile, FILE_MIMETYPE); +_LIT(KMimeTypeFolder , FOLDER_MIMETYPE); +_LIT(KMimeTypeField , CPIX_MIMETYPE_FIELD); + +#define CONSTANT_TO_PTR16(ptr, c) TPtrC16 ptr; ptr.Set((const TUint16*)c,User::StringLength(c) ); /** * MapFileToDrive - returns the TDriveNumber that the file is located on. @@ -91,6 +106,34 @@ } // anonymous namespace + +TBool CFilePlugin::IsFileTypeMedia(const TDesC& aExt) + { + + const TText* KMediaExt[] = {_S("txt"),_S("pdf"), _S("jpg"),_S("mp3"), _S("jpeg"), _S("wma"), _S("3gp"), _S("mpg4"), + _S("avi"), _S("jpf"), _S("mbm"), _S("png"), _S("gif"), _S("bmp"), _S("mp4"), _S("mpeg4"), + _S("m4v"), _S("m4a"), _S("3gpp"), _S("3g2"), _S("aac"), _S("amr"), _S("wmv"), _S("divx"), + _S("awb"),_S("mid"), _S("midi"), _S("spmid"), _S("rng"), _S("mxmf"), _S("wav"), + _S("au"), _S("nrt"), _S("mka"),_S("jp2"), _S("j2k"), _S("jpx"), + _S("rm"), _S("rmvb"),_S("ota"), _S("wbmp"), _S("wmf"),_S("otb"), + _S("rv"), _S("mkv"), _S("ra"),_S("tif"), _S("tiff")}; + + const TInt count = sizeof( KMediaExt ) / sizeof( TText* ); + + TBool isValid = false; + + for (TInt i = 0; i < count; i++) + { + CONSTANT_TO_PTR16(type, KMediaExt[i]); + if(!aExt.Compare(type)) + { + isValid = true; + break; + } + } + return isValid; + } + CFilePlugin* CFilePlugin::NewL() { CFilePlugin* instance = CFilePlugin::NewLC(); @@ -111,6 +154,7 @@ for (TInt i=EDriveA; i<=EDriveZ; i++) { iIndexer[i] = NULL; //Initialize to NULL + iFolderIndexer[i] = NULL; } } @@ -138,10 +182,12 @@ { User::LeaveIfError( iFs.Connect() ); TInt err = iFs.AddPlugin(KFastFindFSPluginFile); + OstTrace1( TRACE_NORMAL, CFILEPLUGIN_CONSTRUCTL, "CFilePlugin::ConstructL;iFs.AddPlugin=%d", err ); CPIXLOGSTRING2("CFilePlugin::ConstructL, iFs.AddPlugin: %i", err); if ( err != KErrAlreadyExists ) { err = iFs.MountPlugin(KFastFindFSPluginName); + OstTrace1( TRACE_NORMAL, DUP1_CFILEPLUGIN_CONSTRUCTL, "CFilePlugin::ConstructL;iFs.MountPlugin=%d", err ); CPIXLOGSTRING2("CFilePlugin::ConstructL, iFs.MountPlugin: %i", err); } // check if already up, unload and reload @@ -149,15 +195,19 @@ { // dismount TInt err = iFs.DismountPlugin(KFastFindFSPluginName); + OstTrace1( TRACE_NORMAL, DUP2_CFILEPLUGIN_CONSTRUCTL, "CFilePlugin::ConstructL;iFs.DismountPlugin=%d", err ); CPIXLOGSTRING2("CFilePlugin::ConstructL(), iFs.DismountPlugin: %i", err); err = iFs.RemovePlugin(KFastFindFSPluginName); + OstTrace1( TRACE_NORMAL, DUP3_CFILEPLUGIN_CONSTRUCTL, "CFilePlugin::ConstructL;iFs.RemovePlugin=%d", err ); CPIXLOGSTRING2("CFilePlugin::ConstructL(), iFs.RemovePlugin: %i", err); // if no error reload if ( err == KErrNone ) { err = iFs.AddPlugin(KFastFindFSPluginFile); + OstTrace1( TRACE_NORMAL, DUP4_CFILEPLUGIN_CONSTRUCTL, "CFilePlugin::ConstructL;iFs.AddPlugin=%d", err ); CPIXLOGSTRING2("CFilePlugin::ConstructL, iFs.AddPlugin: %i", err); err = iFs.MountPlugin(KFastFindFSPluginName); + OstTrace1( TRACE_NORMAL, DUP5_CFILEPLUGIN_CONSTRUCTL, "CFilePlugin::ConstructL;iFs.MountPlugin=%d", err ); CPIXLOGSTRING2("CFilePlugin::ConstructL, iFs.MountPlugin: %i", err); } } @@ -174,6 +224,7 @@ if (!iIsMonitorInit) { error = iMonitor->Initialize(); + OstTrace1( TRACE_NORMAL, CFILEPLUGIN_STARTPLUGINL, "CFilePlugin::StartPluginL;Monitor Error=%d", error ); CPIXLOGSTRING2("CFilePlugin::StartMonitoring, error: %i", error ); iIsMonitorInit = ETrue; } @@ -182,11 +233,13 @@ if (error == KErrNone && iIsMonitorInit) { iMonitor->StartMonitoring(); + OstTrace0( TRACE_NORMAL, DUP1_CFILEPLUGIN_STARTPLUGINL, "CFilePlugin::StartMonitoring - iFileMonitor->StartMonitoring " ); CPIXLOGSTRING("CFilePlugin::StartMonitoring - iFileMonitor->StartMonitoring "); } iMmcMonitor->StartMonitoring(); + OstTrace0( TRACE_NORMAL, DUP2_CFILEPLUGIN_STARTPLUGINL, "END CFilePlugin::StartMonitoring" ); CPIXLOGSTRING("END CFilePlugin::StartMonitoring"); // Add harvesters for each non removable drive @@ -215,47 +268,65 @@ void CFilePlugin::MountL(TDriveNumber aMedia, TBool aForceReharvest) { + OstTraceFunctionEntry0( CFILEPLUGIN_MOUNTL_ENTRY ); CPIXLOGSTRING("ENTER CFilePlugin::MountL"); // Check if already exists - if (iIndexer[aMedia]) + if (iIndexer[aMedia] && iFolderIndexer[aMedia]) return; // Add Notifications paths prior to opening IndexDB. AddNotificationPathsL(aMedia); - // Form the baseappclass for this media - TBuf baseAppClass; - FormBaseAppClass(aMedia, baseAppClass); - - // Define this volume - HBufC* path = DatabasePathLC(aMedia); - User::LeaveIfError(iSearchSession.DefineVolume(baseAppClass, *path)); + // Form the baseappclass for folder + TBuf baseFolderAppClass; + FormBaseAppClass(aMedia,KFileBaseAppClassFolder, baseFolderAppClass); + //Form the baseappclass for content + TBuf baseContentAppClass; + FormBaseAppClass(aMedia,KFileBaseAppClassContent, baseContentAppClass); + + // Define volume for folder and content index database + HBufC* path = DatabasePathLC(aMedia,KPathFolder); + User::LeaveIfError(iSearchSession.DefineVolume(baseFolderAppClass, *path)); CleanupStack::PopAndDestroy(path); + HBufC* contentpath = DatabasePathLC(aMedia,KPathFileContent); + User::LeaveIfError(iSearchSession.DefineVolume(baseContentAppClass, *contentpath)); + CleanupStack::PopAndDestroy(contentpath); + // construct and open the database iIndexer[aMedia] = CCPixIndexer::NewL(iSearchSession); - iIndexer[aMedia]->OpenDatabaseL(baseAppClass); + iIndexer[aMedia]->OpenDatabaseL(baseContentAppClass); + + iFolderIndexer[aMedia]= CCPixIndexer::NewL(iSearchSession); + iFolderIndexer[aMedia]->OpenDatabaseL(baseFolderAppClass); // Add to harvesting queue - iObserver->AddHarvestingQueue(this, baseAppClass, aForceReharvest); + iObserver->AddHarvestingQueue(this, baseContentAppClass, aForceReharvest); + CPIXLOGSTRING("END CFilePlugin::MountL"); + OstTraceFunctionExit0( CFILEPLUGIN_MOUNTL_EXIT ); } void CFilePlugin::UnMount(TDriveNumber aMedia, TBool aUndefineAsWell) { + OstTraceFunctionEntry0( CFILEPLUGIN_UNMOUNT_ENTRY ); CPIXLOGSTRING("ENTER CFilePlugin::UnMount "); // Check if already exists - if (!iIndexer[aMedia]) + if (!iIndexer[aMedia] && !iFolderIndexer[aMedia]) { + OstTraceFunctionExit0( CFILEPLUGIN_UNMOUNT_EXIT ); return; } - // Form the baseappclass for this media - TBuf baseAppClass; - FormBaseAppClass(aMedia, baseAppClass); + // Form the baseappclass for folder + TBuf baseFolderAppClass; + FormBaseAppClass(aMedia,KFileBaseAppClassFolder, baseFolderAppClass); + //Form the baseappclass for content + TBuf baseContentAppClass; + FormBaseAppClass(aMedia,KFileBaseAppClassContent, baseContentAppClass); // Remove from harvesting queue - iObserver->RemoveHarvestingQueue(this, baseAppClass); + iObserver->RemoveHarvestingQueue(this, baseContentAppClass); // Delete the index object if (iIndexer[aMedia]) @@ -263,18 +334,26 @@ delete iIndexer[aMedia]; iIndexer[aMedia] = NULL; } - + + if (iFolderIndexer[aMedia]) + { + delete iFolderIndexer[aMedia]; + iFolderIndexer[aMedia] = NULL; + } RemoveNotificationPaths(aMedia); if (aUndefineAsWell) { - iSearchSession.UnDefineVolume(baseAppClass); + iSearchSession.UnDefineVolume(baseFolderAppClass); + iSearchSession.UnDefineVolume(baseContentAppClass); } CPIXLOGSTRING("END CFilePlugin::UnMount "); + OstTraceFunctionExit0( DUP1_CFILEPLUGIN_UNMOUNT_EXIT ); } void CFilePlugin::StartHarvestingL(const TDesC& aQualifiedBaseAppClass) { + OstTraceFunctionEntry0( CFILEPLUGIN_STARTHARVESTINGL_ENTRY ); CPIXLOGSTRING("ENTER CFilePlugin::StartHarvestingL "); // Map base app class to a drive number TDriveNumber drive(EDriveA); //Initialize to get rid of compiler warning. @@ -284,7 +363,7 @@ } // Leave if no indexer for this drive - if (!iIndexer[drive]) + if (!iIndexer[drive] && !iFolderIndexer[drive]) { User::Leave(KErrGeneral); } @@ -294,17 +373,20 @@ #endif // Reset the database iIndexer[drive]->ResetL(); - + iFolderIndexer[drive]->ResetL(); + // Start the actual harvest iHarvester->StartL(drive); CPIXLOGSTRING("END CFilePlugin::StartHarvestingL "); + OstTraceFunctionExit0( CFILEPLUGIN_STARTHARVESTINGL_EXIT ); } -void CFilePlugin::CreateFileIndexItemL(const TDesC& aFilename, TCPixActionType aActionType) +void CFilePlugin::CreateContentIndexItemL(const TDesC& aFilename, TCPixActionType aActionType) { TFileName lowerCaseFilename(aFilename); lowerCaseFilename.LowerCase(); + OstTraceExt2( TRACE_NORMAL, DUP1_CFILEPLUGIN_CREATECONTENTINDEXITEML, "CFilePlugin::CreateContentIndexItemL;lowerCaseFilename=%S;aActionType=%d", lowerCaseFilename, aActionType ); CPIXLOGSTRING3("CFilePlugin::CreateFileIndexItemL lowerCaseFilename = %S aActionType = %d ", &lowerCaseFilename, aActionType); @@ -312,8 +394,10 @@ User::LeaveIfError( MapFileToDrive( lowerCaseFilename, drive ) ); CCPixIndexer* indexer = iIndexer[drive]; + if (!indexer) { + OstTrace0( TRACE_NORMAL, DUP2_CFILEPLUGIN_CREATECONTENTINDEXITEML, "CFilePlugin::CreateFileIndexItemL(): Could not map file to drive." ); CPIXLOGSTRING("CFilePlugin::CreateFileIndexItemL(): Could not map file to drive."); return; } @@ -323,6 +407,7 @@ { #ifdef _DEBUG TRAPD(err, indexer->DeleteL(lowerCaseFilename)); + OstTrace1( TRACE_NORMAL, CFILEPLUGIN_CREATECONTENTINDEXITEML, "CFilePlugin::CreateContentIndexItemL;DeleteL returned=%d", err ); CPIXLOGSTRING2("CFilePlugin::CreateFileIndexItemL(): DeleteL returned %d.", err); #else TRAP_IGNORE( indexer->DeleteL(lowerCaseFilename) ); @@ -338,6 +423,7 @@ { #ifdef _DEBUG TRAPD(err, indexer->AddL(*index_item)); + OstTrace1( TRACE_NORMAL, DUP3_CFILEPLUGIN_CREATECONTENTINDEXITEML, "CFilePlugin::CreateContentIndexItemL;AddL returned=%d", err ); CPIXLOGSTRING2("CFilePlugin::CreateFileIndexItemL(): AddL returned %d.", err); #else TRAP_IGNORE( indexer->AddL(*index_item) ); @@ -347,51 +433,144 @@ { #ifdef _DEBUG TRAPD(err, indexer->UpdateL(*index_item)); + OstTrace1( TRACE_NORMAL, DUP4_CFILEPLUGIN_CREATECONTENTINDEXITEML, "CFilePlugin::CreateContentIndexItemL;UpdateL returned=%d", err ); CPIXLOGSTRING2("CFilePlugin::CreateFileIndexItemL(): UpdateL returned %d.", err); #else TRAP_IGNORE( indexer->UpdateL(*index_item) ); #endif } CleanupStack::PopAndDestroy(index_item); - } + } + } + +void CFilePlugin::CreateFolderFileIndexItemL(const TDesC& aFilename, TCPixActionType aActionType, TBool aIsDir) + { + CSearchDocument* index_item = NULL; + TBool isMediaFile = false; + TFileName lowerCaseFilename(aFilename); + lowerCaseFilename.LowerCase(); + + // Adding the file entry to folder index,check for file or folder entry, + //if file, extract the extension + if (!aIsDir) + { + TFileName extension; + TInt pos = lowerCaseFilename.LocateReverse('.'); + if (pos > 0) + { + extension.Copy(lowerCaseFilename.Mid(pos+1)); + isMediaFile = IsFileTypeMedia(extension); + } + } + //Check for extension type, if media items do not index them + if(!isMediaFile) + { + OstTraceExt2( TRACE_NORMAL, CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML, "CFilePlugin::CreateFolderFileIndexItemL;lowerCaseFilename=%S;aActionType=%d", lowerCaseFilename, aActionType ); + CPIXLOGSTRING3("CFilePlugin::CreateFolderFileIndexItemL lowerCaseFilename = %S aActionType = %d ", + &lowerCaseFilename, aActionType); + + TDriveNumber drive(EDriveA); + User::LeaveIfError( MapFileToDrive( lowerCaseFilename, drive ) ); + + CCPixIndexer* indexer = iFolderIndexer[drive]; + if (!indexer) + { + OstTrace0( TRACE_NORMAL, DUP1_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML, "CFilePlugin::CreateFolderFileIndexItemL(): Could not map file to drive." ); + CPIXLOGSTRING("CFilePlugin::CreateFolderFileIndexItemL(): Could not map file to drive."); + return; + } + + if (aActionType == ECPixRemoveAction) + { + #ifdef _DEBUG + TRAPD(err, indexer->DeleteL(lowerCaseFilename)); + OstTrace1( TRACE_NORMAL, DUP2_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML, "CFilePlugin::CreateFolderFileIndexItemL;DeleteL returned=%d", err ); + CPIXLOGSTRING2("CFilePlugin::CreateFolderFileIndexItemL(): DeleteL returned %d.", err); + #else + TRAP_IGNORE( indexer->DeleteL(lowerCaseFilename) ); + #endif + } + else + { + index_item = CreateCpixDocumentL(lowerCaseFilename, aIsDir); + + if( aActionType == ECPixAddAction ) + { + #ifdef _DEBUG + TRAPD(err, indexer->AddL(*index_item)); + OstTrace1( TRACE_NORMAL, DUP3_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML, "CFilePlugin::CreateFolderFileIndexItemL;AddL returned=%d", err ); + CPIXLOGSTRING2("CFilePlugin::CreateFolderFileIndexItemL(): AddL returned %d.", err); + #else + TRAP_IGNORE( indexer->AddL(*index_item) ); + #endif + } + else if( aActionType == ECPixUpdateAction ) + { + #ifdef _DEBUG + TRAPD(err, indexer->UpdateL(*index_item)); + OstTrace1( TRACE_NORMAL, DUP4_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML, "CFilePlugin::CreateFolderFileIndexItemL;UpdateL returned=%d", err ); + CPIXLOGSTRING2("CFilePlugin::CreateFolderFileIndexItemL(): UpdateL returned %d.", err); + #else + TRAP_IGNORE( indexer->UpdateL(*index_item) ); + #endif + } + delete index_item; + } + } } void CFilePlugin::HarvestingCompleted(TDriveNumber aDriveNumber, TInt aError) { + OstTraceFunctionEntry0( CFILEPLUGIN_HARVESTINGCOMPLETED_ENTRY ); CPIXLOGSTRING("ENTER CFilePlugin::HarvestingCompleted "); if (iIndexer[aDriveNumber]) { Flush(*iIndexer[aDriveNumber]); } - TBuf baseAppClass; - FormBaseAppClass(TDriveNumber(aDriveNumber), baseAppClass); + if (iFolderIndexer[aDriveNumber]) + { + Flush(*iFolderIndexer[aDriveNumber]); + } + + //Form baseapp class for folder and content database + TBuf baseContentAppClass; + FormBaseAppClass(TDriveNumber(aDriveNumber),KFileBaseAppClassContent, baseContentAppClass); + + iObserver->HarvestingCompleted(this, baseContentAppClass, aError); + #ifdef __PERFORMANCE_DATA TRAP_IGNORE( UpdatePerformaceDataL(aDriveNumber) ); #endif - iObserver->HarvestingCompleted(this, baseAppClass, aError); + CPIXLOGSTRING("END CFilePlugin::HarvestingCompleted "); + OstTraceFunctionExit0( CFILEPLUGIN_HARVESTINGCOMPLETED_EXIT ); } void CFilePlugin::AddNotificationPathsL(const TDriveNumber aDriveNumber) { + OstTraceFunctionEntry0( CFILEPLUGIN_ADDNOTIFICATIONPATHSL_ENTRY ); CPIXLOGSTRING("ENTER CFilePlugin::AddNotificationPathsL "); iMonitor->AddNotificationPathsL(aDriveNumber); iHarvester->AddIgnorePathsL(aDriveNumber); CPIXLOGSTRING("END CFilePlugin::AddNotificationPathsL "); + OstTraceFunctionExit0( CFILEPLUGIN_ADDNOTIFICATIONPATHSL_EXIT ); } void CFilePlugin::RemoveNotificationPaths(const TDriveNumber aDriveNumber) { + OstTraceFunctionEntry0( CFILEPLUGIN_REMOVENOTIFICATIONPATHS_ENTRY ); CPIXLOGSTRING("ENTER CFilePlugin::RemoveNotificationPaths"); iMonitor->RemoveNotificationPaths(aDriveNumber); iHarvester->RemoveIgnorePaths(aDriveNumber); CPIXLOGSTRING("END CFilePlugin::RemoveNotificationPaths"); + OstTraceFunctionExit0( CFILEPLUGIN_REMOVENOTIFICATIONPATHS_EXIT ); } -TInt CFilePlugin::FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass) +TInt CFilePlugin::FormBaseAppClass(TDriveNumber aMedia, const TDesC& aGenericAppClass, TDes& aBaseAppClass) { + OstTraceFunctionEntry0( CFILEPLUGIN_FORMBASEAPPCLASS_ENTRY ); CPIXLOGSTRING("ENTER CFilePlugin::FormBaseAppClass"); TChar chr; const TInt ret = RFs::DriveToChar(aMedia, chr); @@ -400,19 +579,22 @@ aBaseAppClass.Copy(KFilePluginAtSign); aBaseAppClass.Append(chr); aBaseAppClass.LowerCase(); - aBaseAppClass.Append(KFileBaseAppClassGeneric); + aBaseAppClass.Append(KFilePluginColon); + aBaseAppClass.Append(aGenericAppClass); } CPIXLOGSTRING("END CFilePlugin::FormBaseAppClass"); + OstTraceFunctionExit0( CFILEPLUGIN_FORMBASEAPPCLASS_EXIT ); return ret; } -HBufC* CFilePlugin::DatabasePathLC(TDriveNumber aMedia) +HBufC* CFilePlugin::DatabasePathLC(TDriveNumber aMedia,const TDesC& aPath) { + OstTraceFunctionEntry0( CFILEPLUGIN_DATABASEPATHLC_ENTRY ); CPIXLOGSTRING("ENTER CFilePlugin::DatabasePathLC"); // Allocate extra space for root path e.g. "C:\\Private\\2001f6f7\\" const TInt KRootPathMaxLength = 30; - HBufC* indexDbPath = HBufC::NewLC(KRootPathMaxLength + KPathIndexDbPath().Length() + KPathTrailer().Length()); + HBufC* indexDbPath = HBufC::NewLC(KRootPathMaxLength + KPathIndexDbPath().Length() + aPath.Length()); TPtr indexDbPathPtr = indexDbPath->Des(); // Data caging implementation @@ -428,12 +610,53 @@ indexDbPathPtr.Append(KCPixSearchServerPrivateDirectory); indexDbPathPtr.Append(KPathIndexDbPath); - indexDbPathPtr.Append(KPathTrailer); + indexDbPathPtr.Append(aPath); CPIXLOGSTRING("END CFilePlugin::DatabasePathLC"); + OstTraceFunctionExit0( CFILEPLUGIN_DATABASEPATHLC_EXIT ); return indexDbPath; } +CSearchDocument* CFilePlugin::CreateCpixDocumentL(const TDesC& aFilePath, TBool aIsDir) + { + + CSearchDocument* index_item = CSearchDocument::NewLC(aFilePath, KFileBaseAppClassFolder); + + TParse file; + file.Set(aFilePath, NULL, NULL); + + TFileName fileFoldername; + TInt pos = aFilePath.LocateReverse('\\'); + if (pos > 0) + { + fileFoldername.Copy(aFilePath.Mid(pos+1)); + index_item->AddFieldL(KNameField, fileFoldername); + } + + //check for the extension, for folders names store the extension field as NULL + //adding Mimetype and Extension field + if(!aIsDir) + { + if( file.ExtPresent()) + { + TPtrC extension = file.Ext(); + index_item->AddFieldL(KExtensionField, extension); + } + index_item->AddFieldL(KMimeTypeField, KMimeTypeFile, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); + } + else + { + index_item->AddFieldL(KExtensionField, KNullDesC); + index_item->AddFieldL(KMimeTypeField, KMimeTypeFolder, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); + } + + //Add excerpt field + index_item->AddExcerptL(aFilePath); + + CleanupStack::Pop(index_item); + return index_item; + } + #ifdef __PERFORMANCE_DATA void CFilePlugin::UpdatePerformaceDataL(TDriveNumber aDriveNumber) { @@ -446,7 +669,7 @@ RFs fileSession; RFile perfFile; User::LeaveIfError( fileSession.Connect () ); - RFs::DriveToChar((TInt)aDriveNumber, aChar); + RFs::DriveToChar((TInt)aDriveNumber, aChar); /* Open file if it exists, otherwise create it and write content in it */ diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/src/cfolderrenamedharvester.cpp --- a/harvesterplugins/file/src/cfolderrenamedharvester.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/src/cfolderrenamedharvester.cpp Mon May 03 12:32:15 2010 +0300 @@ -26,17 +26,23 @@ #include "cfileplugin.h" #include "cfolderrenamedharvester.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cfolderrenamedharvesterTraces.h" +#endif + // CONSTANTS _LIT( KFileMask, "*.*" ); const TInt KItemsPerRun = 1; + namespace { void AppendBackslash( TDes& aDirectory ) - { + { + const TInt lastChar = aDirectory.Length() - 1; const TChar KBackslashChar( '\\' ); - const TInt lastChar = aDirectory.Length() - 1; // If it is directory which not contain backslash. if ( KBackslashChar != aDirectory[lastChar] ) @@ -45,6 +51,21 @@ } } +void RemoveBackslash( TDes& aDirectory ) + { + const TInt lastChar = aDirectory.Length() - 1; + const TChar KBackslashChar( '\\' ); + + //If directory contains slash at the end + if ( KBackslashChar == aDirectory[lastChar] ) + { + TPtrC temppath( aDirectory.Left( lastChar ) ); + aDirectory.Zero(); + aDirectory.Append(temppath); + } + + } + } // namespace // ============================ MEMBER FUNCTIONS =============================== @@ -149,9 +170,11 @@ iFilePlugin( aFilePlugin ), iFs( aFs ) { + OstTraceFunctionEntry0( CFOLDERRENAMEDHARVESTER_CFOLDERRENAMEDHARVESTER_ENTRY ); CPIXLOGSTRING("ENTER CFolderRenamedHarvester::CFolderRenamedHarvester"); CActiveScheduler::Add( this ); CPIXLOGSTRING("END CFolderRenamedHarvester::CFolderRenamedHarvester"); + OstTraceFunctionExit0( CFOLDERRENAMEDHARVESTER_CFOLDERRENAMEDHARVESTER_EXIT ); } @@ -171,6 +194,7 @@ TBool CFolderRenamedHarvester::StartL( const TFileName& aOldDirectoryName, const TFileName& aNewDirectoryName ) { + OstTraceFunctionEntry0( CFOLDERRENAMEDHARVESTER_STARTL_ENTRY ); CPIXLOGSTRING("ENTER CFolderRenamedHarvester::Start"); // Append trailing backslash if required @@ -184,6 +208,7 @@ SetNextRequest( EFolderRenamedIdleState ); CPIXLOGSTRING("END CFolderRenamedHarvester::Start"); + OstTraceFunctionExit0( CFOLDERRENAMEDHARVESTER_STARTL_EXIT ); return ETrue; } @@ -193,6 +218,7 @@ // void CFolderRenamedHarvester::GetNextFolderL() { + OstTraceFunctionEntry0( CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL_ENTRY ); CPIXLOGSTRING("ENTER CFolderRenamedHarvester::GetNextFolderL"); delete iDir; @@ -203,13 +229,15 @@ if( iDir ) { + OstTrace0( TRACE_NORMAL, CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL, "CFolderRenamedHarvester::GetNextFolderL - IF EHarvesterGetFileId" ); CPIXLOGSTRING("CFolderRenamedHarvester::GetNextFolderL - IF EHarvesterGetFileId"); SetNextRequest( EFolderRenamedGetFileId ); } else { + OstTrace0( TRACE_NORMAL, DUP1_CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL, "CFolderRenamedHarvester::GetNextFolderL - IF EHarvesterIdle" ); CPIXLOGSTRING("CFolderRenamedHarvester::GetNextFolderL - IF EHarvesterIdle"); - + HandleFolderRenameL(); // finished folder rename, delete the folder from the array. CFolderRenamedItem *item = iRenamedFolders[0]; iRenamedFolders.Remove(0); @@ -218,6 +246,7 @@ SetNextRequest( EFolderRenamedIdleState ); } CPIXLOGSTRING("END CFolderRenamedHarvester::GetNextFolderL"); + OstTraceFunctionExit0( CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL_EXIT ); } // --------------------------------------------------------------------------- @@ -227,6 +256,7 @@ // void CFolderRenamedHarvester::GetFileIdL() { + OstTraceFunctionEntry0( CFOLDERRENAMEDHARVESTER_GETFILEIDL_ENTRY ); CPIXLOGSTRING("ENTER CFolderRenamedHarvester::GetFileId"); if( iCurrentIndex == 0 ) @@ -251,7 +281,7 @@ TEntry entry = (*iDir)[iCurrentIndex]; // Check if entry is a hidden or system file // if true -> continue until find something to index or have checked whole directory - if( !entry.IsHidden() && !entry.IsSystem() && !entry.IsDir() ) + if( !entry.IsHidden() && !entry.IsSystem() ) { TParse fileParser; fileParser.Set( iDirscan->FullPath(), &(*iDir)[iCurrentIndex].iName, NULL ); @@ -260,12 +290,22 @@ TPtrC leaf( fileNamePtr.Right( fileNamePtr.Length() - iNewFolderName.Length() ) ); TFileName oldFileName( iOldFolderName ); oldFileName.Append( leaf ); - - iFilePlugin.CreateFileIndexItemL( oldFileName, ECPixRemoveAction ); - iFilePlugin.CreateFileIndexItemL( fileParser.FullName(), ECPixAddAction ); + if(entry.IsDir()) + { + iFilePlugin.CreateFolderFileIndexItemL( oldFileName, ECPixRemoveAction ); + iFilePlugin.CreateFolderFileIndexItemL( fileParser.FullName(), ECPixAddAction ); + } + else + { + iFilePlugin.CreateContentIndexItemL( oldFileName, ECPixRemoveAction ); + iFilePlugin.CreateFolderFileIndexItemL( oldFileName, ECPixRemoveAction, false ); + + iFilePlugin.CreateContentIndexItemL( fileParser.FullName(), ECPixAddAction ); + iFilePlugin.CreateFolderFileIndexItemL( fileParser.FullName(), ECPixAddAction, false ); + } // TODO: If this is not TRAPPED, state machine breaks iStepNumber++; - } + } iCurrentIndex++; } @@ -286,6 +326,7 @@ SetNextRequest( EFolderRenamedStartHarvest ); } CPIXLOGSTRING("END CFolderRenamedHarvester::GetFileId"); + OstTraceFunctionExit0( CFOLDERRENAMEDHARVESTER_GETFILEIDL_EXIT ); } @@ -295,6 +336,7 @@ // void CFolderRenamedHarvester::DoCancel() { + OstTrace0( TRACE_NORMAL, CFOLDERRENAMEDHARVESTER_DOCANCEL, "CFolderRenamedHarvester::DoCancel" ); CPIXLOGSTRING("CFolderRenamedHarvester::DoCancel"); } @@ -304,6 +346,7 @@ // void CFolderRenamedHarvester::RunL() { + OstTraceFunctionEntry0( CFOLDERRENAMEDHARVESTER_RUNL_ENTRY ); CPIXLOGSTRING("ENTER CFolderRenamedHarvester::RunL"); // Simple Round-Robin scheduling. Deque(); @@ -315,6 +358,7 @@ { if ( iRenamedFolders.Count() == 0 ) { + OstTraceFunctionExit0( CFOLDERRENAMEDHARVESTER_RUNL_EXIT ); return; // Nothing to do. } @@ -342,6 +386,7 @@ break; } CPIXLOGSTRING("END CFolderRenamedHarvester::RunL"); + OstTraceFunctionExit0( DUP1_CFOLDERRENAMEDHARVESTER_RUNL_EXIT ); } // ----------------------------------------------------------------------------- @@ -350,6 +395,7 @@ // TInt CFolderRenamedHarvester::RunError(TInt aError) { + OstTrace1( TRACE_NORMAL, CFOLDERRENAMEDHARVESTER_RUNERROR, "CFolderRenamedHarvester::RunError;aError=%d", aError ); CPIXLOGSTRING2("CFolderRenamedHarvester::RunError - aError: %d", aError ); iRenamedFolders.ResetAndDestroy(); iHarvestState = EFolderRenamedIdleState; @@ -363,6 +409,7 @@ // void CFolderRenamedHarvester::SetNextRequest( TFileHarvesterState aState ) { + OstTrace0( TRACE_NORMAL, CFOLDERRENAMEDHARVESTER_SETNEXTREQUEST, "CFolderRenamedHarvester::SetNextRequest" ); CPIXLOGSTRING("CFolderRenamedHarvester::SetNextRequest"); if ( !IsActive() ) { @@ -373,5 +420,11 @@ } } - +void CFolderRenamedHarvester::HandleFolderRenameL() + { + RemoveBackslash(iOldFolderName); + iFilePlugin.CreateFolderFileIndexItemL( iOldFolderName, ECPixRemoveAction ); + RemoveBackslash(iNewFolderName); + iFilePlugin.CreateFolderFileIndexItemL( iNewFolderName, ECPixAddAction ); + } // End of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/src/cmmcmonitor.cpp --- a/harvesterplugins/file/src/cmmcmonitor.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/file/src/cmmcmonitor.cpp Mon May 03 12:32:15 2010 +0300 @@ -26,7 +26,12 @@ #include // TDriveNumber #include // TDriveInfo -#include +#include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cmmcmonitorTraces.h" +#endif + // CONSTANTS // @@ -55,9 +60,11 @@ : CActive( CActive::EPriorityStandard ), iFilePlugin( aFilePlugin ) { + OstTraceFunctionEntry0( CMMCMONITOR_CMMCMONITOR_ENTRY ); CPIXLOGSTRING("ENTER CMMCMonitor::CMMCMonitor"); CActiveScheduler::Add( this ); CPIXLOGSTRING("END CMMCMonitor::CMMCMonitor"); + OstTraceFunctionExit0( CMMCMONITOR_CMMCMONITOR_EXIT ); } @@ -81,23 +88,31 @@ // void CMMCMonitor::ConstructL( RFs* aFsSession ) { + OstTraceFunctionEntry0( CMMCMONITOR_CONSTRUCTL_ENTRY ); CPIXLOGSTRING("ENTER CMMCMonitor::ConstructL Foobar"); iFsSession = aFsSession; TInt error = iProperty.Attach( KPSUidUikon, KUikMMCInserted ); - if ( error != KErrNone ) CPIXLOGSTRING("END CMMCMonitor::Attach to MMCInserted failed"); + if ( error != KErrNone ) + { + OstTrace0( TRACE_NORMAL, CMMCMONITOR_CONSTRUCTL, "END CMMCMonitor::Attach to MMCInserted failed" ); + CPIXLOGSTRING("END CMMCMonitor::Attach to MMCInserted failed"); + } error = iProperty.Get( KPSUidUikon, KUikMMCInserted, iMmcStatus ); if ( error != KErrNone ) { + OstTrace0( TRACE_NORMAL, DUP1_CMMCMONITOR_CONSTRUCTL, "CMMCMonitor::Get MMCInserted failed" ); CPIXLOGSTRING("CMMCMonitor::Get MMCInserted failed"); } else if ( iMmcStatus ) { + OstTrace0( TRACE_NORMAL, DUP2_CMMCMONITOR_CONSTRUCTL, "CMMCMonitor::MMC card is in" ); CPIXLOGSTRING("CMMCMonitor::MMC card is in"); } else { + OstTrace0( TRACE_NORMAL, DUP3_CMMCMONITOR_CONSTRUCTL, "CMMCMonitor::no MMC card" ); CPIXLOGSTRING("CMMCMonitor::no MMC card"); } @@ -106,6 +121,7 @@ // CMMCMonitor::RunL(). // CPIXLOGSTRING("END CMMCMonitor::ConstructL"); + OstTraceFunctionExit0( CMMCMONITOR_CONSTRUCTL_EXIT ); } @@ -115,9 +131,11 @@ // TBool CMMCMonitor::StartMonitoring() { + OstTraceFunctionEntry0( CMMCMONITOR_STARTMONITORING_ENTRY ); CPIXLOGSTRING("ENTER CMMCMonitor::StartMonitoring"); TRAP_IGNORE( RunL() ); // Need to TRAP this rather than use RunError CPIXLOGSTRING("END CMMCMonitor::StartMonitoring"); + OstTraceFunctionExit0( CMMCMONITOR_STARTMONITORING_EXIT ); return ETrue; } @@ -142,6 +160,7 @@ if ( ( drvStatus & DriveInfo::EDriveRemovable ) && ( drvStatus & DriveInfo::EDriveUserVisible ) ) { + OstTrace1( TRACE_NORMAL, CMMCMONITOR_MMCSTATUS, "CMMCMonitor::MmcStatus;Drive Number=%d", aDriveNumber ); CPIXLOGSTRING2("CMMCMonitor::MmcStatus Drive Number %d", aDriveNumber); isMmcPresent = ETrue; } @@ -156,6 +175,7 @@ // TInt CMMCMonitor::RunError( TInt aError ) { + OstTrace1( TRACE_NORMAL, CMMCMONITOR_RUNERROR, "CMMCMonitor::RunError;aError=%d", aError ); CPIXLOGSTRING2("CMMCMonitor::RunError Error:",aError); return KErrNone; } @@ -167,9 +187,11 @@ // void CMMCMonitor::DoCancel() { + OstTraceFunctionEntry0( CMMCMONITOR_DOCANCEL_ENTRY ); CPIXLOGSTRING("ENTER CMMCMonitor::DoCancel"); iProperty.Cancel(); CPIXLOGSTRING("END CMMCMonitor::DoCancel"); + OstTraceFunctionExit0( CMMCMONITOR_DOCANCEL_EXIT ); } @@ -179,6 +201,7 @@ // void CMMCMonitor::RunL() { + OstTraceFunctionEntry0( CMMCMONITOR_RUNL_ENTRY ); CPIXLOGSTRING("ENTER CMMCMonitor::RunL"); iProperty.Subscribe( iStatus ); SetActive(); @@ -186,10 +209,12 @@ if ( iMmcStatus ) { + OstTrace0( TRACE_NORMAL, CMMCMONITOR_RUNL, "CMMCMonitor::MMC card is in" ); CPIXLOGSTRING("CMMCMonitor::MMC card is in"); } else { + OstTrace0( TRACE_NORMAL, DUP1_CMMCMONITOR_RUNL, "CMMCMonitor::no MMC card" ); CPIXLOGSTRING("CMMCMonitor::no MMC card"); } @@ -214,12 +239,14 @@ if ( drvStatus & DriveInfo::EDrivePresent ) { + OstTrace0( TRACE_NORMAL, DUP2_CMMCMONITOR_RUNL, "CMMCMonitor::RunL insert event" ); CPIXLOGSTRING("CMMCMonitor::RunL insert event"); // Mount MMC and force reharvest iFilePlugin.MountL(drv, ETrue); } else { + OstTrace0( TRACE_NORMAL, DUP3_CMMCMONITOR_RUNL, "CMMCMonitor::RunL eject event" ); CPIXLOGSTRING("CMMCMonitor::RunL eject event"); // If the MMC has been ejected, then need to dismount // and undefine the volume @@ -227,6 +254,7 @@ } } CPIXLOGSTRING("END CMMCMonitor::RunL"); + OstTraceFunctionExit0( CMMCMONITOR_RUNL_EXIT ); } // End Of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/traces/cfileharvesterTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/traces/cfileharvesterTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,76 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CFILEHARVESTERTRACES_H__ +#define __CFILEHARVESTERTRACES_H__ + +#define KOstTraceComponentID 0x2001f703 + +#define CFILEHARVESTER_CFILEHARVESTER_ENTRY 0x8a0001 +#define CFILEHARVESTER_CFILEHARVESTER_EXIT 0x8a0002 +#define CFILEHARVESTER_STARTL_ENTRY 0x8a0003 +#define CFILEHARVESTER_STARTL_EXIT 0x8a0004 +#define CFILEHARVESTER_GETNEXTFOLDERL_ENTRY 0x8a0005 +#define CFILEHARVESTER_GETNEXTFOLDERL_EXIT 0x8a0006 +#define CFILEHARVESTER_GETFILEIDL_ENTRY 0x8a0007 +#define CFILEHARVESTER_GETFILEIDL_EXIT 0x8a0008 +#define CFILEHARVESTER_RUNL_ENTRY 0x8a0009 +#define CFILEHARVESTER_RUNL_EXIT 0x8a000a +#define CFILEHARVESTER_ADDIGNOREPATHSL 0x860001 +#define DUP1_CFILEHARVESTER_ADDIGNOREPATHSL 0x860002 +#define DUP2_CFILEHARVESTER_ADDIGNOREPATHSL 0x860003 +#define CFILEHARVESTER_REMOVEIGNOREPATHS 0x860004 +#define DUP1_CFILEHARVESTER_REMOVEIGNOREPATHS 0x860005 +#define DUP2_CFILEHARVESTER_REMOVEIGNOREPATHS 0x860006 +#define CFILEHARVESTER_REMOVEIGNOREPATH 0x860007 +#define CFILEHARVESTER_CHECKPATH 0x860008 +#define CFILEHARVESTER_GETNEXTFOLDERL 0x860009 +#define DUP1_CFILEHARVESTER_GETNEXTFOLDERL 0x86000a +#define DUP2_CFILEHARVESTER_GETNEXTFOLDERL 0x86000b +#define CFILEHARVESTER_DOCANCEL 0x86000c +#define CFILEHARVESTER_RUNERROR 0x86000d +#define CFILEHARVESTER_SETNEXTREQUEST 0x86000e + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC16& aParam1 ) + { + TBool retval; + TInt size = aParam1.Size(); + // BTrace assumes that parameter size is atleast 4 bytes + if (size % 4 == 0) + { + TUint8* ptr = ( TUint8* )aParam1.Ptr(); + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + else + { + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + if (size > KOstMaxDataLength) + { + size = KOstMaxDataLength; + } + TInt sizeAligned = ( size + 3 ) & ~3; + memcpy( ptr, aParam1.Ptr(), size ); + ptr += size; + // Fillers are written to get 32-bit alignment + while ( size++ < sizeAligned ) + { + *ptr++ = 0; + } + ptr -= sizeAligned; + size = sizeAligned; + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + return retval; + } +#endif + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/traces/cfilemonitorTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/traces/cfilemonitorTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,87 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CFILEMONITORTRACES_H__ +#define __CFILEMONITORTRACES_H__ + +#define KOstTraceComponentID 0x2001f703 + +#define CFILEMONITOR_CFILEMONITOR_ENTRY 0x8a000b +#define CFILEMONITOR_CFILEMONITOR_EXIT 0x8a000c +#define CFILEMONITOR_RUNL_ENTRY 0x8a000d +#define CFILEMONITOR_RUNL_EXIT 0x8a000e +#define CFILEMONITOR_STARTMONITORING_ENTRY 0x8a000f +#define CFILEMONITOR_STARTMONITORING_EXIT 0x8a0010 +#define CFILEMONITOR_INITIALIZE_ENTRY 0x8a0011 +#define CFILEMONITOR_INITIALIZE_EXIT 0x8a0012 +#define DUP1_CFILEMONITOR_INITIALIZE_EXIT 0x8a0013 +#define CFILEMONITOR_RUNERROR 0x86000f +#define DUP1_CFILEMONITOR_RUNL 0x860010 +#define DUP4_CFILEMONITOR_RUNL 0x860011 +#define DUP2_CFILEMONITOR_RUNL 0x860012 +#define DUP3_CFILEMONITOR_RUNL 0x860013 +#define DUP5_CFILEMONITOR_RUNL 0x860014 +#define DUP6_CFILEMONITOR_RUNL 0x860015 +#define DUP7_CFILEMONITOR_RUNL 0x860016 +#define DUP8_CFILEMONITOR_RUNL 0x860017 +#define DUP9_CFILEMONITOR_RUNL 0x860018 +#define DUP10_CFILEMONITOR_RUNL 0x860019 +#define DUP11_CFILEMONITOR_RUNL 0x86001a +#define DUP12_CFILEMONITOR_RUNL 0x86001b +#define DUP13_CFILEMONITOR_RUNL 0x86001c +#define CFILEMONITOR_STARTMONITORING 0x86001d +#define CFILEMONITOR_RESETSTATUS 0x86001e +#define CFILEMONITOR_INITIALIZE 0x86001f +#define DUP1_CFILEMONITOR_INITIALIZE 0x860020 +#define CFILEMONITOR_ADDNOTIFICATIONPATHSL 0x860021 +#define DUP1_CFILEMONITOR_ADDNOTIFICATIONPATHSL 0x860022 +#define DUP2_CFILEMONITOR_ADDNOTIFICATIONPATHSL 0x860023 +#define DUP3_CFILEMONITOR_ADDNOTIFICATIONPATHSL 0x860024 +#define CFILEMONITOR_REMOVENOTIFICATIONPATHS 0x860025 +#define DUP1_CFILEMONITOR_REMOVENOTIFICATIONPATHS 0x860026 +#define DUP2_CFILEMONITOR_REMOVENOTIFICATIONPATHS 0x860027 +#define DUP3_CFILEMONITOR_REMOVENOTIFICATIONPATHS 0x860028 + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen1( TUint32 aTraceID, const TDesC16& aParam1 ) + { + TBool retval; + TInt size = aParam1.Size(); + // BTrace assumes that parameter size is atleast 4 bytes + if (size % 4 == 0) + { + TUint8* ptr = ( TUint8* )aParam1.Ptr(); + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + else + { + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + if (size > KOstMaxDataLength) + { + size = KOstMaxDataLength; + } + TInt sizeAligned = ( size + 3 ) & ~3; + memcpy( ptr, aParam1.Ptr(), size ); + ptr += size; + // Fillers are written to get 32-bit alignment + while ( size++ < sizeAligned ) + { + *ptr++ = 0; + } + ptr -= sizeAligned; + size = sizeAligned; + // Data is written directly and length is determined from trace message length + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, size ); + } + return retval; + } +#endif + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/traces/cfilepluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/traces/cfilepluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,165 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CFILEPLUGINTRACES_H__ +#define __CFILEPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2001f703 + +#define CFILEPLUGIN_MOUNTL_ENTRY 0x8a0014 +#define CFILEPLUGIN_MOUNTL_EXIT 0x8a0015 +#define CFILEPLUGIN_UNMOUNT_ENTRY 0x8a0016 +#define CFILEPLUGIN_UNMOUNT_EXIT 0x8a0017 +#define DUP1_CFILEPLUGIN_UNMOUNT_EXIT 0x8a0018 +#define CFILEPLUGIN_STARTHARVESTINGL_ENTRY 0x8a0019 +#define CFILEPLUGIN_STARTHARVESTINGL_EXIT 0x8a001a +#define CFILEPLUGIN_HARVESTINGCOMPLETED_ENTRY 0x8a001b +#define CFILEPLUGIN_HARVESTINGCOMPLETED_EXIT 0x8a001c +#define CFILEPLUGIN_ADDNOTIFICATIONPATHSL_ENTRY 0x8a001d +#define CFILEPLUGIN_ADDNOTIFICATIONPATHSL_EXIT 0x8a001e +#define CFILEPLUGIN_REMOVENOTIFICATIONPATHS_ENTRY 0x8a001f +#define CFILEPLUGIN_REMOVENOTIFICATIONPATHS_EXIT 0x8a0020 +#define CFILEPLUGIN_FORMBASEAPPCLASS_ENTRY 0x8a0021 +#define CFILEPLUGIN_FORMBASEAPPCLASS_EXIT 0x8a0022 +#define CFILEPLUGIN_DATABASEPATHLC_ENTRY 0x8a0023 +#define CFILEPLUGIN_DATABASEPATHLC_EXIT 0x8a0024 +#define CFILEPLUGIN_CONSTRUCTL 0x860029 +#define DUP1_CFILEPLUGIN_CONSTRUCTL 0x86002a +#define DUP2_CFILEPLUGIN_CONSTRUCTL 0x86002b +#define DUP3_CFILEPLUGIN_CONSTRUCTL 0x86002c +#define DUP4_CFILEPLUGIN_CONSTRUCTL 0x86002d +#define DUP5_CFILEPLUGIN_CONSTRUCTL 0x86002e +#define CFILEPLUGIN_STARTPLUGINL 0x86002f +#define DUP1_CFILEPLUGIN_STARTPLUGINL 0x860030 +#define DUP2_CFILEPLUGIN_STARTPLUGINL 0x860031 +#define DUP1_CFILEPLUGIN_CREATECONTENTINDEXITEML 0x860032 +#define DUP2_CFILEPLUGIN_CREATECONTENTINDEXITEML 0x860033 +#define CFILEPLUGIN_CREATECONTENTINDEXITEML 0x860034 +#define DUP3_CFILEPLUGIN_CREATECONTENTINDEXITEML 0x860035 +#define DUP4_CFILEPLUGIN_CREATECONTENTINDEXITEML 0x860036 +#define CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML 0x860037 +#define DUP1_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML 0x860038 +#define DUP2_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML 0x860039 +#define DUP3_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML 0x86003a +#define DUP4_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML 0x86003b + + +#ifndef __KERNEL_MODE__ +inline TBool OstTraceGen2( TUint32 aTraceID, const TDesC16& aParam1, TInt aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TInt length = 0; + // Check that parameter lenght is not too long + TInt length1 = aParam1.Size(); + if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned1 = ( length1 + 3 ) & ~3; + if (lengthAligned1 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned1; + } + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + // Set length to zero and calculate it againg + // when adding parameters + length = 0; + if (length1 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam1.Ptr(), length1 ); + ptr += length1; + // Fillers are written to get 32-bit alignment + while ( length1++ < lengthAligned1 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned1; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + // Check that there are enough space to next parameter + if ((length + sizeof ( TInt )) <= KOstMaxDataLength) + { + *( ( TInt* )ptr ) = aParam2; + ptr += sizeof ( TInt ); + length += sizeof ( TInt ); + } + ptr -= length; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); + } + return retval; + } + +inline TBool OstTraceGen2( TUint32 aTraceID, const TDesC16& aParam1, TInt32 aParam2 ) + { + TBool retval = BTraceFiltered8( EXTRACT_GROUP_ID(aTraceID), EOstTraceActivationQuery, KOstTraceComponentID, aTraceID ); + if ( retval ) + { + TInt length = 0; + // Check that parameter lenght is not too long + TInt length1 = aParam1.Size(); + if ((length + length1 + sizeof ( TUint32 )) > KOstMaxDataLength) + { + length1 = KOstMaxDataLength - (length + sizeof ( TUint32 )); + } + TInt lengthAligned1 = ( length1 + 3 ) & ~3; + if (lengthAligned1 > 0) + { + length = length + sizeof ( TUint32 ) + lengthAligned1; + } + TUint8 data[ KOstMaxDataLength ]; + TUint8* ptr = data; + // Set length to zero and calculate it againg + // when adding parameters + length = 0; + if (length1 > 0) + { + // Number of elements is written before data + // In case of Unicode string, number of elements is half of length + *( ( TUint32* )ptr ) = length1 / (aParam1.Size() / aParam1.Length()); + ptr += sizeof ( TUint32 ); + memcpy( ptr, aParam1.Ptr(), length1 ); + ptr += length1; + // Fillers are written to get 32-bit alignment + while ( length1++ < lengthAligned1 ) + { + *ptr++ = 0; + } + length += sizeof ( TUint32 ) + lengthAligned1; + } + else if (length + sizeof ( TUint32 ) <= KOstMaxDataLength) + { + *( ( TUint32* )ptr ) = 0; + ptr += sizeof ( TUint32 ); + length += sizeof ( TUint32 ); + } + // Check that there are enough space to next parameter + if ((length + sizeof ( TInt )) <= KOstMaxDataLength) + { + *( ( TInt* )ptr ) = aParam2; + ptr += sizeof ( TInt ); + length += sizeof ( TInt ); + } + ptr -= length; + retval = OstSendNBytes( EXTRACT_GROUP_ID(aTraceID), EOstTrace, KOstTraceComponentID, aTraceID, ptr, length ); + } + return retval; + } +#endif + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/traces/cfolderrenamedharvesterTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/traces/cfolderrenamedharvesterTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,30 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CFOLDERRENAMEDHARVESTERTRACES_H__ +#define __CFOLDERRENAMEDHARVESTERTRACES_H__ + +#define KOstTraceComponentID 0x2001f703 + +#define CFOLDERRENAMEDHARVESTER_CFOLDERRENAMEDHARVESTER_ENTRY 0x8a0025 +#define CFOLDERRENAMEDHARVESTER_CFOLDERRENAMEDHARVESTER_EXIT 0x8a0026 +#define CFOLDERRENAMEDHARVESTER_STARTL_ENTRY 0x8a0027 +#define CFOLDERRENAMEDHARVESTER_STARTL_EXIT 0x8a0028 +#define CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL_ENTRY 0x8a0029 +#define CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL_EXIT 0x8a002a +#define CFOLDERRENAMEDHARVESTER_GETFILEIDL_ENTRY 0x8a002b +#define CFOLDERRENAMEDHARVESTER_GETFILEIDL_EXIT 0x8a002c +#define CFOLDERRENAMEDHARVESTER_RUNL_ENTRY 0x8a002d +#define CFOLDERRENAMEDHARVESTER_RUNL_EXIT 0x8a002e +#define DUP1_CFOLDERRENAMEDHARVESTER_RUNL_EXIT 0x8a002f +#define CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL 0x86003c +#define DUP1_CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL 0x86003d +#define CFOLDERRENAMEDHARVESTER_DOCANCEL 0x86003e +#define CFOLDERRENAMEDHARVESTER_RUNERROR 0x86003f +#define CFOLDERRENAMEDHARVESTER_SETNEXTREQUEST 0x860040 + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/traces/cmmcmonitorTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/traces/cmmcmonitorTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,34 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CMMCMONITORTRACES_H__ +#define __CMMCMONITORTRACES_H__ + +#define KOstTraceComponentID 0x2001f703 + +#define CMMCMONITOR_CMMCMONITOR_ENTRY 0x8a0030 +#define CMMCMONITOR_CMMCMONITOR_EXIT 0x8a0031 +#define CMMCMONITOR_CONSTRUCTL_ENTRY 0x8a0032 +#define CMMCMONITOR_CONSTRUCTL_EXIT 0x8a0033 +#define CMMCMONITOR_STARTMONITORING_ENTRY 0x8a0034 +#define CMMCMONITOR_STARTMONITORING_EXIT 0x8a0035 +#define CMMCMONITOR_DOCANCEL_ENTRY 0x8a0036 +#define CMMCMONITOR_DOCANCEL_EXIT 0x8a0037 +#define CMMCMONITOR_RUNL_ENTRY 0x8a0038 +#define CMMCMONITOR_RUNL_EXIT 0x8a0039 +#define CMMCMONITOR_CONSTRUCTL 0x860041 +#define DUP1_CMMCMONITOR_CONSTRUCTL 0x860042 +#define DUP2_CMMCMONITOR_CONSTRUCTL 0x860043 +#define DUP3_CMMCMONITOR_CONSTRUCTL 0x860044 +#define CMMCMONITOR_MMCSTATUS 0x860045 +#define CMMCMONITOR_RUNERROR 0x860046 +#define CMMCMONITOR_RUNL 0x860047 +#define DUP1_CMMCMONITOR_RUNL 0x860048 +#define DUP2_CMMCMONITOR_RUNL 0x860049 +#define DUP3_CMMCMONITOR_RUNL 0x86004a + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/file/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/file/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,134 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_CFILEHARVESTER_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_CFILEHARVESTER_EXIT=0x2 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_GETFILEIDL_ENTRY=0x7 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_GETFILEIDL_EXIT=0x8 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_GETNEXTFOLDERL_ENTRY=0x5 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_GETNEXTFOLDERL_EXIT=0x6 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_RUNL_ENTRY=0x9 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_RUNL_EXIT=0xa +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_STARTL_ENTRY=0x3 +[TRACE]TRACE_FLOW[0x8A]_CFILEHARVESTER_STARTL_EXIT=0x4 +[TRACE]TRACE_FLOW[0x8A]_CFILEMONITOR_CFILEMONITOR_ENTRY=0xb +[TRACE]TRACE_FLOW[0x8A]_CFILEMONITOR_CFILEMONITOR_EXIT=0xc +[TRACE]TRACE_FLOW[0x8A]_CFILEMONITOR_INITIALIZE_ENTRY=0x11 +[TRACE]TRACE_FLOW[0x8A]_CFILEMONITOR_INITIALIZE_EXIT=0x12 +[TRACE]TRACE_FLOW[0x8A]_CFILEMONITOR_RUNL_ENTRY=0xd +[TRACE]TRACE_FLOW[0x8A]_CFILEMONITOR_RUNL_EXIT=0xe +[TRACE]TRACE_FLOW[0x8A]_CFILEMONITOR_STARTMONITORING_ENTRY=0xf +[TRACE]TRACE_FLOW[0x8A]_CFILEMONITOR_STARTMONITORING_EXIT=0x10 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_ADDNOTIFICATIONPATHSL_ENTRY=0x1d +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_ADDNOTIFICATIONPATHSL_EXIT=0x1e +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_DATABASEPATHLC_ENTRY=0x23 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_DATABASEPATHLC_EXIT=0x24 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_FORMBASEAPPCLASS_ENTRY=0x21 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_FORMBASEAPPCLASS_EXIT=0x22 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_HARVESTINGCOMPLETED_ENTRY=0x1b +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_HARVESTINGCOMPLETED_EXIT=0x1c +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_MOUNTL_ENTRY=0x14 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_MOUNTL_EXIT=0x15 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_REMOVENOTIFICATIONPATHS_ENTRY=0x1f +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_REMOVENOTIFICATIONPATHS_EXIT=0x20 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_STARTHARVESTINGL_ENTRY=0x19 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_STARTHARVESTINGL_EXIT=0x1a +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_UNMOUNT_ENTRY=0x16 +[TRACE]TRACE_FLOW[0x8A]_CFILEPLUGIN_UNMOUNT_EXIT=0x17 +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_CFOLDERRENAMEDHARVESTER_ENTRY=0x25 +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_CFOLDERRENAMEDHARVESTER_EXIT=0x26 +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_GETFILEIDL_ENTRY=0x2b +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_GETFILEIDL_EXIT=0x2c +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL_ENTRY=0x29 +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL_EXIT=0x2a +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_RUNL_ENTRY=0x2d +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_RUNL_EXIT=0x2e +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_STARTL_ENTRY=0x27 +[TRACE]TRACE_FLOW[0x8A]_CFOLDERRENAMEDHARVESTER_STARTL_EXIT=0x28 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_CMMCMONITOR_ENTRY=0x30 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_CMMCMONITOR_EXIT=0x31 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_CONSTRUCTL_ENTRY=0x32 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_CONSTRUCTL_EXIT=0x33 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_DOCANCEL_ENTRY=0x36 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_DOCANCEL_EXIT=0x37 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_RUNL_ENTRY=0x38 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_RUNL_EXIT=0x39 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_STARTMONITORING_ENTRY=0x34 +[TRACE]TRACE_FLOW[0x8A]_CMMCMONITOR_STARTMONITORING_EXIT=0x35 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CFILEMONITOR_INITIALIZE_EXIT=0x13 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CFILEPLUGIN_UNMOUNT_EXIT=0x18 +[TRACE]TRACE_FLOW[0x8A]_DUP1_CFOLDERRENAMEDHARVESTER_RUNL_EXIT=0x2f +[TRACE]TRACE_NORMAL[0x86]_CFILEHARVESTER_ADDIGNOREPATHSL=0x1 +[TRACE]TRACE_NORMAL[0x86]_CFILEHARVESTER_CHECKPATH=0x8 +[TRACE]TRACE_NORMAL[0x86]_CFILEHARVESTER_DOCANCEL=0xc +[TRACE]TRACE_NORMAL[0x86]_CFILEHARVESTER_GETNEXTFOLDERL=0x9 +[TRACE]TRACE_NORMAL[0x86]_CFILEHARVESTER_REMOVEIGNOREPATH=0x7 +[TRACE]TRACE_NORMAL[0x86]_CFILEHARVESTER_REMOVEIGNOREPATHS=0x4 +[TRACE]TRACE_NORMAL[0x86]_CFILEHARVESTER_RUNERROR=0xd +[TRACE]TRACE_NORMAL[0x86]_CFILEHARVESTER_SETNEXTREQUEST=0xe +[TRACE]TRACE_NORMAL[0x86]_CFILEMONITOR_ADDNOTIFICATIONPATHSL=0x21 +[TRACE]TRACE_NORMAL[0x86]_CFILEMONITOR_INITIALIZE=0x1f +[TRACE]TRACE_NORMAL[0x86]_CFILEMONITOR_REMOVENOTIFICATIONPATHS=0x25 +[TRACE]TRACE_NORMAL[0x86]_CFILEMONITOR_RESETSTATUS=0x1e +[TRACE]TRACE_NORMAL[0x86]_CFILEMONITOR_RUNERROR=0xf +[TRACE]TRACE_NORMAL[0x86]_CFILEMONITOR_STARTMONITORING=0x1d +[TRACE]TRACE_NORMAL[0x86]_CFILEPLUGIN_CONSTRUCTL=0x29 +[TRACE]TRACE_NORMAL[0x86]_CFILEPLUGIN_CREATECONTENTINDEXITEML=0x34 +[TRACE]TRACE_NORMAL[0x86]_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML=0x37 +[TRACE]TRACE_NORMAL[0x86]_CFILEPLUGIN_STARTPLUGINL=0x2f +[TRACE]TRACE_NORMAL[0x86]_CFOLDERRENAMEDHARVESTER_DOCANCEL=0x3e +[TRACE]TRACE_NORMAL[0x86]_CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL=0x3c +[TRACE]TRACE_NORMAL[0x86]_CFOLDERRENAMEDHARVESTER_RUNERROR=0x3f +[TRACE]TRACE_NORMAL[0x86]_CFOLDERRENAMEDHARVESTER_SETNEXTREQUEST=0x40 +[TRACE]TRACE_NORMAL[0x86]_CMMCMONITOR_CONSTRUCTL=0x41 +[TRACE]TRACE_NORMAL[0x86]_CMMCMONITOR_MMCSTATUS=0x45 +[TRACE]TRACE_NORMAL[0x86]_CMMCMONITOR_RUNERROR=0x46 +[TRACE]TRACE_NORMAL[0x86]_CMMCMONITOR_RUNL=0x47 +[TRACE]TRACE_NORMAL[0x86]_DUP10_CFILEMONITOR_RUNL=0x19 +[TRACE]TRACE_NORMAL[0x86]_DUP11_CFILEMONITOR_RUNL=0x1a +[TRACE]TRACE_NORMAL[0x86]_DUP12_CFILEMONITOR_RUNL=0x1b +[TRACE]TRACE_NORMAL[0x86]_DUP13_CFILEMONITOR_RUNL=0x1c +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEHARVESTER_ADDIGNOREPATHSL=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEHARVESTER_GETNEXTFOLDERL=0xa +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEHARVESTER_REMOVEIGNOREPATHS=0x5 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEMONITOR_ADDNOTIFICATIONPATHSL=0x22 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEMONITOR_INITIALIZE=0x20 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEMONITOR_REMOVENOTIFICATIONPATHS=0x26 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEMONITOR_RUNL=0x10 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEPLUGIN_CONSTRUCTL=0x2a +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEPLUGIN_CREATECONTENTINDEXITEML=0x32 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML=0x38 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFILEPLUGIN_STARTPLUGINL=0x30 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CFOLDERRENAMEDHARVESTER_GETNEXTFOLDERL=0x3d +[TRACE]TRACE_NORMAL[0x86]_DUP1_CMMCMONITOR_CONSTRUCTL=0x42 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CMMCMONITOR_RUNL=0x48 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEHARVESTER_ADDIGNOREPATHSL=0x3 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEHARVESTER_GETNEXTFOLDERL=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEHARVESTER_REMOVEIGNOREPATHS=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEMONITOR_ADDNOTIFICATIONPATHSL=0x23 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEMONITOR_REMOVENOTIFICATIONPATHS=0x27 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEMONITOR_RUNL=0x12 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEPLUGIN_CONSTRUCTL=0x2b +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEPLUGIN_CREATECONTENTINDEXITEML=0x33 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML=0x39 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CFILEPLUGIN_STARTPLUGINL=0x31 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CMMCMONITOR_CONSTRUCTL=0x43 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CMMCMONITOR_RUNL=0x49 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFILEMONITOR_ADDNOTIFICATIONPATHSL=0x24 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFILEMONITOR_REMOVENOTIFICATIONPATHS=0x28 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFILEMONITOR_RUNL=0x13 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFILEPLUGIN_CONSTRUCTL=0x2c +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFILEPLUGIN_CREATECONTENTINDEXITEML=0x35 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML=0x3a +[TRACE]TRACE_NORMAL[0x86]_DUP3_CMMCMONITOR_CONSTRUCTL=0x44 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CMMCMONITOR_RUNL=0x4a +[TRACE]TRACE_NORMAL[0x86]_DUP4_CFILEMONITOR_RUNL=0x11 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CFILEPLUGIN_CONSTRUCTL=0x2d +[TRACE]TRACE_NORMAL[0x86]_DUP4_CFILEPLUGIN_CREATECONTENTINDEXITEML=0x36 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CFILEPLUGIN_CREATEFOLDERFILEINDEXITEML=0x3b +[TRACE]TRACE_NORMAL[0x86]_DUP5_CFILEMONITOR_RUNL=0x14 +[TRACE]TRACE_NORMAL[0x86]_DUP5_CFILEPLUGIN_CONSTRUCTL=0x2e +[TRACE]TRACE_NORMAL[0x86]_DUP6_CFILEMONITOR_RUNL=0x15 +[TRACE]TRACE_NORMAL[0x86]_DUP7_CFILEMONITOR_RUNL=0x16 +[TRACE]TRACE_NORMAL[0x86]_DUP8_CFILEMONITOR_RUNL=0x17 +[TRACE]TRACE_NORMAL[0x86]_DUP9_CFILEMONITOR_RUNL=0x18 diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/audio/data/20029ab9.rss --- a/harvesterplugins/media/audio/data/20029ab9.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/audio/data/20029ab9.rss Mon May 03 12:32:15 2010 +0300 @@ -36,7 +36,7 @@ { implementation_uid = 0x20029AB9; version_no = 1; - display_name = "Media harvester plugin"; + display_name = "Audios"; default_data = "Media"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/audio/group/audioplugin.mmp --- a/harvesterplugins/media/audio/group/audioplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/audio/group/audioplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -31,7 +31,7 @@ SOURCE tproxy.cpp USERINCLUDE ../inc -USERINCLUDE ../../mediautils/inc +USERINCLUDE ../../mediautils/inc ../traces APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp --- a/harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp Mon May 03 12:32:15 2010 +0300 @@ -23,6 +23,11 @@ #include #include #include "harvesterserverlogger.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cpixmediaaudiodocTraces.h" +#endif + // ----------------------------------------------------------------------------- // CCPIXDocFetcher::NewL() @@ -83,6 +88,7 @@ const TDesC& aAppClass, CMdEObjectDef& aObjectDef) { + OstTraceFunctionEntry0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_ENTRY ); CPIXLOGSTRING("START CCPIXMediaAudioDoc::GetCpixDocumentL"); //Get basic document CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef); @@ -134,6 +140,7 @@ textProperty->Value()); } CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL"); + OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT ); return index_item; } //End of life diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/audio/src/mediaplugin.cpp --- a/harvesterplugins/media/audio/src/mediaplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/audio/src/mediaplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -33,6 +33,11 @@ #include "mmcmonitor.h" #include "cpixmdedbmanager.h" #include "mdsitementity.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "mediapluginTraces.h" +#endif + //Constants _LIT(KPathTrailer, "\\root\\media\\audio"); @@ -98,6 +103,7 @@ // ----------------------------------------------------------------------------- void CAudioPlugin::StartPluginL() { + OstTraceFunctionEntry0( CAUDIOPLUGIN_STARTPLUGINL_ENTRY ); CPIXLOGSTRING("CAudioPlugin::StartPluginL"); // Define this base application class, use default location iIndexerUtil = CCPixIndexerUtils::NewL(iSearchSession); @@ -122,6 +128,7 @@ TUid uidOfPlugin = {0x20029AB9}; iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin); iMdsItem = CMDSEntity::NewL(); + OstTraceFunctionExit0( CAUDIOPLUGIN_STARTPLUGINL_EXIT ); } void CAudioPlugin::HarvestingCompletedL() @@ -134,6 +141,7 @@ // ----------------------------------------------------------------------------- void CAudioPlugin::StartHarvestingL( const TDesC& /*aMedia*/ ) { + OstTraceFunctionEntry0( CAUDIOPLUGIN_STARTHARVESTINGL_ENTRY ); //iIndexer->ResetL();//reset any indexes if exist already CPIXLOGSTRING("CAudioPlugin::StartHarvestingL"); iDBManager->ResetL(); @@ -143,6 +151,7 @@ iStartTime.UniversalTime(); #endif iMdeHarvester->DoHarvesetL(MdeConstants::Audio::KAudioObject);//Start Harvesting + OstTraceFunctionExit0( CAUDIOPLUGIN_STARTHARVESTINGL_EXIT ); } //handle MMC event for the Drive @@ -170,6 +179,7 @@ void CAudioPlugin::HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType) { //Get the object from object utils and get the CPIX document and add delete or update + OstTrace1( TRACE_NORMAL, CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL;aObjId=%d", aObjId ); CPIXLOGSTRING2("CAudioPlugin::HandleMdeItemL(): aObjId = %d ", aObjId ); // creating CSearchDocument object with unique ID for this application TBuf docid_str; @@ -179,6 +189,7 @@ //and we already have in our database just return in case of update move forward if(iDBManager->IsAlreadyExistL(aObjId) && aActionType == ECPixAddAction)//Avoid reharvesting { + OstTrace0( TRACE_NORMAL, DUP1_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL(): Already harvested returning" ); CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Already harvested returning"); return; } @@ -191,6 +202,7 @@ if(!iIndexer) { delete index_item;//Remove + OstTrace0( TRACE_NORMAL, DUP2_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL(): Indexer not found" ); CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Indexer not found"); return; } @@ -200,6 +212,7 @@ #ifdef __PERFORMANCE_DATA ++count; #endif + OstTrace0( TRACE_NORMAL, DUP3_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL(): Indexer found calling AddL" ); CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Indexer found calling AddL"); //First check if it already exist in database TRAPD(err, iIndexer->UpdateL(*index_item)); //Always Update to avoid reharvesting @@ -213,10 +226,12 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->SetDrive(drive); iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP4_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL(): Added." ); CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Added."); } else { + OstTrace1( TRACE_NORMAL, DUP5_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL;Error %d in adding", err ); CPIXLOGSTRING2("CAudioPlugin::HandleMdeItemL(): Error %d in adding.", err); } } @@ -237,6 +252,7 @@ CCPixIndexer *tempIndexer; tempIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber()); tempIndexer->DeleteL(iMdsItem->Uri()); + OstTrace0( TRACE_NORMAL, DUP6_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL(): Deleted existing URI for update" ); CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Deleted existing URI for update"); } TRAPD(error, iIndexer->UpdateL(*index_item)); @@ -248,10 +264,12 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->Set(aObjId,iAudioDocument->GetUri(),drive); iDBManager->UpdateL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP7_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL(): Updated." ); CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Updated."); } else { + OstTrace1( TRACE_NORMAL, DUP8_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL;Error %d in Updating", err ); CPIXLOGSTRING2("CAudioPlugin::HandleMdeItemL(): Error %d in updating.", error); } } @@ -271,6 +289,7 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->SetDrive(drive); iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP9_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL(): Added Item before Update." ); CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Added Item before Update."); } } @@ -293,10 +312,12 @@ TRAPD(err, iIndexer->DeleteL(docid_str));//Delete it if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP10_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL(): Deleted." ); CPIXLOGSTRING("CAudioPlugin::HandleMdeItemL(): Deleted."); } else { + OstTrace1( TRACE_NORMAL, DUP11_CAUDIOPLUGIN_HANDLEMDEITEML, "CAudioPlugin::HandleMdeItemL;Error %d in deleting", err ); CPIXLOGSTRING2("CAudioPlugin::HandleMdeItemL(): Error %d in deleting.", err); } } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/audio/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/audio/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/audio/traces/cpixmediaaudiodocTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/audio/traces/cpixmediaaudiodocTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,16 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CPIXMEDIAAUDIODOCTRACES_H__ +#define __CPIXMEDIAAUDIODOCTRACES_H__ + +#define KOstTraceComponentID 0x20029ab9 + +#define CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_ENTRY 0x8a0001 +#define CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT 0x8a0002 + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/audio/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/audio/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,21 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_FLOW[0x8A]_CAUDIOPLUGIN_STARTHARVESTINGL_ENTRY=0x5 +[TRACE]TRACE_FLOW[0x8A]_CAUDIOPLUGIN_STARTHARVESTINGL_EXIT=0x6 +[TRACE]TRACE_FLOW[0x8A]_CAUDIOPLUGIN_STARTPLUGINL_ENTRY=0x3 +[TRACE]TRACE_FLOW[0x8A]_CAUDIOPLUGIN_STARTPLUGINL_EXIT=0x4 +[TRACE]TRACE_FLOW[0x8A]_CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT=0x2 +[TRACE]TRACE_NORMAL[0x86]_CAUDIOPLUGIN_HANDLEMDEITEML=0x1 +[TRACE]TRACE_NORMAL[0x86]_DUP10_CAUDIOPLUGIN_HANDLEMDEITEML=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP11_CAUDIOPLUGIN_HANDLEMDEITEML=0xc +[TRACE]TRACE_NORMAL[0x86]_DUP1_CAUDIOPLUGIN_HANDLEMDEITEML=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CAUDIOPLUGIN_HANDLEMDEITEML=0x3 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CAUDIOPLUGIN_HANDLEMDEITEML=0x4 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CAUDIOPLUGIN_HANDLEMDEITEML=0x5 +[TRACE]TRACE_NORMAL[0x86]_DUP5_CAUDIOPLUGIN_HANDLEMDEITEML=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP6_CAUDIOPLUGIN_HANDLEMDEITEML=0x7 +[TRACE]TRACE_NORMAL[0x86]_DUP7_CAUDIOPLUGIN_HANDLEMDEITEML=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP8_CAUDIOPLUGIN_HANDLEMDEITEML=0x9 +[TRACE]TRACE_NORMAL[0x86]_DUP9_CAUDIOPLUGIN_HANDLEMDEITEML=0xa diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/audio/traces/mediapluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/audio/traces/mediapluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,30 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __MEDIAPLUGINTRACES_H__ +#define __MEDIAPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x20029ab9 + +#define CAUDIOPLUGIN_STARTPLUGINL_ENTRY 0x8a0003 +#define CAUDIOPLUGIN_STARTPLUGINL_EXIT 0x8a0004 +#define CAUDIOPLUGIN_STARTHARVESTINGL_ENTRY 0x8a0005 +#define CAUDIOPLUGIN_STARTHARVESTINGL_EXIT 0x8a0006 +#define CAUDIOPLUGIN_HANDLEMDEITEML 0x860001 +#define DUP1_CAUDIOPLUGIN_HANDLEMDEITEML 0x860002 +#define DUP2_CAUDIOPLUGIN_HANDLEMDEITEML 0x860003 +#define DUP3_CAUDIOPLUGIN_HANDLEMDEITEML 0x860004 +#define DUP4_CAUDIOPLUGIN_HANDLEMDEITEML 0x860005 +#define DUP5_CAUDIOPLUGIN_HANDLEMDEITEML 0x860006 +#define DUP6_CAUDIOPLUGIN_HANDLEMDEITEML 0x860007 +#define DUP7_CAUDIOPLUGIN_HANDLEMDEITEML 0x860008 +#define DUP8_CAUDIOPLUGIN_HANDLEMDEITEML 0x860009 +#define DUP9_CAUDIOPLUGIN_HANDLEMDEITEML 0x86000a +#define DUP10_CAUDIOPLUGIN_HANDLEMDEITEML 0x86000b +#define DUP11_CAUDIOPLUGIN_HANDLEMDEITEML 0x86000c + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/image/data/20029abb.rss --- a/harvesterplugins/media/image/data/20029abb.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/image/data/20029abb.rss Mon May 03 12:32:15 2010 +0300 @@ -36,7 +36,7 @@ { implementation_uid = 0x20029ABB; version_no = 1; - display_name = "Media harvester Images plugin"; + display_name = "Images"; default_data = "Images"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/image/group/imageplugin.mmp --- a/harvesterplugins/media/image/group/imageplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/image/group/imageplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -32,7 +32,7 @@ SOURCE tproxy.cpp USERINCLUDE ../inc -USERINCLUDE ../../mediautils/inc +USERINCLUDE ../../mediautils/inc ../traces SYSTEMINCLUDE /epoc32/include/ecom APP_LAYER_SYSTEMINCLUDE diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/image/src/cpixmediaimagedoc.cpp --- a/harvesterplugins/media/image/src/cpixmediaimagedoc.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/image/src/cpixmediaimagedoc.cpp Mon May 03 12:32:15 2010 +0300 @@ -23,6 +23,11 @@ #include #include #include "harvesterserverlogger.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cpixmediaimagedocTraces.h" +#endif + _LIT( KFormatDateTime, "%04d-%02d-%02dT%02d:%02d:%02dZ"); // yyyy-mm-ddThh:mm:ssZ @@ -85,6 +90,7 @@ const TDesC& aAppClass, CMdEObjectDef& aObjectDef) { + OstTraceFunctionEntry0( CCPIXMEDIAIMAGEDOC_GETCPIXDOCUMENTL_ENTRY ); //Get basic document CPIXLOGSTRING("START CCPIXMediaImageDoc::GetCpixDocumentL"); CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef); @@ -176,6 +182,7 @@ } */ CPIXLOGSTRING("END CCPIXMediaImageDoc::GetCpixDocumentL"); + OstTraceFunctionExit0( CCPIXMEDIAIMAGEDOC_GETCPIXDOCUMENTL_EXIT ); return index_item; } //End of life diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/image/src/imageplugin.cpp --- a/harvesterplugins/media/image/src/imageplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/image/src/imageplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -31,6 +31,11 @@ #include "mmcmonitor.h" #include "cpixmdedbmanager.h" #include "mdsitementity.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "imagepluginTraces.h" +#endif + //Constants _LIT(KPathTrailer, "\\root\\media\\image"); @@ -96,6 +101,7 @@ // ----------------------------------------------------------------------------- void CImagePlugin::StartPluginL() { + OstTraceFunctionEntry0( CIMAGEPLUGIN_STARTPLUGINL_ENTRY ); CPIXLOGSTRING("CImagePlugin::StartPluginL"); // Define this base application class, use default location iIndexerUtil = CCPixIndexerUtils::NewL(iSearchSession); @@ -120,6 +126,7 @@ TUid uidOfPlugin = {0x20029ABB}; iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin); iMdsItem = CMDSEntity::NewL(); + OstTraceFunctionExit0( CIMAGEPLUGIN_STARTPLUGINL_EXIT ); } void CImagePlugin::HarvestingCompletedL() @@ -132,6 +139,7 @@ // ----------------------------------------------------------------------------- void CImagePlugin::StartHarvestingL( const TDesC& /*aMedia*/ ) { + OstTraceFunctionEntry0( CIMAGEPLUGIN_STARTHARVESTINGL_ENTRY ); //iIndexer->ResetL();//reset any indexes if exist already CPIXLOGSTRING("CImagePlugin::StartHarvestingL"); iDBManager->ResetL(); @@ -141,6 +149,7 @@ iStartTime.UniversalTime(); #endif iMdeHarvester->DoHarvesetL(MdeConstants::Image::KImageObject);//Start Harvesting + OstTraceFunctionExit0( CIMAGEPLUGIN_STARTHARVESTINGL_EXIT ); } //handle MMC event for the Drive @@ -168,6 +177,7 @@ void CImagePlugin::HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType) { //Get the object from object utils and get the CPIX document and add delete or update + OstTrace1( TRACE_NORMAL, CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL;aObjId=%d", aObjId ); CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): aObjId = %d ", aObjId ); // creating CSearchDocument object with unique ID for this application TBuf docid_str; @@ -176,6 +186,7 @@ //The caller should always handle leave of HandleMdeItemL if(iDBManager->IsAlreadyExistL(aObjId) && aActionType == ECPixAddAction)//Avoid reharvesting { + OstTrace0( TRACE_NORMAL, DUP1_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Already harvested returning" ); CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Already harvested returning"); return; } @@ -187,6 +198,7 @@ if(!iIndexer) { delete index_item; + OstTrace0( TRACE_NORMAL, DUP2_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Indexer not found" ); CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Indexer not found"); return; } @@ -196,6 +208,7 @@ #ifdef __PERFORMANCE_DATA ++count; # endif + OstTrace0( TRACE_NORMAL, DUP3_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Indexer found calling AddL" ); CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Indexer found calling AddL"); //First check if it already exist in database TRAPD(err, iIndexer->UpdateL(*index_item)); //Always Update to avoid reharvesting @@ -209,10 +222,12 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->SetDrive(drive); iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP4_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Added." ); CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Added."); } else { + OstTrace1( TRACE_NORMAL, DUP5_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL;Error %d in adding", err ); CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in adding.", err); } } @@ -233,6 +248,7 @@ CCPixIndexer *tempIndexer; tempIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber()); tempIndexer->DeleteL(iMdsItem->Uri()); + OstTrace0( TRACE_NORMAL, DUP6_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Deleted existing URI for update" ); CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Deleted existing URI for update"); } TRAPD(error, iIndexer->UpdateL(*index_item)); @@ -244,10 +260,12 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->Set(aObjId,iImageDocument->GetUri(),drive); iDBManager->UpdateL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP7_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Updated." ); CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Updated."); } else { + OstTrace1( TRACE_NORMAL, DUP8_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL;Error %d in updating", err ); CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in updating.", error); } } @@ -267,6 +285,7 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->SetDrive(drive); iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP9_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Added Item before Update." ); CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Added Item before Update."); } } @@ -291,10 +310,12 @@ TRAPD(err, iIndexer->DeleteL(docid_str));//Delete it if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP10_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL(): Deleted." ); CPIXLOGSTRING("CImagePlugin::HandleMdeItemL(): Deleted."); } else { + OstTrace1( TRACE_NORMAL, DUP11_CIMAGEPLUGIN_HANDLEMDEITEML, "CImagePlugin::HandleMdeItemL;Error %d in deleting", err ); CPIXLOGSTRING2("CImagePlugin::HandleMdeItemL(): Error %d in deleting.", err); } } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/image/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/image/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/image/traces/cpixmediaimagedocTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/image/traces/cpixmediaimagedocTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,16 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CPIXMEDIAIMAGEDOCTRACES_H__ +#define __CPIXMEDIAIMAGEDOCTRACES_H__ + +#define KOstTraceComponentID 0x20029abb + +#define CCPIXMEDIAIMAGEDOC_GETCPIXDOCUMENTL_ENTRY 0x8a0001 +#define CCPIXMEDIAIMAGEDOC_GETCPIXDOCUMENTL_EXIT 0x8a0002 + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/image/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/image/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,21 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_FLOW[0x8A]_CCPIXMEDIAIMAGEDOC_GETCPIXDOCUMENTL_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CCPIXMEDIAIMAGEDOC_GETCPIXDOCUMENTL_EXIT=0x2 +[TRACE]TRACE_FLOW[0x8A]_CIMAGEPLUGIN_STARTHARVESTINGL_ENTRY=0x5 +[TRACE]TRACE_FLOW[0x8A]_CIMAGEPLUGIN_STARTHARVESTINGL_EXIT=0x6 +[TRACE]TRACE_FLOW[0x8A]_CIMAGEPLUGIN_STARTPLUGINL_ENTRY=0x3 +[TRACE]TRACE_FLOW[0x8A]_CIMAGEPLUGIN_STARTPLUGINL_EXIT=0x4 +[TRACE]TRACE_NORMAL[0x86]_CIMAGEPLUGIN_HANDLEMDEITEML=0x1 +[TRACE]TRACE_NORMAL[0x86]_DUP10_CIMAGEPLUGIN_HANDLEMDEITEML=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP11_CIMAGEPLUGIN_HANDLEMDEITEML=0xc +[TRACE]TRACE_NORMAL[0x86]_DUP1_CIMAGEPLUGIN_HANDLEMDEITEML=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CIMAGEPLUGIN_HANDLEMDEITEML=0x3 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CIMAGEPLUGIN_HANDLEMDEITEML=0x4 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CIMAGEPLUGIN_HANDLEMDEITEML=0x5 +[TRACE]TRACE_NORMAL[0x86]_DUP5_CIMAGEPLUGIN_HANDLEMDEITEML=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP6_CIMAGEPLUGIN_HANDLEMDEITEML=0x7 +[TRACE]TRACE_NORMAL[0x86]_DUP7_CIMAGEPLUGIN_HANDLEMDEITEML=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP8_CIMAGEPLUGIN_HANDLEMDEITEML=0x9 +[TRACE]TRACE_NORMAL[0x86]_DUP9_CIMAGEPLUGIN_HANDLEMDEITEML=0xa diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/image/traces/imagepluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/image/traces/imagepluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,30 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __IMAGEPLUGINTRACES_H__ +#define __IMAGEPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x20029abb + +#define CIMAGEPLUGIN_STARTPLUGINL_ENTRY 0x8a0003 +#define CIMAGEPLUGIN_STARTPLUGINL_EXIT 0x8a0004 +#define CIMAGEPLUGIN_STARTHARVESTINGL_ENTRY 0x8a0005 +#define CIMAGEPLUGIN_STARTHARVESTINGL_EXIT 0x8a0006 +#define CIMAGEPLUGIN_HANDLEMDEITEML 0x860001 +#define DUP1_CIMAGEPLUGIN_HANDLEMDEITEML 0x860002 +#define DUP2_CIMAGEPLUGIN_HANDLEMDEITEML 0x860003 +#define DUP3_CIMAGEPLUGIN_HANDLEMDEITEML 0x860004 +#define DUP4_CIMAGEPLUGIN_HANDLEMDEITEML 0x860005 +#define DUP5_CIMAGEPLUGIN_HANDLEMDEITEML 0x860006 +#define DUP6_CIMAGEPLUGIN_HANDLEMDEITEML 0x860007 +#define DUP7_CIMAGEPLUGIN_HANDLEMDEITEML 0x860008 +#define DUP8_CIMAGEPLUGIN_HANDLEMDEITEML 0x860009 +#define DUP9_CIMAGEPLUGIN_HANDLEMDEITEML 0x86000a +#define DUP10_CIMAGEPLUGIN_HANDLEMDEITEML 0x86000b +#define DUP11_CIMAGEPLUGIN_HANDLEMDEITEML 0x86000c + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp --- a/harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/mediautils/src/cpixdocfetcher.cpp Mon May 03 12:32:15 2010 +0300 @@ -102,10 +102,14 @@ { SetAbsoluteURI(aObject.Uri());//Convert URI to absolute path index_item = CSearchDocument::NewLC(GetUri(), aAppClass); + + TInt slashpos = GetUri().LocateReverse('\\'); + + TPtrC name = GetUri().Mid( (slashpos+1) ); //Uri is our Document ID AddFiledtoDocumentL(*index_item, KNameField, //URI as Name field - GetUri()); + name); //Store media ID for client to generate path and launch corresponding Item TBuf mediaBuf; diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/mediautils/src/mmcmonitor.cpp --- a/harvesterplugins/media/mediautils/src/mmcmonitor.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/mediautils/src/mmcmonitor.cpp Mon May 03 12:32:15 2010 +0300 @@ -25,7 +25,7 @@ #include // TDriveNumber #include // TDriveInfo -#include +#include // CONSTANTS // diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/video/data/20029aba.rss --- a/harvesterplugins/media/video/data/20029aba.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/video/data/20029aba.rss Mon May 03 12:32:15 2010 +0300 @@ -36,7 +36,7 @@ { implementation_uid = 0x20029ABA; version_no = 1; - display_name = "Media harvester Video plugin"; + display_name = "Videos"; default_data = "Videos"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/video/group/videoplugin.mmp --- a/harvesterplugins/media/video/group/videoplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/video/group/videoplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -31,7 +31,7 @@ SOURCE cpixmediavideodoc.cpp USERINCLUDE ../inc -USERINCLUDE ../../mediautils/inc +USERINCLUDE ../../mediautils/inc ../traces APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/video/src/cpixmediavideodoc.cpp --- a/harvesterplugins/media/video/src/cpixmediavideodoc.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/video/src/cpixmediavideodoc.cpp Mon May 03 12:32:15 2010 +0300 @@ -23,6 +23,11 @@ #include #include #include "harvesterserverlogger.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cpixmediavideodocTraces.h" +#endif + // ----------------------------------------------------------------------------- // CCPIXDocFetcher::NewL() @@ -83,6 +88,7 @@ const TDesC& aAppClass, CMdEObjectDef& aObjectDef) { + OstTraceFunctionEntry0( CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_ENTRY ); //Get basic document CPIXLOGSTRING("CCPIXMediaVideoDoc::GetCpixDocumentL()"); CSearchDocument* index_item = CCPIXDocFetcher::GetCpixDocumentL(aObject,aAppClass,aObjectDef); @@ -133,6 +139,7 @@ MdeConstants::MediaObject::KCommentProperty, textProperty->Value()); } + OstTraceFunctionExit0( CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_EXIT ); return index_item; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/video/src/videoplugin.cpp --- a/harvesterplugins/media/video/src/videoplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/media/video/src/videoplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -31,6 +31,11 @@ #include "mmcmonitor.h" #include "cpixmdedbmanager.h" #include "mdsitementity.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "videopluginTraces.h" +#endif + //Constants _LIT(KPathTrailer, "\\root\\media\\video"); @@ -76,6 +81,7 @@ void CVideoPlugin::StartPluginL() { + OstTraceFunctionEntry0( CVIDEOPLUGIN_STARTPLUGINL_ENTRY ); //Define the basic application class CPIXLOGSTRING("CVideoPlugin::StartPluginL"); iIndexerUtil = CCPixIndexerUtils::NewL( iSearchSession ); @@ -99,10 +105,12 @@ TUid uidOfPlugin = {0x20029ABA}; iDBManager = CCPIXMDEDbManager::NewL(uidOfPlugin); iMdsItem = CMDSEntity::NewL(); + OstTraceFunctionExit0( CVIDEOPLUGIN_STARTPLUGINL_EXIT ); } void CVideoPlugin::StartHarvestingL( const TDesC& /*aMedia*/ ) { + OstTraceFunctionEntry0( CVIDEOPLUGIN_STARTHARVESTINGL_ENTRY ); CPIXLOGSTRING("CVideoPlugin::StartHarvestingL"); iDBManager->ResetL(); iIndexerUtil->ResetAllL(); @@ -111,15 +119,18 @@ iStartTime.UniversalTime(); #endif iMdeHarvester->DoHarvesetL( MdeConstants::Video::KVideoObject ); + OstTraceFunctionExit0( CVIDEOPLUGIN_STARTHARVESTINGL_EXIT ); } void CVideoPlugin::HarvestingCompletedL() { + OstTraceFunctionEntry0( CVIDEOPLUGIN_HARVESTINGCOMPLETEDL_ENTRY ); CPIXLOGSTRING("CVideoPlugin::HarvestingCompletedL"); #ifdef __PERFORMANCE_DATA UpdatePerformaceDataL(); #endif iObserver->HarvestingCompleted(this, _L(MEDIA_QBASEAPPCLASS), KErrNone); + OstTraceFunctionExit0( CVIDEOPLUGIN_HARVESTINGCOMPLETEDL_EXIT ); } //handle MMC event for the Drive @@ -144,6 +155,7 @@ void CVideoPlugin::HandleMdeItemL( TItemId aObjId, TCPixActionType aActionType) { //Get the object from object utils and get the CPIX document and add delete or update + OstTrace1( TRACE_NORMAL, CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL;aObjId=%d", aObjId ); CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): aObjId = %d ", aObjId ); // creating CSearchDocument object with unique ID for this application TBuf docid_str; @@ -153,6 +165,7 @@ //and we already have in our database just return in case of update move forward if(iDBManager->IsAlreadyExistL(aObjId) && aActionType == ECPixAddAction)//Avoid reharvesting { + OstTrace0( TRACE_NORMAL, DUP1_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Already harvested returning" ); CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Already harvested returning"); return; } @@ -165,6 +178,7 @@ if (!iIndexer) { delete index_item; + OstTrace0( TRACE_NORMAL, DUP2_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Indexer not found" ); CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Indexer not found"); return; } @@ -174,6 +188,7 @@ #ifdef __PERFORMANCE_DATA ++count; #endif + OstTrace0( TRACE_NORMAL, DUP3_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Indexer found calling AddL" ); CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Indexer found calling AddL"); //First check if it already exist in database TRAPD(err, iIndexer->UpdateL(*index_item)); //Always Update to avoid reharvesting @@ -187,10 +202,12 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->SetDrive(drive); iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP4_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Added." ); CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Added."); } else { + OstTrace1( TRACE_NORMAL, DUP5_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL;Error %d in adding", err ); CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in adding.", err); } } @@ -211,6 +228,7 @@ CCPixIndexer *tempIndexer; tempIndexer = iIndexerUtil->GetIndexerFromDrive(iMdsItem->DriveNumber()); tempIndexer->DeleteL(iMdsItem->Uri()); + OstTrace0( TRACE_NORMAL, DUP6_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Deleted existing URI for update" ); CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Deleted existing URI for update"); } TRAPD(error, iIndexer->UpdateL(*index_item)); @@ -222,10 +240,12 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->Set(aObjId,iVideoDocument->GetUri(),drive); iDBManager->UpdateL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP7_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Updated." ); CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Updated."); } else { + OstTrace1( TRACE_NORMAL, DUP8_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL;Error %d in updating", err ); CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in updating.", error); } } @@ -245,6 +265,7 @@ iIndexerUtil->GetDriveFromMediaId(object.MediaId(),drive); iMdsItem->SetDrive(drive); iDBManager->AddL(aObjId,*iMdsItem);//Add to SyncDB + OstTrace0( TRACE_NORMAL, DUP9_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Added Item before Update." ); CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Added Item before Update."); } } @@ -267,10 +288,12 @@ TRAPD(err, iIndexer->DeleteL(docid_str));//Delete it if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP10_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL(): Deleted." ); CPIXLOGSTRING("CVideoPlugin::HandleMdeItemL(): Deleted."); } else { + OstTrace1( TRACE_NORMAL, DUP11_CVIDEOPLUGIN_HANDLEMDEITEML, "CVideoPlugin::HandleMdeItemL;Error %d in deleting", err ); CPIXLOGSTRING2("CVideoPlugin::HandleMdeItemL(): Error %d in deleting.", err); } } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/video/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/video/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/video/traces/cpixmediavideodocTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/video/traces/cpixmediavideodocTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,16 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CPIXMEDIAVIDEODOCTRACES_H__ +#define __CPIXMEDIAVIDEODOCTRACES_H__ + +#define KOstTraceComponentID 0x20029aba + +#define CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_ENTRY 0x8a0001 +#define CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_EXIT 0x8a0002 + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/video/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/video/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_FLOW[0x8A]_CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CCPIXMEDIAVIDEODOC_GETCPIXDOCUMENTL_EXIT=0x2 +[TRACE]TRACE_FLOW[0x8A]_CVIDEOPLUGIN_HARVESTINGCOMPLETEDL_ENTRY=0x7 +[TRACE]TRACE_FLOW[0x8A]_CVIDEOPLUGIN_HARVESTINGCOMPLETEDL_EXIT=0x8 +[TRACE]TRACE_FLOW[0x8A]_CVIDEOPLUGIN_STARTHARVESTINGL_ENTRY=0x5 +[TRACE]TRACE_FLOW[0x8A]_CVIDEOPLUGIN_STARTHARVESTINGL_EXIT=0x6 +[TRACE]TRACE_FLOW[0x8A]_CVIDEOPLUGIN_STARTPLUGINL_ENTRY=0x3 +[TRACE]TRACE_FLOW[0x8A]_CVIDEOPLUGIN_STARTPLUGINL_EXIT=0x4 +[TRACE]TRACE_NORMAL[0x86]_CVIDEOPLUGIN_HANDLEMDEITEML=0x1 +[TRACE]TRACE_NORMAL[0x86]_DUP10_CVIDEOPLUGIN_HANDLEMDEITEML=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP11_CVIDEOPLUGIN_HANDLEMDEITEML=0xc +[TRACE]TRACE_NORMAL[0x86]_DUP1_CVIDEOPLUGIN_HANDLEMDEITEML=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CVIDEOPLUGIN_HANDLEMDEITEML=0x3 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CVIDEOPLUGIN_HANDLEMDEITEML=0x4 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CVIDEOPLUGIN_HANDLEMDEITEML=0x5 +[TRACE]TRACE_NORMAL[0x86]_DUP5_CVIDEOPLUGIN_HANDLEMDEITEML=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP6_CVIDEOPLUGIN_HANDLEMDEITEML=0x7 +[TRACE]TRACE_NORMAL[0x86]_DUP7_CVIDEOPLUGIN_HANDLEMDEITEML=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP8_CVIDEOPLUGIN_HANDLEMDEITEML=0x9 +[TRACE]TRACE_NORMAL[0x86]_DUP9_CVIDEOPLUGIN_HANDLEMDEITEML=0xa diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/media/video/traces/videopluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/media/video/traces/videopluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,32 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __VIDEOPLUGINTRACES_H__ +#define __VIDEOPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x20029aba + +#define CVIDEOPLUGIN_STARTPLUGINL_ENTRY 0x8a0003 +#define CVIDEOPLUGIN_STARTPLUGINL_EXIT 0x8a0004 +#define CVIDEOPLUGIN_STARTHARVESTINGL_ENTRY 0x8a0005 +#define CVIDEOPLUGIN_STARTHARVESTINGL_EXIT 0x8a0006 +#define CVIDEOPLUGIN_HARVESTINGCOMPLETEDL_ENTRY 0x8a0007 +#define CVIDEOPLUGIN_HARVESTINGCOMPLETEDL_EXIT 0x8a0008 +#define CVIDEOPLUGIN_HANDLEMDEITEML 0x860001 +#define DUP1_CVIDEOPLUGIN_HANDLEMDEITEML 0x860002 +#define DUP2_CVIDEOPLUGIN_HANDLEMDEITEML 0x860003 +#define DUP3_CVIDEOPLUGIN_HANDLEMDEITEML 0x860004 +#define DUP4_CVIDEOPLUGIN_HANDLEMDEITEML 0x860005 +#define DUP5_CVIDEOPLUGIN_HANDLEMDEITEML 0x860006 +#define DUP6_CVIDEOPLUGIN_HANDLEMDEITEML 0x860007 +#define DUP7_CVIDEOPLUGIN_HANDLEMDEITEML 0x860008 +#define DUP8_CVIDEOPLUGIN_HANDLEMDEITEML 0x860009 +#define DUP9_CVIDEOPLUGIN_HANDLEMDEITEML 0x86000a +#define DUP10_CVIDEOPLUGIN_HANDLEMDEITEML 0x86000b +#define DUP11_CVIDEOPLUGIN_HANDLEMDEITEML 0x86000c + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/data/2001f701.rss --- a/harvesterplugins/messaging/data/2001f701.rss Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -// 0x2001F701.RSS - -#include - -// Declares info for one test implementation -RESOURCE REGISTRY_INFO theInfo - { - // UID for the DLL - dll_uid = 0x2001F701; // ECOM Messaging Plugin dll UID - // Declare array of interface info - interfaces = - { - INTERFACE_INFO - { - // UID of interface that is implemented - interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID - implementations = - { - // Info for CMessagePlugin - IMPLEMENTATION_INFO - { - implementation_uid = 0x2001F701; - version_no = 1; - display_name = "CPix Search Messaging plugin"; - default_data = "Messaging"; - opaque_data = ""; - } - }; - } - }; - } - diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/data/20029b09.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/data/20029b09.rss Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// 0x20029b09.RSS + +#include + +// Declares info for one test implementation +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x20029b09; // ECOM Email Plugin dll UID + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID + implementations = + { + // Info for Email Plugin + IMPLEMENTATION_INFO + { + implementation_uid = 0x20029b09; + version_no = 1; + display_name = "Email"; + default_data = "Messaging"; + opaque_data = ""; + } + }; + } + }; + } + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/group/bld.inf Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +PRJ_MMPFILES + +emailplugin.mmp + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/group/emailplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/group/emailplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +TARGET cpixemailplugin.dll +TARGETTYPE PLUGIN + +#include +CAPABILITY CAP_GENERAL_DLL -AllFiles -DRM +#include "../../../../harvesterplugins/inc/s60performance.h" +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x20029b09 + +SOURCEPATH ../src +SOURCE cemailplugin.cpp +SOURCE tproxy.cpp + +USERINCLUDE ../inc +USERINCLUDE ../qtemailfetcher + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/mw/QtCore +SYSTEMINCLUDE /epoc32/include/stdapis +SYSTEMINCLUDE /epoc32/include/stdapis/sys +SYSTEMINCLUDE . +SYSTEMINCLUDE /epoc32/include/stdapis/stlport + +SOURCEPATH ../data +start RESOURCE 20029b09.rss +target cpixemailplugin.rsc +end + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY cpixharvesterplugininterface.lib +LIBRARY cpixsearchclient.lib +LIBRARY qtemailfetcher.lib +LIBRARY qtcore.lib + +OPTION CW -wchar_t on +MACRO _WCHAR_T_DECLARED + +// For logging +LIBRARY flogger.lib + +EXPORTUNFROZEN + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/inc/cemailplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/inc/cemailplugin.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef CEMAILPLUGIN_H +#define CEMAILPLUGIN_H + +#include +#include +#include +#include + +class CSearchDocument; +class CCPixIndexer; +class QEmailFetcher; + +class CEmailPlugin : public CIndexingPlugin, public MEmailItemObserver +{ +public: + static CEmailPlugin* NewL(); + static CEmailPlugin* NewLC(); + virtual ~CEmailPlugin(); + + /** + * From CIndexingPlugin + */ + void StartPluginL(); + void StartHarvestingL(const TDesC& aQualifiedBaseAppClass); + + /** + * From MEmailItemObserver + */ + void HandleDocumentL(const CSearchDocument* aSearchDocument, TCPixActionType aActionType); + + /** + * Gets the database observer class + */ + CCPixIndexer* GetIndexer(); //SPB { return iIndexer; } + + /** + * MountL - Mount an IndexDB. + * @aMedia drive to mount. + * @aForceReharvesting to reharvest or not + */ + void MountL(TDriveNumber aMedia, TBool aForceReharvesting=EFalse); + + /** + * UnMount - Dismount a IndexDB for drive aMedia. + * @aMedia drive to unmount. + * @aUndefineAsWell if ETrue then undefine the volume as well + * + */ + void UnMount(TDriveNumber aMedia, TBool aUndefineAsWell = ETrue); + + /** + * FormBaseAppClass - constructs a baseAppClass for the given drive. + * @aMedia drive to form the baseAppClass for. + * @aBaseAppClass return descriptor containing the baseAppClass + * returns KErrNone on success or a standard error code + */ + static TInt FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass); + + /** + * DatabasePathL - Forms IndexDb path. + * @param aMedia - The drive for which the path should be constructed. + * returns pointer to the IndexDb path. + */ + HBufC* DatabasePathLC(TDriveNumber aMedia); + +public: + /* + * Notifies the indexing manager of completed harvesting, called by CMessageHarvester + */ + void HarvestingCompleted(TInt aError); + +protected: + CEmailPlugin(); + void ConstructL(); + +private: + // CPix indexer + CCPixIndexer* iIndexer[EDriveZ+1]; // EDriveZ enum value is 25, so add 1. + //Currently used Drive by messaging application it is Default drive + TInt iCurrentDrive; + // File system session + RFs iFs; + //Email fecther from Qt Module + QEmailFetcher* iQEmailFetcher; +#ifdef __PERFORMANCE_DATA + TTime iStartTime; + TTime iCompleteTime; + void UpdatePerformaceDataL(); + void UpdatePerformaceDataL(TMsvSessionEvent); +#endif +}; + +#endif // CEMAILPLUGIN_H diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/inc/memailitemobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/inc/memailitemobserver.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MEMAILITEMOBSERVER_H +#define MEMAILITEMOBSERVER_H + +#include +#include + +/** + * @file + * @ingroup Email Plugin internal API + * @brief Contains Interface to handle e-mail documents from e-mail fetcher + */ + +class CSearchDocument; + +/** + * @brief The interface providing way to handle search document and update index database from action + * @ingroup Email Plugin internal API + * + * MEmailItemObserver provides callback to email plugin from email fetcher. + * + */ +class MEmailItemObserver +{ +public: + + /** + * A pure virtual method which is called by the email fetcher when it wants to send a document to + * e-mail plugin for action on that document add/delete or update. + * + * @param aSearchDocument search document created by email fetcher + * @param aActionType action to be taken on document + */ + virtual void HandleDocumentL(const CSearchDocument* aSearchDocument, TCPixActionType aActionType) = 0; + +}; + +#endif // MEMAILITEMOBSERVER_H diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/qtemailfetcher/bwins/qtemailfetcheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/qtemailfetcher/bwins/qtemailfetcheru.def Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,22 @@ +EXPORTS + ?initialize@QEmailFetcher@@CAXPAV1@@Z @ 1 NONAME ; void QEmailFetcher::initialize(class QEmailFetcher *) + ?processMessages@QEmailFetcher@@QAEXH@Z @ 2 NONAME ; void QEmailFetcher::processMessages(int) + ?trUtf8@QEmailFetcher@@SA?AVQString@@PBD0@Z @ 3 NONAME ; class QString QEmailFetcher::trUtf8(char const *, char const *) + ?qt_metacall@QEmailFetcher@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 4 NONAME ; int QEmailFetcher::qt_metacall(enum QMetaObject::Call, int, void * *) + ?tr@QEmailFetcher@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString QEmailFetcher::tr(char const *, char const *) + ?StartHarvesting@QEmailFetcher@@QAEXXZ @ 6 NONAME ; void QEmailFetcher::StartHarvesting(void) + ?tr@QEmailFetcher@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString QEmailFetcher::tr(char const *, char const *, int) + ?getStaticMetaObject@QEmailFetcher@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & QEmailFetcher::getStaticMetaObject(void) + ?staticMetaObject@QEmailFetcher@@2UQMetaObject@@B @ 9 NONAME ; struct QMetaObject const QEmailFetcher::staticMetaObject + ?handleMailboxesListed@QEmailFetcher@@QAEXH@Z @ 10 NONAME ; void QEmailFetcher::handleMailboxesListed(int) + ??1QEmailFetcher@@UAE@XZ @ 11 NONAME ; QEmailFetcher::~QEmailFetcher(void) + ?mailFoldersListed@QEmailFetcher@@QAEXH@Z @ 12 NONAME ; void QEmailFetcher::mailFoldersListed(int) + ?emailServiceIntialized@QEmailFetcher@@QAEX_N@Z @ 13 NONAME ; void QEmailFetcher::emailServiceIntialized(bool) + ?qt_metacast@QEmailFetcher@@UAEPAXPBD@Z @ 14 NONAME ; void * QEmailFetcher::qt_metacast(char const *) + ?newInstance@QEmailFetcher@@SAPAV1@AAVMEmailItemObserver@@@Z @ 15 NONAME ; class QEmailFetcher * QEmailFetcher::newInstance(class MEmailItemObserver &) + ?trUtf8@QEmailFetcher@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString QEmailFetcher::trUtf8(char const *, char const *, int) + ?metaObject@QEmailFetcher@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * QEmailFetcher::metaObject(void) const + ??0QEmailFetcher@@AAE@AAVMEmailItemObserver@@@Z @ 18 NONAME ; QEmailFetcher::QEmailFetcher(class MEmailItemObserver &) + ??_EQEmailFetcher@@UAE@I@Z @ 19 NONAME ; QEmailFetcher::~QEmailFetcher(unsigned int) + ?handleMessageEvent@QEmailFetcher@@QAEXW4MessageEvent@@_K1V?$QList@_K@@@Z @ 20 NONAME ; void QEmailFetcher::handleMessageEvent(enum MessageEvent, unsigned long long, unsigned long long, class QList) + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/qtemailfetcher/eabi/qtemailfetcheru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/qtemailfetcher/eabi/qtemailfetcheru.def Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,22 @@ +EXPORTS + _ZN13QEmailFetcher10initializeEPS_ @ 1 NONAME + _ZN13QEmailFetcher11newInstanceER18MEmailItemObserver @ 2 NONAME + _ZN13QEmailFetcher11qt_metacallEN11QMetaObject4CallEiPPv @ 3 NONAME + _ZN13QEmailFetcher11qt_metacastEPKc @ 4 NONAME + _ZN13QEmailFetcher15StartHarvestingEv @ 5 NONAME + _ZN13QEmailFetcher15processMessagesEi @ 6 NONAME + _ZN13QEmailFetcher16staticMetaObjectE @ 7 NONAME DATA 16 + _ZN13QEmailFetcher17mailFoldersListedEi @ 8 NONAME + _ZN13QEmailFetcher18handleMessageEventE12MessageEventyy5QListIyE @ 9 NONAME + _ZN13QEmailFetcher19getStaticMetaObjectEv @ 10 NONAME + _ZN13QEmailFetcher21handleMailboxesListedEi @ 11 NONAME + _ZN13QEmailFetcher22emailServiceIntializedEb @ 12 NONAME + _ZN13QEmailFetcherC1ER18MEmailItemObserver @ 13 NONAME + _ZN13QEmailFetcherC2ER18MEmailItemObserver @ 14 NONAME + _ZN13QEmailFetcherD0Ev @ 15 NONAME + _ZN13QEmailFetcherD1Ev @ 16 NONAME + _ZN13QEmailFetcherD2Ev @ 17 NONAME + _ZNK13QEmailFetcher10metaObjectEv @ 18 NONAME + _ZTI13QEmailFetcher @ 19 NONAME + _ZTV13QEmailFetcher @ 20 NONAME + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.cpp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,249 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility class for fetching email. +* +*/ + +#include "qtemailfetcher.h" +#include +#include +//#include //If we happen to use QThread::yieldCurrentThread() + +//Symbian specific details; picked up from cemailplugin.cpp. +//Refactor it to cpixmaindefs.h +_LIT(KMsgBaseAppClassGeneric, "root msg email"); + +_LIT(KMsgSubject, "Subject"); +_LIT(KMsgRecipients, "Recipients"); +_LIT(KMsgBody, "Body"); +_LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD); +_LIT(KMimeTypeMsg, "Messages"); + +//------------------------------------------------------------------------------ +QEmailFetcher::QEmailFetcher( MEmailItemObserver& aObserver ) + :iEmailObserver( aObserver ), + iEmailEventNotifier( NULL ), + iEmailService( NULL ), + iMailBoxListings( NULL ), + iMailFolderList( NULL ), + iEnvelopeListing( NULL ) + { + } + +//------------------------------------------------------------------------------ +QEmailFetcher::~QEmailFetcher() + { + delete iEmailEventNotifier; + delete iEmailService; + delete iMailBoxListings; + delete iMailFolderList; + } + +//------------------------------------------------------------------------------ +QEmailFetcher* QEmailFetcher::newInstance( MEmailItemObserver& aObserver ){ + QEmailFetcher* emailFetcher = NULL; + + //Leak free init. + try{ + QEmailFetcher* emailFetcher = new QEmailFetcher( aObserver ); + //Uncomment 'this' once the actual APIs are ready. + emailFetcher->iEmailService = new NmEmailService( emailFetcher ); + emailFetcher->iEmailEventNotifier = new NmEventNotifier( emailFetcher ); + emailFetcher->iMailBoxListings = new NmMailboxListing( emailFetcher ); + }catch(...){ //cleanup. + delete emailFetcher; + delete emailFetcher->iEmailService; + delete emailFetcher->iEmailEventNotifier; + delete emailFetcher->iMailBoxListings; + emailFetcher->iEmailService = NULL; + emailFetcher->iEmailEventNotifier = NULL; + emailFetcher->iMailBoxListings = NULL; + throw; //rethrow the exception to caller. + } + initialize( emailFetcher ); //Do the rest of the init. + return emailFetcher; //returns only if not null. +} + +//------------------------------------------------------------------------------ +void QEmailFetcher::initialize( QEmailFetcher* aThis ){ + //The use of 'aThis' is because the current function is static. + connect( aThis->iEmailService, SIGNAL(initialized(bool)), + aThis, SLOT(emailServiceIntialized(bool)) ); + aThis->iEmailService->initialise(); + aThis->connect( aThis->iEmailEventNotifier, + SIGNAL(messageEvent(MessageEvent, quint64, quint64, QList)), + aThis, + SLOT(handleMessageEvent(MessageEvent, quint64, quint64, QList)) ); +} + +//------------------------------------------------------------------------------ +void QEmailFetcher::emailServiceIntialized(bool aAllOk){ + if( aAllOk ){ + connect( iMailBoxListings, SIGNAL(mailboxesListed(int)), this, SLOT(handleMailboxesListed(int)) ); + } +} + +//------------------------------------------------------------------------------ +void QEmailFetcher::StartHarvesting(){ + iMailBoxListings->start(); +} + +//------------------------------------------------------------------------------ +namespace { + +// Taken from qt/src/corelib/kernel/qcore_symbian_p.cpp, as recomended in +// http://qt.nokia.com/files/pdf/whitepaper-using-qt-and-symbian-c-together, page 34. +// URL last accessed on April 6th, 2010. + +// Returned TPtrC is valid as long as the given parameter is valid and unmodified +static inline TPtrC qt_QString2TPtrC( const QString& string ) +{ + return TPtrC16(static_cast(string.utf16()), string.length()); +} + +//------------------------------------------------------------------------------ +// TODO Remove this code if qt_QString2TPtrC works. +// TODO If this function is used, remember to release memory. +// Ownership with caller. +//HBufC* qt_QString2HBufC(const QString& aString) +//{ +// HBufC *buffer; +//#ifdef QT_NO_UNICODE +// TPtrC8 ptr(reinterpret_cast(aString.toLocal8Bit().constData())); +//#else +// TPtrC16 ptr(qt_QString2TPtrC(aString)); +//#endif +// buffer = q_check_ptr(HBufC::New(ptr.Length())); +// buffer->Des().Copy(ptr); +// return buffer; +//} + +//------------------------------------------------------------------------------ +//Private free function creates CSearchDocument from EMailMessageEnvelope. +CSearchDocument* getSearchDocument( const NmMessageEnvelope& aEnvelope ){ + QList toList; + //Need to cast away const-ness since the get method is unfortunately not const. + const_cast(aEnvelope).getToRecipients( toList ); + + //We need ALL the recipients in a SINGLE field. + QString recipients = ""; + for( int i=0; i(aEnvelope).getPlainTextBody( body ); + QString msgBody = body.content(); + + CSearchDocument* doc = 0; + QT_TRAP_THROWING( + //Use qt_Qstring2TPtrC since we are working with const EmailMessageEnvelope. + doc = CSearchDocument::NewL( qt_QString2TPtrC( QString().setNum( aEnvelope.id() ) ), + KMsgBaseAppClassGeneric ); + doc->AddFieldL( KMimeTypeField, KMimeTypeMsg, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); + doc->AddFieldL( KMsgSubject, qt_QString2TPtrC( aEnvelope.subject() ), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); + doc->AddFieldL( KMsgRecipients, qt_QString2TPtrC( recipients ), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); + doc->AddFieldL( KMsgBody, qt_QString2TPtrC( msgBody ), CDocumentField::EStoreYes | CDocumentField::EIndexTokenized ); + //TODO: What should go in here? + doc->AddExcerptL( KNullDesC ); + ); + return doc; +} +} //anonymous namespace + +//------------------------------------------------------------------------------ +//Options to make async (like other plugins' Asynchronizer): +//1. Use http://doc.trolltech.com/4.6/qtimer.html and connect timeout() signal to something? +//Downside: +//Have to save the state of the function and resume. Achievable via static members. +//Remeber to reset counters. +//2. Use timer; unlike above, have handleMailboxesListed() simply trigger a +//Timer controlled function. +//3. Use QThread::currentThread()->yieldCurrentThread(); +//Downside: Not tested. +//4. As recommended by the email API documentation, use SingleShotTimer: +//QTimer::singleShot(nsecs,nmFolderListing,SLOT(start()); +// +//Recommendation: Use option 4. + +void QEmailFetcher::handleMailboxesListed(int aCount){ + QList mailBoxes; + if( aCount>0 && iMailBoxListings->getMailboxes( mailBoxes ) ){ + for( int i=0; i folders; + if ( aCount && iMailFolderList->getFolders( folders ) ) { + for( int i=0; istart(); + } + } +} + +//------------------------------------------------------------------------------ +void QEmailFetcher::processMessages(int aCount){ + if( aCount == NmMailboxListing::MailboxListingFailed ) return; //silently. + QList envelopes; + if ( aCount > 0 && iEnvelopeListing->getEnvelopes(envelopes) ) { + for( int i=0; i aMessageList){ + NmMessageEnvelope envelope; + const int messageCount = aMessageList.count(); + if( messageCount>0 ){ + if( aEvent == MessageCreated || aEvent == MessageChanged ){ + for( int i=0; igetEnvelope( aMailboxId, aFolderId, aMessageList.at( i ), envelope ) ){ + QT_TRAP_THROWING( + iEmailObserver.HandleDocumentL( getSearchDocument( envelope ), + //Doing this simply avoids *duplicate* code for update action. + aEvent == MessageCreated ? ECPixAddAction : ECPixUpdateAction ) ); + } + } + } + else if( aEvent == MessageDeleted ) { + //TODO We can do better. For delete, we dont have to create full document. Just the ID should be enough. + //We can have another function called getPartialSearchDocument so deletes will be faster. + for( int i=0; igetEnvelope( aMailboxId, aFolderId, aMessageList.at( i ), envelope ) ){ + QT_TRAP_THROWING( + iEmailObserver.HandleDocumentL( getSearchDocument( envelope ), ECPixRemoveAction ) ); + } + } + } + } +} diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility class for fetching email. +* +*/ + +#ifndef _QEMAILFETCHER_H +#define _QEMAILFETCHER_H + +#ifdef BUILD_DLL +#define DLL_EXPORT Q_DECL_EXPORT +#else +#define DLL_EXPORT Q_DECL_IMPORT +#endif + +//TODO: Uncomment when available. +#include +#include +#include +#include +#include +#include +#include +#include "memailitemobserver.h" + +using namespace EmailClientApi; + +//How this works: +//1. List all mail boxes. +//2. In each mail box, list the folders +//3. In each folder, list the mails +//4. Process each email +// +//We voluntarily relinquish the processor (we sleep) each time we have completed +//processing a given folder. This is to avoid 'hogging' the processor. + + +class DLL_EXPORT QEmailFetcher: public QObject + { + Q_OBJECT +public: + static QEmailFetcher* newInstance(MEmailItemObserver& aObserver); + ~QEmailFetcher(); + void StartHarvesting(); + +private: + QEmailFetcher(MEmailItemObserver& aObserver ); + static void initialize(QEmailFetcher* aThis); //helper (2nd phase constructor). + + //Private? +public slots: + void emailServiceIntialized( bool ); + void handleMailboxesListed( int ); + void mailFoldersListed( int ); + void processMessages( int ); + //Connect to messageEvent signal + void handleMessageEvent( MessageEvent aEvent, quint64 mailboxId, quint64 folderId, QList messageList ); + +private: + MEmailItemObserver& iEmailObserver; //The parent/creator. Not owned. + NmEventNotifier* iEmailEventNotifier; //owned; triggers handleMessageEvent. + NmEmailService* iEmailService; //owned. + NmMailboxListing* iMailBoxListings; //owned. + NmFolderListing* iMailFolderList; //owned. + NmEnvelopeListing* iEnvelopeListing; //owned. + NmMessageEnvelope* iMessageListing; //owned. + }; + +#endif //_QEMAILFETCHER_H diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/qtemailfetcher/qtemailfetcher.pro Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,49 @@ +# +# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +TEMPLATE = lib +TARGET = qtemailfetcher + +QT += core +QT -= gui + +HEADERS += qtemailfetcher.h +SOURCES += qtemailfetcher.cpp + +DEFINES += BUILD_DLL + +symbian{ + TARGET.UID3 = 0x20029B0A + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.VID = VID_DEFAULT + TARGET.CAPABILITY = CAP_GENERAL_DLL -DRM + VERSION = 1.0.0 + + INCLUDEPATH += ../inc + + HEADERS += memailitemobserver.h + LIBS += -lcpixsearchclient + LIBS += -lnmailclientapi + + defFileBlock = \ + "$${LITERAL_HASH}if defined(WINSCW)" \ + "DEFFILE bwins/" \ + "$${LITERAL_HASH}else" \ + "DEFFILE eabi/" \ + "$${LITERAL_HASH}endif" \ + + MMP_RULES += defFileBlock +} diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/src/cemailplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/src/cemailplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,456 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include +#include +#include "cemailplugin.h" +#include "harvesterserverlogger.h" +#include "qtemailfetcher.h" + +// maximum length that the fully qualified msg Plugin base app class descriptor can be +// e.g. "@c:root msg email" +const TInt KMsgPluginBaseAppClassMaxLen = 64; + + +// local declarations and functions +namespace { + +_LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\"); +_LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); + +_LIT(KPathTrailer, "\\root\\msg\\email"); +_LIT(KMsgBaseAppClassGeneric, ":root msg email"); +_LIT(KAtSign, "@"); +_LIT(KColon, ":"); + +/** +* MapFileToDrive - gets the TDriveNumber associated with the aBaseAppClass. +* @aBaseAppClass e.g. "@c:root file" +* @aDrive returns the TDriveNumber for the aBaseAppClass +* returns KErrNone on success or a standard error code +*/ +TInt MapBaseAppClassToDrive(const TDesC& aBaseAppClass, TDriveNumber& aDrive) + { + if (KErrNone != aBaseAppClass.Left(1).Compare(KAtSign)) + { + return KErrGeneral; + } + + TPtrC drvChar = aBaseAppClass.Left(2).Right(1); + TChar d(drvChar[0]); + TInt drive; + const TInt ret = RFs::CharToDrive(d, drive); + if (!ret) + { + aDrive = TDriveNumber(drive); + } + + return ret; + } + +}// anonymous namespace + + +// --------------------------------------------------------------------------- +// CEmailPlugin::NewL +// --------------------------------------------------------------------------- +// +CEmailPlugin* CEmailPlugin::NewL() +{ + CEmailPlugin* instance = CEmailPlugin::NewLC(); + CleanupStack::Pop(instance); + return instance; +} + +// --------------------------------------------------------------------------- +// CEmailPlugin::NewLC +// --------------------------------------------------------------------------- +// +CEmailPlugin* CEmailPlugin::NewLC() +{ + CEmailPlugin* instance = new (ELeave)CEmailPlugin(); + CleanupStack::PushL(instance); + instance->ConstructL(); + return instance; +} + +// --------------------------------------------------------------------------- +// CEmailPlugin::CEmailPlugin +// --------------------------------------------------------------------------- +// +CEmailPlugin::CEmailPlugin() +{ + +} + +// --------------------------------------------------------------------------- +// CEmailPlugin::~CEmailPlugin +// --------------------------------------------------------------------------- +// +CEmailPlugin::~CEmailPlugin() +{ + // remove notification paths before destroying iMonitor + for (TInt i=EDriveA; i<=EDriveZ; i++) + UnMount(TDriveNumber(i), EFalse); + iFs.Close(); + delete iQEmailFetcher; +} + +// --------------------------------------------------------------------------- +// CEmailPlugin::ConstructL +// --------------------------------------------------------------------------- +// +void CEmailPlugin::ConstructL() +{ + TInt err = iFs.Connect(); + CPIXLOGSTRING2("CEmailPlugin::ConstructL, iFs.Connect: %i", err); + User::LeaveIfError(err); + iCurrentDrive = EDriveC; //Default drive is C drive + for (TInt i=EDriveA; i<=EDriveZ; i++) + { + iIndexer[i] = NULL; //Initialize to NULL + } +} + +// --------------------------------------------------------------------------- +// CEmailPlugin::StartPluginL +// --------------------------------------------------------------------------- +// +void CEmailPlugin::StartPluginL() + { + CPIXLOGSTRING2("currentDrive used is : %d", iCurrentDrive ); + MountL(TDriveNumber(iCurrentDrive)); //Mount current drive + //create instance of QEmailFetcher + QT_TRYCATCH_LEAVING(iQEmailFetcher = QEmailFetcher::newInstance(*this)); + // Define this base application class, use default location + } + +// --------------------------------------------------------------------------- +// CEmailPlugin::StartHarvestingL +// --------------------------------------------------------------------------- +// +void CEmailPlugin::StartHarvestingL(const TDesC& aQualifiedBaseAppClass) + { + CPIXLOGSTRING("START CEmailPlugin::StartHarvestingL"); + // Map base app class to a drive number + TDriveNumber drive ( EDriveA );//Initialize to silence compiler warnings. + if (KErrNone != MapBaseAppClassToDrive(aQualifiedBaseAppClass, drive)) + User::Leave(KErrGeneral); + + // Leave if no indexer for this drive + if (!iIndexer[drive]) + User::Leave(KErrGeneral); + + //Complete harvesting here only for time being + //HarvestingCompleted(KErrNone); + // Reset the database + iIndexer[drive]->ResetL(); +#ifdef __PERFORMANCE_DATA + iStartTime.UniversalTime(); +#endif + } + +// --------------------------------------------------------------------------- +// CEmailPlugin::HandleDocumentL +// --------------------------------------------------------------------------- +// +void CEmailPlugin::HandleDocumentL(const CSearchDocument* aSearchDocument, + TCPixActionType aActionType) + { + CPIXLOGSTRING("START CEmailPlugin::HandleDocumentL"); + // Index an empty item if removal action + if (aActionType == ECPixRemoveAction) + { + if (GetIndexer()) + { + TRAPD(err, GetIndexer()->DeleteL(aSearchDocument->Id())); + if (err == KErrNone) + { + CPIXLOGSTRING("CEmailPlugin::HandleDocumentL: Document deleted."); + } + else + { + CPIXLOGSTRING2("CEmailPlugin::HandleDocumentL: Error %d in deleting the document.", err); + } + } + return; + } + //Add or update action do accordingly + if (GetIndexer()) + { + if (aActionType == ECPixAddAction) + { + TRAPD(err, GetIndexer()->AddL(*aSearchDocument)); + if (err == KErrNone) + { + CPIXLOGSTRING("CEmailPlugin::HandleDocumentL(): Added."); + } + else + { + CPIXLOGSTRING2("CEmailPlugin::HandleDocumentL(): Error %d in adding.", err); + } + } + else if (aActionType == ECPixUpdateAction) + { + TRAPD(err, GetIndexer()->UpdateL(*aSearchDocument)); + if (err == KErrNone) + { + CPIXLOGSTRING("CEmailPlugin::HandleDocumentL(): Updated."); + } + else + { + CPIXLOGSTRING2("CEmailPlugin::HandleDocumentL(): Error %d in updating.", err); + } + } + } + else + { + CPIXLOGSTRING("END CEmailPlugin::HandleDocumentL(): No indexer present."); + } + } + +// --------------------------------------------------------------------------- +// CEmailPlugin::MountL +// --------------------------------------------------------------------------- +// +void CEmailPlugin::MountL(TDriveNumber aMedia,TBool aForceReharvesting) + { + CPIXLOGSTRING("START CEmailPlugin::MountL"); + // Check if already exists + if (iIndexer[aMedia]) + return; + + // Form the baseappclass for this media + TBuf baseAppClass; + FormBaseAppClass(aMedia, baseAppClass); + + // Define this volume + HBufC* path = DatabasePathLC(aMedia); + User::LeaveIfError(iSearchSession.DefineVolume(baseAppClass, *path)); + CleanupStack::PopAndDestroy(path); + + // construct and open the database + TRAPD(err,iIndexer[aMedia] = CCPixIndexer::NewL(iSearchSession)); + CPIXLOGSTRING2("CCPixIndexer::NewL returned : %d", err ); + TRAP(err,iIndexer[aMedia]->OpenDatabaseL(baseAppClass)); + + // Add to harvesting queue + iObserver->AddHarvestingQueue(this, baseAppClass,aForceReharvesting); + CPIXLOGSTRING("END CEmailPlugin::MountL"); + } + +// --------------------------------------------------------------------------- +// CEmailPlugin::UnMount +// --------------------------------------------------------------------------- +// +void CEmailPlugin::UnMount(TDriveNumber aMedia, TBool aUndefineAsWell) + { + CPIXLOGSTRING("START CEmailPlugin::UnMount"); + // Check if already exists + if (!iIndexer[aMedia]) + return; + + // Form the baseappclass for this media + TBuf baseAppClass; + FormBaseAppClass(aMedia, baseAppClass); + + // Remove from harvesting queue + iObserver->RemoveHarvestingQueue(this, baseAppClass); + + // Delete the index object + if (iIndexer[aMedia]) + { + delete iIndexer[aMedia]; + iIndexer[aMedia] = NULL; + } + + // if the aActionType is EFFMmcDismount, then the + // parameter aFilename is the baseAppClass of the Index database + // to be dropped. + if (aUndefineAsWell) + iSearchSession.UnDefineVolume(baseAppClass); + } + + +// --------------------------------------------------------------------------- +// CEmailPlugin::FormBaseAppClass +// --------------------------------------------------------------------------- +// +TInt CEmailPlugin::FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass) + { + TChar chr; + const TInt ret = RFs::DriveToChar(aMedia, chr); + if (KErrNone == ret) + { + aBaseAppClass.Copy(KAtSign); + aBaseAppClass.Append(chr); + aBaseAppClass.LowerCase(); + aBaseAppClass.Append(KMsgBaseAppClassGeneric); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// CEmailPlugin::DatabasePathLC +// --------------------------------------------------------------------------- +// +HBufC* CEmailPlugin::DatabasePathLC(TDriveNumber aMedia) + { + CPIXLOGSTRING("START CEmailPlugin::DatabasePathLC"); + // Allocate extra space for root path e.g. "C:\\Private\\2001f6f7\\" + const TInt KRootPathMaxLength = 30; + HBufC* indexDbPath = HBufC::NewLC(KRootPathMaxLength + KPathIndexDbPath().Length() + KPathTrailer().Length()); + TPtr indexDbPathPtr = indexDbPath->Des(); + +#if 1 // Data caging implementation + iFs.CreatePrivatePath(aMedia); + + TChar chr; + RFs::DriveToChar(aMedia, chr); + indexDbPathPtr.Append(chr); + indexDbPathPtr.Append(KColon); + + TFileName pathWithoutDrive; + iFs.PrivatePath(pathWithoutDrive); + indexDbPathPtr.Append(KCPixSearchServerPrivateDirectory); +#else // here is the way to calculate the path if data caging is not being used. + TFileName rootPath; + PathInfo::GetRootPath(rootPath, aMedia); + indexDbPathPtr.Append(rootPath); +#endif + + indexDbPathPtr.Append(KPathIndexDbPath); + indexDbPathPtr.Append(KPathTrailer); + + return indexDbPath; + } + +// --------------------------------------------------------------------------- +// CEmailPlugin::GetIndexer +// --------------------------------------------------------------------------- +// +CCPixIndexer* CEmailPlugin::GetIndexer() + { + return iIndexer[iCurrentDrive]; + } + +// --------------------------------------------------------------------------- +// CEmailPlugin::HarvestingCompleted +// --------------------------------------------------------------------------- +// +void CEmailPlugin::HarvestingCompleted(TInt aError) +{ + // Notifies the indexing manager of completed harvesting, called by CMessageHarvester + Flush( *GetIndexer() ); + TBuf baseAppClass; + FormBaseAppClass(TDriveNumber(iCurrentDrive), baseAppClass); +#ifdef __PERFORMANCE_DATA + TRAP_IGNORE( UpdatePerformaceDataL() ); +#endif + iObserver->HarvestingCompleted(this, baseAppClass, aError); +} + +// --------------------------------------------------------------------------- +// CEmailPlugin::UpdatePerformaceDataL +// --------------------------------------------------------------------------- +// +#ifdef __PERFORMANCE_DATA +void CEmailPlugin::UpdatePerformaceDataL() + { + TTime now; + + + iCompleteTime.UniversalTime(); + TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime); + + RFs fileSession; + RFile perfFile; + User::LeaveIfError( fileSession.Connect () ); + + + /* Open file if it exists, otherwise create it and write content in it */ + + if(perfFile.Open(fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)) + User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)); + + HBufC8 *heap = HBufC8::NewL(100); + TPtr8 ptr = heap->Des(); + now.HomeTime(); + TBuf<50> timeString; + + _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S"); + now.FormatL(timeString,KOwnTimeFormat); + ptr.AppendNum(now.DateTime().Day()); + ptr.Append(_L("/")); + ptr.AppendNum(now.DateTime().Month()); + ptr.Append(_L("/")); + ptr.AppendNum(now.DateTime().Year()); + ptr.Append(_L(":")); + ptr.Append(timeString); + ptr.Append( _L("Time taken for Harvesting Message is : ")); + ptr.AppendNum(timeDiff.Int64()/1000) ; + ptr.Append(_L(" MilliSeonds \n")); + TInt myInt = 0; + perfFile.Seek(ESeekEnd,myInt); + perfFile.Write (ptr); + perfFile.Close (); + fileSession.Close (); + delete heap; + } + +// --------------------------------------------------------------------------- +// CEmailPlugin::UpdatePerformaceDataL +// --------------------------------------------------------------------------- +// +void CEmailPlugin::UpdatePerformaceDataL(TMsvSessionEvent action) { + + iCompleteTime.UniversalTime(); + TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime); + + RFs fileSession; + RFile perfFile; + User::LeaveIfError( fileSession.Connect () ); + + + /* Open file if it exists, otherwise create it and write content in it */ + + if(perfFile.Open(fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)) + User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)); + + HBufC8 *heap = HBufC8::NewL(100); + TPtr8 ptr = heap->Des(); + + switch (action) { + case EMsvEntriesDeleted: ptr.Append( _L("del "));break; + case EMsvEntriesChanged: ptr.Append( _L("upd "));break; + case EMsvEntriesMoved: ptr.Append( _L("mov "));break; + } + ptr.AppendNum(timeDiff.Int64()/1000) ; + ptr.Append(_L("\n")); + TInt myInt = 0; + perfFile.Seek(ESeekEnd,myInt); + perfFile.Write (ptr); + perfFile.Close (); + fileSession.Close (); + delete heap; + } + +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/email/src/tproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/email/src/tproxy.cpp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Message plugin +* +*/ + + + +#include +#include +#include +#include "cemailplugin.h" + + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy KImplementationTable[] = + { + {{0x20029B09},( TProxyNewLPtr) CEmailPlugin::NewL} + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy ); + return KImplementationTable; + } + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/group/bld.inf --- a/harvesterplugins/messaging/group/bld.inf Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/messaging/group/bld.inf Mon May 03 12:32:15 2010 +0300 @@ -15,8 +15,5 @@ * */ - PRJ_MMPFILES - -messageplugin.mmp - +#include "../smsmms/group/bld.inf" \ No newline at end of file diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/group/messageplugin.mmp --- a/harvesterplugins/messaging/group/messageplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -TARGET cpixmessageplugin.dll -TARGETTYPE PLUGIN - -#include -CAPABILITY CAP_GENERAL_DLL -AllFiles -DRM -#include "../../../harvesterplugins/inc/s60performance.h" -// ECom Dll recognition UID followed by the unique UID for this dll -UID 0x10009D8D 0x2001F701 - -SOURCEPATH ../src -SOURCE cmessageplugin.cpp -SOURCE cmessagedatahandler.cpp -SOURCE cmessageharvester.cpp -SOURCE cmessagemonitor.cpp -SOURCE tproxy.cpp - -USERINCLUDE ../inc - -APP_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom - - -SOURCEPATH ../data -start RESOURCE 2001f701.rss -target cpixmessageplugin.rsc -end - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY msgs.lib -LIBRARY gsmu.lib -LIBRARY cpixharvesterplugininterface.lib -LIBRARY cpixsearchclient.lib -LIBRARY charconv.lib -LIBRARY imcm.lib // CImHeader, CImEmailMessage -LIBRARY etext.lib // CParaFormatLayer etc - -// For logging -LIBRARY flogger.lib - -EXPORTUNFROZEN - diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/inc/cmessagedatahandler.h --- a/harvesterplugins/messaging/inc/cmessagedatahandler.h Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,169 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Harvester message plugin - * -*/ - - -#ifndef CMESSAGEDATAHANDLER_H -#define CMESSAGEDATAHANDLER_H - -// INCLUDES - -#include -#include -#include "cmessageplugin.h" - -// FORWARD DECLARATIONS -class CMmsClientMtm; -class CSmsClientMtm; -class CClientMtmRegistry; -class CSmtpClientMtm; -class CPop3ClientMtm; -class CImap4ClientMtm; - -class CMessageDataHandler : public CActive - { -public: - /** - * Construction - * @return Harvester image plugin - */ - static CMessageDataHandler* NewL(CMessagePlugin& aMessagePlugin, - CMsvSession& aSession); - - /** - * Destruction - */ - virtual ~CMessageDataHandler(); - - /** - * Set a item to be indexed. - * @param TMsvId& aMessageId Id of message - * @param TCPixActionType aActionType Action type of item - * @param TMsvId& aFolderId Id of the folder where message is located - */ - void GatherDataL(TMsvId& aMessageId, TCPixActionType aActionType, TMsvId& aFolderId); - -private: - //From CActive - - /** - * From CACtive. - */ - void DoCancel(); - - /** - * From CACtive. - */ - void RunL(); - - /** - * From CActive. - * @param aError Leave code from RunL() - * @return Error code, KErrNone if error was handled successfully. - */ - TInt RunError(TInt aError); - - /** - * Check if the message is valid and what type it is. - * @param TMsvId aIdToCheck Id of the message - * @param TMsgInfo& aMessageType Reference to put message type - * @return TInt error, if any - */ - TInt IsValidMessageType(TMsvId aIdToCheck, TMsgType& aMessageType); - - /** - * Launch the next request. - */ - void HandleNextRequest(); - -private: - - /** - * Private constructor - */ - CMessageDataHandler(CMessagePlugin& aMessagePlugin, CMsvSession& aSession); - - /** - * 2nd phase construction - */ - void ConstructL(); - - /** - * Create a message item to be indexed based on the params. - * @param TMsvId& aMsvId Id of the item to be indexed - * @param TCPixActionType aAction type of the indexing event - * @param TFolderId& aFolderId Id of the folder where indexed message is located - */ - void CreateMessageIndexItemL(const TMsvId& aMsvId, TCPixActionType aActionType, const TMsvId& aFolderId); - - /** - * Creates general message excerpt - */ - HBufC* CreateExcerptLC(const TDesC& aFromAddress, - const CDesCArray& aRecipientArray, - const TDesC& aSubject, - const TDesC& aBodyText, - const TMsvId& aFolderId); - - CSearchDocument* CreateSmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId); - CSearchDocument* CreateMmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId); - CSearchDocument* CreateEmailDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId); - TUint TextFileCharsetL(RFs aFs, RFile aFile); - void ConvertToUcs2FromUtfL(RFs& aFs, - TDes& aUcs2Text, - const TDesC8& aUtfText, - TUint aMibCharset); - TBool IsTextUcs2(const TDesC8& aText); - TBool TextContainsUtf8Bom(const TDesC8& aText); - -private: - class TMessageItem - { - public: - TMessageItem(TMsvId aMessageId, TCPixActionType aActionType, TMsvId aFolderId) - { - iMessageId = aMessageId; - iActionType = aActionType; - iFolderId = aFolderId; - } - ; - - public: - TMsvId iMessageId; - TCPixActionType iActionType; - TMsvId iFolderId; - }; - -private: - // Message plugin handle - CMessagePlugin& iMessagePlugin; - // Session Message server session, own - CMsvSession& iMsvSession; - // Messages to be handled - RArray iMessageArray; - - // Data sources - CClientMtmRegistry* iMtmReg; - CMmsClientMtm* iMmsMtm; - CSmsClientMtm* iSmsMtm; - CSmtpClientMtm* iSmtpMtm; // client for opening smtp - CPop3ClientMtm* iPop3Mtm; // client for opening pop3 - CImap4ClientMtm* iImap4Mtm; // client for opening imap4 - RFs iFs; - }; - -#endif // CMESSAGEDATAHANDLER_H -// End of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/inc/cmessageharvester.h --- a/harvesterplugins/messaging/inc/cmessageharvester.h Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Harvester message plugin -* -*/ - - -#ifndef CMESSAGEHARVESTER_H -#define CMESSAGEHARVESTER_H - -// INCLUDES - -#include -#include -//#include - -#include "cmessageplugin.h" - - -class CMessageHarvester : public CActive - { - public: - /** - * Construction - * @return Harvester image plugin - */ - static CMessageHarvester* NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); - - /** - * Destruction - */ - virtual ~CMessageHarvester(); - - /** - * Start harvesting message items - */ - void StartHarvestingL(); - - private: //From CActive - - /** - * From CACtive. - */ - void DoCancel(); - - /** - * From CACtive. - */ - void RunL(); - - /** - * From CACtive. - * @param aError Leave code from RunL() - * @return Error code, KErrNone if error was handled successfully. - */ - TInt RunError( TInt aError ); - - - private: - - /** - * Private constructor - */ - CMessageHarvester( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); - - /** - * Get next messaging folder - */ - void GetNextFolderL(); - - /** - * List subfolder from current folder - * @param aFolderEntry Folder entry - */ - void ListSubFoldersL( const CMsvEntry& aFolderEntry ); - - /** - * List subfolder from current folder - * @param aFolderId a folder identifier - */ - void AddFolderWithSubFoldersL( const TMsvId& aFolderId ); - - /** - * Get message folders under the messaging - */ - void GetMessageFoldersL(); - - /** - * Get message identifier - */ - void GetMessageIdL(); - - /** - * Handles next request - */ - void HandleNextRequest(); - - private: - enum TState - { - EStateIdle, // Stopped - EStateNextFolder, // Getting the next folder - EStateNextMessage, // Getting the next message - }; - - private: - // Whether Harvesting is ready - TBool iHarvestCompleted; - // Message plugin for observing - CMessagePlugin& iMessagePlugin; - // Session Message server session, own - CMsvSession& iMsvSession; - // Internal state machine state - TState iState; - // Array of folders to be searched - RArray iToBeSearchedFolders; - // UID of current folder searched - TMsvId iCurrentFolder; - // Current folder message items - CMsvEntrySelection* iChildren; - }; - -#endif // CMESSAGEHARVESTER_H - -// End of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/inc/cmessagemonitor.h --- a/harvesterplugins/messaging/inc/cmessagemonitor.h Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef CMESSAGEMONITOR_H -#define CMESSAGEMONITOR_H - -// INCLUDES - -#include -#include -#include "cmessageplugin.h" -#include - -// FORWARD DECLARATIONS - -class CMessageMonitor : public CActive - { - public: - /** - * NewL - * @return - */ - static CMessageMonitor* NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); - - /** - * Destructor - */ - virtual ~CMessageMonitor(); - - /** - * HandleMsgMovedL handle a moved message - */ - void HandleMsgMovedL( const TMsvId aNewFolderId, - const TMsvId aOldFolderId, - const CMsvEntrySelection& aSelection ); - - /** - * HandleMsgCreatedChangedL handles a new or changed message - * @param CMsvEntrySelection aSelection list of messages TMsvIds that have changed - * @param TMsvId aFolderId Folder that contains these changed messages - * @param MMsvSessionObserver::TMsvSessionEvent aEvent type of event, not used currently - */ - void HandleMsgCreatedChangedL( const CMsvEntrySelection& aSelection, - const TMsvId aFolderId, - const MMsvSessionObserver::TMsvSessionEvent aEvent ); - - /** - * HandleMsgCreatedChangedL handles a deleted message - * @param CMsvEntrySelection aSelection list of messages TMsvIds that have been deleted - */ - void HandleMsgDeletedL( const CMsvEntrySelection& aSelection ); - - protected: - /** - * inherited from CActive - */ - void RunL(); - void DoCancel(); - TInt RunError(TInt aError); - - private: - - /** - * From Constructor - */ - CMessageMonitor( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); - - /** - * 2nd phase construction - */ - void ConstructL(); - - /** - * OverwriteOrAddToQuereL is a helper for MessageItemL. Adds only unique TMsvId's to the processing queue. - * @param TMsvId aMsvId message to be added to the list - * @param TCPixActionType aAction action type to be added to the list - * @param TMsvId aFolderId id of the folder where message is located - */ - void OverwriteOrAddToQuereL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId); - - /** - * MessageItemL adds a message to the delayed queue, and schedules the RunL - * @param TMsvId aMsvId message to be added to the list - * @param TCPixActionType aAction action type to be added to the list - * @param TMsvId aFolderId id of the folder where message is located - */ - void MessageItemL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId); - - private: - enum TState - { - EStateNone = 0, - EStateWaiting - }; - - struct TMessageRecord - { - TMsvId iMsvId; - TCPixActionType iAction; - TMsvId iFolderId; - }; - - private: - // Queue of documents to be indexed - RArray iMessages; - - // State machine's state - TState iState; - - // Timer which is used to delay indexing messages - RTimer iTimer; - - CMsvSession& iMsvSession; - CMessagePlugin& iMessagePlugin; - }; - -#endif // CMESSAGEMONITOR_H diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/inc/cmessageplugin.h --- a/harvesterplugins/messaging/inc/cmessageplugin.h Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#ifndef CMESSAGEPLUGIN_H -#define CMESSAGEPLUGIN_H - -#include -#include -#include -#include - -class CMessageMonitor; -class CMessageHarvester; -class CMessageDataHandler; -class CCPixIndexer; - -enum TMsgType -{ - EMsgTypeInvalid, - EMsgTypeSms, - EMsgTypeMms, - EMsgTypeDraft, - EMsgTypeEmailPop3, - EMsgTypeEmailSmtp, - EMsgTypeEmailImap4 -}; - -class CMessagePlugin : public CIndexingPlugin, public MMsvSessionObserver -{ -public: - static CMessagePlugin* NewL(); - static CMessagePlugin* NewLC(); - virtual ~CMessagePlugin(); - - /** - * From CIndexingPlugin - */ - void StartPluginL(); - void StartHarvestingL(const TDesC& aQualifiedBaseAppClass); - - /** - * callback from MMsvSessionObserver - */ - virtual void HandleSessionEventL(TMsvSessionEvent aEvent, - TAny* aArg1, - TAny* aArg2, - TAny* aArg3); - - /** - * Called by Message monitor or harvester when new item is found. - * - * @param aMsgId Message item identifier - * @param TCPixActionType aActionType action type - * @param aFolderId identifier of the folder where message is stored - */ - void MessageItemL( TMsvId aMsgId, TCPixActionType aActionType, TMsvId aFolderId ); - - /** - * Indentify the message type from TMsvEntry - * - * @param TMsvEntry& aEntry a entry item to identify - */ - TMsgType CalculateMessageType (const TMsvEntry& aEntry ); - - /** - * Gets the database observer class - */ - CCPixIndexer* GetIndexer(); //SPB { return iIndexer; } - /** - * MountL - Mount an IndexDB. - * @aMedia drive to mount. - * @aForceReharvesting to reharvest or not - */ - void MountL(TDriveNumber aMedia, TBool aForceReharvesting=EFalse); - - /** - * UnMount - Dismount a IndexDB for drive aMedia. - * @aMedia drive to unmount. - * @aUndefineAsWell if ETrue then undefine the volume as well - * - */ - void UnMount(TDriveNumber aMedia, TBool aUndefineAsWell = ETrue); - - /** - * FormBaseAppClass - constructs a baseAppClass for the given drive. - * @aMedia drive to form the baseAppClass for. - * @aBaseAppClass return descriptor containing the baseAppClass - * returns KErrNone on success or a standard error code - */ - static TInt FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass); - - /** - * DatabasePathL - Forms IndexDb path. - * @param aMedia - The drive for which the path should be constructed. - * returns pointer to the IndexDb path. - */ - HBufC* DatabasePathLC(TDriveNumber aMedia); - - /** - * IsMediaRemovableL - Check media is removable or not. - * @param aDrive - The drive for which it is checked. - * returns ETrue if it is removable else EFalse. - */ - TBool IsMediaRemovableL(TDriveNumber& aDrive); - -public: - /* - * Notifies the indexing manager of completed harvesting, called by CMessageHarvester - */ - void HarvestingCompleted(TInt aError); - -protected: - CMessagePlugin(); - void ConstructL(); - -private: - // Session to Messge server session - CMsvSession* iMsvSession; - CMessageMonitor* iMessageMonitor; - CMessageHarvester* iMessageHarvester; - CMessageDataHandler* iMessageDataHandler; - - // File system session - RFs iFs; - //Currently used Drive by messaging application - TInt iCurrentDrive; - // CPix indexer - CCPixIndexer* iIndexer[EDriveZ+1]; // EDriveZ enum value is 25, so add 1. - -#ifdef __PERFORMANCE_DATA - TTime iStartTime; - TTime iCompleteTime; - void UpdatePerformaceDataL(); - void UpdatePerformaceDataL(TMsvSessionEvent); -#endif -}; - -#endif // CMESSAGEPLUGIN_H diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/data/2001f701.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/data/2001f701.rss Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +// 0x2001F701.RSS + +#include + +// Declares info for one test implementation +RESOURCE REGISTRY_INFO theInfo + { + // UID for the DLL + dll_uid = 0x2001F701; // ECOM Messaging Plugin dll UID + // Declare array of interface info + interfaces = + { + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = 0x2001F700; // CPixSearch Plugin Interface UID + implementations = + { + // Info for CMessagePlugin + IMPLEMENTATION_INFO + { + implementation_uid = 0x2001F701; + version_no = 1; + display_name = "Messages"; + default_data = "Messaging"; + opaque_data = ""; + } + }; + } + }; + } + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/group/bld.inf Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +PRJ_MMPFILES + +messageplugin.mmp + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/group/messageplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/group/messageplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +TARGET cpixmessageplugin.dll +TARGETTYPE PLUGIN + +#include +CAPABILITY CAP_GENERAL_DLL -AllFiles -DRM +#include "../../../../harvesterplugins/inc/s60performance.h" +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x2001F701 + +SOURCEPATH ../src +SOURCE cmessageplugin.cpp +SOURCE cmessagedatahandler.cpp +SOURCE cmessageharvester.cpp +SOURCE cmessagemonitor.cpp +SOURCE tproxy.cpp + +USERINCLUDE ../inc ../traces + +APP_LAYER_SYSTEMINCLUDE +SYSTEMINCLUDE /epoc32/include/ecom + + +SOURCEPATH ../data +start RESOURCE 2001f701.rss +target cpixmessageplugin.rsc +end + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY msgs.lib +LIBRARY gsmu.lib +LIBRARY cpixharvesterplugininterface.lib +LIBRARY cpixsearchclient.lib +LIBRARY charconv.lib +LIBRARY imcm.lib // CImHeader, CImEmailMessage +LIBRARY etext.lib // CParaFormatLayer etc + +// For logging +LIBRARY flogger.lib + +EXPORTUNFROZEN + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/inc/cmessagedatahandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/inc/cmessagedatahandler.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Harvester message plugin + * +*/ + + +#ifndef CMESSAGEDATAHANDLER_H +#define CMESSAGEDATAHANDLER_H + +// INCLUDES + +#include +#include +#include "cmessageplugin.h" + +// FORWARD DECLARATIONS +class CMmsClientMtm; +class CSmsClientMtm; +class CClientMtmRegistry; +class CSmtpClientMtm; +class CPop3ClientMtm; +class CImap4ClientMtm; + +class CMessageDataHandler : public CActive + { +public: + /** + * Construction + * @return Harvester image plugin + */ + static CMessageDataHandler* NewL(CMessagePlugin& aMessagePlugin, + CMsvSession& aSession); + + /** + * Destruction + */ + virtual ~CMessageDataHandler(); + + /** + * Set a item to be indexed. + * @param TMsvId& aMessageId Id of message + * @param TCPixActionType aActionType Action type of item + * @param TMsvId& aFolderId Id of the folder where message is located + */ + void GatherDataL(TMsvId& aMessageId, TCPixActionType aActionType, TMsvId& aFolderId); + +private: + //From CActive + + /** + * From CACtive. + */ + void DoCancel(); + + /** + * From CACtive. + */ + void RunL(); + + /** + * From CActive. + * @param aError Leave code from RunL() + * @return Error code, KErrNone if error was handled successfully. + */ + TInt RunError(TInt aError); + + /** + * Check if the message is valid and what type it is. + * @param TMsvId aIdToCheck Id of the message + * @param TMsgInfo& aMessageType Reference to put message type + * @return TInt error, if any + */ + TInt IsValidMessageType(TMsvId aIdToCheck, TMsgType& aMessageType); + + /** + * Launch the next request. + */ + void HandleNextRequest(); + +private: + + /** + * Private constructor + */ + CMessageDataHandler(CMessagePlugin& aMessagePlugin, CMsvSession& aSession); + + /** + * 2nd phase construction + */ + void ConstructL(); + + /** + * Create a message item to be indexed based on the params. + * @param TMsvId& aMsvId Id of the item to be indexed + * @param TCPixActionType aAction type of the indexing event + * @param TFolderId& aFolderId Id of the folder where indexed message is located + */ + void CreateMessageIndexItemL(const TMsvId& aMsvId, TCPixActionType aActionType, const TMsvId& aFolderId); + + /** + * Creates general message excerpt + */ + HBufC* CreateExcerptLC(const TDesC& aFromAddress, + const CDesCArray& aRecipientArray, + const TDesC& aSubject, + const TDesC& aBodyText, + const TMsvId& aFolderId); + + CSearchDocument* CreateSmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId); + CSearchDocument* CreateMmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId); + CSearchDocument* CreateEmailDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId); + TUint TextFileCharsetL(RFs aFs, RFile aFile); + void ConvertToUcs2FromUtfL(RFs& aFs, + TDes& aUcs2Text, + const TDesC8& aUtfText, + TUint aMibCharset); + TBool IsTextUcs2(const TDesC8& aText); + TBool TextContainsUtf8Bom(const TDesC8& aText); + +private: + class TMessageItem + { + public: + TMessageItem(TMsvId aMessageId, TCPixActionType aActionType, TMsvId aFolderId) + { + iMessageId = aMessageId; + iActionType = aActionType; + iFolderId = aFolderId; + } + ; + + public: + TMsvId iMessageId; + TCPixActionType iActionType; + TMsvId iFolderId; + }; + +private: + // Message plugin handle + CMessagePlugin& iMessagePlugin; + // Session Message server session, own + CMsvSession& iMsvSession; + // Messages to be handled + RArray iMessageArray; + + // Data sources + CClientMtmRegistry* iMtmReg; + CMmsClientMtm* iMmsMtm; + CSmsClientMtm* iSmsMtm; + CSmtpClientMtm* iSmtpMtm; // client for opening smtp + CPop3ClientMtm* iPop3Mtm; // client for opening pop3 + CImap4ClientMtm* iImap4Mtm; // client for opening imap4 + RFs iFs; + }; + +#endif // CMESSAGEDATAHANDLER_H +// End of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/inc/cmessageharvester.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/inc/cmessageharvester.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,136 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Harvester message plugin +* +*/ + + +#ifndef CMESSAGEHARVESTER_H +#define CMESSAGEHARVESTER_H + +// INCLUDES + +#include +#include +//#include + +#include "cmessageplugin.h" + + +class CMessageHarvester : public CActive + { + public: + /** + * Construction + * @return Harvester image plugin + */ + static CMessageHarvester* NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); + + /** + * Destruction + */ + virtual ~CMessageHarvester(); + + /** + * Start harvesting message items + */ + void StartHarvestingL(); + + private: //From CActive + + /** + * From CACtive. + */ + void DoCancel(); + + /** + * From CACtive. + */ + void RunL(); + + /** + * From CACtive. + * @param aError Leave code from RunL() + * @return Error code, KErrNone if error was handled successfully. + */ + TInt RunError( TInt aError ); + + + private: + + /** + * Private constructor + */ + CMessageHarvester( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); + + /** + * Get next messaging folder + */ + void GetNextFolderL(); + + /** + * List subfolder from current folder + * @param aFolderEntry Folder entry + */ + void ListSubFoldersL( const CMsvEntry& aFolderEntry ); + + /** + * List subfolder from current folder + * @param aFolderId a folder identifier + */ + void AddFolderWithSubFoldersL( const TMsvId& aFolderId ); + + /** + * Get message folders under the messaging + */ + void GetMessageFoldersL(); + + /** + * Get message identifier + */ + void GetMessageIdL(); + + /** + * Handles next request + */ + void HandleNextRequest(); + + private: + enum TState + { + EStateIdle, // Stopped + EStateNextFolder, // Getting the next folder + EStateNextMessage, // Getting the next message + }; + + private: + // Whether Harvesting is ready + TBool iHarvestCompleted; + // Message plugin for observing + CMessagePlugin& iMessagePlugin; + // Session Message server session, own + CMsvSession& iMsvSession; + // Internal state machine state + TState iState; + // Array of folders to be searched + RArray iToBeSearchedFolders; + // UID of current folder searched + TMsvId iCurrentFolder; + // Current folder message items + CMsvEntrySelection* iChildren; + }; + +#endif // CMESSAGEHARVESTER_H + +// End of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/inc/cmessagemonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/inc/cmessagemonitor.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef CMESSAGEMONITOR_H +#define CMESSAGEMONITOR_H + +// INCLUDES + +#include +#include +#include "cmessageplugin.h" +#include + +// FORWARD DECLARATIONS + +class CMessageMonitor : public CActive + { + public: + /** + * NewL + * @return + */ + static CMessageMonitor* NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); + + /** + * Destructor + */ + virtual ~CMessageMonitor(); + + /** + * HandleMsgMovedL handle a moved message + */ + void HandleMsgMovedL( const TMsvId aNewFolderId, + const TMsvId aOldFolderId, + const CMsvEntrySelection& aSelection ); + + /** + * HandleMsgCreatedChangedL handles a new or changed message + * @param CMsvEntrySelection aSelection list of messages TMsvIds that have changed + * @param TMsvId aFolderId Folder that contains these changed messages + * @param MMsvSessionObserver::TMsvSessionEvent aEvent type of event, not used currently + */ + void HandleMsgCreatedChangedL( const CMsvEntrySelection& aSelection, + const TMsvId aFolderId, + const MMsvSessionObserver::TMsvSessionEvent aEvent ); + + /** + * HandleMsgCreatedChangedL handles a deleted message + * @param CMsvEntrySelection aSelection list of messages TMsvIds that have been deleted + */ + void HandleMsgDeletedL( const CMsvEntrySelection& aSelection ); + + protected: + /** + * inherited from CActive + */ + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + + private: + + /** + * From Constructor + */ + CMessageMonitor( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ); + + /** + * 2nd phase construction + */ + void ConstructL(); + + /** + * OverwriteOrAddToQuereL is a helper for MessageItemL. Adds only unique TMsvId's to the processing queue. + * @param TMsvId aMsvId message to be added to the list + * @param TCPixActionType aAction action type to be added to the list + * @param TMsvId aFolderId id of the folder where message is located + */ + void OverwriteOrAddToQuereL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId); + + /** + * MessageItemL adds a message to the delayed queue, and schedules the RunL + * @param TMsvId aMsvId message to be added to the list + * @param TCPixActionType aAction action type to be added to the list + * @param TMsvId aFolderId id of the folder where message is located + */ + void MessageItemL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId); + + private: + enum TState + { + EStateNone = 0, + EStateWaiting + }; + + struct TMessageRecord + { + TMsvId iMsvId; + TCPixActionType iAction; + TMsvId iFolderId; + }; + + private: + // Queue of documents to be indexed + RArray iMessages; + + // State machine's state + TState iState; + + // Timer which is used to delay indexing messages + RTimer iTimer; + + CMsvSession& iMsvSession; + CMessagePlugin& iMessagePlugin; + }; + +#endif // CMESSAGEMONITOR_H diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/inc/cmessageplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/inc/cmessageplugin.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,153 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef CMESSAGEPLUGIN_H +#define CMESSAGEPLUGIN_H + +#include +#include +#include +#include + +class CMessageMonitor; +class CMessageHarvester; +class CMessageDataHandler; +class CCPixIndexer; + +enum TMsgType +{ + EMsgTypeInvalid, + EMsgTypeSms, + EMsgTypeMms, + EMsgTypeDraft, + EMsgTypeEmailPop3, + EMsgTypeEmailSmtp, + EMsgTypeEmailImap4 +}; + +class CMessagePlugin : public CIndexingPlugin, public MMsvSessionObserver +{ +public: + static CMessagePlugin* NewL(); + static CMessagePlugin* NewLC(); + virtual ~CMessagePlugin(); + + /** + * From CIndexingPlugin + */ + void StartPluginL(); + void StartHarvestingL(const TDesC& aQualifiedBaseAppClass); + + /** + * callback from MMsvSessionObserver + */ + virtual void HandleSessionEventL(TMsvSessionEvent aEvent, + TAny* aArg1, + TAny* aArg2, + TAny* aArg3); + + /** + * Called by Message monitor or harvester when new item is found. + * + * @param aMsgId Message item identifier + * @param TCPixActionType aActionType action type + * @param aFolderId identifier of the folder where message is stored + */ + void MessageItemL( TMsvId aMsgId, TCPixActionType aActionType, TMsvId aFolderId ); + + /** + * Indentify the message type from TMsvEntry + * + * @param TMsvEntry& aEntry a entry item to identify + */ + TMsgType CalculateMessageType (const TMsvEntry& aEntry ); + + /** + * Gets the database observer class + */ + CCPixIndexer* GetIndexer(); //SPB { return iIndexer; } + /** + * MountL - Mount an IndexDB. + * @aMedia drive to mount. + * @aForceReharvesting to reharvest or not + */ + void MountL(TDriveNumber aMedia, TBool aForceReharvesting=EFalse); + + /** + * UnMount - Dismount a IndexDB for drive aMedia. + * @aMedia drive to unmount. + * @aUndefineAsWell if ETrue then undefine the volume as well + * + */ + void UnMount(TDriveNumber aMedia, TBool aUndefineAsWell = ETrue); + + /** + * FormBaseAppClass - constructs a baseAppClass for the given drive. + * @aMedia drive to form the baseAppClass for. + * @aBaseAppClass return descriptor containing the baseAppClass + * returns KErrNone on success or a standard error code + */ + static TInt FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass); + + /** + * DatabasePathL - Forms IndexDb path. + * @param aMedia - The drive for which the path should be constructed. + * returns pointer to the IndexDb path. + */ + HBufC* DatabasePathLC(TDriveNumber aMedia); + + /** + * IsMediaRemovableL - Check media is removable or not. + * @param aDrive - The drive for which it is checked. + * returns ETrue if it is removable else EFalse. + */ + TBool IsMediaRemovableL(TDriveNumber& aDrive); + +public: + /* + * Notifies the indexing manager of completed harvesting, called by CMessageHarvester + */ + void HarvestingCompleted(TInt aError); + +protected: + CMessagePlugin(); + void ConstructL(); + +private: + // Session to Messge server session + CMsvSession* iMsvSession; + CMessageMonitor* iMessageMonitor; + CMessageHarvester* iMessageHarvester; + CMessageDataHandler* iMessageDataHandler; + + // File system session + RFs iFs; + //Currently used Drive by messaging application + TInt iCurrentDrive; + // CPix indexer + CCPixIndexer* iIndexer[EDriveZ+1]; // EDriveZ enum value is 25, so add 1. + +#ifdef __PERFORMANCE_DATA + TTime iStartTime; + TTime iCompleteTime; + void UpdatePerformaceDataL(); + void UpdatePerformaceDataL(TMsvSessionEvent); +#endif +}; + +#endif // CMESSAGEPLUGIN_H diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/src/cmessagedatahandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/src/cmessagedatahandler.cpp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,922 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Harvester message plugin + * +*/ + + +// INCLUDES + +#include + +#include +#include // SMS Headers +#include // MMS Headers +#include +#include // IMAP Headers +#include // SMTP +#include // POP + +#include "harvesterserverlogger.h" +#include "cmessagedatahandler.h" +#include "cmessageplugin.h" +#include +#include + +#include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cmessagedatahandlerTraces.h" +#endif + + +/** Number of symbols from MsgBody taken to excerpt */ +const TInt KMsgBodyExcerptSymbols = 90; + +// For Ucs2 detection +const TInt KUtf8BomLength = 3; +const TUint8 KUtf8Bom[KUtf8BomLength] = {0xEF, 0xBB, 0xBF}; + +// CSearchDocument ID max length +const TUint KMaxDocId = 20; +// Hardcoded limit for the body size to index (and store) +const TInt KMaxDocumentSize = 1024; + +_LIT8(KMimeTypeText, "text/plain" ); + +_LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD); +_LIT(KMimeTypeMessaging, MESSAGING_MIMETYPE); + +/** Field names */ +_LIT(KToField, TO_FIELD); +_LIT(KCcField, CC_FIELD); +_LIT(KBccField, BCC_FIELD); +_LIT(KFromField, FROM_FIELD); +_LIT(KFolderField, FOLDER_FIELD); +_LIT(KBodyField, BODY_FIELD); +_LIT(KSubjectField, SUBJECT_FIELD); + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// CMessageDataHandler::NewL +// --------------------------------------------------------------------------- +// +CMessageDataHandler* CMessageDataHandler::NewL(CMessagePlugin& aMessagePlugin, + CMsvSession& aSession) + { + OstTraceFunctionEntry0( CMESSAGEDATAHANDLER_NEWL_ENTRY ); + CPIXLOGSTRING( "CMessageDataHandler::NewL() - enter" ); + + CMessageDataHandler* self = new (ELeave) CMessageDataHandler( + aMessagePlugin, aSession); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + CPIXLOGSTRING( "CMessageDataHandler::NewL() - return" ); + OstTraceFunctionExit0( CMESSAGEDATAHANDLER_NEWL_EXIT ); + return self; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::~CMessageDataHandler +// --------------------------------------------------------------------------- +// +CMessageDataHandler::~CMessageDataHandler() + { + Cancel(); + iFs.Close(); + delete iMmsMtm; + delete iSmsMtm; + delete iSmtpMtm; + delete iPop3Mtm; + delete iImap4Mtm; + delete iMtmReg; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::CMessageDataHandler +// --------------------------------------------------------------------------- +// +CMessageDataHandler::CMessageDataHandler(CMessagePlugin& aMessagePlugin, CMsvSession& aSession) + : CActive(EPriorityLow), iMessagePlugin(aMessagePlugin), iMsvSession(aSession) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::ConstructL +// --------------------------------------------------------------------------- +// +void CMessageDataHandler::ConstructL() + { + // TODO iFs only used in MMS attachment logic, + // from a performance perspective, is it worthwhile connecting here? + User::LeaveIfError(iFs.Connect()); + iMtmReg = CClientMtmRegistry::NewL(iMsvSession); + TRAPD(err,iSmsMtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeSMS))); + OstTrace1( TRACE_NORMAL, CMESSAGEDATAHANDLER_CONSTRUCTL, "CMessageDataHandler::ConstructL;iSmsMtm err=%d",err ); + CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iSmsMtm err = %d",err); + TRAP(err,iMmsMtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeMultimedia))); + OstTrace1( TRACE_NORMAL, DUP1_CMESSAGEDATAHANDLER_CONSTRUCTL, "CMessageDataHandler::ConstructL;iMmsMtm err=%d", err ); + CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iMmsMtm err = %d",err); + /* + TRAP(err,iSmtpMtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeSMTP))); + CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iSmtpMtm err = %d",err); + TRAP(err, iPop3Mtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypePOP3))); + CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iPop3Mtm err = %d",err); + TRAP(err,iImap4Mtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeIMAP4))); + CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iImap4Mtm err = %d",err); + */ + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::GatherData +// --------------------------------------------------------------------------- +// +void CMessageDataHandler::GatherDataL(TMsvId& aMessageId, + TCPixActionType aActionType, TMsvId& aFolderId) + { + TMessageItem item(aMessageId, aActionType, aFolderId); + iMessageArray.AppendL(item); + HandleNextRequest(); + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::IsValidMessageTypeL +// --------------------------------------------------------------------------- +// +TInt CMessageDataHandler::IsValidMessageType(TMsvId aIdToCheck, + TMsgType& aMessageType) + { + OstTraceFunctionEntry0( CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE_ENTRY ); + CPIXLOGSTRING("ENTER CMessageDataHandler::IsValidMessageType"); + TMsvEntry entry; + TMsvId service = 0; + TInt err = iMsvSession.GetEntry(aIdToCheck, service, entry); + OstTrace1( TRACE_NORMAL, CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE, "CMessageDataHandler::IsValidMessageType;GetEntry Error=%d", err ); + CPIXLOGSTRING2("CMessageDataHandler::IsValidMessageType GetEntry: %d", err); + if (!err) + { + aMessageType = iMessagePlugin.CalculateMessageType(entry); + OstTrace1( TRACE_NORMAL, DUP1_CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE, "CMessageDataHandler::IsValidMessageType;Message Type=%d", aMessageType ); + CPIXLOGSTRING2("CMessageDataHandler::IsValidMessageType type: %d", aMessageType ); + } + CPIXLOGSTRING("END CMessageDataHandler::IsValidMessageType"); + OstTraceFunctionExit0( CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE_EXIT ); + return err; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::CreateSmsIndexItemLC +// --------------------------------------------------------------------------- +// +void CMessageDataHandler::CreateMessageIndexItemL(const TMsvId& aMsvId, + TCPixActionType aActionType, const TMsvId& aFolderId) + { + OstTrace1( TRACE_NORMAL, CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;aMsvId=%d", aMsvId ); + CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): aMsvId = %d ", aMsvId ); + + // Index an empty item if removal action + if (aActionType == ECPixRemoveAction) + { + TBuf<20> docid_str; + docid_str.AppendNum(aMsvId); + if (iMessagePlugin.GetIndexer()) + { + TRAPD(err, iMessagePlugin.GetIndexer()->DeleteL(docid_str)); + if (err == KErrNone) + { + OstTrace0( TRACE_NORMAL, DUP1_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Document deleted." ); + CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Document deleted."); + } + else + { + OstTrace1( TRACE_NORMAL, DUP2_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in deleting the doc=%d", err ); + CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in deleting the document.", err); + } + } + return; + } + + // Check message type + TMsgType messageType = EMsgTypeInvalid; // initialisation + TInt error = IsValidMessageType(aMsvId, messageType); + + // creating CSearchDocument object with unique ID for this application + CSearchDocument* index_item = NULL; + + switch (messageType) + { + case EMsgTypeSms: + { + TRAPD(err, index_item = CreateSmsDocumentL(aMsvId, aFolderId)); + if (err == KErrNone) + { + OstTrace0( TRACE_NORMAL, DUP3_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): SMS document created." ); + CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): SMS document created."); + } + else + { + OstTrace1( TRACE_NORMAL, DUP4_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in creating the sms doc=%d", err ); + CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating SMS document.", err); + } + break; + } + case EMsgTypeMms: + { + TRAPD(err, index_item = CreateMmsDocumentL(aMsvId, aFolderId)); + if (err == KErrNone) + { + OstTrace0( TRACE_NORMAL, DUP5_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): MMS document created." ); + CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): MMS document created."); + } + else + { + OstTrace1( TRACE_NORMAL, DUP6_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in creating the mms doc=%d", err ); + CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating MMS document.", err); + } + break; + } + case EMsgTypeEmailPop3: + case EMsgTypeEmailImap4: + case EMsgTypeEmailSmtp: + { + TRAPD(err, index_item = CreateEmailDocumentL(aMsvId, aFolderId)); + if (err == KErrNone) + { + OstTrace0( TRACE_NORMAL, DUP7_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): E-mail document created." ); + CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): E-mail document created."); + } + else + { + OstTrace1( TRACE_NORMAL, DUP8_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in ccreating the email doc=%d", err ); + CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating e-mail document.", err); + } + break; + } + case EMsgTypeInvalid: + // For EMsgTypeDraft there is no way to tell if it was a SMS, MMS or email, + // so don't create index_item. + case EMsgTypeDraft: + default: + // Error occurred + break; + } + + // Exit if wrong message type + if (index_item == NULL) + { + OstTrace0( TRACE_NORMAL, DUP9_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Document was not created." ); + CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Document was not created."); + return; + } + CleanupStack::PushL(index_item); + + // Folder field + TMsvEntry entry; + TMsvId service = 0; + iMsvSession.GetEntry(aFolderId, service, entry); + HBufC *folder_str = entry.iDetails.AllocLC(); + index_item->AddFieldL(KFolderField, *folder_str, CDocumentField::EStoreYes | CDocumentField::EIndexNo); + + // Mime type field + index_item->AddFieldL(KMimeTypeField, KMimeTypeMessaging, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); + + // Send for indexing + if (iMessagePlugin.GetIndexer()) + { + if (aActionType == ECPixAddAction) + { + TRAPD(err, iMessagePlugin.GetIndexer()->AddL(*index_item)); + if (err == KErrNone) + { + OstTrace0( TRACE_NORMAL, DUP10_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Added." ); + CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Added."); + } + else + { + OstTrace1( TRACE_NORMAL, DUP11_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in Adding=%d", err ); + CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in adding.", err); + } + } + else if (aActionType == ECPixUpdateAction) + { + TRAPD(err, iMessagePlugin.GetIndexer()->UpdateL(*index_item)); + if (err == KErrNone) + { + OstTrace0( TRACE_NORMAL, DUP12_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL(): Updated." ); + CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Updated."); + } + else + { + OstTrace1( TRACE_NORMAL, DUP13_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "CMessageDataHandler::CreateMessageIndexItemL;Error in Updating=%d", err ); + CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in updating.", err); + } + } + } + else + { + OstTrace0( TRACE_NORMAL, DUP14_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML, "END CMessageDataHandler::CreateMessageIndexItemL(): No indexer present." ); + CPIXLOGSTRING("END CMessageDataHandler::CreateMessageIndexItemL(): No indexer present."); + } + + CleanupStack::PopAndDestroy(folder_str); + CleanupStack::PopAndDestroy(index_item); + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::CreateSmsDocumentL +// --------------------------------------------------------------------------- +// +CSearchDocument* CMessageDataHandler::CreateSmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId) + { + // Select mtm for this type + iSmsMtm->SwitchCurrentEntryL(aMsvId); + iSmsMtm->LoadMessageL(); + + // creating CSearchDocument object with unique ID for this application + TBuf docid_str; + docid_str.AppendNum(aMsvId); + CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(SMSAPPCLASS)); + + // Add from field use the name instead of number if in the contacts db. + // (iSmsMtm->SmsHeader().FromAddress() - only returns the number) + TMsvEntry entry; + TMsvId service = 0; + iMsvSession.GetEntry(aMsvId, service, entry); + HBufC *fromNameOrNumberBuf = entry.iDetails.AllocLC(); + index_item->AddFieldL(KFromField, *fromNameOrNumberBuf); + + // Add the recipients as content items + TBuf<64> to_field; + const CDesCArray + & recipientArray = + static_cast (iSmsMtm->AddresseeList().RecipientList()); + for (TInt i = 0; i < recipientArray.MdcaCount(); i++) + { + to_field = KToField; + if (i>0) + to_field.AppendNum(i); + index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i)); + } + + // Add the body text as a content item + TInt msgLength = iSmsMtm->Body().DocumentLength(); + HBufC* bodyText = HBufC::NewLC(msgLength); + TPtr body_ptr = bodyText->Des(); + iSmsMtm->Body().Extract(body_ptr); + index_item->AddFieldL(KBodyField, *bodyText); + + // Add excerpt + // Note SMS does not have a subject field. + HBufC* excerpt = CreateExcerptLC(*fromNameOrNumberBuf, recipientArray, KNullDesC(), body_ptr, aFolderId); + index_item->AddExcerptL(*excerpt); + CleanupStack::PopAndDestroy(excerpt); + CleanupStack::PopAndDestroy(bodyText); + + CleanupStack::PopAndDestroy(fromNameOrNumberBuf); + + // Pop the item + CleanupStack::Pop(index_item); + return index_item; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::CreateMmsDocumentL +// --------------------------------------------------------------------------- +// +CSearchDocument* CMessageDataHandler::CreateMmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId) + { + // Select mtm for this type + iMmsMtm->SwitchCurrentEntryL(aMsvId); + iMmsMtm->LoadMessageL(); + + // creating CSearchDocument object with unique ID for this application + TBuf docid_str; + docid_str.AppendNum(aMsvId); + CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(MMSAPPCLASS)); + + // Add from field + index_item->AddFieldL(KFromField, iMmsMtm->Sender()); + + // Add the recipients as content items + TBuf<64> to_field; + const CDesCArray + & recipientArray = + static_cast (iMmsMtm->AddresseeList().RecipientList()); + for (TInt i = 0; i < recipientArray.MdcaCount(); i++) + { + to_field = KToField; + if (i>0) + to_field.AppendNum(i); + index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i)); + } + + // Add subject + TPtrC subject(iMmsMtm->SubjectL()); + index_item->AddFieldL(KSubjectField, subject); + + // Add the body parts as a content items + // See if the MMS contains a text file attachment + TBool excerptFieldAdded(EFalse); + TInt bodycount = 0; + CMsvStore* msvStore = iMmsMtm->Entry().ReadStoreL(); + CleanupStack::PushL( msvStore ); + MMsvAttachmentManager& attManager = msvStore->AttachmentManagerL(); + for ( TInt i = 0; i < attManager.AttachmentCount(); i++ ) + { + CMsvAttachment* attInfo = attManager.GetAttachmentInfoL(i); + CleanupStack::PushL( attInfo ); + + if (attInfo->MimeType() == KMimeTypeText()) + { + // Mime type + RFile attFile = attManager.GetAttachmentFileL(i); + CleanupClosePushL( attFile ); + TInt charsetMIB = TextFileCharsetL(iFs, attFile); + + // Get the file size + TInt fileSize = 0; + User::LeaveIfError(attFile.Size(fileSize)); + + // Read the file + HBufC8* textSource = HBufC8::NewLC(fileSize); + TPtr8 ptr8 = textSource->Des(); + attFile.Read(ptr8); + + // Convert character set + HBufC* text = HBufC::NewLC( fileSize ); + TPtr buf = text->Des(); + if ( KMmsIso10646Ucs2 != charsetMIB ) + { + if ( KMmsUsAscii == charsetMIB ) + buf.Copy(*textSource); + else + ConvertToUcs2FromUtfL(iFs, buf, *textSource, charsetMIB); + } + else + { + TPtrC ptr(reinterpret_cast(textSource->Des().Ptr()), + textSource->Length() / sizeof(TText)); + + // Ignore the first unicode charcter FFFE + ptr.Set( ptr.Mid( 1 ) ); + buf = ptr; + } + + + // Add the text of the file as a content item + // MMS message body is in attachment + TBuf<64> body_field; + body_field = KBodyField; + if (bodycount>0) + { + // Add additional body fields + body_field.AppendNum(bodycount); + } + else + { + // Add excerpt for the first body field + HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, *text, aFolderId); + index_item->AddExcerptL(*excerpt); + CleanupStack::PopAndDestroy(excerpt); + excerptFieldAdded = ETrue; + } + + // TODO: add only few kilobytes of the body? + index_item->AddFieldL(body_field, *text); + ++bodycount; + + CleanupStack::PopAndDestroy( 3, &attFile ); // text, textSource, attFile + } + else + { + // add attachment name when binary file. + if ( !excerptFieldAdded ) + { + // attachment name might not be set + HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, attInfo->AttachmentName(), aFolderId); + index_item->AddExcerptL(*excerpt); + CleanupStack::PopAndDestroy(excerpt); + excerptFieldAdded = ETrue; + } + } + CleanupStack::PopAndDestroy( attInfo ); + } + + // If no excerpt has been added yet, then add information have + if ( !excerptFieldAdded ) + { + HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, KNullDesC(), aFolderId); + index_item->AddExcerptL(*excerpt); + CleanupStack::PopAndDestroy(excerpt); + } + + // Cleanup + CleanupStack::PopAndDestroy( msvStore ); + + // Pop the item + CleanupStack::Pop(index_item); + return index_item; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::CreateEmailDocumentL +// --------------------------------------------------------------------------- +// +CSearchDocument* CMessageDataHandler::CreateEmailDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId) + { + // creating CSearchDocument object with unique ID for this application + TBuf docid_str; + docid_str.AppendNum(aMsvId); + CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(EMAILAPPCLASS)); + + // Open the message entry + CMsvEntry* message_entry = CMsvEntry::NewL(iMsvSession, aMsvId, TMsvSelectionOrdering()); + CleanupStack::PushL(message_entry); + + // Get body + CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(); + CleanupStack::PushL(paraFormatLayer); + CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(); + CleanupStack::PushL(charFormatLayer); + CRichText* richtext = CRichText::NewL(paraFormatLayer, charFormatLayer); + CleanupStack::PushL(richtext); + CImEmailMessage* message_body = CImEmailMessage::NewLC(*message_entry); + message_body->GetBodyTextL(aMsvId, CImEmailMessage::EThisMessageOnly, *richtext, *paraFormatLayer, *charFormatLayer); + + // Read the message header + CMsvStore* message_store = message_entry->ReadStoreL(); + CleanupStack::PushL(message_store); + CImHeader* header = CImHeader::NewLC(); + header->RestoreL(*message_store); + + // Add from field + index_item->AddFieldL(KFromField, header->From()); + + // Add the ToRecipients as content items + TBuf<64> to_field; + for (TInt i = 0; i < header->ToRecipients().MdcaCount(); i++) + { + to_field = KToField; + if (i>0) + to_field.AppendNum(i); + index_item->AddFieldL(to_field, header->ToRecipients().MdcaPoint(i)); + } + + // Add the CcRecipients as content items + TBuf<64> cc_field; + for (TInt i = 0; i < header->CcRecipients().MdcaCount(); i++) + { + cc_field = KCcField; + if (i>0) + cc_field.AppendNum(i); + index_item->AddFieldL(cc_field, header->CcRecipients().MdcaPoint(i)); + } + + // Add the BccRecipients as content items + TBuf<64> bcc_field; + for (TInt i = 0; i < header->BccRecipients().MdcaCount(); i++) + { + bcc_field = KBccField; + if (i>0) + bcc_field.AppendNum(i); + index_item->AddFieldL(bcc_field, header->BccRecipients().MdcaPoint(i)); + } + + const TInt richTxtLen = (richtext->DocumentLength() < KMaxDocumentSize) ? richtext->DocumentLength() : KMaxDocumentSize; + HBufC* body_text = richtext->Read(0).Left(richTxtLen).AllocLC(); + + // Add subject + TPtrC subject(header->Subject()); + index_item->AddFieldL(KSubjectField, subject); + + // Add message body + index_item->AddFieldL(KBodyField, *body_text); + + // Add excerpt + HBufC* excerpt = CreateExcerptLC(header->From(), header->ToRecipients(), subject, *body_text, aFolderId); + index_item->AddExcerptL(*excerpt); + CleanupStack::PopAndDestroy(excerpt); + + // Cleanup everything last item message entry + CleanupStack::PopAndDestroy(8, message_entry); + + // Pop the item + CleanupStack::Pop(index_item); + return index_item; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::CreateExcerptLC +// --------------------------------------------------------------------------- +// +HBufC* CMessageDataHandler::CreateExcerptLC(const TDesC& aFromAddress, + const CDesCArray& aRecipientArray, + const TDesC& aSubject, + const TDesC& aBodyText, + const TMsvId& aFolderId) + { + _LIT(KEllipsis, "..."); + _LIT(KSpace, " "); + TInt excerptLength = KMsgBodyExcerptSymbols + KEllipsis().Length(); + + TMsvEntry entry; + TMsvId service = 0; + iMsvSession.GetEntry(aFolderId, service, entry); + HBufC *folder_str = entry.iDetails.AllocLC(); + + excerptLength += folder_str->Length(); + excerptLength += KSpace().Length(); + + if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue)) + { + excerptLength += aFromAddress.Length(); + excerptLength += KSpace().Length(); + } + if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue)) + { + excerptLength += aRecipientArray.MdcaPoint(0).Length(); + excerptLength += KSpace().Length(); + } + if (aSubject.Length() > 0) + { + excerptLength += aSubject.Length(); + excerptLength += KSpace().Length(); + } + + HBufC* excerpt = HBufC::NewL(excerptLength); + TPtr excerptPtr = excerpt->Des(); + + excerptPtr.Copy(*folder_str); + excerptPtr.Append(KSpace); + + if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue)) + { + excerptPtr.Append(aFromAddress); + excerptPtr.Append(KSpace); + } + if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue)) + { + excerptPtr.Append(aRecipientArray.MdcaPoint(0)); + excerptPtr.Append(KSpace); + } + if (aSubject.Length() > 0) + { + excerptPtr.Append(aSubject); + excerptPtr.Append(KSpace); + } + + excerptPtr.Append(aBodyText.Left(KMsgBodyExcerptSymbols)); + if (aBodyText.Length() > KMsgBodyExcerptSymbols) + excerptPtr.Append(KEllipsis); + + CleanupStack::PopAndDestroy(folder_str); + CleanupStack::PushL(excerpt); + return excerpt; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::IsTextUcs2 +// --------------------------------------------------------------------------- +// +TBool CMessageDataHandler::IsTextUcs2(const TDesC8& aText) + { + TBool ret = EFalse; + // Check UCS-2 Byte order mark is in the first two bytes of aText + if (aText.Length() >= sizeof(KMmsByteOrderMark)) + { + TPtrC ptr(reinterpret_cast(aText.Ptr()), + aText.Length() / sizeof(TText)); + + if (KMmsByteOrderMark == ptr[0] || + KMmsReversedByteOrderMark == ptr[0]) + { + ret = ETrue; + } + } + return ret; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::TextContainsUtf8Bom +// --------------------------------------------------------------------------- +// +TBool CMessageDataHandler::TextContainsUtf8Bom(const TDesC8& aText) + { + TBool ret = EFalse; + // Check to see if there is the UTF8 BOM at the begining + TPtrC8 utf8Id(KUtf8Bom, KUtf8BomLength); + if (aText.Length() >= KUtf8BomLength && + aText.Left(KUtf8BomLength) == utf8Id) + { + ret = ETrue; + } + return ret; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::TextFileCharsetL +// --------------------------------------------------------------------------- +// +TUint CMessageDataHandler::TextFileCharsetL(RFs aFs, RFile aFile) + { + TUint ret = KMmsUsAscii; + TBuf8 ucs2Buf; + + TInt size; + User::LeaveIfError(aFile.Size(size)); + if (size >= sizeof(KMmsByteOrderMark)) + { + // Check for the UCS-2 Byte Order Mark (BOM) at the beginning + // beginning of the file + User::LeaveIfError(aFile.Read(ucs2Buf)); + if(IsTextUcs2(ucs2Buf)) + { + ret = KMmsIso10646Ucs2; + } + } + + if (KMmsIso10646Ucs2 != ret) + { + // If the text is not UCS-2 it will probably be Utf8 or Ascii + + TInt seekPos = 0; + User::LeaveIfError(aFile.Seek(ESeekStart, seekPos)); + + HBufC8* buf = HBufC8::NewLC(size); + TPtr8 ptr = buf->Des(); + User::LeaveIfError(aFile.Read(ptr)); + + // Check to see if there is the UTF8 BOM at the begining + if (TextContainsUtf8Bom(ptr)) + { + ret = KMmsUtf8; + } + else + { + CCnvCharacterSetConverter* converter = + CCnvCharacterSetConverter::NewLC(); + CArrayFix* availCharSets = + CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(aFs); + + CArrayFix* utf8CharSet = + new (ELeave) CArrayFixFlat(1); + CleanupStack::PushL(utf8CharSet); + + TInt count = availCharSets->Count(); + for (TInt i = 0; i < count; i++) + { + CCnvCharacterSetConverter::SCharacterSet& charSet = (*availCharSets)[i]; + if (KCharacterSetIdentifierUtf8 == charSet.Identifier()) + { + utf8CharSet->AppendL(charSet); + break; + } + } + TInt confidence; + TUint charSetId; + converter->AutoDetectCharacterSetL(confidence, + charSetId, + *utf8CharSet, + *buf); + const TInt KMaxConfidence = 100; + if (KMaxConfidence == confidence) + { + ret = KMmsUtf8; + } + CleanupStack::PopAndDestroy(3, converter); + + } + + CleanupStack::PopAndDestroy(buf); + } + + TInt zero = 0; + User::LeaveIfError(aFile.Seek(ESeekStart, zero)); + + return ret; + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::ConvertToUcs2FromUtfL +// --------------------------------------------------------------------------- +// +void CMessageDataHandler::ConvertToUcs2FromUtfL(RFs& aFs, + TDes& aUcs2Text, + const TDesC8& aUtfText, + TUint aMibCharset) + { + TPtrC8 toConvert(aUtfText); + if (KMmsUtf8 == aMibCharset) + { + if (TextContainsUtf8Bom(toConvert)) + { + toConvert.Set(toConvert.Mid(KUtf8BomLength)); + } + } + // prepare to convert character set to unicode + CCnvCharacterSetConverter* converter = + CCnvCharacterSetConverter::NewLC(); + // change character set ID from MIB to Symbian + TUint charsetID = converter->ConvertMibEnumOfCharacterSetToIdentifierL( + aMibCharset, aFs); + CCnvCharacterSetConverter::TAvailability availability = + converter->PrepareToConvertToOrFromL(charsetID, aFs); + + if (availability == CCnvCharacterSetConverter::ENotAvailable) + { + User::Leave(KErrNotSupported); + } + TInt state = CCnvCharacterSetConverter::KStateDefault; + + User::LeaveIfError(converter->ConvertToUnicode(aUcs2Text, toConvert, state)); + + CleanupStack::PopAndDestroy(converter); + } + + +// ----------------------------------------------------------------------------- +// CMessageDataHandler::DoCancel +// ----------------------------------------------------------------------------- +// +void CMessageDataHandler::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CMessageDataHandler::RunL +// ----------------------------------------------------------------------------- +// +void CMessageDataHandler::RunL() + { + OstTrace1( TRACE_NORMAL, CMESSAGEDATAHANDLER_RUNL, "CMessageDataHandler::RunL;status=%d", iStatus.Int() ); + CPIXLOGSTRING2( "CMessageDataHandler::RunL status %d",iStatus.Int() ); + + // Implement round robin for the CActives + Deque(); + CActiveScheduler::Add(this); + + // Handle next message + if (iMessageArray.Count() > 0) + { + // Take first id from array + CreateMessageIndexItemL(iMessageArray[0].iMessageId, + iMessageArray[0].iActionType, iMessageArray[0].iFolderId); + + // Remove item that is handled + iMessageArray.Remove(0); + + // Handle next + HandleNextRequest(); + } + } + +// ----------------------------------------------------------------------------- +// CMessageDataHandler::RunError +// ----------------------------------------------------------------------------- +// +TInt CMessageDataHandler::RunError(TInt aError) + { + OstTrace1( TRACE_NORMAL, CMESSAGEDATAHANDLER_RUNERROR, "CMessageDataHandler::RunError;Error=%d", aError ); + CPIXLOGSTRING2( "CMessageDataHandler::RunError err %d", aError ); + if (iMessageArray.Count() > 0) + { + // Remove item that is handled + iMessageArray.Remove(0); + + // Handle next after the error + HandleNextRequest(); + } + return KErrNone; + } + +// --------------------------------------------------------------------------- +// HandleNextRequest +// --------------------------------------------------------------------------- +// +void CMessageDataHandler::HandleNextRequest() + { + if (!IsActive()) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + } + +// End of File + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/src/cmessageharvester.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/src/cmessageharvester.cpp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,288 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Harvester message plugin +* +*/ + + +// INCLUDES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cmessageharvester.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// --------------------------------------------------------------------------- +// CMessageHarvester::NewL +// --------------------------------------------------------------------------- +// +CMessageHarvester* CMessageHarvester::NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ) + { + CMessageHarvester* self = new (ELeave) CMessageHarvester( aMessagePlugin, aSession ); + return self; + } + +// --------------------------------------------------------------------------- +// CMessageHarvester::~CMessageHarvester +// --------------------------------------------------------------------------- +// +CMessageHarvester::~CMessageHarvester() + { + Cancel(); + delete iChildren; + iToBeSearchedFolders.Close(); + } + +// --------------------------------------------------------------------------- +// CMessageHarvester::CMessageHarvester +// --------------------------------------------------------------------------- +// +CMessageHarvester::CMessageHarvester( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ) : + CActive(CActive::EPriorityIdle), + iMessagePlugin( aMessagePlugin ), + iMsvSession( aSession ), + iState(EStateIdle) + { + CActiveScheduler::Add( this ); + } + +// --------------------------------------------------------------------------- +// CMessageHarvester::StartHarvesting +// --------------------------------------------------------------------------- +// +void CMessageHarvester::StartHarvestingL() + { + // First, get message folders + GetMessageFoldersL(); + + // Then, harvest them + iState = EStateNextFolder; + HandleNextRequest(); + } + +// --------------------------------------------------------------------------- +// CMessageHarvester::AddFolderWithSubFoldersL +// --------------------------------------------------------------------------- +// +void CMessageHarvester::AddFolderWithSubFoldersL( const TMsvId& aFolderId ) + { + // Add a folder to the search list + User::LeaveIfError(iToBeSearchedFolders.Append(aFolderId)); + CMsvEntry* folderEntry = CMsvEntry::NewL(iMsvSession, aFolderId, TMsvSelectionOrdering(KMsvGroupByStandardFolders, EMsvSortByDetails, EFalse)); + CleanupStack::PushL(folderEntry); + ListSubFoldersL(*folderEntry); + CleanupStack::PopAndDestroy(folderEntry); + } + +// --------------------------------------------------------------------------- +// CMessageHarvester::ListSubFoldersL +// --------------------------------------------------------------------------- +// +void CMessageHarvester::ListSubFoldersL( const CMsvEntry& aFolderEntry ) + { + // Only list "folder" children + CMsvEntrySelection* children = aFolderEntry.ChildrenL(); + CleanupStack::PushL( children ); + + for ( TInt i=0; i < children->Count(); i++ ) + { + TMsvId& childId = ( *children )[i]; + const TMsvEntry& childEntry ( aFolderEntry.ChildDataL( childId ) ); + if ( ( childEntry.iType == KUidMsvServiceEntry ) || + ( childEntry.iType == KUidMsvFolderEntry ) ) + { + // Add this folder to search list + AddFolderWithSubFoldersL( childId ); + } + } + CleanupStack::PopAndDestroy(); // children + } + +// --------------------------------------------------------------------------- +// CMessageHarvester::GetMessageFoldersL +// --------------------------------------------------------------------------- +// +void CMessageHarvester::GetMessageFoldersL() + { + // Get list of folders + CMsvEntry* rootEntry; + rootEntry = CMsvEntry::NewL( iMsvSession, KMsvRootIndexEntryIdValue, + TMsvSelectionOrdering( KMsvGroupByStandardFolders, EMsvSortByDetails, EFalse ) ); + CleanupStack::PushL( rootEntry ); + ListSubFoldersL( *rootEntry); + CleanupStack::PopAndDestroy( rootEntry ); + } + + +// --------------------------------------------------------------------------- +// CMessageHarvester::GetNextFolderL +// --------------------------------------------------------------------------- +// +void CMessageHarvester::GetNextFolderL() + { + if ( iToBeSearchedFolders.Count() > 0 ) + + { + // Open the new folder + CMsvEntry* folder = CMsvEntry::NewL( + iMsvSession, + iToBeSearchedFolders[0], + TMsvSelectionOrdering( KMsvGroupByStandardFolders, EMsvSortByDetails )); + + iCurrentFolder = iToBeSearchedFolders[0]; + + // Get the message items from the folder + CleanupStack::PushL(folder); + iChildren = folder->ChildrenWithTypeL( KUidMsvMessageEntry ); + CleanupStack::PopAndDestroy( folder ); + + // Remove current folder from the queue + iToBeSearchedFolders.Remove(0); + iState = EStateNextMessage; + HandleNextRequest(); + } + else + { + // No more folders in the queue + iState = EStateIdle; + HandleNextRequest(); + } + } + + +// --------------------------------------------------------------------------- +// CMessageHarvester::GetMessageId +// --------------------------------------------------------------------------- +// +void CMessageHarvester::GetMessageIdL() + { + if (iChildren && iChildren->Count() > 0) + { + // Take first item from list of message items, and give it for indexing + iMessagePlugin.MessageItemL((*iChildren)[0], ECPixAddAction, iCurrentFolder); + + // Delete the item from list + iChildren->Delete( 0 ); + if ( iChildren->Count() > 0 ) + { + // Get the next message + iState = EStateNextMessage; + HandleNextRequest(); + } + else + { + // No messages in this folder + iState = EStateNextFolder; + HandleNextRequest(); + } + } + else + { + // Current folder dosen't contain any message items so change folder + iState = EStateNextFolder; + HandleNextRequest(); + } + } + +// ----------------------------------------------------------------------------- +// CMessageHarvester::DoCancel +// ----------------------------------------------------------------------------- +// +void CMessageHarvester::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CMessageHarvester::RunL +// ----------------------------------------------------------------------------- +// +void CMessageHarvester::RunL() + { + + // Simple Round-Robin scheduling. + Deque(); + CActiveScheduler::Add( this ); + + switch (iState) + { + case EStateIdle: + { + // Delete current folder items + delete iChildren; + iChildren = NULL; + + // Started idling, close the folders + iToBeSearchedFolders.Reset(); + + // Update harvester status + iMessagePlugin.HarvestingCompleted(KErrNone); + break; + } + case EStateNextMessage: + { + // Get the next message + GetMessageIdL(); + break; + } + case EStateNextFolder: + { + // Delete current folder items + delete iChildren; + iChildren = NULL; + + // Start harvesting folders. + GetNextFolderL(); + break; + } + } + } + +// ----------------------------------------------------------------------------- +// CMessageHarvester::RunError +// ----------------------------------------------------------------------------- +// +TInt CMessageHarvester::RunError( TInt aError ) + { + iState = EStateIdle; + iMessagePlugin.HarvestingCompleted(aError); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// SetNextRequest +// --------------------------------------------------------------------------- +// +void CMessageHarvester::HandleNextRequest() + { + if (!IsActive()) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); + } + } + + +// End of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/src/cmessagemonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/src/cmessagemonitor.cpp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,282 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include "cmessagemonitor.h" +#include "harvesterserverlogger.h" + +#include +#include // MMsvAttachmentManager +#include // CMsvEntry +#include +#include +#include +#include +#include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cmessagemonitorTraces.h" +#endif + + + +// DEFINES +#define INDEXING_QUEUE_MAX 100 // Maximum number of messages in the queue +#define INDEXING_DELAY 5000000 // Nano seconds to delay the monitored messages + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMessageMonitor::NewL +// ----------------------------------------------------------------------------- +// +CMessageMonitor* CMessageMonitor::NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ) + { + CMessageMonitor* self = new ( ELeave ) CMessageMonitor( aMessagePlugin, aSession ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CMessageMonitor::CMessageMonitor +// ----------------------------------------------------------------------------- +// +CMessageMonitor::CMessageMonitor( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ) + : CActive(CActive::EPriorityStandard), + iState(EStateNone), + iMsvSession(aSession), + iMessagePlugin(aMessagePlugin) + { + OstTraceFunctionEntry0( CMESSAGEMONITOR_CMESSAGEMONITOR_ENTRY ); + CPIXLOGSTRING("ENTER CMessageMonitor::CMessageMonitor"); + + CActiveScheduler::Add(this); + + CPIXLOGSTRING("END CMessageMonitor::CMessageMonitor"); + OstTraceFunctionExit0( CMESSAGEMONITOR_CMESSAGEMONITOR_EXIT ); + } + +// ----------------------------------------------------------------------------- +// CMessageMonitor::ConstructL +// ----------------------------------------------------------------------------- +// +void CMessageMonitor::ConstructL() + { + OstTraceFunctionEntry0( CMESSAGEMONITOR_CONSTRUCTL_ENTRY ); + CPIXLOGSTRING("ENTER CMessageMonitor::ConstructL"); + + // Create timer + User::LeaveIfError(iTimer.CreateLocal()); + + CPIXLOGSTRING("END CMessageMonitor::ConstructL"); + OstTraceFunctionExit0( CMESSAGEMONITOR_CONSTRUCTL_EXIT ); + } + + + +// ----------------------------------------------------------------------------- +// CMessageMonitor::~CMessageMonitor +// ----------------------------------------------------------------------------- +// +CMessageMonitor::~CMessageMonitor() + { + CPIXLOGSTRING("ENTER ~CMessageMonitor"); + Cancel(); + iMessages.Close(); + iTimer.Close(); + CPIXLOGSTRING("END ~CMessageMonitor"); + } + +// ----------------------------------------------------------------------------- +// CMessageMonitor::HandleMsgMovedL +// ----------------------------------------------------------------------------- +// +void CMessageMonitor::HandleMsgMovedL( const TMsvId aNewFolderId, + const TMsvId /* aOldFolderId */, + const CMsvEntrySelection& aSelection ) + { + OstTraceFunctionEntry0( CMESSAGEMONITOR_HANDLEMSGMOVEDL_ENTRY ); + CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgMovedL"); + + const TInt count( aSelection.Count() ); + // cycle through every message in the CMsvEntrySelection + for ( TInt i=0; i < count; ++i ) + { + TMsvId msgId = aSelection[i]; + OstTrace1( TRACE_NORMAL, CMESSAGEMONITOR_HANDLEMSGMOVEDL, "CMessageMonitor::HandleMsgMovedL;msgId=%d", msgId ); + CPIXLOGSTRING2("msgId: %d", msgId ); + MessageItemL( msgId, ECPixUpdateAction, aNewFolderId ); + } + CPIXLOGSTRING("END CMessageMonitor::HandleMsgMovedL"); + OstTraceFunctionExit0( CMESSAGEMONITOR_HANDLEMSGMOVEDL_EXIT ); + } + + +// ----------------------------------------------------------------------------- +// CMessageMonitor::0 +// ----------------------------------------------------------------------------- +// +void CMessageMonitor::HandleMsgCreatedChangedL( const CMsvEntrySelection& aSelection, + const TMsvId aFolderId, + const MMsvSessionObserver::TMsvSessionEvent /*aEvent*/ ) + { + OstTraceFunctionEntry0( CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL_ENTRY ); + CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgCreatedChangedL"); + const TInt count( aSelection.Count() ); + //MMsvSessionObserver::TMsvSessionEvent theEvent = aEvent; + // cycle through every message in the CMsvEntrySelection + for ( TInt i=0; i < count; ++i ) + { + // extract the message server entry from the parameters + TMsvId msgId = aSelection[i]; + OstTrace1( TRACE_NORMAL, CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL, "CMessageMonitor::HandleMsgCreatedChangedL;msgId=%d", msgId ); + CPIXLOGSTRING2("msgId: %d", msgId ); + TMsvId service = 0; + TMsvEntry entry; + const TInt err = iMsvSession.GetEntry( msgId, service, entry ); + if ( ( !err ) && + ( KUidMsvMessageEntry == entry.iType ) && + ( entry.Visible() && entry.Complete() && !entry.InPreparation() ) && + ( iMessagePlugin.CalculateMessageType( entry ) != EMsgTypeInvalid ) ) + { + OstTrace0( TRACE_NORMAL, DUP1_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL, "CMessageMonitor::HandleMsgCreatedChangedL Called # MonitorEvent #" ); + CPIXLOGSTRING("CMessageMonitor::HandleMsgCreatedChangedL Called # MonitorEvent #"); + MessageItemL( msgId, ECPixUpdateAction, aFolderId ); + } + OstTrace1( TRACE_NORMAL, DUP2_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL, "CMessageMonitor::HandleMsgCreatedChangedL;Folder Type=%x", aFolderId ); + CPIXLOGSTRING2(" Folder TYPE %x", aFolderId ); + CPIXLOGSTRING2(" Entry TYPE %x", entry.iType ); + OstTrace1( TRACE_NORMAL, DUP4_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL, "CMessageMonitor::HandleMsgCreatedChangedL;Entry Visible=%d", entry.Visible() ); + CPIXLOGSTRING2(" Entry VISIBLE %d", entry.Visible() ); + OstTrace1( TRACE_NORMAL, DUP5_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL, "CMessageMonitor::HandleMsgCreatedChangedL;Entry Complete=%d", entry.Complete() ); + CPIXLOGSTRING2(" Entry COMPLETE %d", entry.Complete() ); + OstTrace1( TRACE_NORMAL, DUP6_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL, "CMessageMonitor::HandleMsgCreatedChangedL;Entry InPreparation=%d", entry.InPreparation() ); + CPIXLOGSTRING2(" Entry INPREPARATION %d", entry.InPreparation() ); + OstTrace1( TRACE_NORMAL, DUP7_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL, "CMessageMonitor::HandleMsgCreatedChangedL;Message Type=%d", iMessagePlugin.CalculateMessageType( entry ) ); + CPIXLOGSTRING2(" Message TYPE %d", iMessagePlugin.CalculateMessageType( entry )); + } + CPIXLOGSTRING("END CMessageMonitor::HandleMsgCreatedChangedL"); + OstTraceFunctionExit0( CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL_EXIT ); + } + +// ----------------------------------------------------------------------------- +// CMessageMonitor::HandleMsgDeletedL +// ----------------------------------------------------------------------------- +// +void CMessageMonitor::HandleMsgDeletedL( const CMsvEntrySelection& aSelection ) + { + OstTraceFunctionEntry0( CMESSAGEMONITOR_HANDLEMSGDELETEDL_ENTRY ); + CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgDeletedL"); + + const TInt count( aSelection.Count() ); + // cycle through every message in the CMsvEntrySelection + for( TInt i = 0; i < count; ++i ) + { + TMsvId msgId = aSelection[i]; + OstTrace1( TRACE_NORMAL, CMESSAGEMONITOR_HANDLEMSGDELETEDL, "CMessageMonitor::HandleMsgDeletedL;MsgId=%d", msgId ); + CPIXLOGSTRING2("msgId: %d", msgId ); + MessageItemL( msgId, ECPixRemoveAction, NULL); + } + CPIXLOGSTRING("END CMessageMonitor::HandleMsgDeletedL"); + OstTraceFunctionExit0( CMESSAGEMONITOR_HANDLEMSGDELETEDL_EXIT ); + } + + +void CMessageMonitor::OverwriteOrAddToQuereL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId) +{ + // Overwrite or add the index to the queue + TMessageRecord message; + message.iMsvId = aMsvId; + message.iAction = aAction; + message.iFolderId = aFolderId; + for (TInt i=0; i INDEXING_QUEUE_MAX) + { + // Maximum is exceeded, force the write immediately + if (iState == EStateWaiting) + { + iTimer.Cancel(); // RunL will be called with iStatus of KErrCancelled + } + else if (iState == EStateNone) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); // RunL will be called with iStatus of KErrNone + } + } + else + { + // Maximum is not exceeded, keep waiting + if (iState == EStateNone) + { + iState = EStateWaiting; + iTimer.After(iStatus, INDEXING_DELAY); // Wait 5 seconds before putting this to index + SetActive(); + } + } + } + +void CMessageMonitor::RunL() + { + // Index the current queue + while (iMessages.Count()>0) + { + TMessageRecord message = iMessages[0]; + iMessages.Remove(0); + iMessagePlugin.MessageItemL(message.iMsvId, message.iAction, message.iFolderId); + } + + // Everything is indexed no need to be waiting anymore + iState = EStateNone; + } + +void CMessageMonitor::DoCancel() + { + iTimer.Cancel(); + iState = EStateNone; + } + +TInt CMessageMonitor::RunError(TInt /* aError */) + { + // TODO handle indexing errors here + return KErrNone; // Don't panic + } + +// End Of File + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/src/cmessageplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/src/cmessageplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,644 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cmessageplugin.h" +#include "cmessagemonitor.h" +#include "cmessageharvester.h" +#include "cmessagedatahandler.h" +#include "harvesterserverlogger.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "cmessagepluginTraces.h" +#endif + + +// maximum length that the fully qualified msg Plugin base app class descriptor can be +// e.g. "@c:root msg" +const TInt KMsgPluginBaseAppClassMaxLen = 64; + + +// local declarations and functions +namespace { + +_LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\"); +_LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); + +_LIT(KPathTrailer, "\\root\\msg\\smsmms"); +_LIT(KMsgBaseAppClassGeneric, ":root msg smsmms"); +_LIT(KAtSign, "@"); +_LIT(KColon, ":"); + +/** +* MapFileToDrive - gets the TDriveNumber associated with the aBaseAppClass. +* @aBaseAppClass e.g. "@c:root file" +* @aDrive returns the TDriveNumber for the aBaseAppClass +* returns KErrNone on success or a standard error code +*/ +TInt MapBaseAppClassToDrive(const TDesC& aBaseAppClass, TDriveNumber& aDrive) + { + if (KErrNone != aBaseAppClass.Left(1).Compare(KAtSign)) + { + return KErrGeneral; + } + + TPtrC drvChar = aBaseAppClass.Left(2).Right(1); + TChar d(drvChar[0]); + TInt drive; + const TInt ret = RFs::CharToDrive(d, drive); + if (!ret) + { + aDrive = TDriveNumber(drive); + } + + return ret; + } + +}// anonymous namespace + + +// --------------------------------------------------------------------------- +// CMessagePlugin::NewL +// --------------------------------------------------------------------------- +// +CMessagePlugin* CMessagePlugin::NewL() +{ + CMessagePlugin* instance = CMessagePlugin::NewLC(); + CleanupStack::Pop(instance); + return instance; +} + +// --------------------------------------------------------------------------- +// CMessagePlugin::NewLC +// --------------------------------------------------------------------------- +// +CMessagePlugin* CMessagePlugin::NewLC() +{ + CMessagePlugin* instance = new (ELeave)CMessagePlugin(); + CleanupStack::PushL(instance); + instance->ConstructL(); + return instance; +} + +// --------------------------------------------------------------------------- +// CMessagePlugin::CMessagePlugin +// --------------------------------------------------------------------------- +// +CMessagePlugin::CMessagePlugin() +{ + iMessageDataHandler = NULL; + iMessageHarvester = NULL; + iMessageMonitor = NULL; + iMsvSession = NULL; +} + +// --------------------------------------------------------------------------- +// CMessagePlugin::~CMessagePlugin +// --------------------------------------------------------------------------- +// +CMessagePlugin::~CMessagePlugin() +{ + // remove notification paths before destroying iMonitor + for (TInt i=EDriveA; i<=EDriveZ; i++) + UnMount(TDriveNumber(i), EFalse); + delete iMessageDataHandler; + delete iMessageHarvester; + delete iMessageMonitor; + delete iMsvSession; + iFs.Close(); +} + +// --------------------------------------------------------------------------- +// CMessagePlugin::ConstructL +// --------------------------------------------------------------------------- +// +void CMessagePlugin::ConstructL() +{ + TInt err = iFs.Connect(); + OstTrace1( TRACE_NORMAL, CMESSAGEPLUGIN_CONSTRUCTL, "CMessagePlugin::ConstructL;iFs Connect Error=%d", err ); + CPIXLOGSTRING2("CMessagePlugin::ConstructL, iFs.Connect: %i", err); + User::LeaveIfError(err); + iCurrentDrive = EDriveC; //Default drive is C drive + iMsvSession = CMsvSession::OpenSyncL(*this); + iMessageMonitor = CMessageMonitor::NewL( *this, *iMsvSession ); + iMessageHarvester = CMessageHarvester::NewL( *this, *iMsvSession ); + iMessageDataHandler = CMessageDataHandler::NewL( *this, *iMsvSession ); + for (TInt i=EDriveA; i<=EDriveZ; i++) + { + iIndexer[i] = NULL; //Initialize to NULL + } +} + +// --------------------------------------------------------------------------- +// CMessagePlugin::StartPluginL +// --------------------------------------------------------------------------- +// +void CMessagePlugin::StartPluginL() + { + //Get the current Drive for storage + iCurrentDrive = iMsvSession->CurrentDriveL(); + OstTrace1( TRACE_NORMAL, CMESSAGEPLUGIN_STARTPLUGINL, "CMessagePlugin::StartPluginL;Current Drive for Messaging =%d", iCurrentDrive ); + CPIXLOGSTRING2("currentDrive from messaging app : %d", iCurrentDrive ); + MountL(TDriveNumber(iCurrentDrive)); //Mount current drive + // Define this base application class, use default location + } + +// --------------------------------------------------------------------------- +// CMessagePlugin::StartHarvestingL +// --------------------------------------------------------------------------- +// +void CMessagePlugin::StartHarvestingL(const TDesC& aQualifiedBaseAppClass) + { + OstTraceFunctionEntry0( CMESSAGEPLUGIN_STARTHARVESTINGL_ENTRY ); + CPIXLOGSTRING("START CMessagePlugin::StartHarvestingL"); + // Map base app class to a drive number + TDriveNumber drive ( EDriveA );//Initialize to silence compiler warnings. + if (KErrNone != MapBaseAppClassToDrive(aQualifiedBaseAppClass, drive)) + User::Leave(KErrGeneral); + + // Leave if no indexer for this drive + if (!iIndexer[drive]) + User::Leave(KErrGeneral); + + // Reset the database + iIndexer[drive]->ResetL(); +#ifdef __PERFORMANCE_DATA + iStartTime.UniversalTime(); +#endif + iMessageHarvester->StartHarvestingL(); + OstTraceFunctionExit0( CMESSAGEPLUGIN_STARTHARVESTINGL_EXIT ); + } + +// --------------------------------------------------------------------------- +// CMessagePlugin::MountL +// --------------------------------------------------------------------------- +// +void CMessagePlugin::MountL(TDriveNumber aMedia,TBool aForceReharvesting) + { + OstTraceFunctionEntry0( CMESSAGEPLUGIN_MOUNTL_ENTRY ); + CPIXLOGSTRING("START CMessagePlugin::MountL"); + // Check if already exists + if (iIndexer[aMedia]) + return; + + // Form the baseappclass for this media + TBuf baseAppClass; + FormBaseAppClass(aMedia, baseAppClass); + + // Define this volume + HBufC* path = DatabasePathLC(aMedia); + User::LeaveIfError(iSearchSession.DefineVolume(baseAppClass, *path)); + CleanupStack::PopAndDestroy(path); + + // construct and open the database + TRAPD(err,iIndexer[aMedia] = CCPixIndexer::NewL(iSearchSession)); + OstTrace1( TRACE_NORMAL, CMESSAGEPLUGIN_MOUNTL, "CMessagePlugin::MountL;Indexer NewL return error=%d", err ); + CPIXLOGSTRING2("CCPixIndexer::NewL returned : %d", err ); + TRAP(err,iIndexer[aMedia]->OpenDatabaseL(baseAppClass)); + + // Add to harvesting queue + iObserver->AddHarvestingQueue(this, baseAppClass,aForceReharvesting); + CPIXLOGSTRING("END CMessagePlugin::MountL"); + OstTraceFunctionExit0( CMESSAGEPLUGIN_MOUNTL_EXIT ); + } + +// --------------------------------------------------------------------------- +// CMessagePlugin::UnMount +// --------------------------------------------------------------------------- +// +void CMessagePlugin::UnMount(TDriveNumber aMedia, TBool aUndefineAsWell) + { + OstTraceFunctionEntry0( CMESSAGEPLUGIN_UNMOUNT_ENTRY ); + CPIXLOGSTRING("START CMessagePlugin::UnMount"); + // Check if already exists + if (!iIndexer[aMedia]) + return; + + // Form the baseappclass for this media + TBuf baseAppClass; + FormBaseAppClass(aMedia, baseAppClass); + + // Remove from harvesting queue + iObserver->RemoveHarvestingQueue(this, baseAppClass); + + // Delete the index object + if (iIndexer[aMedia]) + { + delete iIndexer[aMedia]; + iIndexer[aMedia] = NULL; + } + + // if the aActionType is EFFMmcDismount, then the + // parameter aFilename is the baseAppClass of the Index database + // to be dropped. + if (aUndefineAsWell) + iSearchSession.UnDefineVolume(baseAppClass); + OstTraceFunctionExit0( CMESSAGEPLUGIN_UNMOUNT_EXIT ); + } + + +// --------------------------------------------------------------------------- +// CMessagePlugin::FormBaseAppClass +// --------------------------------------------------------------------------- +// +TInt CMessagePlugin::FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass) + { + TChar chr; + const TInt ret = RFs::DriveToChar(aMedia, chr); + if (KErrNone == ret) + { + aBaseAppClass.Copy(KAtSign); + aBaseAppClass.Append(chr); + aBaseAppClass.LowerCase(); + aBaseAppClass.Append(KMsgBaseAppClassGeneric); + } + + return ret; + } + +// --------------------------------------------------------------------------- +// CMessagePlugin::DatabasePathLC +// --------------------------------------------------------------------------- +// +HBufC* CMessagePlugin::DatabasePathLC(TDriveNumber aMedia) + { + OstTraceFunctionEntry0( CMESSAGEPLUGIN_DATABASEPATHLC_ENTRY ); + CPIXLOGSTRING("START CMessagePlugin::DatabasePathLC"); + // Allocate extra space for root path e.g. "C:\\Private\\2001f6f7\\" + const TInt KRootPathMaxLength = 30; + HBufC* indexDbPath = HBufC::NewLC(KRootPathMaxLength + KPathIndexDbPath().Length() + KPathTrailer().Length()); + TPtr indexDbPathPtr = indexDbPath->Des(); + +#if 1 // Data caging implementation + iFs.CreatePrivatePath(aMedia); + + TChar chr; + RFs::DriveToChar(aMedia, chr); + indexDbPathPtr.Append(chr); + indexDbPathPtr.Append(KColon); + + TFileName pathWithoutDrive; + iFs.PrivatePath(pathWithoutDrive); + indexDbPathPtr.Append(KCPixSearchServerPrivateDirectory); +#else // here is the way to calculate the path if data caging is not being used. + TFileName rootPath; + PathInfo::GetRootPath(rootPath, aMedia); + indexDbPathPtr.Append(rootPath); +#endif + + indexDbPathPtr.Append(KPathIndexDbPath); + indexDbPathPtr.Append(KPathTrailer); + + OstTraceFunctionExit0( CMESSAGEPLUGIN_DATABASEPATHLC_EXIT ); + return indexDbPath; + } + +// --------------------------------------------------------------------------- +// CMessagePlugin::GetIndexer +// --------------------------------------------------------------------------- +// +CCPixIndexer* CMessagePlugin::GetIndexer() + { + return iIndexer[iCurrentDrive]; + } + +// --------------------------------------------------------------------------- +// CMessagePlugin::IsMediaRemovableL +// --------------------------------------------------------------------------- +// +TBool CMessagePlugin::IsMediaRemovableL(TDriveNumber& aDrive) + { + TDriveInfo driveInfo; + User::LeaveIfError(iFs.Drive(driveInfo,aDrive)); + TBool mediaRemovable(EFalse); + driveInfo.iDriveAtt & KDriveAttRemovable ? mediaRemovable = ETrue : mediaRemovable = EFalse; + return mediaRemovable; + } +// --------------------------------------------------------------------------- +// CMessagePlugin::HandleSessionEventL +// --------------------------------------------------------------------------- +// +void CMessagePlugin::HandleSessionEventL( TMsvSessionEvent aEvent, + TAny* aArg1, + TAny* aArg2, + TAny* aArg3 ) + { + OstTraceFunctionEntry0( CMESSAGEPLUGIN_HANDLESESSIONEVENTL_ENTRY ); + CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL"); + OstTrace1( TRACE_NORMAL, CMESSAGEPLUGIN_HANDLESESSIONEVENTL, "CMessagePlugin::HandleSessionEventL;aEvent=%d", aEvent ); + CPIXLOGSTRING2("TMsvSessionEvent aEvent: %d", aEvent ); + + switch( aEvent ) + { + case EMsvEntriesCreated: + case EMsvEntriesChanged: + { + // Handle changed / created event + CMsvEntrySelection* selection = reinterpret_cast(aArg1); + TMsvId folderId = *( reinterpret_cast(aArg2)); +#ifdef __PERFORMANCE_DATA + iStartTime.UniversalTime(); + iMessageMonitor->HandleMsgCreatedChangedL(*selection, folderId, aEvent); + UpdatePerformaceDataL(EMsvEntriesChanged); +#else + iMessageMonitor->HandleMsgCreatedChangedL(*selection, folderId, aEvent); +#endif + break; + } + case EMsvEntriesDeleted: + { + // Handle deletion event + CMsvEntrySelection* selection = reinterpret_cast ( aArg1 ); +#ifdef __PERFORMANCE_DATA + iStartTime.UniversalTime(); + iMessageMonitor->HandleMsgDeletedL( *selection ); + UpdatePerformaceDataL(EMsvEntriesDeleted); +#else + iMessageMonitor->HandleMsgDeletedL( *selection ); +#endif + break; + } + case EMsvEntriesMoved: + { + // track move operations + // or sent folder + // ... extract the useful parameters + if( aArg1 && aArg2 && aArg3 ) + { + CMsvEntrySelection* selection = reinterpret_cast ( aArg1 ); + // aArg2 is the TMsvId of the new parent. aArg3 is the TMsvId of + // the old parent entry. + TMsvId newFolderId = *(reinterpret_cast(aArg2)); + TMsvId oldFolderId = *(reinterpret_cast(aArg3)); +#ifdef __PERFORMANCE_DATA + iStartTime.UniversalTime(); + iMessageMonitor->HandleMsgMovedL(newFolderId, oldFolderId, *selection); + UpdatePerformaceDataL(EMsvEntriesMoved); +#else + iMessageMonitor->HandleMsgMovedL(newFolderId, oldFolderId, *selection); +#endif + } + break; + } + case EMsvMediaChanged: + { + //Unmount old media drive + OstTrace0( TRACE_NORMAL, DUP1_CMESSAGEPLUGIN_HANDLESESSIONEVENTL, "ENTER CMessagePlugin::HandleSessionEventL EMsvMediaChanged" ); + CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaChanged"); + TDriveNumber drive = *(reinterpret_cast(aArg1)); + UnMount(drive); + drive = *(reinterpret_cast(aArg2)); + //Check if Media is removable then force reharvesting else keep indexes same + MountL(drive,IsMediaRemovableL(drive)); //Mount new media drive for harvesting + iCurrentDrive = drive;//Index of current drive + } + break; + case EMsvMediaUnavailable: + { + //No need to handle as when drive will be removed EMsvMediaChanged event + //will be received for default media drive can be handled there + //Unmount old media drive + OstTrace0( TRACE_NORMAL, DUP2_CMESSAGEPLUGIN_HANDLESESSIONEVENTL, "ENTER CMessagePlugin::HandleSessionEventL EMsvMediaUnavailable" ); + CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaUnavailable"); + TDriveNumber drive = *(reinterpret_cast(aArg1)); + UnMount(drive); + } + break; + case EMsvMediaAvailable: + { + OstTrace0( TRACE_NORMAL, DUP3_CMESSAGEPLUGIN_HANDLESESSIONEVENTL, "ENTER CMessagePlugin::HandleSessionEventL EMsvMediaAvailable" ); + CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaAvailable"); + //Removed media drive available again mount media drive and unmount default + UnMount(TDriveNumber(iCurrentDrive)); //Unmount current drive + TDriveNumber drive = *(reinterpret_cast(aArg1)); + MountL(drive,IsMediaRemovableL(drive)); //Mount avilable media drive for harvesting + } + break; + case EMsvServerFailedToStart: + case EMsvCloseSession: + case EMsvServerTerminated: + { + User::Panic(_L("CMessagePlugin PANIC"), KErrServerTerminated); + break; + } + case EMsvMtmGroupInstalled: + case EMsvMtmGroupDeInstalled: + case EMsvGeneralError: // not used after v5 + case EMsvServerReady: + case EMsvCorruptedIndexRebuilt: + case EMsvMediaIncorrect: + case EMsvCorruptedIndexRebuilding: + default: + { + break; + } + } + CPIXLOGSTRING("END CMessagePlugin::HandleSessionEventL"); + + OstTraceFunctionExit0( CMESSAGEPLUGIN_HANDLESESSIONEVENTL_EXIT ); + } + +// --------------------------------------------------------------------------- +// CMessageDataHandler::CalculateMessageType +// --------------------------------------------------------------------------- +// +TMsgType CMessagePlugin::CalculateMessageType (const TMsvEntry& aEntry ) +{ + OstTraceFunctionEntry0( CMESSAGEPLUGIN_CALCULATEMESSAGETYPE_ENTRY ); + CPIXLOGSTRING("ENTER CMessagePlugin::CalculateMessageType"); + TMsgType ret = EMsgTypeInvalid; + OstTrace1( TRACE_NORMAL, CMESSAGEPLUGIN_CALCULATEMESSAGETYPE, "CMessagePlugin::CalculateMessageType;uid=%x", aEntry.iMtm.iUid ); + CPIXLOGSTRING2("CMessagePlugin::CalculateMessageType uid: %x", aEntry.iMtm.iUid ); + if( aEntry.iMtm.iUid == KUidMsgTypeMultimedia.iUid ) + { + OstTrace0( TRACE_NORMAL, DUP1_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE, "CMessagePlugin:CalculateMessageType ### Mms Message ###" ); + CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### Mms Message ###"); + ret = EMsgTypeMms; + } + else if( aEntry.iMtm.iUid == KUidMsgTypeSMTP.iUid ) + { + OstTrace0( TRACE_NORMAL, DUP2_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE, "CMessagePlugin:CalculateMessageType ### ESmtpEmail ###" ); + CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### ESmtpEmail ###"); + ret = EMsgTypeEmailSmtp; + } + else if( aEntry.iMtm.iUid == KUidMsgTypePOP3.iUid ) + { + OstTrace0( TRACE_NORMAL, DUP3_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE, "CMessagePlugin:CalculateMessageType ### EPop3Email ###" ); + CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### EPop3Email ###"); + ret = EMsgTypeEmailPop3; + } + else if( aEntry.iMtm.iUid == KUidMsgTypeIMAP4.iUid ) + { + OstTrace0( TRACE_NORMAL, DUP4_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE, "CMessagePlugin:CalculateMessageType ### EImap4Email ###" ); + CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### EImap4Email ###"); + ret = EMsgTypeEmailImap4; + } + // Add J.J +#ifndef __SERIES60_30__ // Not supported before S60 3d FP1 + else if ( aEntry.iMtm.iUid == KSenduiMtmUniMessageUid.iUid ) + { + OstTrace0( TRACE_NORMAL, DUP5_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE, "CMessagePlugin:CalculateMessageType ### EDraftMessage ###" ); + CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### EDraftMessage ###"); + ret = EMsgTypeDraft; + } +#endif + // else if we have a normal text based SMS it is valid + else if ( aEntry.iMtm.iUid == KUidMsgTypeSMS.iUid ) + { + OstTrace0( TRACE_NORMAL, DUP6_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE, "CMessagePlugin:CalculateMessageType ### SMS Message ###" ); + CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### SMS Message ###"); + ret = EMsgTypeSms; + } + else if ( aEntry.iMtm.iUid == KSenduiMtmSmsUid.iUid ) + { + OstTrace0( TRACE_NORMAL, DUP7_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE, "CMessagePlugin:CalculateMessageType ### Sms Message ###" ); + CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### Sms Message ###"); + ret = EMsgTypeSms; + } + CPIXLOGSTRING("END CMessagePlugin::CalculateMessageType"); + OstTraceFunctionExit0( CMESSAGEPLUGIN_CALCULATEMESSAGETYPE_EXIT ); + return ret; +} + +// --------------------------------------------------------------------------- +// CMessagePlugin::MessageItemL +// --------------------------------------------------------------------------- +// +void CMessagePlugin::MessageItemL( TMsvId aMsgId, TCPixActionType aActionType, TMsvId aFolderId ) + { + //New item found gather data from that. + iMessageDataHandler->GatherDataL( aMsgId, aActionType, aFolderId ); + } + +// --------------------------------------------------------------------------- +// CMessagePlugin::HarvestingCompleted +// --------------------------------------------------------------------------- +// +void CMessagePlugin::HarvestingCompleted(TInt aError) +{ + // Notifies the indexing manager of completed harvesting, called by CMessageHarvester + Flush( *GetIndexer() ); + TBuf baseAppClass; + FormBaseAppClass(TDriveNumber(iCurrentDrive), baseAppClass); +#ifdef __PERFORMANCE_DATA + TRAP_IGNORE( UpdatePerformaceDataL() ); +#endif + iObserver->HarvestingCompleted(this, baseAppClass, aError); +} + +// --------------------------------------------------------------------------- +// CMessagePlugin::UpdatePerformaceDataL +// --------------------------------------------------------------------------- +// +#ifdef __PERFORMANCE_DATA +void CMessagePlugin::UpdatePerformaceDataL() + { + TTime now; + + + iCompleteTime.UniversalTime(); + TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime); + + RFs fileSession; + RFile perfFile; + User::LeaveIfError( fileSession.Connect () ); + + + /* Open file if it exists, otherwise create it and write content in it */ + + if(perfFile.Open(fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)) + User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)); + + HBufC8 *heap = HBufC8::NewL(100); + TPtr8 ptr = heap->Des(); + now.HomeTime(); + TBuf<50> timeString; + + _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S"); + now.FormatL(timeString,KOwnTimeFormat); + ptr.AppendNum(now.DateTime().Day()); + ptr.Append(_L("/")); + ptr.AppendNum(now.DateTime().Month()); + ptr.Append(_L("/")); + ptr.AppendNum(now.DateTime().Year()); + ptr.Append(_L(":")); + ptr.Append(timeString); + ptr.Append( _L("Time taken for Harvesting Message is : ")); + ptr.AppendNum(timeDiff.Int64()/1000) ; + ptr.Append(_L(" MilliSeonds \n")); + TInt myInt = 0; + perfFile.Seek(ESeekEnd,myInt); + perfFile.Write (ptr); + perfFile.Close (); + fileSession.Close (); + delete heap; + } + +// --------------------------------------------------------------------------- +// CMessagePlugin::UpdatePerformaceDataL +// --------------------------------------------------------------------------- +// +void CMessagePlugin::UpdatePerformaceDataL(TMsvSessionEvent action) { + + iCompleteTime.UniversalTime(); + TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime); + + RFs fileSession; + RFile perfFile; + User::LeaveIfError( fileSession.Connect () ); + + + /* Open file if it exists, otherwise create it and write content in it */ + + if(perfFile.Open(fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)) + User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)); + + HBufC8 *heap = HBufC8::NewL(100); + TPtr8 ptr = heap->Des(); + + switch (action) { + case EMsvEntriesDeleted: ptr.Append( _L("del "));break; + case EMsvEntriesChanged: ptr.Append( _L("upd "));break; + case EMsvEntriesMoved: ptr.Append( _L("mov "));break; + } + ptr.AppendNum(timeDiff.Int64()/1000) ; + ptr.Append(_L("\n")); + TInt myInt = 0; + perfFile.Seek(ESeekEnd,myInt); + perfFile.Write (ptr); + perfFile.Close (); + fileSession.Close (); + delete heap; + } + +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/src/tproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/src/tproxy.cpp Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Message plugin +* +*/ + + + +#include +#include +#include +#include "cmessageplugin.h" + + +// Map the interface UIDs to implementation factory functions +const TImplementationProxy KImplementationTable[] = + { + {{0x2001F701},( TProxyNewLPtr) CMessagePlugin::NewL} + }; + +// Exported proxy for instantiation method resolution +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) + { + aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy ); + return KImplementationTable; + } + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/traces/cmessagedatahandlerTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/traces/cmessagedatahandlerTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,39 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CMESSAGEDATAHANDLERTRACES_H__ +#define __CMESSAGEDATAHANDLERTRACES_H__ + +#define KOstTraceComponentID 0x2001f701 + +#define CMESSAGEDATAHANDLER_NEWL_ENTRY 0x8a0001 +#define CMESSAGEDATAHANDLER_NEWL_EXIT 0x8a0002 +#define CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE_ENTRY 0x8a0003 +#define CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE_EXIT 0x8a0004 +#define CMESSAGEDATAHANDLER_CONSTRUCTL 0x860001 +#define DUP1_CMESSAGEDATAHANDLER_CONSTRUCTL 0x860002 +#define CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE 0x860003 +#define DUP1_CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE 0x860004 +#define CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860005 +#define DUP1_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860006 +#define DUP2_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860007 +#define DUP3_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860008 +#define DUP4_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860009 +#define DUP5_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x86000a +#define DUP6_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x86000b +#define DUP7_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x86000c +#define DUP8_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x86000d +#define DUP9_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x86000e +#define DUP10_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x86000f +#define DUP11_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860010 +#define DUP12_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860011 +#define DUP13_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860012 +#define DUP14_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML 0x860013 +#define CMESSAGEDATAHANDLER_RUNL 0x860014 +#define CMESSAGEDATAHANDLER_RUNERROR 0x860015 + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/traces/cmessagemonitorTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/traces/cmessagemonitorTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,33 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CMESSAGEMONITORTRACES_H__ +#define __CMESSAGEMONITORTRACES_H__ + +#define KOstTraceComponentID 0x2001f701 + +#define CMESSAGEMONITOR_CMESSAGEMONITOR_ENTRY 0x8a0005 +#define CMESSAGEMONITOR_CMESSAGEMONITOR_EXIT 0x8a0006 +#define CMESSAGEMONITOR_CONSTRUCTL_ENTRY 0x8a0007 +#define CMESSAGEMONITOR_CONSTRUCTL_EXIT 0x8a0008 +#define CMESSAGEMONITOR_HANDLEMSGMOVEDL_ENTRY 0x8a0009 +#define CMESSAGEMONITOR_HANDLEMSGMOVEDL_EXIT 0x8a000a +#define CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL_ENTRY 0x8a000b +#define CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL_EXIT 0x8a000c +#define CMESSAGEMONITOR_HANDLEMSGDELETEDL_ENTRY 0x8a000d +#define CMESSAGEMONITOR_HANDLEMSGDELETEDL_EXIT 0x8a000e +#define CMESSAGEMONITOR_HANDLEMSGMOVEDL 0x860016 +#define CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL 0x860017 +#define DUP1_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL 0x860018 +#define DUP2_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL 0x860019 +#define DUP4_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL 0x86001a +#define DUP5_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL 0x86001b +#define DUP6_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL 0x86001c +#define DUP7_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL 0x86001d +#define CMESSAGEMONITOR_HANDLEMSGDELETEDL 0x86001e + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/traces/cmessagepluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/traces/cmessagepluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,41 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __CMESSAGEPLUGINTRACES_H__ +#define __CMESSAGEPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2001f701 + +#define CMESSAGEPLUGIN_STARTHARVESTINGL_ENTRY 0x8a000f +#define CMESSAGEPLUGIN_STARTHARVESTINGL_EXIT 0x8a0010 +#define CMESSAGEPLUGIN_MOUNTL_ENTRY 0x8a0011 +#define CMESSAGEPLUGIN_MOUNTL_EXIT 0x8a0012 +#define CMESSAGEPLUGIN_UNMOUNT_ENTRY 0x8a0013 +#define CMESSAGEPLUGIN_UNMOUNT_EXIT 0x8a0014 +#define CMESSAGEPLUGIN_DATABASEPATHLC_ENTRY 0x8a0015 +#define CMESSAGEPLUGIN_DATABASEPATHLC_EXIT 0x8a0016 +#define CMESSAGEPLUGIN_HANDLESESSIONEVENTL_ENTRY 0x8a0017 +#define CMESSAGEPLUGIN_HANDLESESSIONEVENTL_EXIT 0x8a0018 +#define CMESSAGEPLUGIN_CALCULATEMESSAGETYPE_ENTRY 0x8a0019 +#define CMESSAGEPLUGIN_CALCULATEMESSAGETYPE_EXIT 0x8a001a +#define CMESSAGEPLUGIN_CONSTRUCTL 0x86001f +#define CMESSAGEPLUGIN_STARTPLUGINL 0x860020 +#define CMESSAGEPLUGIN_MOUNTL 0x860021 +#define CMESSAGEPLUGIN_HANDLESESSIONEVENTL 0x860022 +#define DUP1_CMESSAGEPLUGIN_HANDLESESSIONEVENTL 0x860023 +#define DUP2_CMESSAGEPLUGIN_HANDLESESSIONEVENTL 0x860024 +#define DUP3_CMESSAGEPLUGIN_HANDLESESSIONEVENTL 0x860025 +#define CMESSAGEPLUGIN_CALCULATEMESSAGETYPE 0x860026 +#define DUP1_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE 0x860027 +#define DUP2_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE 0x860028 +#define DUP3_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE 0x860029 +#define DUP4_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE 0x86002a +#define DUP5_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE 0x86002b +#define DUP6_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE 0x86002c +#define DUP7_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE 0x86002d + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/smsmms/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/messaging/smsmms/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,74 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE_ENTRY=0x3 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE_EXIT=0x4 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEDATAHANDLER_NEWL_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEDATAHANDLER_NEWL_EXIT=0x2 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_CMESSAGEMONITOR_ENTRY=0x5 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_CMESSAGEMONITOR_EXIT=0x6 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_CONSTRUCTL_ENTRY=0x7 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_CONSTRUCTL_EXIT=0x8 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL_ENTRY=0xb +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL_EXIT=0xc +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_HANDLEMSGDELETEDL_ENTRY=0xd +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_HANDLEMSGDELETEDL_EXIT=0xe +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_HANDLEMSGMOVEDL_ENTRY=0x9 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEMONITOR_HANDLEMSGMOVEDL_EXIT=0xa +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE_ENTRY=0x19 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE_EXIT=0x1a +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_DATABASEPATHLC_ENTRY=0x15 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_DATABASEPATHLC_EXIT=0x16 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_HANDLESESSIONEVENTL_ENTRY=0x17 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_HANDLESESSIONEVENTL_EXIT=0x18 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_MOUNTL_ENTRY=0x11 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_MOUNTL_EXIT=0x12 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_STARTHARVESTINGL_ENTRY=0xf +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_STARTHARVESTINGL_EXIT=0x10 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_UNMOUNT_ENTRY=0x13 +[TRACE]TRACE_FLOW[0x8A]_CMESSAGEPLUGIN_UNMOUNT_EXIT=0x14 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEDATAHANDLER_CONSTRUCTL=0x1 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x5 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE=0x3 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEDATAHANDLER_RUNERROR=0x15 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEDATAHANDLER_RUNL=0x14 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL=0x17 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEMONITOR_HANDLEMSGDELETEDL=0x1e +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEMONITOR_HANDLEMSGMOVEDL=0x16 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE=0x26 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEPLUGIN_CONSTRUCTL=0x1f +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEPLUGIN_HANDLESESSIONEVENTL=0x22 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEPLUGIN_MOUNTL=0x21 +[TRACE]TRACE_NORMAL[0x86]_CMESSAGEPLUGIN_STARTPLUGINL=0x20 +[TRACE]TRACE_NORMAL[0x86]_DUP10_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0xf +[TRACE]TRACE_NORMAL[0x86]_DUP11_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x10 +[TRACE]TRACE_NORMAL[0x86]_DUP12_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x11 +[TRACE]TRACE_NORMAL[0x86]_DUP13_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x12 +[TRACE]TRACE_NORMAL[0x86]_DUP14_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x13 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CMESSAGEDATAHANDLER_CONSTRUCTL=0x2 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CMESSAGEDATAHANDLER_ISVALIDMESSAGETYPE=0x4 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL=0x18 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE=0x27 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CMESSAGEPLUGIN_HANDLESESSIONEVENTL=0x23 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x7 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL=0x19 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE=0x28 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CMESSAGEPLUGIN_HANDLESESSIONEVENTL=0x24 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE=0x29 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CMESSAGEPLUGIN_HANDLESESSIONEVENTL=0x25 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0x9 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL=0x1a +[TRACE]TRACE_NORMAL[0x86]_DUP4_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE=0x2a +[TRACE]TRACE_NORMAL[0x86]_DUP5_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0xa +[TRACE]TRACE_NORMAL[0x86]_DUP5_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL=0x1b +[TRACE]TRACE_NORMAL[0x86]_DUP5_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE=0x2b +[TRACE]TRACE_NORMAL[0x86]_DUP6_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP6_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL=0x1c +[TRACE]TRACE_NORMAL[0x86]_DUP6_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE=0x2c +[TRACE]TRACE_NORMAL[0x86]_DUP7_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0xc +[TRACE]TRACE_NORMAL[0x86]_DUP7_CMESSAGEMONITOR_HANDLEMSGCREATEDCHANGEDL=0x1d +[TRACE]TRACE_NORMAL[0x86]_DUP7_CMESSAGEPLUGIN_CALCULATEMESSAGETYPE=0x2d +[TRACE]TRACE_NORMAL[0x86]_DUP8_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0xd +[TRACE]TRACE_NORMAL[0x86]_DUP9_CMESSAGEDATAHANDLER_CREATEMESSAGEINDEXITEML=0xe diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/src/cmessagedatahandler.cpp --- a/harvesterplugins/messaging/src/cmessagedatahandler.cpp Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,892 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Harvester message plugin - * -*/ - - -// INCLUDES - -#include - -#include -#include // SMS Headers -#include // MMS Headers -#include -#include // IMAP Headers -#include // SMTP -#include // POP - -#include "harvesterserverlogger.h" -#include "cmessagedatahandler.h" -#include "cmessageplugin.h" -#include -#include - -#include - -/** Number of symbols from MsgBody taken to excerpt */ -const TInt KMsgBodyExcerptSymbols = 90; - -// For Ucs2 detection -const TInt KUtf8BomLength = 3; -const TUint8 KUtf8Bom[KUtf8BomLength] = {0xEF, 0xBB, 0xBF}; - -// CSearchDocument ID max length -const TUint KMaxDocId = 20; -// Hardcoded limit for the body size to index (and store) -const TInt KMaxDocumentSize = 1024; - -_LIT8(KMimeTypeText, "text/plain" ); - -_LIT(KMimeTypeField, CPIX_MIMETYPE_FIELD); -_LIT(KMimeTypeMessaging, MESSAGING_MIMETYPE); - -/** Field names */ -_LIT(KToField, TO_FIELD); -_LIT(KCcField, CC_FIELD); -_LIT(KBccField, BCC_FIELD); -_LIT(KFromField, FROM_FIELD); -_LIT(KFolderField, FOLDER_FIELD); -_LIT(KBodyField, BODY_FIELD); -_LIT(KSubjectField, SUBJECT_FIELD); - -// ============================ MEMBER FUNCTIONS =============================== - -// --------------------------------------------------------------------------- -// CMessageDataHandler::NewL -// --------------------------------------------------------------------------- -// -CMessageDataHandler* CMessageDataHandler::NewL(CMessagePlugin& aMessagePlugin, - CMsvSession& aSession) - { - CPIXLOGSTRING( "CMessageDataHandler::NewL() - enter" ); - - CMessageDataHandler* self = new (ELeave) CMessageDataHandler( - aMessagePlugin, aSession); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - - CPIXLOGSTRING( "CMessageDataHandler::NewL() - return" ); - return self; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::~CMessageDataHandler -// --------------------------------------------------------------------------- -// -CMessageDataHandler::~CMessageDataHandler() - { - Cancel(); - iFs.Close(); - delete iMmsMtm; - delete iSmsMtm; - delete iSmtpMtm; - delete iPop3Mtm; - delete iImap4Mtm; - delete iMtmReg; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::CMessageDataHandler -// --------------------------------------------------------------------------- -// -CMessageDataHandler::CMessageDataHandler(CMessagePlugin& aMessagePlugin, CMsvSession& aSession) - : CActive(EPriorityLow), iMessagePlugin(aMessagePlugin), iMsvSession(aSession) - { - CActiveScheduler::Add(this); - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::ConstructL -// --------------------------------------------------------------------------- -// -void CMessageDataHandler::ConstructL() - { - // TODO iFs only used in MMS attachment logic, - // from a performance perspective, is it worthwhile connecting here? - User::LeaveIfError(iFs.Connect()); - iMtmReg = CClientMtmRegistry::NewL(iMsvSession); - TRAPD(err,iSmsMtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeSMS))); - CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iSmsMtm err = %d",err); - TRAP(err,iMmsMtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeMultimedia))); - CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iMmsMtm err = %d",err); - /* - TRAP(err,iSmtpMtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeSMTP))); - CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iSmtpMtm err = %d",err); - TRAP(err, iPop3Mtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypePOP3))); - CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iPop3Mtm err = %d",err); - TRAP(err,iImap4Mtm = static_cast (iMtmReg->NewMtmL(KUidMsgTypeIMAP4))); - CPIXLOGSTRING2( "CMessageDataHandler::ConstructL() iImap4Mtm err = %d",err); - */ - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::GatherData -// --------------------------------------------------------------------------- -// -void CMessageDataHandler::GatherDataL(TMsvId& aMessageId, - TCPixActionType aActionType, TMsvId& aFolderId) - { - TMessageItem item(aMessageId, aActionType, aFolderId); - iMessageArray.AppendL(item); - HandleNextRequest(); - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::IsValidMessageTypeL -// --------------------------------------------------------------------------- -// -TInt CMessageDataHandler::IsValidMessageType(TMsvId aIdToCheck, - TMsgType& aMessageType) - { - CPIXLOGSTRING("ENTER CMessageDataHandler::IsValidMessageType"); - TMsvEntry entry; - TMsvId service = 0; - TInt err = iMsvSession.GetEntry(aIdToCheck, service, entry); - CPIXLOGSTRING2("CMessageDataHandler::IsValidMessageType GetEntry: %d", err); - if (!err) - { - aMessageType = iMessagePlugin.CalculateMessageType(entry); - CPIXLOGSTRING2("CMessageDataHandler::IsValidMessageType type: %d", aMessageType ); - } - CPIXLOGSTRING("END CMessageDataHandler::IsValidMessageType"); - return err; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::CreateSmsIndexItemLC -// --------------------------------------------------------------------------- -// -void CMessageDataHandler::CreateMessageIndexItemL(const TMsvId& aMsvId, - TCPixActionType aActionType, const TMsvId& aFolderId) - { - CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): aMsvId = %d ", aMsvId ); - - // Index an empty item if removal action - if (aActionType == ECPixRemoveAction) - { - TBuf<20> docid_str; - docid_str.AppendNum(aMsvId); - if (iMessagePlugin.GetIndexer()) - { - TRAPD(err, iMessagePlugin.GetIndexer()->DeleteL(docid_str)); - if (err == KErrNone) - { - CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Document deleted."); - } - else - { - CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in deleting the document.", err); - } - } - return; - } - - // Check message type - TMsgType messageType = EMsgTypeInvalid; // initialisation - TInt error = IsValidMessageType(aMsvId, messageType); - - // creating CSearchDocument object with unique ID for this application - CSearchDocument* index_item = NULL; - - switch (messageType) - { - case EMsgTypeSms: - { - TRAPD(err, index_item = CreateSmsDocumentL(aMsvId, aFolderId)); - if (err == KErrNone) - { - CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): SMS document created."); - } - else - { - CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating SMS document.", err); - } - break; - } - case EMsgTypeMms: - { - TRAPD(err, index_item = CreateMmsDocumentL(aMsvId, aFolderId)); - if (err == KErrNone) - { - CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): MMS document created."); - } - else - { - CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating MMS document.", err); - } - break; - } - case EMsgTypeEmailPop3: - case EMsgTypeEmailImap4: - case EMsgTypeEmailSmtp: - { - TRAPD(err, index_item = CreateEmailDocumentL(aMsvId, aFolderId)); - if (err == KErrNone) - { - CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): E-mail document created."); - } - else - { - CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in creating e-mail document.", err); - } - break; - } - case EMsgTypeInvalid: - // For EMsgTypeDraft there is no way to tell if it was a SMS, MMS or email, - // so don't create index_item. - case EMsgTypeDraft: - default: - // Error occurred - break; - } - - // Exit if wrong message type - if (index_item == NULL) - { - CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Document was not created."); - return; - } - CleanupStack::PushL(index_item); - - // Folder field - TMsvEntry entry; - TMsvId service = 0; - iMsvSession.GetEntry(aFolderId, service, entry); - HBufC *folder_str = entry.iDetails.AllocLC(); - index_item->AddFieldL(KFolderField, *folder_str, CDocumentField::EStoreYes | CDocumentField::EIndexNo); - - // Mime type field - index_item->AddFieldL(KMimeTypeField, KMimeTypeMessaging, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized); - - // Send for indexing - if (iMessagePlugin.GetIndexer()) - { - if (aActionType == ECPixAddAction) - { - TRAPD(err, iMessagePlugin.GetIndexer()->AddL(*index_item)); - if (err == KErrNone) - { - CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Added."); - } - else - { - CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in adding.", err); - } - } - else if (aActionType == ECPixUpdateAction) - { - TRAPD(err, iMessagePlugin.GetIndexer()->UpdateL(*index_item)); - if (err == KErrNone) - { - CPIXLOGSTRING("CMessageDataHandler::CreateMessageIndexItemL(): Updated."); - } - else - { - CPIXLOGSTRING2("CMessageDataHandler::CreateMessageIndexItemL(): Error %d in updating.", err); - } - } - } - else - { - CPIXLOGSTRING("END CMessageDataHandler::CreateMessageIndexItemL(): No indexer present."); - } - - CleanupStack::PopAndDestroy(folder_str); - CleanupStack::PopAndDestroy(index_item); - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::CreateSmsDocumentL -// --------------------------------------------------------------------------- -// -CSearchDocument* CMessageDataHandler::CreateSmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId) - { - // Select mtm for this type - iSmsMtm->SwitchCurrentEntryL(aMsvId); - iSmsMtm->LoadMessageL(); - - // creating CSearchDocument object with unique ID for this application - TBuf docid_str; - docid_str.AppendNum(aMsvId); - CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(SMSAPPCLASS)); - - // Add from field use the name instead of number if in the contacts db. - // (iSmsMtm->SmsHeader().FromAddress() - only returns the number) - TMsvEntry entry; - TMsvId service = 0; - iMsvSession.GetEntry(aMsvId, service, entry); - HBufC *fromNameOrNumberBuf = entry.iDetails.AllocLC(); - index_item->AddFieldL(KFromField, *fromNameOrNumberBuf); - - // Add the recipients as content items - TBuf<64> to_field; - const CDesCArray - & recipientArray = - static_cast (iSmsMtm->AddresseeList().RecipientList()); - for (TInt i = 0; i < recipientArray.MdcaCount(); i++) - { - to_field = KToField; - if (i>0) - to_field.AppendNum(i); - index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i)); - } - - // Add the body text as a content item - TInt msgLength = iSmsMtm->Body().DocumentLength(); - HBufC* bodyText = HBufC::NewLC(msgLength); - TPtr body_ptr = bodyText->Des(); - iSmsMtm->Body().Extract(body_ptr); - index_item->AddFieldL(KBodyField, *bodyText); - - // Add excerpt - // Note SMS does not have a subject field. - HBufC* excerpt = CreateExcerptLC(*fromNameOrNumberBuf, recipientArray, KNullDesC(), body_ptr, aFolderId); - index_item->AddExcerptL(*excerpt); - CleanupStack::PopAndDestroy(excerpt); - CleanupStack::PopAndDestroy(bodyText); - - CleanupStack::PopAndDestroy(fromNameOrNumberBuf); - - // Pop the item - CleanupStack::Pop(index_item); - return index_item; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::CreateMmsDocumentL -// --------------------------------------------------------------------------- -// -CSearchDocument* CMessageDataHandler::CreateMmsDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId) - { - // Select mtm for this type - iMmsMtm->SwitchCurrentEntryL(aMsvId); - iMmsMtm->LoadMessageL(); - - // creating CSearchDocument object with unique ID for this application - TBuf docid_str; - docid_str.AppendNum(aMsvId); - CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(MMSAPPCLASS)); - - // Add from field - index_item->AddFieldL(KFromField, iMmsMtm->Sender()); - - // Add the recipients as content items - TBuf<64> to_field; - const CDesCArray - & recipientArray = - static_cast (iMmsMtm->AddresseeList().RecipientList()); - for (TInt i = 0; i < recipientArray.MdcaCount(); i++) - { - to_field = KToField; - if (i>0) - to_field.AppendNum(i); - index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i)); - } - - // Add subject - TPtrC subject(iMmsMtm->SubjectL()); - index_item->AddFieldL(KSubjectField, subject); - - // Add the body parts as a content items - // See if the MMS contains a text file attachment - TBool excerptFieldAdded(EFalse); - TInt bodycount = 0; - CMsvStore* msvStore = iMmsMtm->Entry().ReadStoreL(); - CleanupStack::PushL( msvStore ); - MMsvAttachmentManager& attManager = msvStore->AttachmentManagerL(); - for ( TInt i = 0; i < attManager.AttachmentCount(); i++ ) - { - CMsvAttachment* attInfo = attManager.GetAttachmentInfoL(i); - CleanupStack::PushL( attInfo ); - - if (attInfo->MimeType() == KMimeTypeText()) - { - // Mime type - RFile attFile = attManager.GetAttachmentFileL(i); - CleanupClosePushL( attFile ); - TInt charsetMIB = TextFileCharsetL(iFs, attFile); - - // Get the file size - TInt fileSize = 0; - User::LeaveIfError(attFile.Size(fileSize)); - - // Read the file - HBufC8* textSource = HBufC8::NewLC(fileSize); - TPtr8 ptr8 = textSource->Des(); - attFile.Read(ptr8); - - // Convert character set - HBufC* text = HBufC::NewLC( fileSize ); - TPtr buf = text->Des(); - if ( KMmsIso10646Ucs2 != charsetMIB ) - { - if ( KMmsUsAscii == charsetMIB ) - buf.Copy(*textSource); - else - ConvertToUcs2FromUtfL(iFs, buf, *textSource, charsetMIB); - } - else - { - TPtrC ptr(reinterpret_cast(textSource->Des().Ptr()), - textSource->Length() / sizeof(TText)); - - // Ignore the first unicode charcter FFFE - ptr.Set( ptr.Mid( 1 ) ); - buf = ptr; - } - - - // Add the text of the file as a content item - // MMS message body is in attachment - TBuf<64> body_field; - body_field = KBodyField; - if (bodycount>0) - { - // Add additional body fields - body_field.AppendNum(bodycount); - } - else - { - // Add excerpt for the first body field - HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, *text, aFolderId); - index_item->AddExcerptL(*excerpt); - CleanupStack::PopAndDestroy(excerpt); - excerptFieldAdded = ETrue; - } - - // TODO: add only few kilobytes of the body? - index_item->AddFieldL(body_field, *text); - ++bodycount; - - CleanupStack::PopAndDestroy( 3, &attFile ); // text, textSource, attFile - } - else - { - // add attachment name when binary file. - if ( !excerptFieldAdded ) - { - // attachment name might not be set - HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, attInfo->AttachmentName(), aFolderId); - index_item->AddExcerptL(*excerpt); - CleanupStack::PopAndDestroy(excerpt); - excerptFieldAdded = ETrue; - } - } - CleanupStack::PopAndDestroy( attInfo ); - } - - // If no excerpt has been added yet, then add information have - if ( !excerptFieldAdded ) - { - HBufC* excerpt = CreateExcerptLC(iMmsMtm->Sender(), recipientArray, subject, KNullDesC(), aFolderId); - index_item->AddExcerptL(*excerpt); - CleanupStack::PopAndDestroy(excerpt); - } - - // Cleanup - CleanupStack::PopAndDestroy( msvStore ); - - // Pop the item - CleanupStack::Pop(index_item); - return index_item; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::CreateEmailDocumentL -// --------------------------------------------------------------------------- -// -CSearchDocument* CMessageDataHandler::CreateEmailDocumentL(const TMsvId& aMsvId, const TMsvId& aFolderId) - { - // creating CSearchDocument object with unique ID for this application - TBuf docid_str; - docid_str.AppendNum(aMsvId); - CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(EMAILAPPCLASS)); - - // Open the message entry - CMsvEntry* message_entry = CMsvEntry::NewL(iMsvSession, aMsvId, TMsvSelectionOrdering()); - CleanupStack::PushL(message_entry); - - // Get body - CParaFormatLayer* paraFormatLayer = CParaFormatLayer::NewL(); - CleanupStack::PushL(paraFormatLayer); - CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL(); - CleanupStack::PushL(charFormatLayer); - CRichText* richtext = CRichText::NewL(paraFormatLayer, charFormatLayer); - CleanupStack::PushL(richtext); - CImEmailMessage* message_body = CImEmailMessage::NewLC(*message_entry); - message_body->GetBodyTextL(aMsvId, CImEmailMessage::EThisMessageOnly, *richtext, *paraFormatLayer, *charFormatLayer); - - // Read the message header - CMsvStore* message_store = message_entry->ReadStoreL(); - CleanupStack::PushL(message_store); - CImHeader* header = CImHeader::NewLC(); - header->RestoreL(*message_store); - - // Add from field - index_item->AddFieldL(KFromField, header->From()); - - // Add the ToRecipients as content items - TBuf<64> to_field; - for (TInt i = 0; i < header->ToRecipients().MdcaCount(); i++) - { - to_field = KToField; - if (i>0) - to_field.AppendNum(i); - index_item->AddFieldL(to_field, header->ToRecipients().MdcaPoint(i)); - } - - // Add the CcRecipients as content items - TBuf<64> cc_field; - for (TInt i = 0; i < header->CcRecipients().MdcaCount(); i++) - { - cc_field = KCcField; - if (i>0) - cc_field.AppendNum(i); - index_item->AddFieldL(cc_field, header->CcRecipients().MdcaPoint(i)); - } - - // Add the BccRecipients as content items - TBuf<64> bcc_field; - for (TInt i = 0; i < header->BccRecipients().MdcaCount(); i++) - { - bcc_field = KBccField; - if (i>0) - bcc_field.AppendNum(i); - index_item->AddFieldL(bcc_field, header->BccRecipients().MdcaPoint(i)); - } - - const TInt richTxtLen = (richtext->DocumentLength() < KMaxDocumentSize) ? richtext->DocumentLength() : KMaxDocumentSize; - HBufC* body_text = richtext->Read(0).Left(richTxtLen).AllocLC(); - - // Add subject - TPtrC subject(header->Subject()); - index_item->AddFieldL(KSubjectField, subject); - - // Add message body - index_item->AddFieldL(KBodyField, *body_text); - - // Add excerpt - HBufC* excerpt = CreateExcerptLC(header->From(), header->ToRecipients(), subject, *body_text, aFolderId); - index_item->AddExcerptL(*excerpt); - CleanupStack::PopAndDestroy(excerpt); - - // Cleanup everything last item message entry - CleanupStack::PopAndDestroy(8, message_entry); - - // Pop the item - CleanupStack::Pop(index_item); - return index_item; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::CreateExcerptLC -// --------------------------------------------------------------------------- -// -HBufC* CMessageDataHandler::CreateExcerptLC(const TDesC& aFromAddress, - const CDesCArray& aRecipientArray, - const TDesC& aSubject, - const TDesC& aBodyText, - const TMsvId& aFolderId) - { - _LIT(KEllipsis, "..."); - _LIT(KSpace, " "); - TInt excerptLength = KMsgBodyExcerptSymbols + KEllipsis().Length(); - - TMsvEntry entry; - TMsvId service = 0; - iMsvSession.GetEntry(aFolderId, service, entry); - HBufC *folder_str = entry.iDetails.AllocLC(); - - excerptLength += folder_str->Length(); - excerptLength += KSpace().Length(); - - if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue)) - { - excerptLength += aFromAddress.Length(); - excerptLength += KSpace().Length(); - } - if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue)) - { - excerptLength += aRecipientArray.MdcaPoint(0).Length(); - excerptLength += KSpace().Length(); - } - if (aSubject.Length() > 0) - { - excerptLength += aSubject.Length(); - excerptLength += KSpace().Length(); - } - - HBufC* excerpt = HBufC::NewL(excerptLength); - TPtr excerptPtr = excerpt->Des(); - - excerptPtr.Copy(*folder_str); - excerptPtr.Append(KSpace); - - if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue)) - { - excerptPtr.Append(aFromAddress); - excerptPtr.Append(KSpace); - } - if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue)) - { - excerptPtr.Append(aRecipientArray.MdcaPoint(0)); - excerptPtr.Append(KSpace); - } - if (aSubject.Length() > 0) - { - excerptPtr.Append(aSubject); - excerptPtr.Append(KSpace); - } - - excerptPtr.Append(aBodyText.Left(KMsgBodyExcerptSymbols)); - if (aBodyText.Length() > KMsgBodyExcerptSymbols) - excerptPtr.Append(KEllipsis); - - CleanupStack::PopAndDestroy(folder_str); - CleanupStack::PushL(excerpt); - return excerpt; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::IsTextUcs2 -// --------------------------------------------------------------------------- -// -TBool CMessageDataHandler::IsTextUcs2(const TDesC8& aText) - { - TBool ret = EFalse; - // Check UCS-2 Byte order mark is in the first two bytes of aText - if (aText.Length() >= sizeof(KMmsByteOrderMark)) - { - TPtrC ptr(reinterpret_cast(aText.Ptr()), - aText.Length() / sizeof(TText)); - - if (KMmsByteOrderMark == ptr[0] || - KMmsReversedByteOrderMark == ptr[0]) - { - ret = ETrue; - } - } - return ret; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::TextContainsUtf8Bom -// --------------------------------------------------------------------------- -// -TBool CMessageDataHandler::TextContainsUtf8Bom(const TDesC8& aText) - { - TBool ret = EFalse; - // Check to see if there is the UTF8 BOM at the begining - TPtrC8 utf8Id(KUtf8Bom, KUtf8BomLength); - if (aText.Length() >= KUtf8BomLength && - aText.Left(KUtf8BomLength) == utf8Id) - { - ret = ETrue; - } - return ret; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::TextFileCharsetL -// --------------------------------------------------------------------------- -// -TUint CMessageDataHandler::TextFileCharsetL(RFs aFs, RFile aFile) - { - TUint ret = KMmsUsAscii; - TBuf8 ucs2Buf; - - TInt size; - User::LeaveIfError(aFile.Size(size)); - if (size >= sizeof(KMmsByteOrderMark)) - { - // Check for the UCS-2 Byte Order Mark (BOM) at the beginning - // beginning of the file - User::LeaveIfError(aFile.Read(ucs2Buf)); - if(IsTextUcs2(ucs2Buf)) - { - ret = KMmsIso10646Ucs2; - } - } - - if (KMmsIso10646Ucs2 != ret) - { - // If the text is not UCS-2 it will probably be Utf8 or Ascii - - TInt seekPos = 0; - User::LeaveIfError(aFile.Seek(ESeekStart, seekPos)); - - HBufC8* buf = HBufC8::NewLC(size); - TPtr8 ptr = buf->Des(); - User::LeaveIfError(aFile.Read(ptr)); - - // Check to see if there is the UTF8 BOM at the begining - if (TextContainsUtf8Bom(ptr)) - { - ret = KMmsUtf8; - } - else - { - CCnvCharacterSetConverter* converter = - CCnvCharacterSetConverter::NewLC(); - CArrayFix* availCharSets = - CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(aFs); - - CArrayFix* utf8CharSet = - new (ELeave) CArrayFixFlat(1); - CleanupStack::PushL(utf8CharSet); - - TInt count = availCharSets->Count(); - for (TInt i = 0; i < count; i++) - { - CCnvCharacterSetConverter::SCharacterSet& charSet = (*availCharSets)[i]; - if (KCharacterSetIdentifierUtf8 == charSet.Identifier()) - { - utf8CharSet->AppendL(charSet); - break; - } - } - TInt confidence; - TUint charSetId; - converter->AutoDetectCharacterSetL(confidence, - charSetId, - *utf8CharSet, - *buf); - const TInt KMaxConfidence = 100; - if (KMaxConfidence == confidence) - { - ret = KMmsUtf8; - } - CleanupStack::PopAndDestroy(3, converter); - - } - - CleanupStack::PopAndDestroy(buf); - } - - TInt zero = 0; - User::LeaveIfError(aFile.Seek(ESeekStart, zero)); - - return ret; - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::ConvertToUcs2FromUtfL -// --------------------------------------------------------------------------- -// -void CMessageDataHandler::ConvertToUcs2FromUtfL(RFs& aFs, - TDes& aUcs2Text, - const TDesC8& aUtfText, - TUint aMibCharset) - { - TPtrC8 toConvert(aUtfText); - if (KMmsUtf8 == aMibCharset) - { - if (TextContainsUtf8Bom(toConvert)) - { - toConvert.Set(toConvert.Mid(KUtf8BomLength)); - } - } - // prepare to convert character set to unicode - CCnvCharacterSetConverter* converter = - CCnvCharacterSetConverter::NewLC(); - // change character set ID from MIB to Symbian - TUint charsetID = converter->ConvertMibEnumOfCharacterSetToIdentifierL( - aMibCharset, aFs); - CCnvCharacterSetConverter::TAvailability availability = - converter->PrepareToConvertToOrFromL(charsetID, aFs); - - if (availability == CCnvCharacterSetConverter::ENotAvailable) - { - User::Leave(KErrNotSupported); - } - TInt state = CCnvCharacterSetConverter::KStateDefault; - - User::LeaveIfError(converter->ConvertToUnicode(aUcs2Text, toConvert, state)); - - CleanupStack::PopAndDestroy(converter); - } - - -// ----------------------------------------------------------------------------- -// CMessageDataHandler::DoCancel -// ----------------------------------------------------------------------------- -// -void CMessageDataHandler::DoCancel() - { - } - -// ----------------------------------------------------------------------------- -// CMessageDataHandler::RunL -// ----------------------------------------------------------------------------- -// -void CMessageDataHandler::RunL() - { - CPIXLOGSTRING2( "CMessageDataHandler::RunL status %d",iStatus.Int() ); - - // Implement round robin for the CActives - Deque(); - CActiveScheduler::Add(this); - - // Handle next message - if (iMessageArray.Count() > 0) - { - // Take first id from array - CreateMessageIndexItemL(iMessageArray[0].iMessageId, - iMessageArray[0].iActionType, iMessageArray[0].iFolderId); - - // Remove item that is handled - iMessageArray.Remove(0); - - // Handle next - HandleNextRequest(); - } - } - -// ----------------------------------------------------------------------------- -// CMessageDataHandler::RunError -// ----------------------------------------------------------------------------- -// -TInt CMessageDataHandler::RunError(TInt aError) - { - CPIXLOGSTRING2( "CMessageDataHandler::RunError err %d", aError ); - if (iMessageArray.Count() > 0) - { - // Remove item that is handled - iMessageArray.Remove(0); - - // Handle next after the error - HandleNextRequest(); - } - return KErrNone; - } - -// --------------------------------------------------------------------------- -// HandleNextRequest -// --------------------------------------------------------------------------- -// -void CMessageDataHandler::HandleNextRequest() - { - if (!IsActive()) - { - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - } - } - -// End of File - diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/src/cmessageharvester.cpp --- a/harvesterplugins/messaging/src/cmessageharvester.cpp Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,288 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Harvester message plugin -* -*/ - - -// INCLUDES - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cmessageharvester.h" - - -// ============================ MEMBER FUNCTIONS =============================== - -// --------------------------------------------------------------------------- -// CMessageHarvester::NewL -// --------------------------------------------------------------------------- -// -CMessageHarvester* CMessageHarvester::NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ) - { - CMessageHarvester* self = new (ELeave) CMessageHarvester( aMessagePlugin, aSession ); - return self; - } - -// --------------------------------------------------------------------------- -// CMessageHarvester::~CMessageHarvester -// --------------------------------------------------------------------------- -// -CMessageHarvester::~CMessageHarvester() - { - Cancel(); - delete iChildren; - iToBeSearchedFolders.Close(); - } - -// --------------------------------------------------------------------------- -// CMessageHarvester::CMessageHarvester -// --------------------------------------------------------------------------- -// -CMessageHarvester::CMessageHarvester( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ) : - CActive(CActive::EPriorityIdle), - iMessagePlugin( aMessagePlugin ), - iMsvSession( aSession ), - iState(EStateIdle) - { - CActiveScheduler::Add( this ); - } - -// --------------------------------------------------------------------------- -// CMessageHarvester::StartHarvesting -// --------------------------------------------------------------------------- -// -void CMessageHarvester::StartHarvestingL() - { - // First, get message folders - GetMessageFoldersL(); - - // Then, harvest them - iState = EStateNextFolder; - HandleNextRequest(); - } - -// --------------------------------------------------------------------------- -// CMessageHarvester::AddFolderWithSubFoldersL -// --------------------------------------------------------------------------- -// -void CMessageHarvester::AddFolderWithSubFoldersL( const TMsvId& aFolderId ) - { - // Add a folder to the search list - User::LeaveIfError(iToBeSearchedFolders.Append(aFolderId)); - CMsvEntry* folderEntry = CMsvEntry::NewL(iMsvSession, aFolderId, TMsvSelectionOrdering(KMsvGroupByStandardFolders, EMsvSortByDetails, EFalse)); - CleanupStack::PushL(folderEntry); - ListSubFoldersL(*folderEntry); - CleanupStack::PopAndDestroy(folderEntry); - } - -// --------------------------------------------------------------------------- -// CMessageHarvester::ListSubFoldersL -// --------------------------------------------------------------------------- -// -void CMessageHarvester::ListSubFoldersL( const CMsvEntry& aFolderEntry ) - { - // Only list "folder" children - CMsvEntrySelection* children = aFolderEntry.ChildrenL(); - CleanupStack::PushL( children ); - - for ( TInt i=0; i < children->Count(); i++ ) - { - TMsvId& childId = ( *children )[i]; - const TMsvEntry& childEntry ( aFolderEntry.ChildDataL( childId ) ); - if ( ( childEntry.iType == KUidMsvServiceEntry ) || - ( childEntry.iType == KUidMsvFolderEntry ) ) - { - // Add this folder to search list - AddFolderWithSubFoldersL( childId ); - } - } - CleanupStack::PopAndDestroy(); // children - } - -// --------------------------------------------------------------------------- -// CMessageHarvester::GetMessageFoldersL -// --------------------------------------------------------------------------- -// -void CMessageHarvester::GetMessageFoldersL() - { - // Get list of folders - CMsvEntry* rootEntry; - rootEntry = CMsvEntry::NewL( iMsvSession, KMsvRootIndexEntryIdValue, - TMsvSelectionOrdering( KMsvGroupByStandardFolders, EMsvSortByDetails, EFalse ) ); - CleanupStack::PushL( rootEntry ); - ListSubFoldersL( *rootEntry); - CleanupStack::PopAndDestroy( rootEntry ); - } - - -// --------------------------------------------------------------------------- -// CMessageHarvester::GetNextFolderL -// --------------------------------------------------------------------------- -// -void CMessageHarvester::GetNextFolderL() - { - if ( iToBeSearchedFolders.Count() > 0 ) - - { - // Open the new folder - CMsvEntry* folder = CMsvEntry::NewL( - iMsvSession, - iToBeSearchedFolders[0], - TMsvSelectionOrdering( KMsvGroupByStandardFolders, EMsvSortByDetails )); - - iCurrentFolder = iToBeSearchedFolders[0]; - - // Get the message items from the folder - CleanupStack::PushL(folder); - iChildren = folder->ChildrenWithTypeL( KUidMsvMessageEntry ); - CleanupStack::PopAndDestroy( folder ); - - // Remove current folder from the queue - iToBeSearchedFolders.Remove(0); - iState = EStateNextMessage; - HandleNextRequest(); - } - else - { - // No more folders in the queue - iState = EStateIdle; - HandleNextRequest(); - } - } - - -// --------------------------------------------------------------------------- -// CMessageHarvester::GetMessageId -// --------------------------------------------------------------------------- -// -void CMessageHarvester::GetMessageIdL() - { - if (iChildren && iChildren->Count() > 0) - { - // Take first item from list of message items, and give it for indexing - iMessagePlugin.MessageItemL((*iChildren)[0], ECPixAddAction, iCurrentFolder); - - // Delete the item from list - iChildren->Delete( 0 ); - if ( iChildren->Count() > 0 ) - { - // Get the next message - iState = EStateNextMessage; - HandleNextRequest(); - } - else - { - // No messages in this folder - iState = EStateNextFolder; - HandleNextRequest(); - } - } - else - { - // Current folder dosen't contain any message items so change folder - iState = EStateNextFolder; - HandleNextRequest(); - } - } - -// ----------------------------------------------------------------------------- -// CMessageHarvester::DoCancel -// ----------------------------------------------------------------------------- -// -void CMessageHarvester::DoCancel() - { - } - -// ----------------------------------------------------------------------------- -// CMessageHarvester::RunL -// ----------------------------------------------------------------------------- -// -void CMessageHarvester::RunL() - { - - // Simple Round-Robin scheduling. - Deque(); - CActiveScheduler::Add( this ); - - switch (iState) - { - case EStateIdle: - { - // Delete current folder items - delete iChildren; - iChildren = NULL; - - // Started idling, close the folders - iToBeSearchedFolders.Reset(); - - // Update harvester status - iMessagePlugin.HarvestingCompleted(KErrNone); - break; - } - case EStateNextMessage: - { - // Get the next message - GetMessageIdL(); - break; - } - case EStateNextFolder: - { - // Delete current folder items - delete iChildren; - iChildren = NULL; - - // Start harvesting folders. - GetNextFolderL(); - break; - } - } - } - -// ----------------------------------------------------------------------------- -// CMessageHarvester::RunError -// ----------------------------------------------------------------------------- -// -TInt CMessageHarvester::RunError( TInt aError ) - { - iState = EStateIdle; - iMessagePlugin.HarvestingCompleted(aError); - return KErrNone; - } - -// --------------------------------------------------------------------------- -// SetNextRequest -// --------------------------------------------------------------------------- -// -void CMessageHarvester::HandleNextRequest() - { - if (!IsActive()) - { - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete( status, KErrNone ); - } - } - - -// End of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/src/cmessagemonitor.cpp --- a/harvesterplugins/messaging/src/cmessagemonitor.cpp Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,258 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -// INCLUDE FILES -#include "cmessagemonitor.h" -#include "harvesterserverlogger.h" - -#include -#include // MMsvAttachmentManager -#include // CMsvEntry -#include -#include -#include -#include -#include - - -// DEFINES -#define INDEXING_QUEUE_MAX 100 // Maximum number of messages in the queue -#define INDEXING_DELAY 5000000 // Nano seconds to delay the monitored messages - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CMessageMonitor::NewL -// ----------------------------------------------------------------------------- -// -CMessageMonitor* CMessageMonitor::NewL( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ) - { - CMessageMonitor* self = new ( ELeave ) CMessageMonitor( aMessagePlugin, aSession ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -// ----------------------------------------------------------------------------- -// CMessageMonitor::CMessageMonitor -// ----------------------------------------------------------------------------- -// -CMessageMonitor::CMessageMonitor( CMessagePlugin& aMessagePlugin, CMsvSession& aSession ) - : CActive(CActive::EPriorityStandard), - iState(EStateNone), - iMsvSession(aSession), - iMessagePlugin(aMessagePlugin) - { - CPIXLOGSTRING("ENTER CMessageMonitor::CMessageMonitor"); - - CActiveScheduler::Add(this); - - CPIXLOGSTRING("END CMessageMonitor::CMessageMonitor"); - } - -// ----------------------------------------------------------------------------- -// CMessageMonitor::ConstructL -// ----------------------------------------------------------------------------- -// -void CMessageMonitor::ConstructL() - { - CPIXLOGSTRING("ENTER CMessageMonitor::ConstructL"); - - // Create timer - User::LeaveIfError(iTimer.CreateLocal()); - - CPIXLOGSTRING("END CMessageMonitor::ConstructL"); - } - - - -// ----------------------------------------------------------------------------- -// CMessageMonitor::~CMessageMonitor -// ----------------------------------------------------------------------------- -// -CMessageMonitor::~CMessageMonitor() - { - CPIXLOGSTRING("ENTER ~CMessageMonitor"); - Cancel(); - iMessages.Close(); - iTimer.Close(); - CPIXLOGSTRING("END ~CMessageMonitor"); - } - -// ----------------------------------------------------------------------------- -// CMessageMonitor::HandleMsgMovedL -// ----------------------------------------------------------------------------- -// -void CMessageMonitor::HandleMsgMovedL( const TMsvId aNewFolderId, - const TMsvId /* aOldFolderId */, - const CMsvEntrySelection& aSelection ) - { - CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgMovedL"); - - const TInt count( aSelection.Count() ); - // cycle through every message in the CMsvEntrySelection - for ( TInt i=0; i < count; ++i ) - { - TMsvId msgId = aSelection[i]; - CPIXLOGSTRING2("msgId: %d", msgId ); - MessageItemL( msgId, ECPixUpdateAction, aNewFolderId ); - } - CPIXLOGSTRING("END CMessageMonitor::HandleMsgMovedL"); - } - - -// ----------------------------------------------------------------------------- -// CMessageMonitor::0 -// ----------------------------------------------------------------------------- -// -void CMessageMonitor::HandleMsgCreatedChangedL( const CMsvEntrySelection& aSelection, - const TMsvId aFolderId, - const MMsvSessionObserver::TMsvSessionEvent /*aEvent*/ ) - { - CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgCreatedChangedL"); - const TInt count( aSelection.Count() ); - //MMsvSessionObserver::TMsvSessionEvent theEvent = aEvent; - // cycle through every message in the CMsvEntrySelection - for ( TInt i=0; i < count; ++i ) - { - // extract the message server entry from the parameters - TMsvId msgId = aSelection[i]; - CPIXLOGSTRING2("msgId: %d", msgId ); - TMsvId service = 0; - TMsvEntry entry; - const TInt err = iMsvSession.GetEntry( msgId, service, entry ); - if ( ( !err ) && - ( KUidMsvMessageEntry == entry.iType ) && - ( entry.Visible() && entry.Complete() && !entry.InPreparation() ) && - ( iMessagePlugin.CalculateMessageType( entry ) != EMsgTypeInvalid ) ) - { - CPIXLOGSTRING("CMessageMonitor::HandleMsgCreatedChangedL Called # MonitorEvent #"); - MessageItemL( msgId, ECPixUpdateAction, aFolderId ); - } - CPIXLOGSTRING2(" Folder TYPE %x", aFolderId ); - CPIXLOGSTRING2(" Entry TYPE %x", entry.iType ); - CPIXLOGSTRING2(" Entry VISIBLE %d", entry.Visible() ); - CPIXLOGSTRING2(" Entry COMPLETE %d", entry.Complete() ); - CPIXLOGSTRING2(" Entry INPREPARATION %d", entry.InPreparation() ); - CPIXLOGSTRING2(" Message TYPE %d", iMessagePlugin.CalculateMessageType( entry )); - } - CPIXLOGSTRING("END CMessageMonitor::HandleMsgCreatedChangedL"); - } - -// ----------------------------------------------------------------------------- -// CMessageMonitor::HandleMsgDeletedL -// ----------------------------------------------------------------------------- -// -void CMessageMonitor::HandleMsgDeletedL( const CMsvEntrySelection& aSelection ) - { - CPIXLOGSTRING("ENTER CMessageMonitor::HandleMsgDeletedL"); - - const TInt count( aSelection.Count() ); - // cycle through every message in the CMsvEntrySelection - for( TInt i = 0; i < count; ++i ) - { - TMsvId msgId = aSelection[i]; - CPIXLOGSTRING2("msgId: %d", msgId ); - MessageItemL( msgId, ECPixRemoveAction, NULL); - } - CPIXLOGSTRING("END CMessageMonitor::HandleMsgDeletedL"); - } - - -void CMessageMonitor::OverwriteOrAddToQuereL(TMsvId aMsvId, TCPixActionType aAction, TMsvId aFolderId) -{ - // Overwrite or add the index to the queue - TMessageRecord message; - message.iMsvId = aMsvId; - message.iAction = aAction; - message.iFolderId = aFolderId; - for (TInt i=0; i INDEXING_QUEUE_MAX) - { - // Maximum is exceeded, force the write immediately - if (iState == EStateWaiting) - { - iTimer.Cancel(); // RunL will be called with iStatus of KErrCancelled - } - else if (iState == EStateNone) - { - SetActive(); - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); // RunL will be called with iStatus of KErrNone - } - } - else - { - // Maximum is not exceeded, keep waiting - if (iState == EStateNone) - { - iState = EStateWaiting; - iTimer.After(iStatus, INDEXING_DELAY); // Wait 5 seconds before putting this to index - SetActive(); - } - } - } - -void CMessageMonitor::RunL() - { - // Index the current queue - while (iMessages.Count()>0) - { - TMessageRecord message = iMessages[0]; - iMessages.Remove(0); - iMessagePlugin.MessageItemL(message.iMsvId, message.iAction, message.iFolderId); - } - - // Everything is indexed no need to be waiting anymore - iState = EStateNone; - } - -void CMessageMonitor::DoCancel() - { - iTimer.Cancel(); - iState = EStateNone; - } - -TInt CMessageMonitor::RunError(TInt /* aError */) - { - // TODO handle indexing errors here - return KErrNone; // Don't panic - } - -// End Of File - diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/src/cmessageplugin.cpp --- a/harvesterplugins/messaging/src/cmessageplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,612 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "cmessageplugin.h" -#include "cmessagemonitor.h" -#include "cmessageharvester.h" -#include "cmessagedatahandler.h" -#include "harvesterserverlogger.h" - -// maximum length that the fully qualified msg Plugin base app class descriptor can be -// e.g. "@c:root msg" -const TInt KMsgPluginBaseAppClassMaxLen = 64; - - -// local declarations and functions -namespace { - -_LIT(KCPixSearchServerPrivateDirectory, "\\Private\\2001f6f7\\"); -_LIT(KPathIndexDbPath, CPIX_INDEVICE_INDEXDB); - -_LIT(KPathTrailer, "\\root\\msg"); -_LIT(KMsgBaseAppClassGeneric, ":root msg"); -_LIT(KAtSign, "@"); -_LIT(KColon, ":"); - -/** -* MapFileToDrive - gets the TDriveNumber associated with the aBaseAppClass. -* @aBaseAppClass e.g. "@c:root file" -* @aDrive returns the TDriveNumber for the aBaseAppClass -* returns KErrNone on success or a standard error code -*/ -TInt MapBaseAppClassToDrive(const TDesC& aBaseAppClass, TDriveNumber& aDrive) - { - if (KErrNone != aBaseAppClass.Left(1).Compare(KAtSign)) - { - return KErrGeneral; - } - - TPtrC drvChar = aBaseAppClass.Left(2).Right(1); - TChar d(drvChar[0]); - TInt drive; - const TInt ret = RFs::CharToDrive(d, drive); - if (!ret) - { - aDrive = TDriveNumber(drive); - } - - return ret; - } - -}// anonymous namespace - - -// --------------------------------------------------------------------------- -// CMessagePlugin::NewL -// --------------------------------------------------------------------------- -// -CMessagePlugin* CMessagePlugin::NewL() -{ - CMessagePlugin* instance = CMessagePlugin::NewLC(); - CleanupStack::Pop(instance); - return instance; -} - -// --------------------------------------------------------------------------- -// CMessagePlugin::NewLC -// --------------------------------------------------------------------------- -// -CMessagePlugin* CMessagePlugin::NewLC() -{ - CMessagePlugin* instance = new (ELeave)CMessagePlugin(); - CleanupStack::PushL(instance); - instance->ConstructL(); - return instance; -} - -// --------------------------------------------------------------------------- -// CMessagePlugin::CMessagePlugin -// --------------------------------------------------------------------------- -// -CMessagePlugin::CMessagePlugin() -{ - iMessageDataHandler = NULL; - iMessageHarvester = NULL; - iMessageMonitor = NULL; - iMsvSession = NULL; -} - -// --------------------------------------------------------------------------- -// CMessagePlugin::~CMessagePlugin -// --------------------------------------------------------------------------- -// -CMessagePlugin::~CMessagePlugin() -{ - // remove notification paths before destroying iMonitor - for (TInt i=EDriveA; i<=EDriveZ; i++) - UnMount(TDriveNumber(i), EFalse); - delete iMessageDataHandler; - delete iMessageHarvester; - delete iMessageMonitor; - delete iMsvSession; - iFs.Close(); -} - -// --------------------------------------------------------------------------- -// CMessagePlugin::ConstructL -// --------------------------------------------------------------------------- -// -void CMessagePlugin::ConstructL() -{ - TInt err = iFs.Connect(); - CPIXLOGSTRING2("CMessagePlugin::ConstructL, iFs.Connect: %i", err); - User::LeaveIfError(err); - iCurrentDrive = EDriveC; //Default drive is C drive - iMsvSession = CMsvSession::OpenSyncL(*this); - iMessageMonitor = CMessageMonitor::NewL( *this, *iMsvSession ); - iMessageHarvester = CMessageHarvester::NewL( *this, *iMsvSession ); - iMessageDataHandler = CMessageDataHandler::NewL( *this, *iMsvSession ); - for (TInt i=EDriveA; i<=EDriveZ; i++) - { - iIndexer[i] = NULL; //Initialize to NULL - } -} - -// --------------------------------------------------------------------------- -// CMessagePlugin::StartPluginL -// --------------------------------------------------------------------------- -// -void CMessagePlugin::StartPluginL() - { - //Get the current Drive for storage - iCurrentDrive = iMsvSession->CurrentDriveL(); - CPIXLOGSTRING2("currentDrive from messaging app : %d", iCurrentDrive ); - MountL(TDriveNumber(iCurrentDrive)); //Mount current drive - // Define this base application class, use default location - } - -// --------------------------------------------------------------------------- -// CMessagePlugin::StartHarvestingL -// --------------------------------------------------------------------------- -// -void CMessagePlugin::StartHarvestingL(const TDesC& aQualifiedBaseAppClass) - { - CPIXLOGSTRING("START CMessagePlugin::StartHarvestingL"); - // Map base app class to a drive number - TDriveNumber drive ( EDriveA );//Initialize to silence compiler warnings. - if (KErrNone != MapBaseAppClassToDrive(aQualifiedBaseAppClass, drive)) - User::Leave(KErrGeneral); - - // Leave if no indexer for this drive - if (!iIndexer[drive]) - User::Leave(KErrGeneral); - - // Reset the database - iIndexer[drive]->ResetL(); -#ifdef __PERFORMANCE_DATA - iStartTime.UniversalTime(); -#endif - iMessageHarvester->StartHarvestingL(); - } - -// --------------------------------------------------------------------------- -// CMessagePlugin::MountL -// --------------------------------------------------------------------------- -// -void CMessagePlugin::MountL(TDriveNumber aMedia,TBool aForceReharvesting) - { - CPIXLOGSTRING("START CMessagePlugin::MountL"); - // Check if already exists - if (iIndexer[aMedia]) - return; - - // Form the baseappclass for this media - TBuf baseAppClass; - FormBaseAppClass(aMedia, baseAppClass); - - // Define this volume - HBufC* path = DatabasePathLC(aMedia); - User::LeaveIfError(iSearchSession.DefineVolume(baseAppClass, *path)); - CleanupStack::PopAndDestroy(path); - - // construct and open the database - TRAPD(err,iIndexer[aMedia] = CCPixIndexer::NewL(iSearchSession)); - CPIXLOGSTRING2("CCPixIndexer::NewL returned : %d", err ); - TRAP(err,iIndexer[aMedia]->OpenDatabaseL(baseAppClass)); - - // Add to harvesting queue - iObserver->AddHarvestingQueue(this, baseAppClass,aForceReharvesting); - CPIXLOGSTRING("END CMessagePlugin::MountL"); - } - -// --------------------------------------------------------------------------- -// CMessagePlugin::UnMount -// --------------------------------------------------------------------------- -// -void CMessagePlugin::UnMount(TDriveNumber aMedia, TBool aUndefineAsWell) - { - CPIXLOGSTRING("START CMessagePlugin::UnMount"); - // Check if already exists - if (!iIndexer[aMedia]) - return; - - // Form the baseappclass for this media - TBuf baseAppClass; - FormBaseAppClass(aMedia, baseAppClass); - - // Remove from harvesting queue - iObserver->RemoveHarvestingQueue(this, baseAppClass); - - // Delete the index object - if (iIndexer[aMedia]) - { - delete iIndexer[aMedia]; - iIndexer[aMedia] = NULL; - } - - // if the aActionType is EFFMmcDismount, then the - // parameter aFilename is the baseAppClass of the Index database - // to be dropped. - if (aUndefineAsWell) - iSearchSession.UnDefineVolume(baseAppClass); - } - - -// --------------------------------------------------------------------------- -// CMessagePlugin::FormBaseAppClass -// --------------------------------------------------------------------------- -// -TInt CMessagePlugin::FormBaseAppClass(TDriveNumber aMedia, TDes& aBaseAppClass) - { - TChar chr; - const TInt ret = RFs::DriveToChar(aMedia, chr); - if (KErrNone == ret) - { - aBaseAppClass.Copy(KAtSign); - aBaseAppClass.Append(chr); - aBaseAppClass.LowerCase(); - aBaseAppClass.Append(KMsgBaseAppClassGeneric); - } - - return ret; - } - -// --------------------------------------------------------------------------- -// CMessagePlugin::DatabasePathLC -// --------------------------------------------------------------------------- -// -HBufC* CMessagePlugin::DatabasePathLC(TDriveNumber aMedia) - { - CPIXLOGSTRING("START CMessagePlugin::DatabasePathLC"); - // Allocate extra space for root path e.g. "C:\\Private\\2001f6f7\\" - const TInt KRootPathMaxLength = 30; - HBufC* indexDbPath = HBufC::NewLC(KRootPathMaxLength + KPathIndexDbPath().Length() + KPathTrailer().Length()); - TPtr indexDbPathPtr = indexDbPath->Des(); - -#if 1 // Data caging implementation - iFs.CreatePrivatePath(aMedia); - - TChar chr; - RFs::DriveToChar(aMedia, chr); - indexDbPathPtr.Append(chr); - indexDbPathPtr.Append(KColon); - - TFileName pathWithoutDrive; - iFs.PrivatePath(pathWithoutDrive); - indexDbPathPtr.Append(KCPixSearchServerPrivateDirectory); -#else // here is the way to calculate the path if data caging is not being used. - TFileName rootPath; - PathInfo::GetRootPath(rootPath, aMedia); - indexDbPathPtr.Append(rootPath); -#endif - - indexDbPathPtr.Append(KPathIndexDbPath); - indexDbPathPtr.Append(KPathTrailer); - - return indexDbPath; - } - -// --------------------------------------------------------------------------- -// CMessagePlugin::GetIndexer -// --------------------------------------------------------------------------- -// -CCPixIndexer* CMessagePlugin::GetIndexer() - { - return iIndexer[iCurrentDrive]; - } - -// --------------------------------------------------------------------------- -// CMessagePlugin::IsMediaRemovableL -// --------------------------------------------------------------------------- -// -TBool CMessagePlugin::IsMediaRemovableL(TDriveNumber& aDrive) - { - TDriveInfo driveInfo; - User::LeaveIfError(iFs.Drive(driveInfo,aDrive)); - TBool mediaRemovable(EFalse); - driveInfo.iDriveAtt & KDriveAttRemovable ? mediaRemovable = ETrue : mediaRemovable = EFalse; - return mediaRemovable; - } -// --------------------------------------------------------------------------- -// CMessagePlugin::HandleSessionEventL -// --------------------------------------------------------------------------- -// -void CMessagePlugin::HandleSessionEventL( TMsvSessionEvent aEvent, - TAny* aArg1, - TAny* aArg2, - TAny* aArg3 ) - { - CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL"); - CPIXLOGSTRING2("TMsvSessionEvent aEvent: %d", aEvent ); - - switch( aEvent ) - { - case EMsvEntriesCreated: - case EMsvEntriesChanged: - { - // Handle changed / created event - CMsvEntrySelection* selection = reinterpret_cast(aArg1); - TMsvId folderId = *( reinterpret_cast(aArg2)); -#ifdef __PERFORMANCE_DATA - iStartTime.UniversalTime(); - iMessageMonitor->HandleMsgCreatedChangedL(*selection, folderId, aEvent); - UpdatePerformaceDataL(EMsvEntriesChanged); -#else - iMessageMonitor->HandleMsgCreatedChangedL(*selection, folderId, aEvent); -#endif - break; - } - case EMsvEntriesDeleted: - { - // Handle deletion event - CMsvEntrySelection* selection = reinterpret_cast ( aArg1 ); -#ifdef __PERFORMANCE_DATA - iStartTime.UniversalTime(); - iMessageMonitor->HandleMsgDeletedL( *selection ); - UpdatePerformaceDataL(EMsvEntriesDeleted); -#else - iMessageMonitor->HandleMsgDeletedL( *selection ); -#endif - break; - } - case EMsvEntriesMoved: - { - // track move operations - // or sent folder - // ... extract the useful parameters - if( aArg1 && aArg2 && aArg3 ) - { - CMsvEntrySelection* selection = reinterpret_cast ( aArg1 ); - // aArg2 is the TMsvId of the new parent. aArg3 is the TMsvId of - // the old parent entry. - TMsvId newFolderId = *(reinterpret_cast(aArg2)); - TMsvId oldFolderId = *(reinterpret_cast(aArg3)); -#ifdef __PERFORMANCE_DATA - iStartTime.UniversalTime(); - iMessageMonitor->HandleMsgMovedL(newFolderId, oldFolderId, *selection); - UpdatePerformaceDataL(EMsvEntriesMoved); -#else - iMessageMonitor->HandleMsgMovedL(newFolderId, oldFolderId, *selection); -#endif - } - break; - } - case EMsvMediaChanged: - { - //Unmount old media drive - CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaChanged"); - TDriveNumber drive = *(reinterpret_cast(aArg1)); - UnMount(drive); - drive = *(reinterpret_cast(aArg2)); - //Check if Media is removable then force reharvesting else keep indexes same - MountL(drive,IsMediaRemovableL(drive)); //Mount new media drive for harvesting - iCurrentDrive = drive;//Index of current drive - } - break; - case EMsvMediaUnavailable: - { - //No need to handle as when drive will be removed EMsvMediaChanged event - //will be received for default media drive can be handled there - //Unmount old media drive - CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaUnavailable"); - TDriveNumber drive = *(reinterpret_cast(aArg1)); - UnMount(drive); - } - break; - case EMsvMediaAvailable: - { - CPIXLOGSTRING("ENTER CMessagePlugin::HandleSessionEventL EMsvMediaAvailable"); - //Removed media drive available again mount media drive and unmount default - UnMount(TDriveNumber(iCurrentDrive)); //Unmount current drive - TDriveNumber drive = *(reinterpret_cast(aArg1)); - MountL(drive,IsMediaRemovableL(drive)); //Mount avilable media drive for harvesting - } - break; - case EMsvServerFailedToStart: - case EMsvCloseSession: - case EMsvServerTerminated: - { - User::Panic(_L("CMessagePlugin PANIC"), KErrServerTerminated); - break; - } - case EMsvMtmGroupInstalled: - case EMsvMtmGroupDeInstalled: - case EMsvGeneralError: // not used after v5 - case EMsvServerReady: - case EMsvCorruptedIndexRebuilt: - case EMsvMediaIncorrect: - case EMsvCorruptedIndexRebuilding: - default: - { - break; - } - } - CPIXLOGSTRING("END CMessagePlugin::HandleSessionEventL"); - - } - -// --------------------------------------------------------------------------- -// CMessageDataHandler::CalculateMessageType -// --------------------------------------------------------------------------- -// -TMsgType CMessagePlugin::CalculateMessageType (const TMsvEntry& aEntry ) -{ - CPIXLOGSTRING("ENTER CMessagePlugin::CalculateMessageType"); - TMsgType ret = EMsgTypeInvalid; - CPIXLOGSTRING2("CMessagePlugin::CalculateMessageType uid: %x", aEntry.iMtm.iUid ); - if( aEntry.iMtm.iUid == KUidMsgTypeMultimedia.iUid ) - { - CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### Mms Message ###"); - ret = EMsgTypeMms; - } - else if( aEntry.iMtm.iUid == KUidMsgTypeSMTP.iUid ) - { - CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### ESmtpEmail ###"); - ret = EMsgTypeEmailSmtp; - } - else if( aEntry.iMtm.iUid == KUidMsgTypePOP3.iUid ) - { - CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### EPop3Email ###"); - ret = EMsgTypeEmailPop3; - } - else if( aEntry.iMtm.iUid == KUidMsgTypeIMAP4.iUid ) - { - CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### EImap4Email ###"); - ret = EMsgTypeEmailImap4; - } - // Add J.J -#ifndef __SERIES60_30__ // Not supported before S60 3d FP1 - else if ( aEntry.iMtm.iUid == KSenduiMtmUniMessageUid.iUid ) - { - CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### EDraftMessage ###"); - ret = EMsgTypeDraft; - } -#endif - // else if we have a normal text based SMS it is valid - else if ( aEntry.iMtm.iUid == KUidMsgTypeSMS.iUid ) - { - CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### SMS Message ###"); - ret = EMsgTypeSms; - } - else if ( aEntry.iMtm.iUid == KSenduiMtmSmsUid.iUid ) - { - CPIXLOGSTRING("CMessagePlugin:CalculateMessageType ### Sms Message ###"); - ret = EMsgTypeSms; - } - CPIXLOGSTRING("END CMessagePlugin::CalculateMessageType"); - return ret; -} - -// --------------------------------------------------------------------------- -// CMessagePlugin::MessageItemL -// --------------------------------------------------------------------------- -// -void CMessagePlugin::MessageItemL( TMsvId aMsgId, TCPixActionType aActionType, TMsvId aFolderId ) - { - //New item found gather data from that. - iMessageDataHandler->GatherDataL( aMsgId, aActionType, aFolderId ); - } - -// --------------------------------------------------------------------------- -// CMessagePlugin::HarvestingCompleted -// --------------------------------------------------------------------------- -// -void CMessagePlugin::HarvestingCompleted(TInt aError) -{ - // Notifies the indexing manager of completed harvesting, called by CMessageHarvester - Flush( *GetIndexer() ); - TBuf baseAppClass; - FormBaseAppClass(TDriveNumber(iCurrentDrive), baseAppClass); -#ifdef __PERFORMANCE_DATA - TRAP_IGNORE( UpdatePerformaceDataL() ); -#endif - iObserver->HarvestingCompleted(this, baseAppClass, aError); -} - -// --------------------------------------------------------------------------- -// CMessagePlugin::UpdatePerformaceDataL -// --------------------------------------------------------------------------- -// -#ifdef __PERFORMANCE_DATA -void CMessagePlugin::UpdatePerformaceDataL() - { - TTime now; - - - iCompleteTime.UniversalTime(); - TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime); - - RFs fileSession; - RFile perfFile; - User::LeaveIfError( fileSession.Connect () ); - - - /* Open file if it exists, otherwise create it and write content in it */ - - if(perfFile.Open(fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)) - User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)); - - HBufC8 *heap = HBufC8::NewL(100); - TPtr8 ptr = heap->Des(); - now.HomeTime(); - TBuf<50> timeString; - - _LIT(KOwnTimeFormat,"%:0%H%:1%T%:2%S"); - now.FormatL(timeString,KOwnTimeFormat); - ptr.AppendNum(now.DateTime().Day()); - ptr.Append(_L("/")); - ptr.AppendNum(now.DateTime().Month()); - ptr.Append(_L("/")); - ptr.AppendNum(now.DateTime().Year()); - ptr.Append(_L(":")); - ptr.Append(timeString); - ptr.Append( _L("Time taken for Harvesting Message is : ")); - ptr.AppendNum(timeDiff.Int64()/1000) ; - ptr.Append(_L(" MilliSeonds \n")); - TInt myInt = 0; - perfFile.Seek(ESeekEnd,myInt); - perfFile.Write (ptr); - perfFile.Close (); - fileSession.Close (); - delete heap; - } - -// --------------------------------------------------------------------------- -// CMessagePlugin::UpdatePerformaceDataL -// --------------------------------------------------------------------------- -// -void CMessagePlugin::UpdatePerformaceDataL(TMsvSessionEvent action) { - - iCompleteTime.UniversalTime(); - TTimeIntervalMicroSeconds timeDiff = iCompleteTime.MicroSecondsFrom(iStartTime); - - RFs fileSession; - RFile perfFile; - User::LeaveIfError( fileSession.Connect () ); - - - /* Open file if it exists, otherwise create it and write content in it */ - - if(perfFile.Open(fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)) - User::LeaveIfError(perfFile.Create (fileSession, _L("c:\\data\\MessagePerf.txt"), EFileWrite)); - - HBufC8 *heap = HBufC8::NewL(100); - TPtr8 ptr = heap->Des(); - - switch (action) { - case EMsvEntriesDeleted: ptr.Append( _L("del "));break; - case EMsvEntriesChanged: ptr.Append( _L("upd "));break; - case EMsvEntriesMoved: ptr.Append( _L("mov "));break; - } - ptr.AppendNum(timeDiff.Int64()/1000) ; - ptr.Append(_L("\n")); - TInt myInt = 0; - perfFile.Seek(ESeekEnd,myInt); - perfFile.Write (ptr); - perfFile.Close (); - fileSession.Close (); - delete heap; - } - -#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/messaging/src/tproxy.cpp --- a/harvesterplugins/messaging/src/tproxy.cpp Mon Apr 19 14:40:05 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Message plugin -* -*/ - - - -#include -#include -#include -#include "cmessageplugin.h" - - -// Map the interface UIDs to implementation factory functions -const TImplementationProxy KImplementationTable[] = - { - {{0x2001F701},( TProxyNewLPtr) CMessagePlugin::NewL} - }; - -// Exported proxy for instantiation method resolution -EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) - { - aTableCount = sizeof( KImplementationTable ) / sizeof( TImplementationProxy ); - return KImplementationTable; - } - diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/notes/data/2001a9d8.rss --- a/harvesterplugins/notes/data/2001a9d8.rss Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/notes/data/2001a9d8.rss Mon May 03 12:32:15 2010 +0300 @@ -36,7 +36,7 @@ { implementation_uid = 0x2001A9D8; version_no = 1; - display_name = "Notes harvester plugin"; + display_name = "Notes"; default_data = "Notes"; opaque_data = ""; } diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/notes/group/notesplugin.mmp --- a/harvesterplugins/notes/group/notesplugin.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/notes/group/notesplugin.mmp Mon May 03 12:32:15 2010 +0300 @@ -30,7 +30,7 @@ SOURCE notesplugin.cpp SOURCE tproxy.cpp -USERINCLUDE ../inc +USERINCLUDE ../inc ../traces APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE /epoc32/include/ecom diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/notes/src/notesplugin.cpp --- a/harvesterplugins/notes/src/notesplugin.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/notes/src/notesplugin.cpp Mon May 03 12:32:15 2010 +0300 @@ -28,6 +28,11 @@ #include #include #include +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "notespluginTraces.h" +#endif + _LIT(KMimeTypeNotes , NOTES_MIMETYPE); _LIT(KMimeTypeField , CPIX_MIMETYPE_FIELD); @@ -125,6 +130,7 @@ // void CNotesPlugin::StartPluginL() { + OstTraceFunctionEntry0( CNOTESPLUGIN_STARTPLUGINL_ENTRY ); CPIXLOGSTRING("CNotesPlugin::StartPluginL: Enter"); // Define this base application class, use default location User::LeaveIfError(iSearchSession.DefineVolume( _L(NOTES_QBASEAPPCLASS), KNullDesC )); @@ -152,6 +158,7 @@ iSession->StartChangeNotification( *this, *filter ); delete filter; CPIXLOGSTRING("CNotesPlugin::StartPluginL: Exit"); + OstTraceFunctionExit0( CNOTESPLUGIN_STARTPLUGINL_EXIT ); } // --------------------------------------------------------------------------- @@ -160,6 +167,7 @@ // void CNotesPlugin::StartHarvestingL(const TDesC& /*aQualifiedBaseAppClass*/) { + OstTraceFunctionEntry0( CNOTESPLUGIN_STARTHARVESTINGL_ENTRY ); CPIXLOGSTRING("CNotesPlugin::StartHarvestingL: Enter"); iIndexer->ResetL(); //Have taken start time and end time reference from calender plugin @@ -171,12 +179,14 @@ //Create an instance for list of Notes items in the system iNotesInstanceView->FindInstanceL( iNotesInstanceArray , CalCommon::EIncludeNotes , CalCommon::TCalTimeRange( startTimeCal, endTimeCal )); iNoteCount = iNotesInstanceArray.Count(); + OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_STARTHARVESTINGL, "CNotesPlugin::StartHarvestingL;Notes Count=%d", iNoteCount ); CPIXLOGSTRING2("CNotesPlugin::StartHarvestingL(): Notes count =%d.", iNoteCount); #ifdef __PERFORMANCE_DATA iStartTime.UniversalTime(); #endif iAsynchronizer->Start( 0, this, KHarvestingDelay ); CPIXLOGSTRING("CNotesPlugin::StartHarvestingL: Exit"); + OstTraceFunctionExit0( CNOTESPLUGIN_STARTHARVESTINGL_EXIT ); } // ----------------------------------------------------------------------------- @@ -185,10 +195,12 @@ // void CNotesPlugin::DelayedCallbackL( TInt /*aCode*/ ) { + OstTraceFunctionEntry0( CNOTESPLUGIN_DELAYEDCALLBACKL_ENTRY ); // Harvest items on each call CPIXLOGSTRING("CNotesPlugin::DelayedCallbackL: Enter"); if( iNoteCount ) { + OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_DELAYEDCALLBACKL, "CNotesPlugin::DelayedCallbackL;Remaining Notes Count=%d", iNoteCount ); CPIXLOGSTRING2("CNotesPlugin::DelayedCallbackL(): remaining Note count=%d.", iNoteCount); // Retrieve the calendar entry for the calinstance and update the CPix database. CCalEntry& noteentry = iNotesInstanceArray[iNoteCount - 1]->Entry(); @@ -199,6 +211,7 @@ } else { + OstTrace0( TRACE_NORMAL, DUP1_CNOTESPLUGIN_DELAYEDCALLBACKL, "CNotesPlugin::DelayedCallbackL: Completed Harvesting" ); CPIXLOGSTRING("CNotesPlugin::DelayedCallbackL: Completed Harvesting"); // Harvesting was successfully completed Flush(*iIndexer); @@ -207,6 +220,7 @@ #endif iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone); } + OstTraceFunctionExit0( CNOTESPLUGIN_DELAYEDCALLBACKL_EXIT ); } // --------------------------------------------------------------------------- @@ -226,14 +240,17 @@ // void CNotesPlugin::CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems ) { + OstTraceFunctionEntry0( CNOTESPLUGIN_CALCHANGENOTIFICATION_ENTRY ); CPIXLOGSTRING("CNotesPlugin::CalChangeNotification: Enter"); const TInt count(aChangeItems.Count()); + OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_CALCHANGENOTIFICATION, "CNotesPlugin::CalChangeNotification;Changed Item Count=%d", count ); CPIXLOGSTRING2("CNotesPlugin::CalChangeNotification(): changed item count =%d.", count); for( TInt i = 0; i < count; ++i ) { TRAP_IGNORE(HandleNoteChangedEntryL( aChangeItems[ i ] )); } CPIXLOGSTRING("CNotesPlugin::CalChangeNotification: Exit"); + OstTraceFunctionExit0( CNOTESPLUGIN_CALCHANGENOTIFICATION_EXIT ); } // --------------------------------------------------------------------------- @@ -246,6 +263,7 @@ { case EChangeAdd: { + OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL, "CNotesPlugin::HandleNoteChangedEntryL;Monitored add id=%d", changedEntry.iEntryId ); CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored add id=%d.", changedEntry.iEntryId); CreateNoteEntryL( changedEntry.iEntryId, ECPixAddAction ); break; @@ -253,6 +271,7 @@ case EChangeDelete: { + OstTrace1( TRACE_NORMAL, DUP1_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL, "CNotesPlugin::HandleNoteChangedEntryL;Monitored delete id=%d", changedEntry.iEntryId ); CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored delete id=%d.", changedEntry.iEntryId); CreateNoteEntryL( changedEntry.iEntryId, ECPixRemoveAction ); break; @@ -260,6 +279,7 @@ case EChangeModify: { + OstTrace1( TRACE_NORMAL, DUP2_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL, "CNotesPlugin::HandleNoteChangedEntryL;Monitored update id=%d", changedEntry.iEntryId ); CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored update id=%d.", changedEntry.iEntryId); CreateNoteEntryL( changedEntry.iEntryId, ECPixUpdateAction ); break; @@ -267,6 +287,7 @@ case EChangeUndefined: { + OstTrace0( TRACE_NORMAL, DUP3_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL, "CNotesPlugin::HandleNoteChangedEntryL(): EChangeUndefined." ); CPIXLOGSTRING("CNotesPlugin::HandleNoteChangedEntryL(): EChangeUndefined."); // This event could be related to synchronization. // Mark harvesting as cancelled. @@ -295,6 +316,7 @@ if (!iIndexer) return; + OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;uid=%d", aLocalUid ); CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Uid = %d.", aLocalUid); @@ -311,10 +333,12 @@ if( CCalEntry::ENote != entry->EntryTypeL() ) { + OstTrace0( TRACE_NORMAL, DUP1_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): return as not a Note entry." ); CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): return as not a Note entry."); CleanupStack::PopAndDestroy(entry); return; } + OstTrace0( TRACE_NORMAL, DUP2_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Creating document." ); CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Creating document."); CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(NOTESAPPCLASS)); // Add Description fields @@ -344,10 +368,12 @@ TRAPD( err, iIndexer->AddL(*index_item) ); if ( err == KErrNone ) { + OstTrace0( TRACE_NORMAL, DUP3_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Added." ); CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Added."); } else { + OstTrace1( TRACE_NORMAL, DUP4_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;Error while adding=%d", err ); CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in adding.", err); } #endif @@ -360,10 +386,12 @@ TRAPD( err, iIndexer->UpdateL(*index_item) ); if ( err == KErrNone ) { + OstTrace0( TRACE_NORMAL, DUP5_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Updated." ); CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Updated."); } else { + OstTrace1( TRACE_NORMAL, DUP6_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;Error while updating=%d", err ); CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in updating.", err); } #endif @@ -379,10 +407,12 @@ TRAPD( err, iIndexer->DeleteL(docid_str) ); if (err == KErrNone) { + OstTrace0( TRACE_NORMAL, DUP7_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Deleted." ); CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Deleted."); } else { + OstTrace1( TRACE_NORMAL, DUP8_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;Error while deleting=%d", err ); CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in deleting.", err); } #endif @@ -395,6 +425,7 @@ // void CNotesPlugin::InitTimeValuesL( TTime& aStartTime, TTime& aEndTime ) { + OstTraceFunctionEntry0( CNOTESPLUGIN_INITTIMEVALUESL_ENTRY ); CPIXLOGSTRING("CNotesPlugin::InitTimeValuesL: Enter"); //Open the cpix common repository CRepository* cpixrepo = CRepository::NewL( KCPIXrepoUidMenu ); @@ -423,6 +454,7 @@ TDateTime enddate(year,(TMonth)(month-1),day , 0 , 0 , 0 , 0); aEndTime = enddate; CPIXLOGSTRING2("CNotesPlugin::InitTimeValuesL: Exit with Error = %d", error); + OstTraceFunctionExit0( CNOTESPLUGIN_INITTIMEVALUESL_EXIT ); } #ifdef __PERFORMANCE_DATA diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/notes/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/notes/traces/OstTraceDefinitions.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/notes/traces/fixed_id.definitions --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/notes/traces/fixed_id.definitions Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,30 @@ +#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt. +[GROUP]TRACE_FLOW=0x8a +[GROUP]TRACE_NORMAL=0x86 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_CALCHANGENOTIFICATION_ENTRY=0x7 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_CALCHANGENOTIFICATION_EXIT=0x8 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_DELAYEDCALLBACKL_ENTRY=0x5 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_DELAYEDCALLBACKL_EXIT=0x6 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_INITTIMEVALUESL_ENTRY=0x9 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_INITTIMEVALUESL_EXIT=0xa +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_STARTHARVESTINGL_ENTRY=0x3 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_STARTHARVESTINGL_EXIT=0x4 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_STARTPLUGINL_ENTRY=0x1 +[TRACE]TRACE_FLOW[0x8A]_CNOTESPLUGIN_STARTPLUGINL_EXIT=0x2 +[TRACE]TRACE_NORMAL[0x86]_CNOTESPLUGIN_CALCHANGENOTIFICATION=0x4 +[TRACE]TRACE_NORMAL[0x86]_CNOTESPLUGIN_CREATENOTEENTRYL=0x9 +[TRACE]TRACE_NORMAL[0x86]_CNOTESPLUGIN_DELAYEDCALLBACKL=0x2 +[TRACE]TRACE_NORMAL[0x86]_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL=0x5 +[TRACE]TRACE_NORMAL[0x86]_CNOTESPLUGIN_STARTHARVESTINGL=0x1 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CNOTESPLUGIN_CREATENOTEENTRYL=0xa +[TRACE]TRACE_NORMAL[0x86]_DUP1_CNOTESPLUGIN_DELAYEDCALLBACKL=0x3 +[TRACE]TRACE_NORMAL[0x86]_DUP1_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL=0x6 +[TRACE]TRACE_NORMAL[0x86]_DUP2_CNOTESPLUGIN_CREATENOTEENTRYL=0xb +[TRACE]TRACE_NORMAL[0x86]_DUP2_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL=0x7 +[TRACE]TRACE_NORMAL[0x86]_DUP3_CNOTESPLUGIN_CREATENOTEENTRYL=0xc +[TRACE]TRACE_NORMAL[0x86]_DUP3_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL=0x8 +[TRACE]TRACE_NORMAL[0x86]_DUP4_CNOTESPLUGIN_CREATENOTEENTRYL=0xd +[TRACE]TRACE_NORMAL[0x86]_DUP5_CNOTESPLUGIN_CREATENOTEENTRYL=0xe +[TRACE]TRACE_NORMAL[0x86]_DUP6_CNOTESPLUGIN_CREATENOTEENTRYL=0xf +[TRACE]TRACE_NORMAL[0x86]_DUP7_CNOTESPLUGIN_CREATENOTEENTRYL=0x10 +[TRACE]TRACE_NORMAL[0x86]_DUP8_CNOTESPLUGIN_CREATENOTEENTRYL=0x11 diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/notes/traces/notespluginTraces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/notes/traces/notespluginTraces.h Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,41 @@ +// Created by TraceCompiler 2.1.2 +// DO NOT EDIT, CHANGES WILL BE LOST + +#ifndef __NOTESPLUGINTRACES_H__ +#define __NOTESPLUGINTRACES_H__ + +#define KOstTraceComponentID 0x2001a9d8 + +#define CNOTESPLUGIN_STARTPLUGINL_ENTRY 0x8a0001 +#define CNOTESPLUGIN_STARTPLUGINL_EXIT 0x8a0002 +#define CNOTESPLUGIN_STARTHARVESTINGL_ENTRY 0x8a0003 +#define CNOTESPLUGIN_STARTHARVESTINGL_EXIT 0x8a0004 +#define CNOTESPLUGIN_DELAYEDCALLBACKL_ENTRY 0x8a0005 +#define CNOTESPLUGIN_DELAYEDCALLBACKL_EXIT 0x8a0006 +#define CNOTESPLUGIN_CALCHANGENOTIFICATION_ENTRY 0x8a0007 +#define CNOTESPLUGIN_CALCHANGENOTIFICATION_EXIT 0x8a0008 +#define CNOTESPLUGIN_INITTIMEVALUESL_ENTRY 0x8a0009 +#define CNOTESPLUGIN_INITTIMEVALUESL_EXIT 0x8a000a +#define CNOTESPLUGIN_STARTHARVESTINGL 0x860001 +#define CNOTESPLUGIN_DELAYEDCALLBACKL 0x860002 +#define DUP1_CNOTESPLUGIN_DELAYEDCALLBACKL 0x860003 +#define CNOTESPLUGIN_CALCHANGENOTIFICATION 0x860004 +#define CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL 0x860005 +#define DUP1_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL 0x860006 +#define DUP2_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL 0x860007 +#define DUP3_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL 0x860008 +#define CNOTESPLUGIN_CREATENOTEENTRYL 0x860009 +#define DUP1_CNOTESPLUGIN_CREATENOTEENTRYL 0x86000a +#define DUP2_CNOTESPLUGIN_CREATENOTEENTRYL 0x86000b +#define DUP3_CNOTESPLUGIN_CREATENOTEENTRYL 0x86000c +#define DUP4_CNOTESPLUGIN_CREATENOTEENTRYL 0x86000d +#define DUP5_CNOTESPLUGIN_CREATENOTEENTRYL 0x86000e +#define DUP6_CNOTESPLUGIN_CREATENOTEENTRYL 0x86000f +#define DUP7_CNOTESPLUGIN_CREATENOTEENTRYL 0x860010 +#define DUP8_CNOTESPLUGIN_CREATENOTEENTRYL 0x860011 + + +#endif + +// End of file + diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/tsrc/harvesterplugintester/conf/harvesterplugintester.cfg --- a/harvesterplugins/tsrc/harvesterplugintester/conf/harvesterplugintester.cfg Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/tsrc/harvesterplugintester/conf/harvesterplugintester.cfg Mon May 03 12:32:15 2010 +0300 @@ -10,13 +10,6 @@ [Endtest] [Test] -title TestFolderRename -create HarvesterPluginTester foobar -foobar TestFolderRename -delete foobar -[Endtest] - -[Test] title TestFormBaseAppClass create HarvesterPluginTester foobar foobar TestFormBaseAppClass -2 a -1 @@ -37,21 +30,35 @@ [Test] title TestCreateIndexItemL_Add create HarvesterPluginTester foobar -foobar TestCreateIndexItemL_Add add testfile1.txt Sai +foobar TestCreateIndexItemL_Add add testfile.txt Hello delete foobar [Endtest] [Test] title TestCreateIndexItemL_Update create HarvesterPluginTester foobar -foobar TestCreateIndexItemL_Update update testfile1.txt Sai sai Keyword +foobar TestCreateIndexItemL_Update update testfile.txt Hello hello delete foobar [Endtest] [Test] title TestCreateIndexItemL_Delete create HarvesterPluginTester foobar -foobar TestCreateIndexItemL_Delete delete testfile1.txt Sai +foobar TestCreateIndexItemL_Delete delete testfile.txt Hello +delete foobar +[Endtest] + +[Test] +title TestFolderCreate +create HarvesterPluginTester foobar +foobar TestFolderCreate +delete foobar +[Endtest] + +[Test] +title TestFolderRename +create HarvesterPluginTester foobar +foobar TestFolderRename delete foobar [Endtest] diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/tsrc/harvesterplugintester/conf/testfile.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvesterplugins/tsrc/harvesterplugintester/conf/testfile.txt Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,1 @@ +Hello \ No newline at end of file diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/tsrc/harvesterplugintester/group/bld.inf --- a/harvesterplugins/tsrc/harvesterplugintester/group/bld.inf Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/tsrc/harvesterplugintester/group/bld.inf Mon May 03 12:32:15 2010 +0300 @@ -30,6 +30,7 @@ ../conf/notesalphanumerictest.txt /epoc32/winscw/c/TestFramework/notesalphanumerictest.txt ../conf/noteslongtest.txt /epoc32/winscw/c/TestFramework/noteslongtest.txt ../conf/testattachment.txt /epoc32/winscw/c/TestFramework/testattachment.txt +../conf/testfile.txt /epoc32/winscw/c/data/testfile.txt ../conf/eagle_landed.mp3 /epoc32/winscw/c/data/eagle_landed.mp3 ../conf/niagara.wmv /epoc32/winscw/c/data/niagara.wmv @@ -40,6 +41,7 @@ ../conf/notesalphanumerictest.txt z:/ids/notesalphanumerictest.txt ../conf/noteslongtest.txt z:/ids/noteslongtest.txt ../conf/testattachment.txt z:/ids/testattachment.txt +../conf/testfile.txt z:/ids/testfile.txt ../conf/eagle_landed.mp3 z:/ids/eagle_landed.mp3 ../conf/niagara.wmv z:/ids/niagara.wmv PRJ_EXPORTS diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester.mmp --- a/harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/tsrc/harvesterplugintester/group/harvesterplugintester.mmp Mon May 03 12:32:15 2010 +0300 @@ -88,9 +88,9 @@ //---------------End of additions for testing FilePlugin------------------- //------------------Added for testing Messaging plugin------------------- -USERINCLUDE ./../../../messaging/inc +USERINCLUDE ./../../../messaging/smsmms/inc -SOURCEPATH ./../../../messaging/src +SOURCEPATH ./../../../messaging/smsmms/src SOURCE cmessageplugin.cpp cmessagedatahandler.cpp cmessageharvester.cpp cmessagemonitor.cpp SOURCEPATH ../src @@ -205,4 +205,15 @@ SOURCE cpixmediaimagedoc.cpp SOURCE imageplugin.cpp //------------------End for image plugin ----------------------------- + +USERINCLUDE ../../../applications/traces +USERINCLUDE ../../../bookmarks/traces +USERINCLUDE ../../../calendar/traces +USERINCLUDE ../../../contacts/traces +USERINCLUDE ../../../file/traces +USERINCLUDE ../../../media/audio/traces +USERINCLUDE ../../../media/image/traces +USERINCLUDE ../../../media/video/traces +USERINCLUDE ../../../messaging/smsmms/traces +USERINCLUDE ../../../notes/traces // End of File diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/tsrc/harvesterplugintester/inc/harvesterplugintester.h --- a/harvesterplugins/tsrc/harvesterplugintester/inc/harvesterplugintester.h Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/tsrc/harvesterplugintester/inc/harvesterplugintester.h Mon May 03 12:32:15 2010 +0300 @@ -152,14 +152,16 @@ */ virtual TInt TestStartHarvesterL( CStifItemParser& aItem ); - virtual TInt TestFolderRenamingL( CStifItemParser& aItem ); - virtual TInt TestFormBaseAppClass( CStifItemParser& aItem ); virtual TInt TestDatabasePathL( CStifItemParser& aItem ); - virtual TInt TestCreateIndexItemL( CStifItemParser& aItem ); - + virtual TInt TestCreateIndexItemL( CStifItemParser& aItem ); + + virtual TInt TestFolderCreateL( CStifItemParser& aItem ); + + virtual TInt TestFolderRenameL( CStifItemParser& aItem ); + /** * Message harvester test method. * @since ?Series60_version diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/capsmod_exe.mmp --- a/harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/capsmod_exe.mmp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/tsrc/harvesterplugintester/src/capsmod_exe/group/capsmod_exe.mmp Mon May 03 12:32:15 2010 +0300 @@ -32,7 +32,7 @@ #ifdef SBSV2 #if defined(__S60_) - OSEXT_LAYER_SYSTEMINCLUDE + OS_LAYER_SYSTEMINCLUDE #else // __S60_ not defined SYSTEMINCLUDE /epoc32/include SYSTEMINCLUDE /epoc32/include/internal diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/tsrc/harvesterplugintester/src/ccalanderobserver.cpp --- a/harvesterplugins/tsrc/harvesterplugintester/src/ccalanderobserver.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/tsrc/harvesterplugintester/src/ccalanderobserver.cpp Mon May 03 12:32:15 2010 +0300 @@ -147,7 +147,7 @@ if ( entry->EntryTypeL() == CCalEntry::ENote ) { iCalEntryView->DeleteL(*entry); - break; + continue; } } CleanupStack::PopAndDestroy(&entryarray); diff -r ccd0fd43f247 -r 208a4ba3894c harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintesterblocks.cpp --- a/harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintesterblocks.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/harvesterplugins/tsrc/harvesterplugintester/src/harvesterplugintesterblocks.cpp Mon May 03 12:32:15 2010 +0300 @@ -42,11 +42,13 @@ #include #include "mdsitementity.h" #include "cpixmdedbmanager.h" +#include "cfolderrenamedharvester.h" //#include "CBlacklistMgr.h" #include "videoplugin.h" #include "imageplugin.h" -_LIT(KAppBasePath,"@c:root file"); +_LIT(KAppBasePath,"@c:root file content"); +_LIT(KAppBaseFolderFilePath,"@c:root file folder"); const TInt KMsgPluginBaseAppClassMaxLen = 64; // For Notes --Start @@ -87,13 +89,14 @@ // Copy this line for every implemented function. // First string is the function name used in TestScripter script file. // Second is the actual implementation member function. - ENTRY( "TestStartHarvester", CHarvesterPluginTester::TestStartHarvesterL ), - ENTRY( "TestFolderRename", CHarvesterPluginTester::TestFolderRenamingL ), + ENTRY( "TestStartHarvester", CHarvesterPluginTester::TestStartHarvesterL ), ENTRY( "TestFormBaseAppClass", CHarvesterPluginTester::TestFormBaseAppClass ), ENTRY( "TestDatabasePath", CHarvesterPluginTester::TestDatabasePathL ), ENTRY( "TestCreateIndexItemL_Add", CHarvesterPluginTester::TestCreateIndexItemL ), ENTRY( "TestCreateIndexItemL_Update", CHarvesterPluginTester::TestCreateIndexItemL ), ENTRY( "TestCreateIndexItemL_Delete", CHarvesterPluginTester::TestCreateIndexItemL ), + ENTRY( "TestFolderCreate", CHarvesterPluginTester::TestFolderCreateL ), + ENTRY( "TestFolderRename", CHarvesterPluginTester::TestFolderRenameL ), ENTRY( "TestMessaging", CHarvesterPluginTester::TestMessageHarvesterL ), ENTRY( "TestMessageHarvesting", CHarvesterPluginTester::TestMessageHarvesterWithMessageL ), ENTRY( "TestMessageDriveChange", CHarvesterPluginTester::TestMessageHarvesterChangeDriveL ), @@ -172,35 +175,12 @@ return KErrNone; } -//Same as before, except we rename a directory before calling wait->Start() -TInt CHarvesterPluginTester::TestFolderRenamingL( CStifItemParser& /*aItem*/ ) - { - CFilePlugin* filePlugin = CFilePlugin::NewL(); - CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( filePlugin ); - filePlugin->StartPluginL(); //Calls Add - filePlugin->StartHarvestingL( KAppBasePath ); - - _LIT( KDirectoryToRenameFrom, "C:\\data\\FileToTestRename" ); - _LIT( KDirectoryToRenameTo, "C:\\data\\FileToTestRenamed" ); - RFs fs; - fs.Connect(); - TInt error = fs.Rename( KDirectoryToRenameFrom, KDirectoryToRenameTo ); - iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. - //rename it back to what it was. - error = fs.Rename( KDirectoryToRenameTo, KDirectoryToRenameFrom ); - - delete filePlugin; - delete iPluginTester; - doLog( iLog, error, _L("Error: TestFolderRename.") ); - - return error; - } - TInt CHarvesterPluginTester::TestFormBaseAppClass( CStifItemParser& aItem ) { // Print to UI _LIT( KFilePluginBaseAppClass, "FormBaseAppClass" ); _LIT( KExample, "In TestFormBaseAppClass" ); + TestModuleIf().Printf( 0, KFilePluginBaseAppClass, KExample ); TInt driveNumber; @@ -213,12 +193,13 @@ TInt error = KErrNone; TInt errorNumber = 0; - _LIT( KBaseAppClassFormatString, "@%c:root file"); + _LIT( KFileBaseAppClassFolder, "root file folder"); + _LIT( KBaseAppClassFormatString, "@%c:root file folder"); _LIT( KTestFormBaseAppClassNoError, "TestFormBaseAppClass: No Error" ); if( aItem.GetNextInt ( driveNumber ) == KErrNone && error == KErrNone ) { - filePlugin->FormBaseAppClass( static_cast( driveNumber ), formedBaseAppClass ); + filePlugin->FormBaseAppClass( static_cast( driveNumber ),KFileBaseAppClassFolder, formedBaseAppClass ); if( aItem.GetNextChar ( driveChar ) == KErrNone ) { expectedBaseAppClass.Format( KBaseAppClassFormatString, driveChar ); @@ -248,11 +229,11 @@ TInt errorNumber; TChar driveChar; _LIT( KTestDatabasePathNoError, "TestDatabasePathL: No Error" ); - - _LIT( KDbFormatString, "%c:\\Private\\2001f6f7\\indexing\\indexdb\\root\\file" ); + _LIT(KPathFileContent, "\\root\\file\\content"); + _LIT( KDbFormatString, "%c:\\Private\\2001f6f7\\indexing\\indexdb\\root\\file\\content" ); if( aItem.GetNextInt ( driveNumber ) == KErrNone && error == KErrNone ) { - buffer = filePlugin->DatabasePathLC( static_cast( driveNumber ) ); + buffer = filePlugin->DatabasePathLC( static_cast( driveNumber ), KPathFileContent ); returnedDbPath.Copy( *buffer ); if( aItem.GetNextChar ( driveChar ) == KErrNone ) { @@ -306,7 +287,7 @@ CFilePlugin* filePlugin = CFilePlugin::NewL(); CHarvesterObserver* observer = CHarvesterObserver::NewL( filePlugin ); filePlugin->StartPluginL(); - _LIT( KFileNameFormat, "C:\\TestFramework\\" ); + _LIT( KFileNameFormat, "C:\\Data\\" ); _LIT( KActionAdd, "add" ); _LIT( KActionDelete, "delete" ); _LIT( KActionUpdate, "update" ); @@ -321,13 +302,14 @@ if( aItem.GetNextString ( fileName ) == KErrNone && error == KErrNone ) { filePathName.Append( fileName ); - filePlugin->CreateFileIndexItemL( filePathName, ECPixAddAction ); + filePlugin->CreateContentIndexItemL( filePathName, ECPixAddAction ); + User::After( (TTimeIntervalMicroSeconds32)35000000 ); TPtrC searchString; while( aItem.GetNextString ( searchString ) == KErrNone && error == KErrNone ) { - error = doSearch( searchString, _L(FILE_QBASEAPPCLASS), ESearchTypeResultsExpected ); + error = doSearch( searchString, KAppBasePath, ESearchTypeResultsExpected ); } - filePlugin->CreateFileIndexItemL( filePathName, ECPixRemoveAction ); + filePlugin->CreateContentIndexItemL( filePathName, ECPixRemoveAction ); } } if( createIndexAction.Compare( KActionDelete ) == 0 ) @@ -335,11 +317,11 @@ if( aItem.GetNextString ( fileName ) == KErrNone && error == KErrNone ) { filePathName.Append( fileName ); - filePlugin->CreateFileIndexItemL( filePathName, ECPixRemoveAction ); + filePlugin->CreateContentIndexItemL( filePathName, ECPixRemoveAction ); TPtrC searchString; while( aItem.GetNextString ( searchString ) == KErrNone && error == KErrNone ) { - error = doSearch( searchString, _L(FILE_QBASEAPPCLASS), ESearchTypeNoResultsExpected ); + error = doSearch( searchString, KAppBasePath, ESearchTypeNoResultsExpected ); } } } @@ -348,11 +330,12 @@ if( aItem.GetNextString ( fileName ) == KErrNone && error == KErrNone ) { filePathName.Append( fileName ); - filePlugin->CreateFileIndexItemL( filePathName, ECPixUpdateAction ); + filePlugin->CreateContentIndexItemL( filePathName, ECPixUpdateAction ); + User::After( (TTimeIntervalMicroSeconds32)35000000 ); TPtrC searchString; while( aItem.GetNextString ( searchString ) == KErrNone && error == KErrNone ) { - error = doSearch( searchString, _L(FILE_QBASEAPPCLASS), ESearchTypeResultsExpected ); + error = doSearch( searchString, KAppBasePath, ESearchTypeResultsExpected ); } } } @@ -362,7 +345,89 @@ doLog( iLog, error, KCreateIndexItemNoError ); return error; } - + +TInt CHarvesterPluginTester::TestFolderCreateL( CStifItemParser& /*aItem*/ ) + { + TInt error = KErrNone; + CFilePlugin* filePlugin = CFilePlugin::NewL(); + CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( filePlugin ); + filePlugin->StartPluginL(); + filePlugin->StartHarvestingL( KAppBasePath ); + + _LIT( KDirectoryToCreate, "C:\\data\\TestFolder\\" ); + RFs fs; + fs.Connect(); + TBool folderExists = BaflUtils::FolderExists(fs, KDirectoryToCreate); + if(!folderExists) + { + error = fs.MkDir(KDirectoryToCreate); + } + iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. + + if(error == KErrNone) + { + error = doSearch( _L("TestFolder"), KAppBaseFolderFilePath, ESearchTypeResultsExpected ); + fs.RmDir(KDirectoryToCreate); + } + fs.Close(); + delete filePlugin; + delete iPluginTester; + doLog( iLog, error, _L("Error: TestFolderCreateL") ); + + return error; + } + +TInt CHarvesterPluginTester::TestFolderRenameL( CStifItemParser& /*aItem*/ ) + { + TInt error = KErrNone; + RFs fs; + fs.Connect(); + + CFilePlugin* filePlugin = CFilePlugin::NewL(); + CFolderRenamedHarvester* iFolderRenameHarvester = CFolderRenamedHarvester::NewL( *filePlugin, fs); + CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( filePlugin ); + filePlugin->StartPluginL(); + filePlugin->StartHarvestingL( KAppBasePath ); + + _LIT( KDirectoryToCreate, "C:\\data\\TestRenameFolder\\" ); + _LIT( KDirectoryRenamed, "C:\\data\\TestFolderRenamed\\" ); + + TFileName oldFolderName(KDirectoryToCreate); + TFileName newFolderName(KDirectoryRenamed); + + if(!BaflUtils::FolderExists(fs, KDirectoryToCreate)) + { + User::LeaveIfError(fs.MkDir(KDirectoryToCreate)); + } + if(BaflUtils::FolderExists(fs, KDirectoryRenamed)) + { + User::LeaveIfError(fs.RmDir(KDirectoryRenamed)); + } + iPluginTester->iWaitForHarvester->Start();//Wait here till Harvesting is complete. + + error = doSearch( _L("TestRenameFolder"), KAppBaseFolderFilePath, ESearchTypeResultsExpected ); + + if(error == KErrNone) + { + fs.Rename(KDirectoryToCreate, KDirectoryRenamed); + iFolderRenameHarvester->StartL( oldFolderName, newFolderName ); + } + + User::After( (TTimeIntervalMicroSeconds32)35000000 ); + + //Search for the renamed directory + error = doSearch( _L("TestFolderRenamed"), KAppBaseFolderFilePath, ESearchTypeNoResultsExpected ); + + fs.RmDir(KDirectoryRenamed); + + delete filePlugin; + delete iFolderRenameHarvester; + delete iPluginTester; + fs.Close(); + doLog( iLog, error, _L("Error: TestFolderRenameL") ); + + return error; + } /** * Message harvester test method. * @since ?Series60_version @@ -709,29 +774,28 @@ TInt CHarvesterPluginTester::TestDeleteNoteL( CStifItemParser& aItem ) { TInt error = KErrNone; - _LIT( KSearchError, "Search Failed" ); - + _LIT( KSearchError, "Search Failed" ); CNotesPlugin* plugin = CNotesPlugin::NewL(); CHarvesterObserver* iPluginTester = CHarvesterObserver::NewL( plugin ); plugin->StartPluginL(); CCalendarObserver* session = CCalendarObserver::NewL(); plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) ); + iPluginTester->iWaitForHarvester->Start(); // Add a Note entry TPtrC searchstring; error = aItem.GetNextString( searchstring ); HBufC8* buf8 = HBufC8::NewL(2*searchstring.Length()); buf8->Des().Copy(searchstring); session->AddNoteL( buf8->Des()); - delete buf8; - iPluginTester->iWaitForHarvester->Start(); + User::After( (TTimeIntervalMicroSeconds32)35000000 ); + delete buf8; error = doSearch( _L("TestNote"), _L( NOTES_QBASEAPPCLASS ), ESearchTypeResultsExpected ); doLog( iLog, error, KSearchError ); if( error == KErrNone) { session->DeleteNoteEntryL(); - plugin->StartHarvestingL( _L(NOTES_QBASEAPPCLASS) ); - iPluginTester->iWaitForHarvester->Start(); + User::After( (TTimeIntervalMicroSeconds32)35000000 ); //Delete the Note entry added previously and search for result error = doSearch( _L("TestNote"), _L( NOTES_QBASEAPPCLASS ), ESearchTypeResultsExpected ); //If the entery is succesfully deleted, make error to KErrNone.To show testcase success diff -r ccd0fd43f247 -r 208a4ba3894c searchui/Searchapplication/Searchapplication.pro --- a/searchui/Searchapplication/Searchapplication.pro Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/Searchapplication/Searchapplication.pro Mon May 03 12:32:15 2010 +0300 @@ -19,8 +19,6 @@ TARGET = Searchapplication win32 { - INCLUDEPATH += \ - $$PWD/../../homescreensrv/homescreensrv_plat/appruntimemodel_api LIBS += -L$$PWD/../../bin/debug CONFIG(debug, debug|release) { @@ -31,7 +29,7 @@ DESTDIR = $$PWD/../../bin/$$SUBDIRPART } -LIBS += -lappruntimemodel +LIBS += -lsearchruntimeprovider QT += xml @@ -47,7 +45,8 @@ INCLUDEPATH += . \ ./inc \ - ../inc + ../inc \ + ../runtimeproviders/searchruntimeprovider/inc symbian { TARGET.UID2 = 0x100039CE @@ -56,14 +55,11 @@ TARGET.EPOCSTACKSIZE = 0x14000 // 80kB TARGET.EPOCHEAPSIZE = 0x20000 0x1000000 // 128kB - 16MB rom:DEFINES += ROM - ICON = resources/search_app_icon.svg - icon.sources = resources/search_app_icon.svg - icon.path = /searchresources - DEPLOYMENT += icon addFiles + SKINICON = qtg_large_search } win32 { -include(Searchapplication_installs_win32.pri) +include(searchapplication_installs_win32.pri) } -include(Searchapplication.pri) +include(searchapplication.pri) diff -r ccd0fd43f247 -r 208a4ba3894c searchui/Searchapplication/inc/Search.h --- a/searchui/Searchapplication/inc/Search.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/Searchapplication/inc/Search.h Mon May 03 12:32:15 2010 +0300 @@ -18,11 +18,11 @@ #ifndef SEARCHAPPLICATION_H #define SEARCHAPPLICATION_H -#include "Search_global.h" +#include "search_global.h" -#include +#include -class HsRuntime; +class QStateMachine; /** * @ingroup group_searchsearchlication @@ -53,8 +53,8 @@ */ virtual ~Search(); -private: - +private: + Q_DISABLE_COPY(Search) signals: @@ -104,7 +104,7 @@ /** * Runtime. */ - HsRuntime* mRuntime; + QStateMachine* mRuntime; }; #endif//SEARCHAPPLICATION_H diff -r ccd0fd43f247 -r 208a4ba3894c searchui/Searchapplication/src/Search.cpp --- a/searchui/Searchapplication/src/Search.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/Searchapplication/src/Search.cpp Mon May 03 12:32:15 2010 +0300 @@ -15,9 +15,10 @@ * */ -#include "Search.h" -#include "hsruntime.h" -#include "hsruntimefactory.h" +#include "search.h" +#include +#include +#include // --------------------------------------------------------------------------- // Search::Search @@ -28,23 +29,16 @@ { SEARCH_FUNC_ENTRY("SEARCH::Search::Search"); - HsRuntimeFactory factory("searchresources/plugins/runtimeproviders", - "searchresources/plugins/runtimeproviders"); - - HsRuntimeToken token; - token.mLibrary = "searchruntimeprovider.dll"; - token.mUri = "search.nokia.com/runtime/defaultruntime"; - - mRuntime = factory.createRuntime(token); + SearchRuntimeProvider *interface = new SearchRuntimeProvider(); + mRuntime = interface->createPlugin(); if (mRuntime) { mRuntime->setParent(this); connect(mRuntime, SIGNAL(started()), SLOT(handleRuntimeStarted())); connect(mRuntime, SIGNAL(stopped()), SLOT(handleRuntimeStopped())); connect(mRuntime, SIGNAL(faulted()), SLOT(handleRuntimeFaulted())); - } - - SEARCH_FUNC_EXIT("SEARCH::Search::Search"); + } + SEARCH_FUNC_EXIT("SEARCH::Search::Search"); } // --------------------------------------------------------------------------- @@ -93,8 +87,10 @@ void Search::stop() { SEARCH_FUNC_ENTRY("SEARCH::Search::stop"); - - mRuntime->stop(); + if (mRuntime) + { + mRuntime->stop(); + } SEARCH_FUNC_EXIT("SEARCH::Search::stop"); } diff -r ccd0fd43f247 -r 208a4ba3894c searchui/Searchapplication/src/main.cpp --- a/searchui/Searchapplication/src/main.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/Searchapplication/src/main.cpp Mon May 03 12:32:15 2010 +0300 @@ -15,8 +15,8 @@ * */ -#include "Search.h" -#include "Search_global.h" +#include "search.h" +#include "search_global.h" #include #include @@ -43,6 +43,22 @@ commonTranslator.load("common_" + lang, path); app.installTranslator(&commonTranslator); + QTranslator musicTranslator; + musicTranslator.load("musicplayer_" + lang, path); + app.installTranslator(&musicTranslator); + + QTranslator contactsTranslator; + contactsTranslator.load("contacts_" + lang, path); + app.installTranslator(&contactsTranslator); + + QTranslator calenderTranslator; + calenderTranslator.load("calendar_" + lang, path); + app.installTranslator(&calenderTranslator); + + QTranslator notesTranslator; + notesTranslator.load("notes_" + lang, path); + app.installTranslator(¬esTranslator); + Search search; #ifdef ROM QDir::setCurrent("Z:/"); diff -r ccd0fd43f247 -r 208a4ba3894c searchui/bwins/searchindevicehandleru.def --- a/searchui/bwins/searchindevicehandleru.def Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/bwins/searchindevicehandleru.def Mon May 03 12:32:15 2010 +0300 @@ -16,12 +16,11 @@ ?trUtf8@InDeviceHandler@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString InDeviceHandler::trUtf8(char const *, char const *) ?getDocumentAsync@InDeviceHandler@@AAEXHPAVQCPixDocument@@@Z @ 16 NONAME ; void InDeviceHandler::getDocumentAsync(int, class QCPixDocument *) ?tr@InDeviceHandler@@SA?AVQString@@PBD0@Z @ 17 NONAME ; class QString InDeviceHandler::tr(char const *, char const *) - ?search@InDeviceHandler@@QAEXVQString@@@Z @ 18 NONAME ; void InDeviceHandler::search(class QString) - ?trUtf8@InDeviceHandler@@SA?AVQString@@PBD0H@Z @ 19 NONAME ; class QString InDeviceHandler::trUtf8(char const *, char const *, int) - ?getStaticMetaObject@InDeviceHandler@@SAABUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const & InDeviceHandler::getStaticMetaObject(void) - ?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) - ?handleDocument@InDeviceHandler@@IAEXHPAVQCPixDocument@@@Z @ 25 NONAME ; void InDeviceHandler::handleDocument(int, class QCPixDocument *) + ?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) + ?getSearchResultCount@InDeviceHandler@@QAEHXZ @ 20 NONAME ; int InDeviceHandler::getSearchResultCount(void) + ?searchAsync@InDeviceHandler@@QAEXVQString@@0@Z @ 21 NONAME ; void InDeviceHandler::searchAsync(class QString, class QString) + ?staticMetaObject@InDeviceHandler@@2UQMetaObject@@B @ 22 NONAME ; struct QMetaObject const InDeviceHandler::staticMetaObject + ?getSearchResult@InDeviceHandler@@AAEXHH@Z @ 23 NONAME ; void InDeviceHandler::getSearchResult(int, int) + ?handleDocument@InDeviceHandler@@IAEXHPAVQCPixDocument@@@Z @ 24 NONAME ; void InDeviceHandler::handleDocument(int, class QCPixDocument *) diff -r ccd0fd43f247 -r 208a4ba3894c searchui/eabi/searchindevicehandleru.def --- a/searchui/eabi/searchindevicehandleru.def Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/eabi/searchindevicehandleru.def Mon May 03 12:32:15 2010 +0300 @@ -15,13 +15,12 @@ _ZN15InDeviceHandler20getSearchResultCountEv @ 14 NONAME _ZN15InDeviceHandler23getDocumentAsyncAtIndexEi @ 15 NONAME _ZN15InDeviceHandler23handleAsyncSearchResultEii @ 16 NONAME - _ZN15InDeviceHandler6searchE7QString @ 17 NONAME - _ZN15InDeviceHandlerC1Ev @ 18 NONAME - _ZN15InDeviceHandlerC2Ev @ 19 NONAME - _ZN15InDeviceHandlerD0Ev @ 20 NONAME - _ZN15InDeviceHandlerD1Ev @ 21 NONAME - _ZN15InDeviceHandlerD2Ev @ 22 NONAME - _ZNK15InDeviceHandler10metaObjectEv @ 23 NONAME - _ZTI15InDeviceHandler @ 24 NONAME - _ZTV15InDeviceHandler @ 25 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 diff -r ccd0fd43f247 -r 208a4ba3894c searchui/indevicehandler/inc/indevicehandler.h --- a/searchui/indevicehandler/inc/indevicehandler.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/indevicehandler/inc/indevicehandler.h Mon May 03 12:32:15 2010 +0300 @@ -20,7 +20,7 @@ #include #include #include -#include "Search_global.h" +#include "search_global.h" #ifdef BUILD_INDEVICEHANDLER #define SEARCH_INDEVICEHANDLER Q_DECL_EXPORT @@ -113,12 +113,7 @@ */ void getDocumentAsyncAtIndex(int aIndex); - /** - * initate the search synchronously. - * @since S60 ?S60_version. - * @param aSearchString search keyword - */ - void search(QString aSearchString); + /** * initate the search asynchronously. diff -r ccd0fd43f247 -r 208a4ba3894c searchui/indevicehandler/src/indevicehandler.cpp --- a/searchui/indevicehandler/src/indevicehandler.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/indevicehandler/src/indevicehandler.cpp Mon May 03 12:32:15 2010 +0300 @@ -27,6 +27,19 @@ { } // --------------------------------------------------------------------------- +// InDeviceHandler::~InDeviceHandler() +// --------------------------------------------------------------------------- +// +InDeviceHandler::~InDeviceHandler() + { + if (mSearchInterface) + { + delete mSearchInterface; + + } + } + +// --------------------------------------------------------------------------- // InDeviceHandler::getSearchResult(int aError, int estimatedResultCount) // aError: error code // estimatedResultCount: number of hits @@ -71,45 +84,8 @@ } return doc; } -// --------------------------------------------------------------------------- -// InDeviceHandler:: search(QString aSearchString) -// aSearchString: string to be searched sync -// --------------------------------------------------------------------------- -// -void InDeviceHandler::search(QString aSearchString) - { - qDebug() << "InDeviceHandler::search Enter"; - if (aSearchString.length()) - { - int error = 0; - mSearchResultCount = 0; - if (mSearchInterface) - { - try - { - mSearchResultCount = mSearchInterface->search(aSearchString); - } - catch (...) - { - error = -1; - } - } - emit handleSearchResult(error, mSearchResultCount); - } - qDebug() << "InDeviceHandler::search Exit"; - } -// --------------------------------------------------------------------------- -// InDeviceHandler::~InDeviceHandler() -// --------------------------------------------------------------------------- -// -InDeviceHandler::~InDeviceHandler() - { - if (mSearchInterface) - { - delete mSearchInterface; - } - } + // --------------------------------------------------------------------------- // InDeviceHandler::getSearchResultCount() // gets the number of hits @@ -141,7 +117,7 @@ } // --------------------------------------------------------------------------- -// InDeviceHandler::searchAsync(QString aSearchAsyncString, QString/* aDefaultSearchField*/) +// InDeviceHandler::searchAsync // aSearchAsyncString: string to be searched // async // --------------------------------------------------------------------------- @@ -186,7 +162,7 @@ } } // --------------------------------------------------------------------------- -// InDeviceHandler::setCategory(QString astring) +// InDeviceHandler::setCategory // astring: setting categories to be searched // --------------------------------------------------------------------------- // @@ -203,6 +179,14 @@ database.append(astring); mSearchInterface = QCPixSearcher::newInstance(database, DEFAULT_SEARCH_FIELD); + } + else + { + mSearchInterface = QCPixSearcher::newInstance("root", + DEFAULT_SEARCH_FIELD); + } + if (mSearchInterface) + { try { mSearchInterface->connect(mSearchInterface, @@ -226,6 +210,7 @@ } } } + // --------------------------------------------------------------------------- // InDeviceHandler::isPrepared() // verify the mSearchInterface is prepared or not diff -r ccd0fd43f247 -r 208a4ba3894c searchui/indevicehandler/tsrc/t_indevicehandler/inc/t_indevicehandler.h --- a/searchui/indevicehandler/tsrc/t_indevicehandler/inc/t_indevicehandler.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/indevicehandler/tsrc/t_indevicehandler/inc/t_indevicehandler.h Mon May 03 12:32:15 2010 +0300 @@ -34,14 +34,11 @@ void initTestCase(); void cleanupTestCase(); void testCreateAndDestructIndeviceHandler(); - void testhandleSearchResult(); void testhandleAsyncSearchResult(); void testhandleDocument(); void testgetSearchResult(); void testgetDocumentAsync(); - void testgetDocumentAtIndex(); void testgetDocumentAsyncAtIndex(); - void testsearch(); void testsearchAsync(); void testcancelLastSearch(); void testgetSearchResultCount(); diff -r ccd0fd43f247 -r 208a4ba3894c searchui/indevicehandler/tsrc/t_indevicehandler/src/t_indevicehandler.cpp --- a/searchui/indevicehandler/tsrc/t_indevicehandler/src/t_indevicehandler.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/indevicehandler/tsrc/t_indevicehandler/src/t_indevicehandler.cpp Mon May 03 12:32:15 2010 +0300 @@ -42,19 +42,7 @@ delete indevicehandler; } -void SearchInDeviceHandlerTest::testhandleSearchResult() - { - InDeviceHandler* indevicehandler = new InDeviceHandler(); - indevicehandler->setCategory("file"); - QSignalSpy spy(indevicehandler, SIGNAL(handleSearchResult(int, int))); - indevicehandler->search("txt"); - QCOMPARE(spy.count(), 1); - delete indevicehandler; - //wait for signal to be emitted. - //QTest::qWait(200); - - } void SearchInDeviceHandlerTest::testhandleAsyncSearchResult() { InDeviceHandler* indevicehandler = new InDeviceHandler(); @@ -72,7 +60,7 @@ InDeviceHandler* indevicehandler = new InDeviceHandler(); indevicehandler->setCategory("file"); - indevicehandler->searchAsync("txt"); + indevicehandler->searchAsync("a"); QTest::qWait(200); QSignalSpy spy(indevicehandler, @@ -91,23 +79,14 @@ { testhandleDocument(); } -void SearchInDeviceHandlerTest::testgetDocumentAtIndex() - { - InDeviceHandler* indevicehandler = new InDeviceHandler(); - indevicehandler->setCategory("file"); - indevicehandler->search("txt"); - QCPixDocument* iDoc = NULL; - iDoc = indevicehandler->getDocumentAtIndex(0); - QVERIFY(iDoc); - delete iDoc; - delete indevicehandler; - } + void SearchInDeviceHandlerTest::testgetDocumentAsyncAtIndex() { InDeviceHandler* indevicehandler = new InDeviceHandler(); indevicehandler->setCategory("file"); - indevicehandler->search("txt"); + indevicehandler->searchAsync("txt"); + QTest::qWait(200); QSignalSpy spy(indevicehandler, SIGNAL(handleDocument(int, QCPixDocument*))); indevicehandler->getDocumentAsyncAtIndex(0); @@ -115,17 +94,7 @@ QCOMPARE(spy.count(), 1); delete indevicehandler; } -void SearchInDeviceHandlerTest::testsearch() - { - InDeviceHandler* indevicehandler = new InDeviceHandler(); - indevicehandler->setCategory("file"); - QSignalSpy spy(indevicehandler, SIGNAL(handleSearchResult(int,int))); - indevicehandler->search(NULL); - QCOMPARE(spy.count(), 0); - indevicehandler->search("txt"); - QCOMPARE(spy.count(), 1); - delete indevicehandler; - } + void SearchInDeviceHandlerTest::testsearchAsync() { InDeviceHandler* indevicehandler = new InDeviceHandler(); @@ -143,7 +112,7 @@ { InDeviceHandler* indevicehandler = new InDeviceHandler(); indevicehandler->setCategory("file"); - indevicehandler->search("txt"); + indevicehandler->searchAsync("txt"); indevicehandler->cancelLastSearch(); delete indevicehandler; } @@ -152,7 +121,8 @@ InDeviceHandler* indevicehandler = new InDeviceHandler(); QCOMPARE(indevicehandler->getSearchResultCount(),0); indevicehandler->setCategory("file"); - indevicehandler->search("txt"); + indevicehandler->searchAsync("txt"); + QTest::qWait(200); QVERIFY(indevicehandler->getSearchResultCount()); delete indevicehandler; @@ -162,8 +132,8 @@ InDeviceHandler* indevicehandler = new InDeviceHandler(); indevicehandler->setCategory("file"); QVERIFY(indevicehandler->mSearchInterface); - indevicehandler->setCategory(NULL); - QVERIFY(indevicehandler->mSearchInterface == NULL); + indevicehandler->setCategory(""); + QVERIFY(indevicehandler->mSearchInterface); delete indevicehandler; } void SearchInDeviceHandlerTest::testisPrepared() @@ -171,11 +141,15 @@ InDeviceHandler* indevicehandler = new InDeviceHandler(); indevicehandler->setCategory("file"); QVERIFY(indevicehandler->isPrepared()); - indevicehandler->setCategory(NULL); - QVERIFY(indevicehandler->isPrepared() == false); + indevicehandler->setCategory(""); + QVERIFY(indevicehandler->isPrepared()); delete indevicehandler; } +#ifdef Q_OS_SYMBIAN + +//QTEST_MAIN corrected since crashes if TRAP not in correct place. +//Will be corrected in later (estimate 4.6.0) Qt release for Symbian. int main(int argc, char *argv[]) { QApplication app(argc, argv); @@ -186,3 +160,7 @@ error = QTest::qExec(&tc, argc, argv);); return error; } +#else //Q_OS_SYMBIAN +QTEST_MAIN(SearchInDeviceHandlerTest) +#endif //Q_OS_SYMBIAN + diff -r ccd0fd43f247 -r 208a4ba3894c searchui/rom/search.iby --- a/searchui/rom/search.iby Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/rom/search.iby Mon May 03 12:32:15 2010 +0300 @@ -35,17 +35,12 @@ //runtime provider dll -data=/epoc32/data/z/searchresources/plugins/runtimeproviders/searchruntimeprovider.manifest searchresources/plugins/runtimeproviders/searchruntimeprovider.manifest -data=/epoc32/data/z/searchresources/plugins/runtimeproviders/searchruntimeprovider.qtplugin searchresources/plugins/runtimeproviders/searchruntimeprovider.qtplugin file=/epoc32/release/armv5/urel/searchruntimeprovider.dll SHARED_LIB_DIR/searchruntimeprovider.dll //state provider dll - -data=/epoc32/data/z/searchresources/plugins/stateproviders/searchstateprovider.manifest searchresources/plugins/stateproviders/searchstateprovider.manifest -data=/epoc32/data/z/searchresources/plugins/stateproviders/searchstateprovider.qtplugin searchresources/plugins/stateproviders/searchstateprovider.qtplugin file=/epoc32/release/armv5/urel/searchstateprovider.dll SHARED_LIB_DIR/searchstateprovider.dll #endif //FF_SEARCH_SW diff -r ccd0fd43f247 -r 208a4ba3894c searchui/runtimeproviders/bwins/searchruntimeprovideru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/searchui/runtimeproviders/bwins/searchruntimeprovideru.def Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,12 @@ +EXPORTS + ?createPlugin@SearchRuntimeProvider@@QBEPAVSearchRuntime@@XZ @ 1 NONAME ; class SearchRuntime * SearchRuntimeProvider::createPlugin(void) const + ?trUtf8@SearchRuntimeProvider@@SA?AVQString@@PBD0H@Z @ 2 NONAME ; class QString SearchRuntimeProvider::trUtf8(char const *, char const *, int) + ?qt_metacall@SearchRuntimeProvider@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 3 NONAME ; int SearchRuntimeProvider::qt_metacall(enum QMetaObject::Call, int, void * *) + ?tr@SearchRuntimeProvider@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString SearchRuntimeProvider::tr(char const *, char const *, int) + ?tr@SearchRuntimeProvider@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString SearchRuntimeProvider::tr(char const *, char const *) + ?qt_metacast@SearchRuntimeProvider@@UAEPAXPBD@Z @ 6 NONAME ; void * SearchRuntimeProvider::qt_metacast(char const *) + ?getStaticMetaObject@SearchRuntimeProvider@@SAABUQMetaObject@@XZ @ 7 NONAME ; struct QMetaObject const & SearchRuntimeProvider::getStaticMetaObject(void) + ?metaObject@SearchRuntimeProvider@@UBEPBUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const * SearchRuntimeProvider::metaObject(void) const + ?staticMetaObject@SearchRuntimeProvider@@2UQMetaObject@@B @ 9 NONAME ; struct QMetaObject const SearchRuntimeProvider::staticMetaObject + ?trUtf8@SearchRuntimeProvider@@SA?AVQString@@PBD0@Z @ 10 NONAME ; class QString SearchRuntimeProvider::trUtf8(char const *, char const *) + diff -r ccd0fd43f247 -r 208a4ba3894c searchui/runtimeproviders/eabi/searchruntimeprovideru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/searchui/runtimeproviders/eabi/searchruntimeprovideru.def Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,10 @@ +EXPORTS + _ZN21SearchRuntimeProvider11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN21SearchRuntimeProvider11qt_metacastEPKc @ 2 NONAME + _ZN21SearchRuntimeProvider16staticMetaObjectE @ 3 NONAME DATA 16 + _ZN21SearchRuntimeProvider19getStaticMetaObjectEv @ 4 NONAME + _ZNK21SearchRuntimeProvider10metaObjectEv @ 5 NONAME + _ZNK21SearchRuntimeProvider12createPluginEv @ 6 NONAME + _ZTI21SearchRuntimeProvider @ 7 NONAME + _ZTV21SearchRuntimeProvider @ 8 NONAME + diff -r ccd0fd43f247 -r 208a4ba3894c searchui/runtimeproviders/searchruntimeprovider/inc/searchruntime.h --- a/searchui/runtimeproviders/searchruntimeprovider/inc/searchruntime.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/runtimeproviders/searchruntimeprovider/inc/searchruntime.h Mon May 03 12:32:15 2010 +0300 @@ -18,9 +18,9 @@ #ifndef SEARCH_RUNTIMES_DEFAULTRUNTIME_H #define SEARCH_RUNTIMES_DEFAULTRUNTIME_H -#include "Search_global.h" -#include "hsruntime.h" +#include "search_global.h" #include +#include SEARCH_CLASS(SearchRuntimeProviderTest) @@ -40,7 +40,7 @@ * @lib ?library * @since S60 ?S60_version */ -class SearchRuntime : public HsRuntime +class SearchRuntime : public QStateMachine { Q_OBJECT @@ -64,19 +64,7 @@ * Copy constructor */ Q_DISABLE_COPY(SearchRuntime) - -public slots: - - /** - * @copydoc HsRuntime::start() - */ - void start(); - - /** - * @copydoc HsRuntime::stop() - */ - void stop(); - + private slots: /** @@ -112,24 +100,12 @@ */ void createStates(); -private: - - /** - * Address of state machine instance. - * Ownership tranfered to application. Don't remove it. - */ - QStateMachine *mStateMachine; +private: /** * Window to visualize scene */ - HbMainWindow *mWindow; - - /** - * Contains address of runtime service. - * Ownership transfered to application. Don't remove it. - */ - QHash mServices; + HbMainWindow *mWindow; SEARCH_FRIEND_CLASS (SearchRuntimeProviderTest) diff -r ccd0fd43f247 -r 208a4ba3894c searchui/runtimeproviders/searchruntimeprovider/inc/searchruntimeprovider.h --- a/searchui/runtimeproviders/searchruntimeprovider/inc/searchruntimeprovider.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/runtimeproviders/searchruntimeprovider/inc/searchruntimeprovider.h Mon May 03 12:32:15 2010 +0300 @@ -18,8 +18,16 @@ #ifndef SEARCH_RUNTIMEPROVIDERS_DEFAULTRUNTIMEPROVIDER_H #define SEARCH_RUNTIMEPROVIDERS_DEFAULTRUNTIMEPROVIDER_H -#include "hsiruntimeprovider.h" -#include "hsistateprovider.h" +#include + +#ifdef BUILD_SEARCHRUNTIMEPROVIDER +#define SEARCH_RUNTIMEPROVIDER Q_DECL_EXPORT +#else +#define SEARCH_RUNTIMEPROVIDER Q_DECL_IMPORT +#endif + + +class SearchRuntime; /** * @ingroup group_Searchruntimeprovider @@ -30,46 +38,12 @@ * * @since S60 ?S60_version. */ -class SearchRuntimeProvider : public QObject, public IHsRuntimeProvider +class SEARCH_RUNTIMEPROVIDER SearchRuntimeProvider : public QObject { Q_OBJECT -Q_INTERFACES(IHsRuntimeProvider) - public: - - /** - * Default constructor. - * - * @since S60 ?S60_version. - */ - SearchRuntimeProvider(); - -public: - - /** - * Returns contained runtimes as a list of tokens. - * - * @return Contained runtimes as a list of tokens. - * @since S60 ?S60_version. - */ - QList runtimes(); - - /** - * Creates a runtime based on the given token. - * - * @param aToken Identifies the runtime to be created. - * @since S60 ?S60_version. - */ - HsRuntime* createRuntime(const HsRuntimeToken& aToken); - -private: - - /** - * Token that describes the default runtime. - */ - HsRuntimeToken mRuntimeToken; - - }; + SearchRuntime* createPlugin() const; +}; #endif //SEARCH_RUNTIMEPROVIDERS_DEFAULTRUNTIMEPROVIDER_H diff -r ccd0fd43f247 -r 208a4ba3894c searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider.pro --- a/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider.pro Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider.pro Mon May 03 12:32:15 2010 +0300 @@ -16,6 +16,7 @@ TEMPLATE = lib +DEFINES += BUILD_SEARCHRUNTIMEPROVIDER symbian { CONFIG(debug, debug|release) { @@ -31,41 +32,40 @@ } else { SUBDIRPART = release } - DESTDIR = $$PWD/../../../bin/$$SUBDIRPART/searchresources/plugins/runtimeproviders - INCLUDEPATH += \ - $$PWD/../../../homescreensrv/homescreensrv_plat/appruntimemodel_api \ - $$PWD/../../../homescreensrv/homescreensrv_plat/statemodel_api + DESTDIR = $$PWD/../../../bin/$$SUBDIRPART/searchresources/plugins/runtimeproviders LIBS += -L$$PWD/../../../bin/debug } -LIBS += -lappruntimemodel -LIBS += -lstatemodel +LIBS += -lsearchstateprovider + - -CONFIG += plugin debug_and_release CONFIG += hb + QT += xml sql -DEFINES += SEARCHRUNTIMEPROVIDER_LIB + coverage:DEFINES += COVERAGE_MEASUREMENT DEPENDPATH += ./inc \ - ./src - + ./src + INCLUDEPATH += ./inc \ - ../../inc \ + ../../inc \ + ../../stateproviders/searchstateprovider/inc + symbian { TARGET.UID3 = 0x2002C37D TARGET.EPOCALLOWDLLDATA=1 - TARGET.CAPABILITY = ALL -TCB + TARGET.CAPABILITY = ALL -TCB -DRM appkey:DEFINES += S60APP_KEY INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - - include(searchruntimeprovider_installs_symbian.pri) + #include(searchruntimeprovider_installs_symbian.pri) + # BLD_INF_RULES.prj_exports += "./inc/searchruntimeprovider.h |../../inc/" \ + # "./inc/searchruntime.h |../../inc/" } win32 { diff -r ccd0fd43f247 -r 208a4ba3894c searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_symbian.pri --- a/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_symbian.pri Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/runtimeproviders/searchruntimeprovider/searchruntimeprovider_installs_symbian.pri Mon May 03 12:32:15 2010 +0300 @@ -14,7 +14,7 @@ # Description: # -export.sources = resource/*.manifest +export.sources = resource/*.xml export.path = /searchresources/plugins/runtimeproviders pluginstub.sources = searchruntimeprovider.dll diff -r ccd0fd43f247 -r 208a4ba3894c searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp --- a/searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp Mon May 03 12:32:15 2010 +0300 @@ -16,8 +16,8 @@ */ #include "searchruntime.h" -#include "Search_global.h" -#include "hsstatefactory.h" +#include "search_global.h" +#include "searchstateprovider.h" #include #include @@ -26,10 +26,7 @@ #include -// plugin factory const -const char factoryManifestDir[] = "searchresources/plugins/stateproviders"; -const char factoryPluginDir[] = "searchresources/plugins/stateproviders"; -const char stateLibrary[] = "searchstateprovider.dll"; + // states const char wizardProgressiveStateUri[] = @@ -42,9 +39,8 @@ // --------------------------------------------------------------------------- // SearchRuntime::SearchRuntime(QObject* aParent) : - HsRuntime(aParent), mStateMachine(0), mWindow(0) +QStateMachine(aParent),mWindow(0) { - mStateMachine = new QStateMachine(this); createGuiServiceParts(); createStates(); } @@ -56,25 +52,7 @@ SearchRuntime::~SearchRuntime() { delete mWindow; - delete mStateMachine; - } - -// --------------------------------------------------------------------------- -// SearchRuntime::start() -// --------------------------------------------------------------------------- -// -void SearchRuntime::start() - { - mStateMachine->start(); - } - -// --------------------------------------------------------------------------- -// SearchRuntime::stop() -// --------------------------------------------------------------------------- -// -void SearchRuntime::stop() - { - mStateMachine->stop(); + // delete mStateMachine; } // --------------------------------------------------------------------------- @@ -83,7 +61,7 @@ // void SearchRuntime::handleStateMachineStarted() { - emit started(); + // emit started(); } // --------------------------------------------------------------------------- @@ -111,15 +89,15 @@ // void SearchRuntime::createStates() { - HsStateFactory factory(factoryManifestDir, factoryPluginDir); - HsStateToken token; + SearchStateProvider stateProvider; + QFinalState* finalState = new QFinalState(); - mStateMachine->addState(finalState); + this->addState(finalState); // parallel state activates all children states QState* parallel = new QState(QState::ParallelStates); - mStateMachine->addState(parallel); + this->addState(parallel); parallel->addTransition(this, SIGNAL(stopStateMachine()), finalState); // root GUI state @@ -127,18 +105,16 @@ QState* searchRootState = new QState(guiRootState); - // create state based on token - token.mLibrary = stateLibrary; - token.mUri = wizardProgressiveStateUri; - QState* wizardProgressiveState = factory.createState(token); + + QState* wizardProgressiveState = stateProvider.createState(wizardProgressiveStateUri); // set state specific data wizardProgressiveState->setParent(searchRootState); - wizardProgressiveState->setObjectName(token.mUri); - token.mUri = wizardSettingStateUri; + wizardProgressiveState->setObjectName(wizardProgressiveStateUri); + - QState* wizardSettingState = factory.createState(token); + QState* wizardSettingState = stateProvider.createState(wizardSettingStateUri); wizardSettingState->setParent(searchRootState); - wizardSettingState->setObjectName(token.mUri); + wizardSettingState->setObjectName(wizardSettingStateUri); wizardProgressiveState->addTransition(wizardProgressiveState, SIGNAL(settingsState()), wizardSettingState); @@ -159,13 +135,13 @@ // set initial state for statemachine searchRootState->setInitialState(wizardProgressiveState); guiRootState->setInitialState(searchRootState); - mStateMachine->setInitialState(parallel); + this->setInitialState(parallel); - connect(mStateMachine, SIGNAL(started()), + connect(this, SIGNAL(started()), SLOT(handleStateMachineStarted())); - connect(mStateMachine, SIGNAL(stopped()), + connect(this, SIGNAL(stopped()), SLOT(handleStateMachineStopped())); - connect(mStateMachine, SIGNAL(finished()), + connect(this, SIGNAL(finished()), SLOT(handleStateMachineStopped())); } diff -r ccd0fd43f247 -r 208a4ba3894c searchui/runtimeproviders/searchruntimeprovider/src/searchruntimeprovider.cpp --- a/searchui/runtimeproviders/searchruntimeprovider/src/searchruntimeprovider.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/runtimeproviders/searchruntimeprovider/src/searchruntimeprovider.cpp Mon May 03 12:32:15 2010 +0300 @@ -18,38 +18,11 @@ #include "searchruntimeprovider.h" #include "searchruntime.h" -// constants -const char providerFileName[] = "searchruntimeprovider.dll"; -const char providerFileUri[] = "search.nokia.com/runtime/defaultruntime"; - // --------------------------------------------------------------------------- -// SearchRuntimeProvider::SearchRuntimeProvider() -// --------------------------------------------------------------------------- -// -SearchRuntimeProvider::SearchRuntimeProvider() - { - mRuntimeToken.mLibrary = providerFileName; - mRuntimeToken.mUri = providerFileUri; - } - -// --------------------------------------------------------------------------- -// SearchRuntimeProvider::runtimes() +// SearchRuntimeProvider::createPlugin() // --------------------------------------------------------------------------- // -QList SearchRuntimeProvider::runtimes() - { - return QList () << mRuntimeToken; - } - -// --------------------------------------------------------------------------- -// SearchRuntimeProvider::createRuntime() -// --------------------------------------------------------------------------- -// -HsRuntime* SearchRuntimeProvider::createRuntime(const HsRuntimeToken& aToken) - { - return (aToken.mUri == providerFileUri ? new SearchRuntime() : 0); - } - -#ifndef COVERAGE_MEASUREMENT -Q_EXPORT_PLUGIN2(Searchruntimeprovider, SearchRuntimeProvider) -#endif //COVERAGE_MEASUREMENT +SearchRuntime *SearchRuntimeProvider::createPlugin() const +{ + return new SearchRuntime(); +} diff -r ccd0fd43f247 -r 208a4ba3894c searchui/searchui.pro --- a/searchui/searchui.pro Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/searchui.pro Mon May 03 12:32:15 2010 +0300 @@ -15,10 +15,11 @@ # TEMPLATE = subdirs -SUBDIRS += indevicehandler \ - Searchapplication \ - runtimeproviders \ - stateproviders +SUBDIRS += indevicehandler \ + stateproviders \ + runtimeproviders \ + searchapplication + CONFIG += ordered diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/bwins/searchstateprovideru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/searchui/stateproviders/bwins/searchstateprovideru.def Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,15 @@ +EXPORTS + ??1SearchStateProvider@@UAE@XZ @ 1 NONAME ; SearchStateProvider::~SearchStateProvider(void) + ??_ESearchStateProvider@@UAE@I@Z @ 2 NONAME ; SearchStateProvider::~SearchStateProvider(unsigned int) + ??0SearchStateProvider@@QAE@PAVQObject@@@Z @ 3 NONAME ; SearchStateProvider::SearchStateProvider(class QObject *) + ?tr@SearchStateProvider@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString SearchStateProvider::tr(char const *, char const *) + ?metaObject@SearchStateProvider@@UBEPBUQMetaObject@@XZ @ 5 NONAME ; struct QMetaObject const * SearchStateProvider::metaObject(void) const + ?getStaticMetaObject@SearchStateProvider@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & SearchStateProvider::getStaticMetaObject(void) + ?staticMetaObject@SearchStateProvider@@2UQMetaObject@@B @ 7 NONAME ; struct QMetaObject const SearchStateProvider::staticMetaObject + ?createState@SearchStateProvider@@QAEPAVQState@@ABVQString@@@Z @ 8 NONAME ; class QState * SearchStateProvider::createState(class QString const &) + ?qt_metacall@SearchStateProvider@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int SearchStateProvider::qt_metacall(enum QMetaObject::Call, int, void * *) + ?trUtf8@SearchStateProvider@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString SearchStateProvider::trUtf8(char const *, char const *, int) + ?trUtf8@SearchStateProvider@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString SearchStateProvider::trUtf8(char const *, char const *) + ?tr@SearchStateProvider@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString SearchStateProvider::tr(char const *, char const *, int) + ?qt_metacast@SearchStateProvider@@UAEPAXPBD@Z @ 13 NONAME ; void * SearchStateProvider::qt_metacast(char const *) + diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/eabi/searchstateprovideru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/searchui/stateproviders/eabi/searchstateprovideru.def Mon May 03 12:32:15 2010 +0300 @@ -0,0 +1,12 @@ +EXPORTS + _ZN19SearchStateProvider11createStateERK7QString @ 1 NONAME + _ZN19SearchStateProvider11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME + _ZN19SearchStateProvider11qt_metacastEPKc @ 3 NONAME + _ZN19SearchStateProvider16staticMetaObjectE @ 4 NONAME DATA 16 + _ZN19SearchStateProvider19getStaticMetaObjectEv @ 5 NONAME + _ZN19SearchStateProviderC1EP7QObject @ 6 NONAME + _ZN19SearchStateProviderC2EP7QObject @ 7 NONAME + _ZNK19SearchStateProvider10metaObjectEv @ 8 NONAME + _ZTI19SearchStateProvider @ 9 NONAME + _ZTV19SearchStateProvider @ 10 NONAME + diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/inc/searchinitstate.h --- a/searchui/stateproviders/searchstateprovider/inc/searchinitstate.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/inc/searchinitstate.h Mon May 03 12:32:15 2010 +0300 @@ -19,7 +19,7 @@ #define SEARCH_STATES_INITSTATE_H #include -#include "Search_global.h" +#include "search_global.h" SEARCH_CLASS( SearchStateProviderTest) class SearchInitState : public QState diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h --- a/searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/inc/searchprogressivestate.h Mon May 03 12:32:15 2010 +0300 @@ -25,7 +25,42 @@ #include #include #include -#include "Search_global.h" +#include +#include +#include "search_global.h" + +//Uncomment to enable performance measurements. +//#define OST_TRACE_COMPILER_IN_USE + +#ifdef OST_TRACE_COMPILER_IN_USE + +#define PERF_CAT_API_TIME_RESTART m_categorySearchApiTime.restart(); +#define PERF_CAT_UI_TIME_RESTART m_categorySearchUiTime.restart(); +#define PERF_CAT_TOTAL_TIME_RESTART m_totalSearchUiTime.restart(); +#define PERF_CAT_API_ENDLOG qDebug() << "Search on category (API): " << mTemplist.at( mDatabasecount-1 ) << "took "<< m_categorySearchApiTime.elapsed() << " msec"; +#define PERF_CAT_UI_ENDLOG qDebug() << "Search on category (UI): " << mTemplist.at( mDatabasecount-1 ) << "took "<< m_categorySearchUiTime.elapsed() << " msec"; +#define PERF_TOTAL_UI_ENDLOG qDebug() << "Search on total (UI): took "<< m_totalSearchUiTime.elapsed() << " msec"; +#define PERF_CAT_HITS_ENDLOG qDebug() << "Hits on category: " << mTemplist.at( mDatabasecount-1 ) << ": "<< aResultCount; +#define PERF_CAT_GETDOC_TIME_RESTART m_categoryGetDocumentApiTime.restart(); +#define PERF_CAT_GETDOC_TIME_ACCUMULATE m_getDocumentCatergoryTimeAccumulator += m_categoryGetDocumentApiTime.elapsed(); +#define PERF_CAT_GETDOC_ACCUMULATOR_RESET m_getDocumentCatergoryTimeAccumulator = 0; +#define PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG qDebug() << "Get Doc on category (API): " << mTemplist.at( mDatabasecount-1 ) << "took " << m_getDocumentCatergoryTimeAccumulator << "msec"; + +#else + +#define PERF_CAT_API_TIME_RESTART +#define PERF_CAT_UI_TIME_RESTART +#define PERF_CAT_TOTAL_TIME_RESTART +#define PERF_CAT_API_ENDLOG +#define PERF_CAT_UI_ENDLOG +#define PERF_TOTAL_UI_ENDLOG +#define PERF_CAT_HITS_ENDLOG +#define PERF_CAT_GETDOC_TIME_RESTART +#define PERF_CAT_GETDOC_TIME_ACCUMULATE +#define PERF_CAT_GETDOC_ACCUMULATOR_RESET +#define PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG + +#endif //OST_TRACE_COMPILER_IN_USE class HbMainWindow; class HbView; @@ -33,10 +68,7 @@ class HbDocumentLoader; class QStandardItemModel; class HbSearchPanel; -class QSortFilterProxyModel; - class CFbsBitmap; - class InDeviceHandler; class QCPixDocument; @@ -104,15 +136,21 @@ * @since S60 ?S60_version. */ CFbsBitmap *copyBitmapLC(CFbsBitmap *input); -public slots: + + /** + * Constructing cpix handlers . + * @since S60 ?S60_version. + */ + void constructHandlers(); /** - * slot connects to CSearchHandler to get the status of search result synchronously + * setting the categories . * @since S60 ?S60_version. - * @param aError error code. - * @param aResultCount number of results */ - void onSearchComplete(int aError, int aResultCount); + void setSelectedCategories(); +public slots: + + /** * slot connects to CSearchHandler to get the status of search result asynchronously @@ -165,7 +203,8 @@ void _customizeGoButton(bool avalue); /** - * slot connects to search state for internet search + * slot implemented to avoid repeated search for the same category + * selection when user search for mutiple times * @since S60 ?S60_version. */ void settingsaction(bool avalue); @@ -175,7 +214,38 @@ * @since S60 ?S60_version. */ void cancelSearch(); + /** + * slot connects to model for rows insert completion + * @since S60 ?S60_version. + */ + void getrowsInserted(); + /** + * slot connects to model for rows delete completion + * @since S60 ?S60_version. + */ + void getrowsRemoved(); + /** + * slot added for Application manager + * @since S60 ?S60_version. + */ + + void handleOk(const QVariant& var); + + /** + * slot added for Application manager + * @since S60 ?S60_version. + */ + + void handleError(int ret, const QString& var); + + /** + * Slot implemented for particular category search + * @since S60 ?S60_version. + */ + + + QString filterDoc(const QCPixDocument* aDoc,const QString& filter); private: /** @@ -252,12 +322,7 @@ * Own. */ HbSearchPanel* mSearchPanel; - /** - * proxymodel for list view - * Own. - */ - QSortFilterProxyModel *proxyModel; - + /** * model for list view * Own. @@ -268,6 +333,8 @@ * qt interface for CPix engine * Own. */ + QList mSearchHandlerList; + InDeviceHandler* mSearchHandler; /** @@ -326,6 +393,19 @@ bool loadSettings; QList mIconArray; HbIcon mIcon; + +private: + XQApplicationManager* mAiwMgr; + XQAiwRequest* mRequest; + +#ifdef OST_TRACE_COMPILER_IN_USE + QTime m_totalSearchUiTime; + QTime m_categorySearchUiTime; + QTime m_categorySearchApiTime; + QTime m_categoryGetDocumentApiTime; + //use long to safeguard overflow from long running operations. + long m_getDocumentCatergoryTimeAccumulator; +#endif SEARCH_FRIEND_CLASS (SearchStateProviderTest) diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/inc/searchsettingsstate.h --- a/searchui/stateproviders/searchstateprovider/inc/searchsettingsstate.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/inc/searchsettingsstate.h Mon May 03 12:32:15 2010 +0300 @@ -20,7 +20,7 @@ #include #include -#include "Search_global.h" +#include "search_global.h" SEARCH_CLASS( SearchStateProviderTest) @@ -31,7 +31,6 @@ class HbView; class HbDocumentLoader; class HbAction; -class HbGridView; class QGraphicsLinearLayout; class SettingsWidget; @@ -86,20 +85,18 @@ private: + /** - * Returns the main window handle. - * @since S60 ?S60_version. - * @return The pointer to the main window. - */ - // HbMainWindow* mainWindow(); - - /** - * Connects signals and slots for active wizard. + * checking whether internet search is selected * @since S60 ?S60_version. */ void isInternetOn(); public slots: + /** + * Called when it receive the selected category information from the settingwidget class + * @since S60 ?S60_version. + */ void getItemCategory(int, bool); @@ -109,11 +106,6 @@ */ void handleBackEvent(bool); - /** - * Function to customize the progressive state. - * @since S60 ?S60_version. - */ - // void customizeGoButton(); signals: /** diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/inc/searchstateprovider.h --- a/searchui/stateproviders/searchstateprovider/inc/searchstateprovider.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/inc/searchstateprovider.h Mon May 03 12:32:15 2010 +0300 @@ -18,11 +18,15 @@ #ifndef SEARCH_STATEPROVIDERS_STATEPROVIDER_H #define SEARCH_STATEPROVIDERS_STATEPROVIDER_H -#include "Search_global.h" +#include "search_global.h" + +SEARCH_CLASS( SearchStateProviderTest) -#include "hsistateprovider.h" - -class SearchStateProviderTest; +#ifdef BUILD_SEARCHSTATEPROVIDER +#define SEARCH_STATEPROVIDER Q_DECL_EXPORT +#else +#define SEARCH_STATEPROVIDER Q_DECL_IMPORT +#endif class QState; @@ -36,11 +40,10 @@ * @lib Searchstateprovider * @since S60 ?S60_version. */ -class SearchStateProvider : public QObject, public IHsStateProvider +class SEARCH_STATEPROVIDER SearchStateProvider : public QObject { Q_OBJECT -Q_INTERFACES(IHsStateProvider) public: @@ -49,24 +52,10 @@ * * @since S60 ?S60_version. */ - SearchStateProvider(); - - /** - * Destructor. - * - * @since S60 ?S60_version. - */ - virtual ~SearchStateProvider(); + SearchStateProvider(QObject *parent=NULL); + -public: - - /** - * Returns contained states as a list of tokens. - * - * @return Contained states as a list of tokens. - * @since S60 ?S60_version. - */ - QList states(); +public: /** * Creates a state based on the given token. @@ -74,20 +63,11 @@ * @param aToken Identifies the state to be created. * @since S60 ?S60_version. */ - QState* createState(const HsStateToken& aToken); - -private: + QState* createState(const QString& uri); - /** - * Token that describes the wizard menu state. - */ - HsStateToken mInitStateToken; +private: - HsStateToken mWizardMenuStateToken; - - HsStateToken mWizardActivatedStateToken; - - friend class SearchStateProviderTest; + SEARCH_FRIEND_CLASS ( SearchStateProviderTest) }; #endif //SEARCH_STATEPROVIDERS_STATEPROVIDER_H diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/inc/settingswidget.h --- a/searchui/stateproviders/searchstateprovider/inc/settingswidget.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/inc/settingswidget.h Mon May 03 12:32:15 2010 +0300 @@ -20,14 +20,19 @@ #include #include #include -#include +#include class HbCheckBox; class HbDialog; class QSignalMapper; +class HbDocumentLoader; +class HbDataFormModel; +class HbDataForm; +class HbRadioButtonList; +class HbDataFormModelItem; SEARCH_CLASS(SearchStateProviderTest) -class SettingsWidget : public HbWidget +class SettingsWidget : public QObject { Q_OBJECT public: @@ -52,11 +57,11 @@ /** * unchecking subcategories under the main category once main category unchecked */ - void unCheckSubCategories(int aUnCheckSubCategory); + void unCheckSubCategories(); /** * checking subcategories under the main category once main category checked */ - void checkSubCategories(int acheckSubCategory); + void checkSubCategories(); /** * storing settings to application ini file * @@ -66,7 +71,15 @@ * Load setting from application ini file * */ - void loadSettingsFrominiFile(); + void loadDeviceSettings(); + + /** + * Load default settings for search categories to ini file + * + */ + + void loadBaseSettings(); + /** * make "OK" button visible * @@ -76,7 +89,28 @@ * enable default settings in the application ini file * */ - void enableDefaultSettings(); + void storeDefaultSettings(); + + /** + * setting up gui for the settings widget + */ + + void createGui(); + + /** + * Filter out categories from the sql database provided by the engine + * for only those categories that have been successfully harvested + */ + + void preparecategories(); + + + /** + * initilize the settings wizard while entering to the setting state + */ + + void initialize(); + public slots: /** * will be called when settings OK is clicked @@ -91,10 +125,10 @@ */ void itemChecked(int); /** - * will be called when change oin internet or device selectin - * - */ - void changeDeviceInternetCheck(); + * slot called while clicking items added to the combobox + */ + + void q_currentIndexChanged(int); signals: /** * Emitted when setting closed @@ -138,8 +172,20 @@ /** * list of hardcoded device categories */ - QStringList deviceCategoryList; + QMap mCategoryDbMapping; + QStringList mDeviceListDisplay; + /** + * list of hardcoded device categories:cretaed to + * set up default category values to the ini file + */ + + QStringList mDeviceCategoryRefList; + /** + * intermediate variable to store selected category values + */ + + QList mDeviceMapping; /** * list of hardcoded service providers */ @@ -147,6 +193,42 @@ /** * for unit testing */ + QStringList mCategoryList; + /** + * DocumentLoader variable for the setting widget + */ + + HbDocumentLoader* mDocumentLoader; + + /** + * Dataform for the settingwidget + */ + + HbDataForm* dataform; + + /** + * Dataform model + */ + HbDataFormModel* mModel; + /** + * variable for customizing each item the in the dataform + */ + + QList mModelItemList; + + QList mActions; + + int mSelectedScope; + + int mSelectedProvider; + /** + * Radio buttion list for internet search categories + */ + + HbRadioButtonList* mradiolist; + + bool mInstialize; + bool mchangestate; SEARCH_FRIEND_CLASS (SearchStateProviderTest) }; #endif diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/resources/resources.qrc --- a/searchui/stateproviders/searchstateprovider/resources/resources.qrc Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/resources/resources.qrc Mon May 03 12:32:15 2010 +0300 @@ -1,14 +1,6 @@ searchstateprovider.docml - - - video.png - calender.png - camera.png - email.png - message.png - phonebook.png - sound.png + delimeterscreen.docml diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/searchstateprovider.pro --- a/searchui/stateproviders/searchstateprovider/searchstateprovider.pro Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/searchstateprovider.pro Mon May 03 12:32:15 2010 +0300 @@ -16,6 +16,7 @@ TEMPLATE = lib +DEFINES += BUILD_SEARCHSTATEPROVIDER symbian { CONFIG(debug, debug|release) { @@ -32,9 +33,6 @@ SUBDIRPART = release } DESTDIR = $$PWD/../../../bin/$$SUBDIRPART/searchresources/plugins/stateproviders - INCLUDEPATH += \ - $$PWD/../../../homescreensrv/homescreensrv_plat/ftuwizardmodel_api/inc \ - $$PWD/../../../homescreensrv/homescreensrv_plat/statemodel_api LIBS += -L$$PWD/../../../bin/debug } @@ -50,13 +48,12 @@ LIBS += -lbitgdi -CONFIG += plugin debug_and_release - coverage:DEFINES += COVERAGE_MEASUREMENT CONFIG += hb -QT += xml +QT += sql xml + nft:DEFINES += NFT @@ -75,10 +72,10 @@ TARGET.EPOCALLOWDLLDATA=1 TARGET.CAPABILITY = ALL -TCB -DRM INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - include(searchstateprovider_installs_symbian.pri) + #include(searchstateprovider_installs_symbian.pri) + # BLD_INF_RULES.prj_exports += "./inc/searchstateprovider.h |../../inc/" } - +win32:include(searchstateprovider_installs_win32.pri) symbian:unix:include(searchstateprovider_installs_unix.pri) include(searchstateprovider.pri) - diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/src/searchinitstate.cpp --- a/searchui/stateproviders/searchstateprovider/src/searchinitstate.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/src/searchinitstate.cpp Mon May 03 12:32:15 2010 +0300 @@ -41,13 +41,12 @@ } // --------------------------------------------------------------------------- -// SearchInitState::~construct() +// SearchInitState::construct() // --------------------------------------------------------------------------- // void SearchInitState::construct() { - // Read configuration parameters? - // lazyInit()? + } // --------------------------------------------------------------------------- diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp --- a/searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/src/searchprogressivestate.cpp Mon May 03 12:32:15 2010 +0300 @@ -17,8 +17,8 @@ #include "searchprogressivestate.h" #include "indevicehandler.h" -#include "qcpixdocument.h" -#include "qcpixdocumentfield.h" +#include +#include #include #include #include @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -51,21 +50,22 @@ const char *TUT_SEARCHPANEL_WIDGET = "searchPanel"; const char *TUT_LIST_VIEW = "listView"; const QSize defaultIconSize(30, 30); - +const int totalcategories = 10; // --------------------------------------------------------------------------- // SearchProgressiveState::SearchProgressiveState // --------------------------------------------------------------------------- // SearchProgressiveState::SearchProgressiveState(QState *parent) : QState(parent), mMainWindow(NULL), mView(NULL), mListView(NULL), - mDocumentLoader(NULL), mModel(NULL), mSearchHandler(NULL) + mDocumentLoader(NULL), mModel(NULL), mSearchHandler(NULL), + mAiwMgr(0), mRequest(0) { mMainWindow = hbInstance->allMainWindows().at(0); mModel = new QStandardItemModel(this); - proxyModel = new QSortFilterProxyModel(this); - proxyModel->setSourceModel(mModel); + + mAiwMgr = new XQApplicationManager; mDocumentLoader = new HbDocumentLoader(); bool ok = false; @@ -100,10 +100,15 @@ } mListView->setModel(mModel, prototype); + + HbAbstractItemView::ItemAnimations noCreationAndRemovalAnimations = + HbAbstractItemView::All; + noCreationAndRemovalAnimations ^= HbAbstractItemView::Appear; + noCreationAndRemovalAnimations ^= HbAbstractItemView::Disappear; + + mListView->setEnabledAnimations(noCreationAndRemovalAnimations); } - //bool bl = mListView->itemRecycling(); - // mListView->setItemRecycling(false); - //mListView->setModel(proxyModel); + mSearchPanel = qobject_cast ( mDocumentLoader->findWidget(TUT_SEARCHPANEL_WIDGET)); @@ -112,8 +117,9 @@ mSearchPanel->setSearchOptionsEnabled(true); } - mSearchHandler = new InDeviceHandler(); - if (mView) + constructHandlers(); + + if (mView && mMainWindow) { mMainWindow->addView(mView); mMainWindow->setCurrentView(mView); @@ -143,6 +149,14 @@ mIconArray.append(getAppIconFromAppId(appUid[i])); } +#ifdef OST_TRACE_COMPILER_IN_USE + //start() the timers to avoid worrying abt having to start()/restart() later + m_categorySearchApiTime.start(); + m_categorySearchUiTime.start(); + m_totalSearchUiTime.start(); + m_categoryGetDocumentApiTime.start(); + m_getDocumentCatergoryTimeAccumulator = 0; +#endif } // --------------------------------------------------------------------------- // SearchProgressiveState::~SearchProgressiveState @@ -150,11 +164,11 @@ // SearchProgressiveState::~SearchProgressiveState() { - if (proxyModel) + if (mAiwMgr) { - delete proxyModel; + delete mAiwMgr; } - + if (mModel) { delete mModel; @@ -163,14 +177,82 @@ { delete mDocumentLoader; } - if (mSearchHandler) + + for (int i = 0; i < mSearchHandlerList.count(); i++) { - delete mSearchHandler; + delete mSearchHandlerList.at(i); } } // --------------------------------------------------------------------------- +// SearchProgressiveState::constructHandlers +// --------------------------------------------------------------------------- +// +void SearchProgressiveState::constructHandlers() + { + InDeviceHandler* handler = NULL; + for (int i = 0; i < totalcategories; 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("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; + } + } + mSearchHandlerList.append(handler); + } + } + +// --------------------------------------------------------------------------- // SearchProgressiveState::onEntry // --------------------------------------------------------------------------- // @@ -182,19 +264,20 @@ activateSignals(); // If this is not the current view, we're getting back from plugin view - - if (mMainWindow->currentView() != mView) + if (mMainWindow) { - mMainWindow->setCurrentView(mView, true); + if (mMainWindow->currentView() != mView) + { + mMainWindow->setCurrentView(mView, true); + } + mMainWindow->show(); } - mMainWindow->show(); - if (loadSettings) { emit settingsState(); loadSettings = false; } - + setSelectedCategories(); } // --------------------------------------------------------------------------- // SearchProgressiveState::onExit @@ -212,14 +295,14 @@ // void SearchProgressiveState::activateSignals() { - if (mSearchHandler) + for (int i = 0; i < mSearchHandlerList.count(); i++) { - connect(mSearchHandler, SIGNAL(handleSearchResult(int,int)), this, - SLOT(onSearchComplete(int,int))); - connect(mSearchHandler, SIGNAL(handleAsyncSearchResult(int,int)), - this, SLOT(onAsyncSearchComplete(int,int))); - connect(mSearchHandler, SIGNAL(handleDocument(int,QCPixDocument*)), - this, SLOT(onGetDocumentComplete(int,QCPixDocument*))); + connect(mSearchHandlerList.at(i), + SIGNAL(handleAsyncSearchResult(int,int)), this, + SLOT(onAsyncSearchComplete(int,int))); + connect(mSearchHandlerList.at(i), + SIGNAL(handleDocument(int,QCPixDocument*)), this, + SLOT(onGetDocumentComplete(int,QCPixDocument*))); } if (mListView) { @@ -233,9 +316,17 @@ connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, SLOT(setSettings())); - + connect(mSearchPanel, SIGNAL(exitClicked()), this, - SLOT(cancelSearch())); + SLOT(cancelSearch())); + } + if (mModel) + { + connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, + SLOT(getrowsInserted())); + + connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, + SLOT(getrowsRemoved())); } } // --------------------------------------------------------------------------- @@ -244,13 +335,12 @@ // void SearchProgressiveState::deActivateSignals() { - if (mSearchHandler) + for (int i = 0; i < mSearchHandlerList.count(); i++) { - disconnect(mSearchHandler, SIGNAL(handleSearchResult(int,int)), this, - SLOT(onSearchComplete(int,int))); - disconnect(mSearchHandler, SIGNAL(handleAsyncSearchResult(int,int)), - this, SLOT(onAsyncSearchComplete(int,int))); - disconnect(mSearchHandler, + disconnect(mSearchHandlerList.at(i), + SIGNAL(handleAsyncSearchResult(int,int)), this, + SLOT(onAsyncSearchComplete(int,int))); + disconnect(mSearchHandlerList.at(i), SIGNAL(handleDocument(int,QCPixDocument*)), this, SLOT(onGetDocumentComplete(int,QCPixDocument*))); } @@ -266,25 +356,17 @@ disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, SLOT(setSettings())); - } - } -// --------------------------------------------------------------------------- -// SearchProgressiveState::onSearchComplete -// --------------------------------------------------------------------------- -// -void SearchProgressiveState::onSearchComplete(int aError, int aResultCount) - { - if (aError != 0) + disconnect(mSearchPanel, SIGNAL(exitClicked()), this, + SLOT(cancelSearch())); + } + if (mModel) { - //Error found - return; - } - if (aResultCount > 0) - { - mResultcount = aResultCount; - mResultparser = 0; - mSearchHandler->getDocumentAsyncAtIndex(mResultparser); + disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, + SLOT(getrowsInserted())); + + disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, + SLOT(getrowsRemoved())); } } // --------------------------------------------------------------------------- @@ -294,6 +376,8 @@ void SearchProgressiveState::onAsyncSearchComplete(int aError, int aResultCount) { + PERF_CAT_API_ENDLOG + PERF_CAT_HITS_ENDLOG if (aError != 0) { @@ -309,7 +393,8 @@ { mResultcount = aResultCount; mResultparser = 0; - + PERF_CAT_GETDOC_TIME_RESTART + PERF_CAT_GETDOC_ACCUMULATOR_RESET mSearchHandler->getDocumentAsyncAtIndex(mResultparser); } } @@ -320,12 +405,11 @@ void SearchProgressiveState::onGetDocumentComplete(int aError, QCPixDocument* aDoc) { + PERF_CAT_GETDOC_TIME_ACCUMULATE if (aDoc == NULL || aError != 0) return; QStringList liststr; QString secondrow = aDoc->excerpt(); - QString baseclass = aDoc->baseAppClass(); - QString Uid = aDoc->docId(); QString firstrow; //-------------- html tag creation------------------- @@ -334,149 +418,141 @@ int insertpt = secondrow.indexOf(mOriginalString, 0, Qt::CaseInsensitive); if (insertpt >= 0) { - int preTagLen = htmlTagPre.length(); - secondrow.insert(insertpt, htmlTagPre); - secondrow.insert(insertpt + mOriginalString.length() + preTagLen, - htmlTagPost); - //--------------------Html Tag Creation completed------------ + secondrow.insert(insertpt + mOriginalString.length() + + htmlTagPre.length(), htmlTagPost); } - + //--------------------Html Tag Creation completed------------ QStandardItem* listitem = new QStandardItem(); if (aDoc->baseAppClass().contains("contact")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) + QString givename; + QString familyname; + bool bgivenname = false; + bool bfamilyname = false; + for (int i = 0; i < aDoc->fieldCount(); i++) { - if (aDoc->field(i).name().contains("GivenName")) + if (!bgivenname && aDoc->field(i).name().contains("GivenName")) + { + givename.append(aDoc->field(i).value()); + bgivenname = true; + } + if (!bfamilyname && aDoc->field(i).name().contains("FamilyName")) { - firstrow = aDoc->field(i).value(); + familyname.append(aDoc->field(i).value()); + bfamilyname = true; + } + if (bgivenname && bfamilyname) break; - } + } + if (givename.length()) + { + firstrow.append(givename); + } + if (familyname.length()) + { + if (firstrow.length()) + firstrow.append(" "); + firstrow.append(familyname); } if (firstrow.length() == 0) - firstrow = baseclass; + { + firstrow = hbTrId("txt_phob_list_unknown"); + } liststr << firstrow << secondrow; listitem->setData(mIconArray.at(0), Qt::DecorationRole); - } else if (aDoc->baseAppClass().contains("audio")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) + firstrow.append(filterDoc(aDoc, "Title")); + if (firstrow.length() == 0) { - if (aDoc->field(i).name().contains("Name")) - { - firstrow = aDoc->field(i).value(); - break; - } + firstrow = hbTrId("txt_mus_dblist_val_unknown4"); } - if (firstrow.length() == 0) - firstrow = baseclass; liststr << firstrow << secondrow; listitem->setData(mIconArray.at(1), Qt::DecorationRole); } else if (aDoc->baseAppClass().contains("video")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) + firstrow.append(filterDoc(aDoc, "Title")); + if (firstrow.length() == 0) { - if (aDoc->field(i).name().contains("Name")) - { - firstrow = aDoc->field(i).value(); - break; - } + firstrow.append(filterDoc(aDoc, "Name")); } - if (firstrow.length() == 0) - firstrow = baseclass; liststr << firstrow << secondrow; listitem->setData(mIconArray.at(2), Qt::DecorationRole); - } else if (aDoc->baseAppClass().contains("image")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) - { - if (aDoc->field(i).name().contains("Name")) - { - firstrow = aDoc->field(i).value(); - break; - } - } - if (firstrow.length() == 0) - firstrow = baseclass; + firstrow.append(filterDoc(aDoc, "Name")); liststr << firstrow << secondrow; listitem->setData(mIconArray.at(3), Qt::DecorationRole); } else if (aDoc->baseAppClass().contains("msg")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) + QString subject; + QString body; + bool bsubject = false; + bool bbody = false; + for (int i = 0; i < aDoc->fieldCount(); i++) { - if (aDoc->field(i).name().contains("Subject")) + if (!bsubject && aDoc->field(i).name().contains("Subject")) + { + subject.append(aDoc->field(i).value()); + bsubject = true; + } + if (!bbody && aDoc->field(i).name().contains("Body")) { - firstrow = aDoc->field(i).value(); + body.append(aDoc->field(i).value()); + bbody = true; + } + if (bsubject && bbody) break; - } + } + if (subject.length()) + { + firstrow.append(subject); + } + else + { + firstrow.append(body); } if (firstrow.length() == 0) - firstrow = baseclass; + { + firstrow = " ";// space if subject and body are missing + } liststr << firstrow << secondrow; listitem->setData(mIconArray.at(4), Qt::DecorationRole); - } else if (aDoc->baseAppClass().contains("email")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) - { - if (aDoc->field(i).name().contains("GivenName")) - { - firstrow = aDoc->field(i).value(); - break; - } - } - if (firstrow.length() == 0) - firstrow = baseclass; + firstrow.append(filterDoc(aDoc, "Subject")); liststr << firstrow << secondrow; } else if (aDoc->baseAppClass().contains("calendar")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) + firstrow.append(filterDoc(aDoc, "Description")); + if (firstrow.length() == 0) { - if (aDoc->field(i).name().contains("Description")) - { - firstrow = aDoc->field(i).value(); - break; - } + firstrow = hbTrId("txt_calendar_preview_unnamed"); } - if (firstrow.length() == 0) - firstrow = baseclass; + liststr << firstrow << secondrow; listitem->setData(mIconArray.at(6), Qt::DecorationRole); } else if (aDoc->baseAppClass().contains("notes")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) + firstrow.append(filterDoc(aDoc, "Memo")); + if (firstrow.length() == 0) { - if (aDoc->field(i).name().contains("Memo")) - { - firstrow = aDoc->field(i).value(); - break; - } + firstrow = hbTrId("txt_notes_dblist_unnamed"); } - if (firstrow.length() == 0) - firstrow = baseclass; liststr << firstrow << secondrow; } else if (aDoc->baseAppClass().contains("applications")) { - liststr << secondrow; bool ok; listitem->setData(getAppIconFromAppId(TUid::Uid(aDoc->docId().toInt( @@ -484,32 +560,18 @@ } else if (aDoc->baseAppClass().contains("bookmark")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) + firstrow.append(filterDoc(aDoc, "Name")); + if (firstrow.length() == 0) { - if (aDoc->field(i).name().contains("Name")) - { - firstrow = aDoc->field(i).value(); - break; - } + firstrow = "UnKnown"; } - if (firstrow.length() == 0) - firstrow = baseclass; liststr << firstrow << secondrow; } else if (aDoc->baseAppClass().contains("file")) { - int index = aDoc->fieldCount(); - for (int i = 0; i < index; i++) - { - if (aDoc->field(i).name().contains("FullName")) - { - firstrow = aDoc->field(i).value(); - break; - } - } + firstrow.append(filterDoc(aDoc, "BaseName")); if (firstrow.length() == 0) - firstrow = baseclass; + firstrow = aDoc->baseAppClass(); liststr << firstrow << secondrow; listitem->setData(mIconArray.at(9), Qt::DecorationRole); } @@ -519,27 +581,56 @@ listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); mModel->appendRow(listitem); + + delete aDoc; + } +// --------------------------------------------------------------------------- +// SearchProgressiveState::getSettingCategory +// --------------------------------------------------------------------------- +// +void SearchProgressiveState::getSettingCategory(int item, bool avalue) + { + mSelectedCategory.insert(item, avalue); + } +// --------------------------------------------------------------------------- +// SearchProgressiveState::getrowsInserted +// --------------------------------------------------------------------------- +// +void SearchProgressiveState::getrowsInserted() + { mResultparser++; if (mResultparser < mResultcount) { - + PERF_CAT_GETDOC_TIME_RESTART mSearchHandler->getDocumentAsyncAtIndex(mResultparser); } else { - + PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG searchOnCategory(mSearchString); } } // --------------------------------------------------------------------------- -// SearchProgressiveState::_selectedcategory +// SearchProgressiveState::getrowsRemoved // --------------------------------------------------------------------------- // -void SearchProgressiveState::getSettingCategory(int item, bool avalue) +void SearchProgressiveState::getrowsRemoved() { - - mSelectedCategory.insert(item, avalue); - + if (mModel->rowCount() != 0) + { + mModel->removeRow(0); + } + else + { + mListView->reset(); + if (mOriginalString.length()) + { + mDatabasecount = 0; + mSearchString = mOriginalString; + mSearchString.append('*'); + searchOnCategory(mSearchString); + } + } } // --------------------------------------------------------------------------- // SearchProgressiveState::openResultitem @@ -549,35 +640,94 @@ { QStandardItem* item = mModel->itemFromIndex(index); QString baseclass = item->data(Qt::UserRole + 1).toString(); + + QVariant retValue; bool t; - int uid = (item->data(Qt::UserRole)).toInt(&t); - - if (index.row() == mLinkindex) + if (baseclass.contains("contact")) { - // emit linkItemClicked(); - } - else - { - XQServiceRequest *mSndEdit; - QVariant retValue; + + mRequest = mAiwMgr->create("com.nokia.services.phonebookservices", + "Fetch", "open(int)", false); + connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, + SLOT(handleOk(const QVariant&))); + // Connect error handling signal or apply lastError function instead. + connect(mRequest, SIGNAL(requestError(int,const QString&)), this, + SLOT(handleError(int,const QString&))); - if (baseclass.contains("contact")) + if (!mRequest) + { + qDebug() << "AIW-ERROR: NULL request"; + return; + } + + int uid = (item->data(Qt::UserRole)).toInt(&t); + QList args; + args << uid; + mRequest->setArguments(args); + // Make the request + if (!mRequest->send()) { - mSndEdit = new XQServiceRequest( - "com.nokia.services.phonebookservices.Fetch", - "open(int)", false); - *mSndEdit << uid; - retValue = mSndEdit->send(); + qDebug() << "AIW-ERROR: Send failed" << mRequest->lastError(); } - else if (baseclass.contains("msg")) + delete mRequest; + + } + else if (baseclass.contains("msg")) + { + int uid = (item->data(Qt::UserRole)).toInt(&t); + + mRequest = mAiwMgr->create("com.nokia.services.hbserviceprovider", + "conversationview", "view(qint64)", false); + connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, + SLOT(handleOk(const QVariant&))); + // Connect error handling signal or apply lastError function instead. + connect(mRequest, SIGNAL(requestError(int,const QString&)), this, + SLOT(handleError(int,const QString&))); + + if (!mRequest) { - mSndEdit = new XQServiceRequest( - "com.nokia.services.hbserviceprovider.conversationview", - "openConversationView(qint64,int)", false); - *mSndEdit << uid << 0; - retValue = mSndEdit->send(); + qDebug() << "AIW-ERROR: NULL request"; + return; } + + QList args; + args << uid; + retValue = mRequest->send(); + delete mRequest; } + else if (baseclass.contains("video")) + { + QString uid = item->data(Qt::UserRole).toString(); + mRequest = mAiwMgr->create("com.nokia.videos", "IVideoView", + "playMedia(QString)", false); + connect(mRequest, SIGNAL(requestOk(const QVariant&)), this, + SLOT(handleOk(const QVariant&))); + // Connect error handling signal or apply lastError function instead. + connect(mRequest, SIGNAL(requestError(int,const QString&)), this, + SLOT(handleError(int,const QString&))); + + QList args; + args << uid; + retValue = mRequest->send(); + delete mRequest; + } + + } +// --------------------------------------------------------------------------- +// SearchProgressiveState::handleOk +// --------------------------------------------------------------------------- +// +void SearchProgressiveState::handleOk(const QVariant& /*var*/) + { + + } +// --------------------------------------------------------------------------- +// SearchProgressiveState::handleError +// --------------------------------------------------------------------------- +// +void SearchProgressiveState::handleError(int /*ret*/, const QString& /*var*/) + { + } // --------------------------------------------------------------------------- // SearchProgressiveState::createSuggestionLink @@ -585,22 +735,15 @@ // void SearchProgressiveState::createSuggestionLink(bool aFlag) { - QStandardItem* listitem = new QStandardItem(); - /* QString displaystr; - QString searchStr(mSearchString);*/ + QStandardItem* listitem = new QStandardItem(); QString htmlKeyword = QString("%1").arg(mOriginalString); - /* QString htmlServiceProvider = QString("in Google");*/ - if (!aFlag) { QString linkString = QString(hbTrId( "txt_search_list_search_for_1_on_2").arg(htmlKeyword)); mLinkindex = mModel->rowCount(); listitem->setData(linkString, Qt::DisplayRole); - /* HbFrameBackground* background = new HbFrameBackground( - "qtg_fr_button_function_latched", HbFrameDrawer::NinePieces); - listitem->setData(*background, Qt::BackgroundRole); - */ + mModel->appendRow(listitem); } @@ -622,37 +765,84 @@ } // --------------------------------------------------------------------------- -// SearchProgressiveState::noResultsFound +// SearchProgressiveState::clear // --------------------------------------------------------------------------- // void SearchProgressiveState::clear() { if (mModel) { - mModel->clear(); + mModel->removeRows(0, mModel->rowCount()); } } // --------------------------------------------------------------------------- -// SearchProgressiveState::noResultsFound +// SearchProgressiveState::searchOnCategory // --------------------------------------------------------------------------- // void SearchProgressiveState::searchOnCategory(const QString aKeyword) { +#ifdef OST_TRACE_COMPILER_IN_USE + if( mDatabasecount != 0 ){//Search just started. + PERF_CAT_UI_ENDLOG + } + PERF_CAT_UI_TIME_RESTART +#endif mResultparser = 0; mResultcount = 0; if (mDatabasecount < mTemplist.count()) { QString str = mTemplist.at(mDatabasecount); - mSearchHandler->setCategory(mTemplist.at(mDatabasecount)); + if (str.contains("selectall")) + { + // mSearchHandler = mSearchHandlerList.at(0); + } + else if (str.contains("contact")) + { + mSearchHandler = mSearchHandlerList.at(1); + } + else if (str.contains("media")) + { + mSearchHandler = mSearchHandlerList.at(2); + } + else if (str.contains("msg")) + { + mSearchHandler = mSearchHandlerList.at(3); + } + else if (str.contains("email")) + { + mSearchHandler = mSearchHandlerList.at(4); + } + else if (str.contains("calendar")) + { + mSearchHandler = mSearchHandlerList.at(5); + } + else if (str.contains("notes")) + { + mSearchHandler = mSearchHandlerList.at(6); + } + else if (str.contains("applications")) + { + mSearchHandler = mSearchHandlerList.at(7); + } + else if (str.contains("file")) + { + mSearchHandler = mSearchHandlerList.at(8); + } + else if (str.contains("bookmark")) + { + mSearchHandler = mSearchHandlerList.at(9); + } + // mSearchHandler->setCategory(mTemplist.at(mDatabasecount)); mDatabasecount++; if (mSearchHandler->isPrepared()) { - + PERF_CAT_API_TIME_RESTART mSearchHandler->searchAsync(aKeyword, "_aggregate"); } } else if (mDatabasecount >= mTemplist.count()) { + PERF_TOTAL_UI_ENDLOG if (mListView->indexCount() == 0 && aKeyword.length() != 0) { noResultsFound(mOriginalString); @@ -668,67 +858,23 @@ // void SearchProgressiveState::startNewSearch(const QString &aKeyword) { + PERF_CAT_TOTAL_TIME_RESTART - if (mSearchHandler) + mOriginalString = aKeyword.trimmed(); + for (int i = 0; i < mSearchHandlerList.count(); i++) { - mSearchHandler->cancelLastSearch(); + mSearchHandlerList.at(i)->cancelLastSearch(); + } + if (mModel->rowCount() != 0) + { clear(); - } - mOriginalString = aKeyword.trimmed(); - if (mOriginalString.length()) + } + else if (mOriginalString.length()) { mDatabasecount = 0; - mTemplist.clear(); + mLinkindex = 0; mSearchString = mOriginalString; mSearchString.append('*'); - QMapIterator i(mSelectedCategory); - while (i.hasNext()) - { - i.next(); - if (i.value()) - { - switch (i.key()) - { - case 0: - { - break; - } - case 1: //Contacts - { - mTemplist.append("contact"); - break; - } - case 2://Media - { - mTemplist.append("media"); - break; - } - case 3://Messages& emails - { - mTemplist.append("msg"); - //mTemplist.append("email"); - break; - } - case 4://Calender& notes - { - mTemplist.append("calendar"); - //mTemplist.append("notes"); - break; - } - case 5://Applications - { - mTemplist.append("applications"); - break; - } - case 6://All other files - { - mTemplist.append("file"); - mTemplist.append("bookmark"); - break; - } - } - } - } searchOnCategory(mSearchString); } } @@ -786,14 +932,75 @@ } } // --------------------------------------------------------------------------- +// SearchProgressiveState::setSelectedCategories +// --------------------------------------------------------------------------- +// +void SearchProgressiveState::setSelectedCategories() + { + mTemplist.clear(); + QMapIterator i(mSelectedCategory); + while (i.hasNext()) + { + i.next(); + if (i.value()) + { + switch (i.key()) + { + case 0: + { + //mTemplist.append("selectall"); + break; + } + case 1: //Contacts + { + mTemplist.append("contact"); + break; + } + case 2://Media + { + mTemplist.append("media"); + break; + } + case 3://Messages& emails + { + mTemplist.append("msg"); + //mTemplist.append("email"); + break; + } + case 4://Calender& notes + { + mTemplist.append("calendar"); + mTemplist.append("notes"); + break; + } + case 5://Applications + { + mTemplist.append("applications"); + break; + } + case 6://Bookmarks + { + mTemplist.append("bookmark"); + break; + } + case 7://All other files + { + mTemplist.append("file"); + break; + } + } + } + } + } +// --------------------------------------------------------------------------- // SearchProgressiveState::cancelSearch // --------------------------------------------------------------------------- // void SearchProgressiveState::cancelSearch() { - if(mSearchHandler) + for (int i = 0; i < mSearchHandlerList.count(); i++) { - mSearchHandler->cancelLastSearch(); + mSearchHandlerList.at(i)->cancelLastSearch(); } } // --------------------------------------------------------------------------- @@ -820,15 +1027,18 @@ ); if (err == KErrNone) { - aknIcon = CAknIcon::NewL(); - aknIcon->SetBitmap(bitmap); - aknIcon->SetMask(mask); + TRAPD( err1, + {aknIcon = CAknIcon::NewL(); + aknIcon->SetBitmap(bitmap); + aknIcon->SetMask(mask);}); + if (err1 == KErrNone) + { + + } } } if (aknIcon) - { - CleanupStack::PushL(aknIcon); - + { //need to disable compression to properly convert the bitmap AknIconUtils::DisableCompression(aknIcon->Bitmap()); @@ -844,20 +1054,27 @@ else { CFbsBitmap *temp(NULL); - temp = copyBitmapLC(aknIcon->Bitmap()); - pixmap = fromSymbianCFbsBitmap(temp); - CleanupStack::PopAndDestroy(); + TRAPD( err, + {temp = copyBitmapLC(aknIcon->Bitmap()); + pixmap = fromSymbianCFbsBitmap(temp); + CleanupStack::PopAndDestroy();}); + if (err == KErrNone) + { + TRAPD( err1, + {temp = copyBitmapLC(aknIcon->Mask()); + QPixmap mask = fromSymbianCFbsBitmap(temp); + CleanupStack::PopAndDestroy(); + pixmap.setAlphaChannel(mask);}); + if (err1 == KErrNone) + { - temp = copyBitmapLC(aknIcon->Mask()); - QPixmap mask = fromSymbianCFbsBitmap(temp); - CleanupStack::PopAndDestroy(); + } + } - pixmap.setAlphaChannel(mask); } pixmap = pixmap.scaled(defaultIconSize, Qt::KeepAspectRatioByExpanding); - CleanupStack::PopAndDestroy(aknIcon); icon = HbIcon(QIcon(pixmap)); } return icon; @@ -940,3 +1157,19 @@ CleanupStack::PopAndDestroy(bitmapDevice); return bmp; } +// --------------------------------------------------------------------------- +// SearchProgressiveState::filterDoc +// --------------------------------------------------------------------------- +// +QString SearchProgressiveState::filterDoc(const QCPixDocument* aDoc, + const QString& filter) + { + for (int i = 0; i < aDoc->fieldCount(); i++) + { + if (aDoc->field(i).name().contains(filter)) + { + return aDoc->field(i).value(); + } + } + return NULL; + } diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/src/searchsettingsstate.cpp --- a/searchui/stateproviders/searchstateprovider/src/searchsettingsstate.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/src/searchsettingsstate.cpp Mon May 03 12:32:15 2010 +0300 @@ -31,8 +31,6 @@ #include #include"settingswidget.h" -const char *WIZARD_VIEW = "tocView"; - // --------------------------------------------------------------------------- // SearchSettingsState::SearchSettingsState // --------------------------------------------------------------------------- @@ -43,32 +41,31 @@ minitialCount = true; mWidget = new SettingsWidget(); - connect(mWidget, SIGNAL(settingsEvent(bool)), this, SLOT(handleBackEvent(bool))); + connect(mWidget, SIGNAL(settingsEvent(bool)), this, + SLOT(handleBackEvent(bool))); connect(mWidget, SIGNAL(selectedItemCategory(int, bool)), this, SLOT(getItemCategory(int, bool))); } // --------------------------------------------------------------------------- -// SearchSettingsState::_selectedcategory -// --------------------------------------------------------------------------- -// -void SearchSettingsState::getItemCategory(int str, bool avalue) - { - emit publishSelectedCategory(str, avalue); - } - -// --------------------------------------------------------------------------- // SearchSettingsState::~SearchSettingsState // --------------------------------------------------------------------------- // SearchSettingsState::~SearchSettingsState() { delete mDocumentLoader; - // delete mWidget; + delete mWidget; } - +// --------------------------------------------------------------------------- +// SearchSettingsState::getItemCategory +// --------------------------------------------------------------------------- +// +void SearchSettingsState::getItemCategory(int str, bool avalue) + { + emit publishSelectedCategory(str, avalue); + } // --------------------------------------------------------------------------- // SearchSettingsState::onEntry // --------------------------------------------------------------------------- @@ -79,7 +76,8 @@ QState::onEntry(event); if (minitialCount) { - mWidget->loadSettingsFrominiFile(); + mWidget->loadBaseSettings(); + mWidget->loadDeviceSettings(); isInternetOn(); minitialCount = false; emit backEventTriggered(); @@ -90,7 +88,6 @@ mWidget->launchSettingWidget(); } } - // --------------------------------------------------------------------------- // SearchSettingsState::onExit // --------------------------------------------------------------------------- @@ -100,15 +97,18 @@ QState::onExit(event); } - +// --------------------------------------------------------------------------- +// SearchSettingsState::handleBackEvent +// --------------------------------------------------------------------------- +// void SearchSettingsState::handleBackEvent(bool aStatus) { emit backEventTriggered(); if (mWidget) { isInternetOn(); - emit clickstatus(aStatus); - } + emit clickstatus(aStatus); + } } // --------------------------------------------------------------------------- // SearchSettingsState::isInternetOn @@ -125,4 +125,3 @@ emit customizeGoButton(false); } } - diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/src/searchstateprovider.cpp --- a/searchui/stateproviders/searchstateprovider/src/searchstateprovider.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/src/searchstateprovider.cpp Mon May 03 12:32:15 2010 +0300 @@ -17,17 +17,16 @@ #include "searchstateprovider.h" #include "searchprogressivestate.h" - #include "searchinitstate.h" #include "searchsettingsstate.h" #include #include -// constants -const char providerFileName[] = "searchstateprovider.dll"; + +// states const char initStateFileUri[] = "search.nokia.com/state/initstate"; -// states + const char wizardProgressiveStateUri[] = "search.nokia.com/state/wizardprogressivestate"; const char wizardSettingStateUri[] = @@ -37,66 +36,30 @@ // searchStateProvider::searchStateProvider() // --------------------------------------------------------------------------- // -SearchStateProvider::SearchStateProvider() - { - mInitStateToken.mLibrary = providerFileName; - mInitStateToken.mUri = initStateFileUri; - - mWizardMenuStateToken.mLibrary = providerFileName; - mWizardMenuStateToken.mUri = wizardProgressiveStateUri; - - mWizardActivatedStateToken.mLibrary = providerFileName; - mWizardActivatedStateToken.mUri = wizardSettingStateUri; - } - -// --------------------------------------------------------------------------- -// SearchStateProvider::~SearchStateProvider() -// --------------------------------------------------------------------------- -// -SearchStateProvider::~SearchStateProvider() +SearchStateProvider::SearchStateProvider(QObject *parent) : + QObject(parent) { } - -// --------------------------------------------------------------------------- -// SearchStateProvider::states() -// --------------------------------------------------------------------------- -// -QList SearchStateProvider::states() - { - return QList () << mInitStateToken << mWizardMenuStateToken - << mWizardActivatedStateToken; - } - // --------------------------------------------------------------------------- // SearchStateProvider::createState(const StateToken& aToken) // --------------------------------------------------------------------------- // -QState* SearchStateProvider::createState(const HsStateToken& aToken) +QState* SearchStateProvider::createState(const QString& uri) { - if (aToken.mUri == mWizardMenuStateToken.mUri) + if (uri == wizardProgressiveStateUri) { return new SearchProgressiveState(); } - else if (aToken.mUri == mWizardActivatedStateToken.mUri) + else if (uri == wizardSettingStateUri) { return new SearchSettingsState(); } - else if (aToken.mUri == mInitStateToken.mUri) + else if (uri == initStateFileUri) { return new SearchInitState(); } - qDebug() << "SEARCH: No state found for mUri: " << aToken.mUri; + qDebug() << "SEARCH: No state found for mUri: " << uri; return NULL; - } - -#ifdef COVERAGE_MEASUREMENT -#pragma CTC SKIP -#endif //COVERAGE_MEASUREMENT -Q_EXPORT_PLUGIN2(SearchStateProvider, SearchStateProvider) -#ifdef COVERAGE_MEASUREMENT -#pragma CTC ENDSKIP -#endif //COVERAGE_MEASUREMENT - diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/src/settingswidget.cpp --- a/searchui/stateproviders/searchstateprovider/src/settingswidget.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/src/settingswidget.cpp Mon May 03 12:32:15 2010 +0300 @@ -24,118 +24,308 @@ #include #include #include -#include +#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +const char *DELIMETER_DOCML = ":/xml/delimeterscreen.docml"; +const char *DIALOG = "dialog"; +const char *DATAFORM = "dataForm"; //---------------------------------------------------------------------------------------------------------------------------- //SettingsWidget::SettingsWidget() // //---------------------------------------------------------------------------------------------------------------------------- SettingsWidget::SettingsWidget() : - HbWidget() + signalMapper(NULL), popup(NULL), mDocumentLoader(NULL), dataform(NULL), + mModel(NULL),mSelectedScope(0),mSelectedProvider(0) + { + for (int i = 0; i < 8; i++) + { + mDeviceMapping.append(false); + } + + mDeviceCategoryRefList = (QStringList() << "first" << "second" << "third" + << "fourth" << "fifth" << "sixth" << "seventh" << "eigth"); + + mchangestate = true; + mInstialize = true; + isInternetSelected = false; + storeDefaultSettings(); + } +//---------------------------------------------------------------------------------------------------------------------------- +//SettingsWidget::intialize() +// +//---------------------------------------------------------------------------------------------------------------------------- +void SettingsWidget::initialize() { - deviceCategoryList = (QStringList() << hbTrId("txt_search_list_device") - << hbTrId("txt_search_list_contatcs") << hbTrId( - "txt_search_list_media") << hbTrId("txt_search_list_messagemail") - << hbTrId("txt_search_list_calendarnotes") << hbTrId( - "txt_search_list_applications") << hbTrId( - "txt_search_list_all_other_files")); - internetCategoryList = (QStringList() << hbTrId( - "txt_search_list_internet") << "Google" << "Bing"); + bool ok = false; + if (!mDocumentLoader) + { + mDocumentLoader = new HbDocumentLoader(); + mDocumentLoader->load(DELIMETER_DOCML, &ok); + } + QGraphicsWidget *widget = NULL; + if (!popup) + { + widget = mDocumentLoader->findWidget(DIALOG); + Q_ASSERT_X(ok && (widget != 0), "DIALOG", "invalid view"); - QGraphicsLinearLayout *linearLayout = new QGraphicsLinearLayout( - Qt::Vertical); + popup = qobject_cast (widget); + } + if (!dataform) + { + widget = mDocumentLoader->findWidget(DATAFORM); + Q_ASSERT_X(ok && (widget != 0), "DATAFORM", "invalid view"); + dataform = qobject_cast (widget); + } + if (!mModel) + { + mModel = new HbDataFormModel(); + } + if (!signalMapper) + { + signalMapper = new QSignalMapper(this); + } - setLayout(linearLayout); - - popup = new HbDialog(); + createGui(); + } +//---------------------------------------------------------------------------------------------------------------------------- +//SettingsWidget::createGui() +// +//---------------------------------------------------------------------------------------------------------------------------- +void SettingsWidget::createGui() + { popup->setDismissPolicy(HbDialog::NoDismiss); - popup->setTimeout(HbDialog::NoTimeout); HbAction * action = new HbAction(hbTrId("txt_common_button_ok"), popup); connect(action, SIGNAL(triggered()), this, SLOT(checkBoxOkEvent())); - popup->setPrimaryAction(action); + mActions.append(action); action = new HbAction(hbTrId("txt_common_button_cancel"), popup); connect(action, SIGNAL(triggered()), this, SLOT(checkBoxCancelEvent())); - popup->setSecondaryAction(action); + mActions.append(action); + + popup->addActions(mActions); + + dataform->setModel(mModel); + + HbLabel *label = new HbLabel(hbTrId("txt_search_title_search_scope")); + popup->setHeadingWidget(label); + + preparecategories(); + + loadBaseSettings(); - //device category creation + HbDataFormModelItem* themeComboGeneral = mModel->appendDataFormItem( + HbDataFormModelItem::ComboBoxItem, hbTrId( + "txt_search_qtl_dialog_pri_heading_delimiter")); + + themeComboGeneral->setContentWidgetData(QString("items"), mCategoryList); + + themeComboGeneral->setContentWidgetData(QString("currentIndex"), + mSelectedScope); - HbCheckBox *checkboxitem = NULL; + QModelIndex index = mModel->indexFromItem(themeComboGeneral); + + HbDataFormViewItem *formItem = dataform->dataFormViewItem(index); + + HbComboBox *comboBox = + static_cast (formItem->dataItemContentWidget()); + + q_currentIndexChanged(mSelectedScope); - signalMapper = new QSignalMapper(this); + connect(comboBox, SIGNAL(currentIndexChanged(int)), this, + SLOT(q_currentIndexChanged(int))); - for (int i = 0; i < deviceCategoryList.count(); i++) + } +//---------------------------------------------------------------------------------------------------------------------------- +//SettingsWidget::q_currentIndexChanged() +// +//---------------------------------------------------------------------------------------------------------------------------- +void SettingsWidget::q_currentIndexChanged(int avalue) + { + for (int i = 0; i < mModelItemList.count(); i++) + { + mModel->removeItem(mModelItemList.at(i)); + } + mModelItemList.clear(); + // int ret = mModel->rowCount(); + if (!avalue) //device category creation { - checkboxitem = new HbCheckBox(deviceCategoryList.at(i)); + isInternetSelected = false; + HbCheckBox *checkboxitem = NULL; + mDeviceCheckBoxList.clear(); + for (int i = 0; i < mDeviceListDisplay.count(); i++) + { + + HbDataFormModelItem* mModelItem = mModel->appendDataFormItem( + HbDataFormModelItem::CheckBoxItem); + mModelItemList.append(mModelItem); + QModelIndex index = mModel->indexFromItem(mModelItem); + + HbDataFormViewItem *formItem = dataform->dataFormViewItem(index); + + checkboxitem + = static_cast (formItem->dataItemContentWidget()); + + checkboxitem->setText(mDeviceListDisplay.at(i)); - mDeviceCheckBoxList.append(checkboxitem); + mDeviceCheckBoxList.append(checkboxitem); + + signalMapper->setMapping(mDeviceCheckBoxList.at(i), i); + + connect(mDeviceCheckBoxList.at(i), SIGNAL(stateChanged(int)), + signalMapper, SLOT(map())); - signalMapper->setMapping(mDeviceCheckBoxList.at(i), i); + connect(signalMapper, SIGNAL(mapped(int)), this, + SLOT(itemChecked(int))); + } + loadDeviceSettings(); + } + else + { + isInternetSelected = true; + mDeviceCheckBoxList.clear(); + HbDataFormModelItem* mModelItem = mModel->appendDataFormItem( + HbDataFormModelItem::RadioButtonListItem); + mModelItemList.append(mModelItem); + mModelItem->setContentWidgetData("items", internetCategoryList); + + QModelIndex index = mModel->indexFromItem(mModelItem); + + HbDataFormViewItem *formItem = dataform->dataFormViewItem(index); + + mradiolist + = static_cast (formItem->dataItemContentWidget()); + + mradiolist->setPreviewMode(HbRadioButtonList::NoPreview); + + mradiolist->setSelected(mSelectedProvider); + connect(mradiolist, SIGNAL(itemSelected(int)), this, + SLOT(q_itemSelected(int))); - connect(mDeviceCheckBoxList.at(i), SIGNAL(stateChanged(int)), - signalMapper, SLOT(map())); + for (int i = 0; i < mActions.count(); i++) + popup->removeAction(mActions.at(i)); + popup->addActions(mActions); + popup->removeAction(mActions.at(0)); + } + } +//---------------------------------------------------------------------------------------------------------------------------- +//SettingsWidget::preparecategories() +// +//---------------------------------------------------------------------------------------------------------------------------- +void SettingsWidget::preparecategories() + { + // read form database + - if (i == 0) + QString mConnectionName("cpixcontentinfo.sq"); + QString mDatabaseName("c:\\Private\\2001f6fb\\cpixcontentinfo.sq"); + + QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", mConnectionName); + db.setDatabaseName(mDatabaseName); + + QSqlQuery query(QSqlDatabase::database(mConnectionName)); + QString statement = "SELECT NAME FROM table1"; + + query.prepare(statement); + query.exec(); + while (query.next()) + { + QString category_name = query.value(0).toString(); + int value = query.value(2).toInt(); + if (value) { - //arrange device search &internet search - linearLayout->addItem(mDeviceCheckBoxList.at(i)); + mCategoryDbMapping.insert(category_name, false); } else { - //arrange other subcategoriess - mDeviceCheckBoxList.at(i)->setContentsMargins(20, 0, 0, 0); - linearLayout->addItem(mDeviceCheckBoxList.at(i)); + mCategoryDbMapping.insert(category_name, true); } + qDebug() <<"string db= "<setMapping(mInternetCheckBoxList.at(j), i); + db.close(); + + /* mCategoryDbMapping.insert("Contacts", true); + mCategoryDbMapping.insert("Audios", true); + mCategoryDbMapping.insert("Images", true); + mCategoryDbMapping.insert("Videos", true); + mCategoryDbMapping.insert("Messages", true); + mCategoryDbMapping.insert("email", true); + mCategoryDbMapping.insert("Calendar", true); + mCategoryDbMapping.insert("Notes", true); + mCategoryDbMapping.insert("Applications", true); + mCategoryDbMapping.insert("Bookmarks", true); + mCategoryDbMapping.insert("Files", true); */ + + // mCategoryDbMapping.insert("email", true); // to remove once email starts working + + mDeviceListDisplay.append("Select all"); + mDeviceMapping.insert(0, true); - connect(mInternetCheckBoxList.at(j), SIGNAL(stateChanged(int)), - signalMapper, SLOT(map())); + if (mCategoryDbMapping.value("Contacts")) + { + mDeviceMapping.insert(1, true); + mDeviceListDisplay.append(hbTrId("txt_search_list_contatcs")); + } - if (i == deviceCategoryList.count()) - { - //arrange device search &internet search - linearLayout->addItem(mInternetCheckBoxList.at(j)); - } - else - { - //arrange other subcategoriess - mInternetCheckBoxList.at(j)->setContentsMargins(20, 0, 0, 0); - linearLayout->addItem(mInternetCheckBoxList.at(j)); - - } - j++; + if (mCategoryDbMapping.value("Audios") + || mCategoryDbMapping.value("Images") || mCategoryDbMapping.value( + "Videos")) + { + mDeviceListDisplay.append(hbTrId("txt_search_list_media")); + mDeviceMapping.insert(2, true); } - connect(signalMapper, SIGNAL(mapped(int)), this, SLOT(itemChecked(int))); - - //Heading label + if (mCategoryDbMapping.value("Messages") || mCategoryDbMapping.value( + "email")) + { + mDeviceListDisplay.append(hbTrId("txt_search_list_messagemail")); + mDeviceMapping.insert(3, true); + } - HbLabel *label = new HbLabel(hbTrId( - "txt_search_qtl_dialog_pri_heading_delimiter")); - popup->setHeadingWidget(label); + if (mCategoryDbMapping.value("Calendar") || mCategoryDbMapping.value( + "Notes")) + { + mDeviceListDisplay.append(hbTrId("txt_search_list_calendarnotes")); + mDeviceMapping.insert(4, true); + } - HbScrollArea* scrollArea = new HbScrollArea(popup); - scrollArea->setScrollDirections(Qt::Vertical); - scrollArea->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); - scrollArea->setContentWidget(this); - popup->setContentWidget(scrollArea); + 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); + } - // loadSettingsFrominiFile(); + if (mCategoryDbMapping.value("Files")) + { + mDeviceListDisplay.append(hbTrId("txt_search_list_all_other_files")); + mDeviceMapping.insert(7, true); + } + internetCategoryList = (QStringList() << "Google" << "Bing"); + + mCategoryList = (QStringList() << hbTrId("txt_search_list_device") + << hbTrId("txt_search_list_internet")); } + //---------------------------------------------------------------------------------------------------------------------------- //SettingsWidget::~SettingsWidget() // @@ -144,6 +334,15 @@ { delete signalMapper; //delete popup; + //delete dataform; + delete mModel; + //delete mradiolist; + mDeviceCheckBoxList.clear(); + mInternetCheckBoxList.clear(); + mModelItemList.clear(); + mActions.clear(); + delete mDocumentLoader; + //delete popup; } //---------------------------------------------------------------------------------------------------------------------------- //SettingsWidget::launchSettingWidget() @@ -151,7 +350,12 @@ //---------------------------------------------------------------------------------------------------------------------------- void SettingsWidget::launchSettingWidget() { - loadSettingsFrominiFile(); + if (mInstialize) + { + initialize(); + mInstialize = false; + } + q_currentIndexChanged(mSelectedScope); setActionVisibility(); popup->show(); } @@ -169,20 +373,12 @@ noItemSelected = false; } } - for (int i = 0; i < mInternetCheckBoxList.count(); i++) + for (int i = 0; i < mActions.count(); i++) + popup->removeAction(mActions.at(i)); + popup->addActions(mActions); + if (noItemSelected) { - if (mInternetCheckBoxList.at(i)->checkState() == Qt::Checked) - { - noItemSelected = false; - } - } - if (!noItemSelected) - { - popup->primaryAction()->setVisible(true); - } - else - { - popup->primaryAction()->setVisible(false); + popup->removeAction(mActions.at(0)); } } //---------------------------------------------------------------------------------------------------------------------------- @@ -191,106 +387,55 @@ //---------------------------------------------------------------------------------------------------------------------------- void SettingsWidget::itemChecked(int selectedIndex) { - int totalcount = deviceCategoryList.count() - + internetCategoryList.count(); - - if (selectedIndex == 0) // validating the parent category "devices" + if (mDeviceCheckBoxList.count() != 0) { - if ((mDeviceCheckBoxList.at(selectedIndex)->checkState() - == Qt::Checked)) - { - isInternetSelected = false; - checkSubCategories(0); - unCheckSubCategories(0); - } - else + if (selectedIndex == 0 && mchangestate) // validating the select all { - unCheckSubCategories(1); - } - setActionVisibility(); - return; - } - else if (selectedIndex == deviceCategoryList.count())// validating the parent category "internet" - { - if (mInternetCheckBoxList.at(selectedIndex - - deviceCategoryList.count())->checkState() == Qt::Checked) - { - isInternetSelected = true; - checkSubCategories(1); - unCheckSubCategories(1); + if ((mDeviceCheckBoxList.at(selectedIndex)->checkState() + == Qt::Checked)) + { + checkSubCategories(); + } + else + { + unCheckSubCategories(); + } } else { - unCheckSubCategories(0); - } - setActionVisibility(); - return; - } - if (selectedIndex < deviceCategoryList.count())// validating the sub categories under "devices" - { - if (mDeviceCheckBoxList.at(selectedIndex)->checkState() - == Qt::Checked) - { - isInternetSelected = false; - unCheckSubCategories(0); - + if ((mDeviceCheckBoxList.at(selectedIndex)->checkState() + == Qt::Unchecked)) + { + mchangestate = false; + mDeviceCheckBoxList.at(0)->setCheckState(Qt::Unchecked); + setActionVisibility(); + return; + } } } - else // validating the sub categories under "internet" - { - int curentindex = (selectedIndex + internetCategoryList.count()) - - (deviceCategoryList.count() + internetCategoryList.count()); - - if (mInternetCheckBoxList.at(curentindex)->checkState() - == Qt::Checked) - { - isInternetSelected = true; - unCheckSubCategories(1); - //return; - } - } + mchangestate = true; setActionVisibility(); } //---------------------------------------------------------------------------------------------------------------------------- -//SettingsWidget::check(int checkSubCategory) +//SettingsWidget::checkSubCategories // //---------------------------------------------------------------------------------------------------------------------------- -void SettingsWidget::checkSubCategories(int checkSubCategory) +void SettingsWidget::checkSubCategories() { - if (checkSubCategory == 0) + for (int i = 0; i < mDeviceCheckBoxList.count(); i++) { - for (int i = 0; i < mDeviceCheckBoxList.count(); i++) - { - mDeviceCheckBoxList.at(i)->setCheckState(Qt::Checked); - } - } - else - { - for (int i = 0; i < mInternetCheckBoxList.count(); i++) - { - mInternetCheckBoxList.at(i)->setCheckState(Qt::Checked); - } + mDeviceCheckBoxList.at(i)->setCheckState(Qt::Checked); } } //---------------------------------------------------------------------------------------------------------------------------- -//SettingsWidget::unCheckSubCategories(int unCheckSubCategory) +//SettingsWidget::unCheckSubCategories // //---------------------------------------------------------------------------------------------------------------------------- -void SettingsWidget::unCheckSubCategories(int unCheckSubCategory) +void SettingsWidget::unCheckSubCategories() { - if (unCheckSubCategory == 0) + for (int i = 0; i < mDeviceCheckBoxList.count(); i++) { - for (int i = 0; i < mInternetCheckBoxList.count(); i++) - { - mInternetCheckBoxList.at(i)->setCheckState(Qt::Unchecked); - } - } - else - { - for (int i = 0; i < mDeviceCheckBoxList.count(); i++) - { - mDeviceCheckBoxList.at(i)->setCheckState(Qt::Unchecked); - } + mDeviceCheckBoxList.at(i)->setCheckState(Qt::Unchecked); } } //---------------------------------------------------------------------------------------------------------------------------- @@ -299,7 +444,7 @@ //---------------------------------------------------------------------------------------------------------------------------- void SettingsWidget::checkBoxCancelEvent() { - loadSettingsFrominiFile();//bug fix for cancel event selection should not reflect "go" button + // loadDeviceSettings();//bug fix for cancel event selection should not reflect "go" button emit settingsEvent(false); } //---------------------------------------------------------------------------------------------------------------------------- @@ -319,82 +464,112 @@ void SettingsWidget::storeSettingsToiniFile() { - QSettings appSettings("Search.ini", QSettings::IniFormat); - - appSettings.setValue("DeviceCount", mDeviceCheckBoxList.count()); - for (int i = 0; i < mDeviceCheckBoxList.count(); i++) + QSettings appSettings("search.ini", QSettings::IniFormat); + appSettings.setValue("selectedcategory", mSelectedScope); + appSettings.setValue("devicecount", mDeviceCategoryRefList.count()); + if (!isInternetSelected) { - if (mDeviceCheckBoxList.at(i)->checkState() == Qt::Checked) + int j = 0; + for (int i = 0; i < mDeviceCategoryRefList.count(); i++) { - appSettings.setValue(mDeviceCheckBoxList.at(i)->text(), 1); - emit selectedItemCategory(i, true); - } - else - { - appSettings.setValue(mDeviceCheckBoxList.at(i)->text(), 0); - emit selectedItemCategory(i, false); + if (mDeviceMapping.at(i)) + { + if (mDeviceCheckBoxList.at(j)->checkState() == Qt::Checked) + { + appSettings.setValue(mDeviceCategoryRefList.at(i), 1); + emit selectedItemCategory(i, true); + } + else + { + appSettings.setValue(mDeviceCategoryRefList.at(i), 0); + emit selectedItemCategory(i, false); + } + j++; + } + else + { + appSettings.setValue(mDeviceCategoryRefList.at(i), 0); + emit selectedItemCategory(i, false); + } + } } - // int totalcount = i; - appSettings.setValue("InternetCount", mInternetCheckBoxList.count()); - for (int i = 0; i < mInternetCheckBoxList.count(); i++) + appSettings.setValue("internetcount", internetCategoryList.count()); + appSettings.setValue("selectedprovider", mSelectedProvider); + } +//---------------------------------------------------------------------------------------------------------------------------- +//void SettingsWidget::loadBaseSettings() +// +//---------------------------------------------------------------------------------------------------------------------------- +void SettingsWidget::loadBaseSettings() + { + QSettings appSettings("search.ini", QSettings::IniFormat); + int value; + if (!(appSettings.contains("selectedcategory"))) { - if (mInternetCheckBoxList.at(i)->checkState() == Qt::Checked) - { - appSettings.setValue(mInternetCheckBoxList.at(i)->text(), 1); - // emit selectedcategory(totalcount,true); - } - else - { - appSettings.setValue(mInternetCheckBoxList.at(i)->text(), 0); - //emit selectedcategory(totalcount,false); - } - // totalcount++; + value = 0; + } + else + { + value = appSettings.value("selectedcategory").toInt(); } + mSelectedScope = value; + if (mSelectedScope) + { + isInternetSelected = true; + } + else + { + isInternetSelected = false; + } + mSelectedProvider = appSettings.value("selectedprovider").toInt(); } //---------------------------------------------------------------------------------------------------------------------------- -//void SettingsWidget::loadSettingsFrominiFile() +//void SettingsWidget::loadDeviceSettings() // //---------------------------------------------------------------------------------------------------------------------------- - -void SettingsWidget::loadSettingsFrominiFile() +void SettingsWidget::loadDeviceSettings() { - enableDefaultSettings(); - isInternetSelected = false; - QSettings appSettings("Search.ini", QSettings::IniFormat); - int ret = 0; - for (int i = 0; i < mDeviceCheckBoxList.count(); i++) + QSettings appSettings("search.ini", QSettings::IniFormat); + int value; + if (!isInternetSelected) { - ret = appSettings.value(mDeviceCheckBoxList.at(i)->text()).toInt(); - if (ret) + int j = 0; + for (int i = 0; i < mDeviceCategoryRefList.count(); i++) { - mDeviceCheckBoxList.at(i)->setCheckState(Qt::Checked); - emit selectedItemCategory(i, true); - } - else - { - mDeviceCheckBoxList.at(i)->setCheckState(Qt::Unchecked); - emit selectedItemCategory(i, false); + if (!(appSettings.contains(mDeviceCategoryRefList.at(i)))) + { + value = 1; + } + else + { + value + = appSettings.value(mDeviceCategoryRefList.at(i)).toInt(); + } + if (mDeviceMapping.count() && mDeviceCheckBoxList.count() + && mDeviceMapping.at(i)) + { + if (value) + { + mDeviceCheckBoxList.at(j)->setCheckState(Qt::Checked); + } + else + { + mDeviceCheckBoxList.at(j)->setCheckState(Qt::Unchecked); + } + j++; + } + if (value) // get the setting before ui preparation + { + emit selectedItemCategory(i, true); + } + else + { + emit selectedItemCategory(i, false); + } } } - for (int i = 0; i < mInternetCheckBoxList.count(); i++) - { - - ret = appSettings.value(mInternetCheckBoxList.at(i)->text()).toInt(); - if (ret) - { - isInternetSelected = true; - mInternetCheckBoxList.at(i)->setCheckState(Qt::Checked); - // emit selectedcategory(mInternetCheckBoxList.at(i)->text(),true); - } - else - { - mInternetCheckBoxList.at(i)->setCheckState(Qt::Unchecked); - // emit selectedcategory(mInternetCheckBoxList.at(i)->text(),false); - } - } - } //---------------------------------------------------------------------------------------------------------------------------- //SettingsWidget::isInternetSearchOptionSelected() @@ -402,50 +577,26 @@ //---------------------------------------------------------------------------------------------------------------------------- bool SettingsWidget::isInternetSearchOptionSelected() { + loadBaseSettings(); return isInternetSelected; } + //---------------------------------------------------------------------------------------------------------------------------- -//void SettingsWidget::changeDeviceInternetCheck() +//void SettingsWidget::storeDefaultSettings() // //---------------------------------------------------------------------------------------------------------------------------- -void SettingsWidget::changeDeviceInternetCheck() +void SettingsWidget::storeDefaultSettings() { - if (isInternetSearchOptionSelected() == true) + QSettings appSettings("search.ini", QSettings::IniFormat); + if (!appSettings.contains("selectedcategory")) // change the settings for the first time only { - mDeviceCheckBoxList.at(0)->setCheckState(Qt::Checked); - + mSelectedScope = 0; + mSelectedProvider = 0; + appSettings.setValue("selectedcategory", mSelectedScope); + appSettings.setValue("devicecount", mDeviceCategoryRefList.count()); + for (int i = 0; i < mDeviceCategoryRefList.count(); i++) + appSettings.setValue(mDeviceCategoryRefList.at(i), 1); + appSettings.setValue("internetcount", internetCategoryList.count()); + appSettings.setValue("selectedprovider", mSelectedProvider); } - else - - { - - mInternetCheckBoxList.at(0)->setCheckState(Qt::Checked); - - } - - emit settingsChanged(); } -//---------------------------------------------------------------------------------------------------------------------------- -//void SettingsWidget::enableDefaultSettings() -// -//---------------------------------------------------------------------------------------------------------------------------- -void SettingsWidget::enableDefaultSettings() - { - QSettings appSettings("Search.ini", QSettings::IniFormat); - if (!appSettings.contains("DeviceCount")) // change the settings for the first time only - { - appSettings.setValue("DeviceCount", mDeviceCheckBoxList.count()); - for (int i = 0; i < mDeviceCheckBoxList.count(); i++) - { - // mDeviceCheckBoxList.at(i)->setCheckState(Qt::Checked); - appSettings.setValue(mDeviceCheckBoxList.at(i)->text(), 1); - } - for (int i = 0; i < mInternetCheckBoxList.count(); i++) - { - //mInternetCheckBoxList.at(i)->setCheckState(Qt::Unchecked); - appSettings.setValue(mInternetCheckBoxList.at(i)->text(), 0); - } - // storeSettingsToiniFile(); - } - - } diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/inc/t_searchstateprovider.h --- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/inc/t_searchstateprovider.h Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/inc/t_searchstateprovider.h Mon May 03 12:32:15 2010 +0300 @@ -45,15 +45,12 @@ void testCreateProgressiveState(); void testCreateSettingsState(); void testCreateinitState(); - void testCreateInvalidState(); - - /** + /** * t_searchprogressivestate.cpp */ void testProgressiveStateConstruction(); void testProgressiveStateOnEntryAndExitSignalled(); - void testonSearchComplete(); void testonAsyncSearchComplete(); void testonGetDocumentComplete(); void testgetSettingCategory(); @@ -63,10 +60,15 @@ void testclear(); void testsearchOnCategory(); void teststartNewSearch(); - void testsetHistory(); void testsetSettings(); - void testaboutToCloseView(); void test_CustomizeGoButton(); + void testgetAppIconFromAppId(); + void testsettingsaction(); + void testcancelsearch(); + void testhandleokanderror(); + void testTDisplayMode2Format(); + void testsetSelectedCategories(); + void testfilterdoc(); /** * t_searchsettingsstate.cpp @@ -87,20 +89,25 @@ */ void testsettingswizardConstruction(); - void testenableDefaultSettings(); + void teststoreDefaultSettings(); void teststoreSettingsToiniFile(); - void testloadSettingsFrominiFile(); - + void testloadDeviceSettings(); + void testloadBaseSettings(); void testlaunchSettingWidget(); void testisInternetSearchOptionSelected(); void testunCheckSubCategories(); void testcheckSubCategories(); - void testsetActionVisibility(); - + void testcheckBoxOkEvent(); void testcheckBoxCancelEvent(); void testitemChecked(); - void testchangeDeviceInternetCheck(); + void testcreateGui(); + void testpreparecategories(); + void testq_currentIndexChanged(); + + void selectedItemCategory(); + + /* void testOnWizardAddedSignalledNoWizardInCS(); void testProgressUpdated(); @@ -117,7 +124,7 @@ * @return True if state was created successfully, false otherwise. * @since S60 ?S60_version. */ - bool verifyStateCreation(const QString& library, const QString& uri); + bool verifyStateCreation(const QString& uri); /** * Helper method testing existence of state diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchprogressivestate.cpp --- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchprogressivestate.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchprogressivestate.cpp Mon May 03 12:32:15 2010 +0300 @@ -19,13 +19,24 @@ #include #include "indevicehandler.h" #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void SearchStateProviderTest::testProgressiveStateConstruction() { - // HbMainWindow* wind = mainWindow(); + // HbMainWindow* wind = mainWindow(); SearchProgressiveState* progressiveState = new SearchProgressiveState(); @@ -35,12 +46,11 @@ QVERIFY(progressiveState->mDocumentLoader); QVERIFY(progressiveState->mSearchPanel); QVERIFY(progressiveState->mModel); - QVERIFY(progressiveState->mSearchHandler); + //QVERIFY(progressiveState->mSearchHandler); delete progressiveState; - - // delete wind; + // delete wind; } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- @@ -48,7 +58,7 @@ void SearchStateProviderTest::testProgressiveStateOnEntryAndExitSignalled() { -// HbMainWindow* wind = mainWindow(); + // HbMainWindow* wind = mainWindow(); SearchProgressiveState* progressiveState = new SearchProgressiveState(); @@ -58,119 +68,93 @@ progressiveState->onExit(event); delete progressiveState; - - // delete wind; + + // delete wind; } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // -void SearchStateProviderTest::testonSearchComplete() + +void SearchStateProviderTest::testonAsyncSearchComplete() { -// HbMainWindow* wind = mainWindow(); + // HbMainWindow* wind = mainWindow(); SearchProgressiveState* progressiveState = new SearchProgressiveState(); QEvent *event = new QEvent(QEvent::None); progressiveState->onEntry(event); - progressiveState->onSearchComplete(-1, 0); - QCOMPARE(progressiveState->mResultcount,0); - progressiveState->onSearchComplete(0, -1); - QCOMPARE(progressiveState->mResultcount,0); - progressiveState->onSearchComplete(0, 10); - QCOMPARE(progressiveState->mResultcount,10); - delete progressiveState; - // delete wind; - } -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// - -void SearchStateProviderTest::testonAsyncSearchComplete() - { - // HbMainWindow* wind = mainWindow(); - SearchProgressiveState* progressiveState = new SearchProgressiveState(); - QEvent *event = new QEvent(QEvent::None); - progressiveState->onEntry(event); - + progressiveState->mSearchHandler + = progressiveState->mSearchHandlerList.at(1); progressiveState->onAsyncSearchComplete(-1, 10); QCOMPARE(progressiveState->mResultcount,0); progressiveState->onAsyncSearchComplete(0, -1); QCOMPARE(progressiveState->mResultcount,0); - - progressiveState->onAsyncSearchComplete(0, 10); - QCOMPARE(progressiveState->mResultcount,10); + progressiveState->mSearchHandler->searchAsync("a", "_aggregate"); + QTest::qWait(100); + //QCOMPARE(progressiveState->mResultcount,10); delete progressiveState; - // delete wind; + // delete wind; } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void SearchStateProviderTest::testonGetDocumentComplete() { -// HbMainWindow* wind = mainWindow(); + // HbMainWindow* wind = mainWindow(); SearchProgressiveState* progressiveState = new SearchProgressiveState(); QEvent *event = new QEvent(QEvent::None); + + progressiveState->mSelectedCategory.insert(1, true); progressiveState->onEntry(event); - + // progressiveState->mSearchHandler = progressiveState->mSearchHandlerList.at(1); progressiveState->onGetDocumentComplete(0, NULL); QCOMPARE(progressiveState->mModel->rowCount(),0); progressiveState->onGetDocumentComplete(-1, NULL); QCOMPARE(progressiveState->mModel->rowCount(),0); - + progressiveState->startNewSearch("a"); + QTest::qWait(2000); + int i =progressiveState->mModel->rowCount(); + QVERIFY(progressiveState->mModel->rowCount()); delete progressiveState; - // delete wind; + // delete wind; } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void SearchStateProviderTest::testgetSettingCategory() { -// HbMainWindow* wind = mainWindow(); + // HbMainWindow* wind = mainWindow(); SearchProgressiveState* progressiveState = new SearchProgressiveState(); QEvent *event = new QEvent(QEvent::None); progressiveState->onEntry(event); + progressiveState->getSettingCategory(3, true); QCOMPARE(progressiveState->mSelectedCategory.count(),1); delete progressiveState; - // delete wind; + // delete wind; } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void SearchStateProviderTest::testopenResultitem() { -// HbMainWindow* wind = mainWindow(); - SearchProgressiveState* progressiveState = new SearchProgressiveState(); + // HbMainWindow* wind = mainWindow(); + SearchProgressiveState* progressiveState = new SearchProgressiveState(); QEvent *event = new QEvent(QEvent::None); - progressiveState->onEntry(event); + progressiveState->mSelectedCategory.insert(1, true); + progressiveState->onEntry(event); progressiveState->startNewSearch("a"); - QTest::qWait(200); + QTest::qWait(100); + progressiveState->cancelSearch(); //code for getting the model index from model - QModelIndex index = progressiveState->mModel->index(1, 0, QModelIndex()); + QModelIndex index = progressiveState->mModel->index(0, 0); progressiveState->openResultitem(index); delete progressiveState; - /*// delete wind; - - { - SearchProgressiveState* progressiveState = - new SearchProgressiveState(); - QEvent *event = new QEvent(QEvent::None); - progressiveState->onEntry(event); - progressiveState->mSelectedCategory.insert(3, true); - progressiveState->startNewSearch("a"); - QTest::qWait(200); - //code for getting the model index from model - QModelIndex index = progressiveState->mModel->index(1, 0, - QModelIndex()); - progressiveState->openResultitem(index); - - //to do - delete progressiveState; - } -*/ } + // delete wind; + } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // @@ -181,12 +165,9 @@ progressiveState->onEntry(event); progressiveState->createSuggestionLink(true); - // QModelIndex index = progressiveState->mModel->index(0, 0, QModelIndex()); - // progressiveState->openResultitem(index); - - //progressiveState->createSuggestionLink(false); - //QCOMPARE(progressiveState->mModel->rowCount(),0); - + QCOMPARE(progressiveState->mModel->rowCount(), 0); + progressiveState->createSuggestionLink(false); + QCOMPARE(progressiveState->mModel->rowCount(), 1); delete progressiveState; } // --------------------------------------------------------------------------- @@ -236,24 +217,12 @@ { SearchProgressiveState* progressiveState = new SearchProgressiveState(); QEvent *event = new QEvent(QEvent::None); + progressiveState->mSelectedCategory.insert(1, true); progressiveState->onEntry(event); - progressiveState->mSelectedCategory.insert(6, true); - progressiveState->startNewSearch("sample"); + progressiveState->startNewSearch("a"); delete progressiveState; } -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -void SearchStateProviderTest::testsetHistory() - { - SearchProgressiveState* progressiveState = new SearchProgressiveState(); - QEvent *event = new QEvent(QEvent::None); - progressiveState->onEntry(event); - QSignalSpy spy(progressiveState, SIGNAL(historyState())); - // progressiveState->setHistory(); - QCOMPARE(spy.count(), 1); - delete progressiveState; - } + // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // @@ -267,28 +236,129 @@ QCOMPARE(spy.count(), 1); delete progressiveState; } + +void SearchStateProviderTest::test_CustomizeGoButton() + { + SearchProgressiveState* progressiveState = new SearchProgressiveState(); + QEvent *event = new QEvent(QEvent::None); + progressiveState->onEntry(event); + progressiveState->_customizeGoButton(true); + QVERIFY(!(progressiveState->mSearchPanel->isProgressive())); + progressiveState->_customizeGoButton(false); + QVERIFY(progressiveState->mSearchPanel->isProgressive()); + delete progressiveState; + } + +void SearchStateProviderTest::testgetAppIconFromAppId() + { + + SearchProgressiveState* progressiveState = new SearchProgressiveState(); + QEvent *event = new QEvent(QEvent::None); + progressiveState->onEntry(event); + for (int i = 0; i < progressiveState->mIconArray.count(); i++) + { + QVERIFY(!(progressiveState->mIconArray.at(i).isNull())); + } + progressiveState->mIconArray.clear(); + delete progressiveState; + } + // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // -void SearchStateProviderTest::testaboutToCloseView() +void SearchStateProviderTest::testsettingsaction() + { + SearchProgressiveState* progressiveState = new SearchProgressiveState(); + QEvent *event = new QEvent(QEvent::None); + progressiveState->onEntry(event); + progressiveState->getSettingCategory(5, true); + progressiveState->mOriginalString = "a"; + progressiveState->settingsaction(false); + QCOMPARE(progressiveState->mResultcount, 0); + progressiveState->settingsaction(true); + QTest::qWait(50); + progressiveState->cancelSearch(); + QCOMPARE(progressiveState->mResultcount, 0); + delete progressiveState; + } +// --------------------------------------------------------------------------- +//SearchStateProviderTest::testcancelsearch() +// --------------------------------------------------------------------------- +// +void SearchStateProviderTest::testcancelsearch() { SearchProgressiveState* progressiveState = new SearchProgressiveState(); QEvent *event = new QEvent(QEvent::None); progressiveState->onEntry(event); - //progressiveState->aboutToCloseView(); + progressiveState->getSettingCategory(5, true); + progressiveState->startNewSearch("a"); + progressiveState->cancelSearch(); + delete progressiveState; + + } +void SearchStateProviderTest::testhandleokanderror() + { + SearchProgressiveState* progressiveState = new SearchProgressiveState(); + QEvent *event = new QEvent(QEvent::None); + progressiveState->onEntry(event); + QVariant var; + progressiveState->handleOk(var); + int ret = 0; + progressiveState->handleError(ret, QString()); + delete progressiveState; + } +void SearchStateProviderTest::testTDisplayMode2Format() + { + SearchProgressiveState* progressiveState = new SearchProgressiveState(); + QEvent *event = new QEvent(QEvent::None); + progressiveState->onEntry(event); + TDisplayMode mode = EGray2; + progressiveState->TDisplayMode2Format(mode); + mode = EColor256; + progressiveState->TDisplayMode2Format(mode); + mode = EGray256; + progressiveState->TDisplayMode2Format(mode); + mode = EColor4K; + progressiveState->TDisplayMode2Format(mode); + mode = EColor64K; + progressiveState->TDisplayMode2Format(mode); + mode = EColor16M; + progressiveState->TDisplayMode2Format(mode); + mode = EColor16MU; + progressiveState->TDisplayMode2Format(mode); + mode = EColor16MA; + progressiveState->TDisplayMode2Format(mode); + mode = EColor16MAP; + progressiveState->TDisplayMode2Format(mode); + mode = ENone; + progressiveState->TDisplayMode2Format(mode); + + delete progressiveState; + } +void SearchStateProviderTest::testsetSelectedCategories() + { + SearchProgressiveState* progressiveState = new SearchProgressiveState(); + QEvent *event = new QEvent(QEvent::None); + progressiveState->onEntry(event); + progressiveState->getSettingCategory(0, true); + progressiveState->getSettingCategory(1, true); + progressiveState->getSettingCategory(2, true); + progressiveState->getSettingCategory(3, true); + progressiveState->getSettingCategory(4, true); + progressiveState->getSettingCategory(5, true); + progressiveState->getSettingCategory(6, true); + progressiveState->getSettingCategory(7, true); + progressiveState->setSelectedCategories(); delete progressiveState; } -void SearchStateProviderTest::test_CustomizeGoButton() +void SearchStateProviderTest::testfilterdoc() { - - SearchProgressiveState* progressiveState = new SearchProgressiveState(); - progressiveState->_customizeGoButton(true); - progressiveState->_customizeGoButton(false); - //QEvent *event = new QEvent(QEvent::None); - // progressiveState->onEntry(event); - // progressiveState->aboutToCloseView(); - delete progressiveState; - + + SearchProgressiveState* progressiveState = new SearchProgressiveState(); + QEvent *event = new QEvent(QEvent::None); + progressiveState->onEntry(event); + progressiveState->filterDoc(NULL,"Name"); + delete progressiveState; + } - diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchstateprovider.cpp --- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchstateprovider.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_searchstateprovider.cpp Mon May 03 12:32:15 2010 +0300 @@ -16,7 +16,7 @@ */ #include "t_searchstateprovider.h" -#include "searchruntimeprovider.h" +//#include "searchruntimeprovider.h" #include "searchstateprovider.h" #include @@ -43,7 +43,7 @@ // SearchStateProviderTest::~SearchStateProviderTest() { - + delete mMainWindow; } // --------------------------------------------------------------------------- @@ -78,7 +78,7 @@ { SearchStateProvider provider; - QVERIFY(provider.mWizardMenuStateToken.mLibrary == "searchstateprovider.dll"); + /* QVERIFY(provider.mWizardMenuStateToken.mLibrary == "searchstateprovider.dll"); QVERIFY(provider.mWizardMenuStateToken.mUri == "search.nokia.com/state/wizardprogressivestate"); QVERIFY(provider.mWizardActivatedStateToken.mLibrary == "searchstateprovider.dll"); @@ -86,22 +86,22 @@ QVERIFY(provider.mInitStateToken.mLibrary == "searchstateprovider.dll"); QVERIFY(provider.mInitStateToken.mUri == "search.nokia.com/state/initstate"); - } + */ } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void SearchStateProviderTest::testStates() { - SearchStateProvider provider; - QList states = provider.states(); + /* SearchStateProvider provider; + QList states = provider.states(); QCOMPARE(states.count(), 3); QVERIFY(findStateInStateList(states, "searchstateprovider.dll","search.nokia.com/state/wizardprogressivestate")); QVERIFY(findStateInStateList(states, "searchstateprovider.dll","search.nokia.com/state/wizardsettingstate")); QVERIFY(findStateInStateList(states, "searchstateprovider.dll","search.nokia.com/state/initstate")); - } + */ } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- @@ -109,7 +109,7 @@ void SearchStateProviderTest::testCreateProgressiveState() { - QVERIFY(verifyStateCreation("searchstateprovider.dll", "search.nokia.com/state/wizardprogressivestate")); + QVERIFY(verifyStateCreation("search.nokia.com/state/wizardprogressivestate")); // delete wind; } // --------------------------------------------------------------------------- @@ -118,7 +118,7 @@ void SearchStateProviderTest::testCreateSettingsState() { //HbMainWindow* wind = mainWindow(); - QVERIFY(verifyStateCreation("searchstateprovider.dll", "search.nokia.com/state/wizardsettingstate")); + QVERIFY(verifyStateCreation("search.nokia.com/state/wizardsettingstate")); // delete wind; } // --------------------------------------------------------------------------- @@ -127,30 +127,18 @@ void SearchStateProviderTest::testCreateinitState() { //HbMainWindow* wind = mainWindow(); - QVERIFY(verifyStateCreation("searchstateprovider.dll", "search.nokia.com/state/initstate")); + QVERIFY(verifyStateCreation("search.nokia.com/state/initstate")); // delete wind; } + // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // -void SearchStateProviderTest::testCreateInvalidState() +bool SearchStateProviderTest::verifyStateCreation(const QString& uri) { - QVERIFY(!verifyStateCreation("searchstateprovider.dll", "invalid uri")); - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -bool SearchStateProviderTest::verifyStateCreation(const QString& library, - const QString& uri) - { - - SearchStateProvider provider; - HsStateToken token; - token.mLibrary = library; - token.mUri = uri; - QState* state = provider.createState(token); + SearchStateProvider provider; + QState* state = provider.createState(uri); bool result = (state != NULL); if (state) { @@ -205,5 +193,5 @@ return error; } #else //Q_OS_SYMBIAN -//QTEST_MAIN(SearchStateProviderTest) +QTEST_MAIN(SearchStateProviderTest) #endif //Q_OS_SYMBIAN diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_settingswidget.cpp --- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_settingswidget.cpp Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/src/t_settingswidget.cpp Mon May 03 12:32:15 2010 +0300 @@ -24,7 +24,7 @@ #include #include #include - +#include // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // @@ -45,13 +45,18 @@ { SettingsWidget* settingswizard = new SettingsWidget(); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + settingswizard->q_currentIndexChanged(0); + for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++) (settingswizard->mDeviceCheckBoxList.at(i))->setCheckState( Qt::Unchecked); settingswizard->storeSettingsToiniFile(); - settingswizard->loadSettingsFrominiFile(); + settingswizard->loadDeviceSettings(); for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++) QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Unchecked); @@ -60,29 +65,48 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // -void SearchStateProviderTest::testloadSettingsFrominiFile() +void SearchStateProviderTest::testloadDeviceSettings() { SettingsWidget* settingswizard = new SettingsWidget(); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + settingswizard->initialize(); + + settingswizard->q_currentIndexChanged(0); + for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++) (settingswizard->mDeviceCheckBoxList.at(i))->setCheckState( Qt::Checked); settingswizard->storeSettingsToiniFile(); - settingswizard->loadSettingsFrominiFile(); + settingswizard->loadDeviceSettings(); + for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++) QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked); delete settingswizard; } +void SearchStateProviderTest::testloadBaseSettings() + { + SettingsWidget* settingswizard = new SettingsWidget(); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + QCOMPARE(settingswizard->mSelectedScope,0); + delete settingswizard; + } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // void SearchStateProviderTest::testlaunchSettingWidget() { SettingsWidget* settingswizard = new SettingsWidget(); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + settingswizard->q_currentIndexChanged(0); settingswizard->launchSettingWidget(); - // QVERIFY(settingswizard->popup->isActive()); delete settingswizard; @@ -90,6 +114,7 @@ void SearchStateProviderTest::testisInternetSearchOptionSelected() { SettingsWidget* settingswizard = new SettingsWidget(); + settingswizard->initialize(); settingswizard->isInternetSelected = false; QCOMPARE(settingswizard->isInternetSearchOptionSelected(),false); @@ -99,10 +124,15 @@ void SearchStateProviderTest::testunCheckSubCategories() { SettingsWidget* settingswizard = new SettingsWidget(); - settingswizard->checkSubCategories(0); - settingswizard->unCheckSubCategories(0); + settingswizard->initialize(); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + settingswizard->q_currentIndexChanged(0); + settingswizard->mDeviceCheckBoxList.at(0)->setCheckState(Qt::Unchecked); + for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++) - QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked); + QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Unchecked); delete settingswizard; @@ -110,31 +140,33 @@ void SearchStateProviderTest::testcheckSubCategories() { SettingsWidget* settingswizard = new SettingsWidget(); + settingswizard->initialize(); - settingswizard->unCheckSubCategories(0); - settingswizard->checkSubCategories(0); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + settingswizard->q_currentIndexChanged(0); + settingswizard->mDeviceCheckBoxList.at(0)->setCheckState(Qt::Checked); + for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++) QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked); delete settingswizard; } -void SearchStateProviderTest::testsetActionVisibility() - { - SettingsWidget* settingswizard = new SettingsWidget(); - settingswizard->mDeviceCheckBoxList.at(2)->setChecked(true); - settingswizard->setActionVisibility(); - QVERIFY(settingswizard->popup->primaryAction()->isVisible()); - delete settingswizard; - } -void SearchStateProviderTest::testenableDefaultSettings() +void SearchStateProviderTest::teststoreDefaultSettings() { QDir dir; - bool ret = dir.remove("Search.ini"); + bool ret = dir.remove("search.ini"); + SettingsWidget* settingswizard = new SettingsWidget(); - settingswizard->enableDefaultSettings(); - settingswizard->loadSettingsFrominiFile(); + settingswizard->initialize(); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + settingswizard->q_currentIndexChanged(0); + for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++) QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked); delete settingswizard; @@ -142,7 +174,13 @@ void SearchStateProviderTest::testcheckBoxOkEvent() { SettingsWidget* settingswizard = new SettingsWidget(); - QSignalSpy spy(settingswizard, SIGNAL(settingsEvent())); + + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + settingswizard->q_currentIndexChanged(0); + + QSignalSpy spy(settingswizard, SIGNAL(settingsEvent(bool))); settingswizard->checkBoxOkEvent(); QCOMPARE(spy.count(), 1); delete settingswizard; @@ -151,7 +189,12 @@ void SearchStateProviderTest::testcheckBoxCancelEvent() { SettingsWidget* settingswizard = new SettingsWidget(); - QSignalSpy spy(settingswizard, SIGNAL(settingsEvent())); + + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + settingswizard->q_currentIndexChanged(0); + QSignalSpy spy(settingswizard, SIGNAL(settingsEvent(bool))); settingswizard->checkBoxCancelEvent(); QCOMPARE(spy.count(), 1); delete settingswizard; @@ -160,26 +203,59 @@ void SearchStateProviderTest::testitemChecked() { SettingsWidget* settingswizard = new SettingsWidget(); - settingswizard->mDeviceCheckBoxList.at(0)->setChecked(2); - settingswizard->itemChecked(0); + settingswizard->initialize(); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + + settingswizard->q_currentIndexChanged(0); + + settingswizard->mDeviceCheckBoxList.at(0)->setCheckState(Qt::Unchecked); + for (int i = 0; i < settingswizard->mDeviceCheckBoxList.count(); i++) - QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Checked); + QCOMPARE(settingswizard->mDeviceCheckBoxList.at(i)->checkState(),Qt::Unchecked); delete settingswizard; } -void SearchStateProviderTest::testchangeDeviceInternetCheck() + +void SearchStateProviderTest::testpreparecategories() { - delete mMainWindow; SettingsWidget* settingswizard = new SettingsWidget(); - settingswizard->isInternetSelected = false; - QSignalSpy spy(settingswizard, SIGNAL(settingsChanged())); - settingswizard->changeDeviceInternetCheck(); - QCOMPARE(settingswizard->mInternetCheckBoxList.at(0)->checkState(), Qt::Checked); - - QCOMPARE(spy.count(),1); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + settingswizard->preparecategories(); + QVERIFY(settingswizard->mDeviceListDisplay.count()); delete settingswizard; } +void SearchStateProviderTest::testq_currentIndexChanged() + { + SettingsWidget* settingswizard = new SettingsWidget(); + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + settingswizard->initialize(); + + settingswizard->q_currentIndexChanged(0); + settingswizard->q_currentIndexChanged(1); + delete settingswizard; + } +void SearchStateProviderTest::selectedItemCategory() + { + SettingsWidget* settingswizard = new SettingsWidget(); + + settingswizard->mCategoryDbMapping.insert("Contacts", true); + settingswizard->mCategoryDbMapping.insert("Messages", true); + settingswizard->q_currentIndexChanged(0); + QSignalSpy spy(settingswizard, SIGNAL(selectedItemCategory(int,bool))); + settingswizard->loadDeviceSettings(); + QVERIFY(spy.count()); + delete settingswizard; + } +void SearchStateProviderTest::testcreateGui() + { + SettingsWidget* settingswizard = new SettingsWidget(); + delete settingswizard; + } + diff -r ccd0fd43f247 -r 208a4ba3894c searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pro --- a/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pro Mon Apr 19 14:40:05 2010 +0300 +++ b/searchui/stateproviders/searchstateprovider/tsrc/t_searchstateprovider/t_searchstateprovider.pro Mon May 03 12:32:15 2010 +0300 @@ -16,7 +16,24 @@ TEMPLATE = app +DEFINES += BUILD_SEARCHSTATEPROVIDER +symbian { + CONFIG(debug, debug|release) { + DESTDIR = ./debug + } else { + DESTDIR = ./release + } +} + +win32 { + + LIBS += -L$$PWD/../../../../../bin/debug + + DESTDIR = $$PWD/../../../../../bin/debug/ +} + +#LIBS += -lappservices LIBS += -lstatemodel #LIBS += -searchstateprovider.dll #LIBS += -searchruntimeprovider.dll @@ -29,7 +46,10 @@ LIBS += -lapgrfx LIBS += -lbitgdi -CONFIG += qtestlib +CONFIG += qtestlib \ + symbian_test \ + debug_and_release \ + console CONFIG += hb QT += xml \ @@ -45,9 +65,8 @@ INCLUDEPATH += .\ ./inc \ ../../inc \ - ../../../../inc \ - ../../../../indevicehandler/inc \ - ../../../../runtimeproviders/searchruntimeprovider/inc + ../../../../inc \ + ../../../../indevicehandler/inc symbian { CONFIG += symbian_test TARGET.UID2 = 0x100039CE