diff -r 33ae025ac1e8 -r 2290317b9ec5 harvester/server/src/harvesterao.cpp --- a/harvester/server/src/harvesterao.cpp Mon May 03 12:55:01 2010 +0300 +++ b/harvester/server/src/harvesterao.cpp Fri May 14 16:38:28 2010 +0300 @@ -22,6 +22,7 @@ #include #include #include +#include using namespace ContentAccess; @@ -34,6 +35,7 @@ #include "harvesterdata.h" #include "ondemandao.h" #include "harvestercommon.h" +#include "mdscommoninternal.h" #include "processoriginmapperinterface.h" #include "mdeobjecthandler.h" #include "harvestereventmanager.h" @@ -79,6 +81,7 @@ iOriginPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty ); iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty ); + iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder ); CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject ); iPreinstalledPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KPreinstalledProperty ); @@ -216,6 +219,15 @@ delete iPropDefs; delete iCameraExtensionArray; + delete iPhoneImagesPath; + delete iMmcImagesPath; + + delete iPhoneVideosPath; + delete iMmcVideosPath; + + delete iPhoneSoundsPath; + delete iMmcSoundsPath; + RMediaIdUtil::ReleaseInstance(); REComSession::FinalClose(); @@ -272,7 +284,40 @@ iCameraExtensionArray->InsertIsqL( KExtension3gp ); iCameraExtensionArray->InsertIsqL( KExtension3gpp ); iCameraExtensionArray->InsertIsqL( KExtension3g2 ); - + + TFileName phoneRoot = PathInfo::PhoneMemoryRootPath(); + TFileName mmcRoot = PathInfo::MemoryCardRootPath(); + + TFileName images = PathInfo::ImagesPath(); + + TFileName phoneImagePath( phoneRoot ); + phoneImagePath.Append( images ); + iPhoneImagesPath = phoneImagePath.AllocL(); + + TFileName mmcImagePath( mmcRoot ); + mmcImagePath.Append( images ); + iMmcImagesPath = mmcImagePath.Right( mmcImagePath.Length() - 1 ).AllocL(); + + TFileName videos = PathInfo::VideosPath(); + + TFileName phoneVideoPath( phoneRoot ); + phoneVideoPath.Append( videos ); + iPhoneVideosPath = phoneVideoPath.AllocL(); + + TFileName mmcVideoPath( mmcRoot ); + mmcVideoPath.Append( videos ); + iMmcVideosPath = mmcVideoPath.Right( mmcVideoPath.Length() - 1 ).AllocL(); + + TFileName sounds = PathInfo::SoundsPath(); + + TFileName phoneSoundPath( phoneRoot ); + phoneSoundPath.Append( sounds ); + iPhoneSoundsPath = phoneSoundPath.AllocL(); + + TFileName mmcSoundPath( mmcRoot ); + mmcSoundPath.Append( sounds ); + iMmcSoundsPath = mmcSoundPath.Right( mmcSoundPath.Length() - 1 ).AllocL(); + WRITELOG( "CHarvesterAO::ConstructL() - end" ); } @@ -780,8 +825,6 @@ TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); - TInt fastHarvestPlaceholderCount = 0; - TInt endindex( iPHArray.Count() ); for( TInt i = 0; i < endindex; i++ ) { @@ -846,6 +889,7 @@ iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); CleanupStack::PopAndDestroy( entry ); CleanupStack::PopAndDestroy( phData ); + CleanupStack::PopAndDestroy( mdeObject ); continue; } phData->SetUri( uri ); @@ -872,6 +916,7 @@ i--; endindex--; iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, 1 ); + CleanupStack::PopAndDestroy( mdeObject ); continue; } CleanupStack::PushL( phData ); @@ -912,6 +957,16 @@ mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, KUndefinedMime ); } + if( hd->Origin() == MdeConstants::Object::ECamera ) + { + TBool inDefaultFolder( ETrue ); + mdeObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder ); + } + else + { + AddDefaultFolderDataL( mdeObject ); + } + TPtrC name; TBool nameFound = MdsUtils::GetName( hd->Uri(), name ); @@ -946,7 +1001,6 @@ // skip if( hd->TakeSnapshot() ) { - fastHarvestPlaceholderCount++; hd->SetObjectType( EFastHarvest ); } else @@ -983,15 +1037,10 @@ iMdESession->AddObjectsL( mdeObjectArray ); } - const TInt eventObjectCount = objectCount - fastHarvestPlaceholderCount; - - if( eventObjectCount > 0 ) - { - iHarvesterEventManager->IncreaseItemCount( EHEObserverTypePlaceholder, - eventObjectCount ); - iHarvesterEventManager->SendEventL( EHEObserverTypePlaceholder, EHEStateStarted, - iHarvesterEventManager->ItemCount( EHEObserverTypePlaceholder ) ); - } + iHarvesterEventManager->IncreaseItemCount( EHEObserverTypePlaceholder, + objectCount ); + iHarvesterEventManager->SendEventL( EHEObserverTypePlaceholder, EHEStateStarted, + iHarvesterEventManager->ItemCount( EHEObserverTypePlaceholder ) ); #ifdef _DEBUG for (TInt i = 0; i < objectCount; ++i) @@ -2420,6 +2469,10 @@ WRITELOG("CHarvesterAO::HarvestingCompleted() NOT COMPLETING AS msg->iMessage->IsNull returns ETrue"); } iHarvestFileMessages.Remove( i ); + if( iHarvestFileMessages.Count() == 0 ) + { + iHarvestFileMessages.Compress(); + } } } } @@ -2457,7 +2510,7 @@ // check if partial restore was done before last boot TBool partialRestore = iRestoreWatcher->Register(); -#ifdef __WINSCW__ +#if defined(__WINSCW__) || defined(FF_PLATFORM_SIMULATOR) partialRestore = ETrue; #endif @@ -2838,3 +2891,60 @@ } } +void CHarvesterAO::AddDefaultFolderDataL( CMdEObject* aObject ) + { + TPtrC objectDefName( aObject->Def().Name() ); + if( objectDefName == MdeConstants::Image::KImageObject ) + { + const TDesC& uri = aObject->Uri(); + if( uri.FindF( iMmcImagesPath->Des()) != KErrNotFound || + uri.FindF( iPhoneImagesPath->Des()) != KErrNotFound || + uri.FindF( KDCIMFolder ) != KErrNotFound ) + { + TBool inDefaultFolder( ETrue ); + aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder ); + } + else + { + TBool inDefaultFolder( EFalse ); + aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder ); + } + } + else if( objectDefName == MdeConstants::Video::KVideoObject ) + { + const TDesC& uri = aObject->Uri(); + if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound || + uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound || + uri.FindF( KDCIMFolder ) != KErrNotFound ) + { + TBool inDefaultFolder( ETrue ); + aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder ); + } + else + { + TBool inDefaultFolder( EFalse ); + aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder ); + } + } + else if( objectDefName == MdeConstants::Audio::KAudioObject ) + { + const TDesC& uri = aObject->Uri(); + if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound || + uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound ) + { + TBool inDefaultFolder( ETrue ); + aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder ); + } + else + { + TBool inDefaultFolder( EFalse ); + aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder ); + } + } + else + { + // Other objects are set to be in default location by default + TBool inDefaultFolder( ETrue ); + aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder ); + } + }