harvester/server/src/harvesterao.cpp
branchRCL_3
changeset 13 4a4892eec172
parent 12 9f21bab39f42
child 14 3e156c80c15d
equal deleted inserted replaced
12:9f21bab39f42 13:4a4892eec172
    20 #include <driveinfo.h>
    20 #include <driveinfo.h>
    21 
    21 
    22 #include <rlocationobjectmanipulator.h>
    22 #include <rlocationobjectmanipulator.h>
    23 #include <placeholderdata.h>
    23 #include <placeholderdata.h>
    24 #include <harvesterclientdata.h>
    24 #include <harvesterclientdata.h>
       
    25 #include <pathinfo.h>
    25 
    26 
    26 using namespace ContentAccess;
    27 using namespace ContentAccess;
    27 
    28 
    28 #include "harvesterao.h"
    29 #include "harvesterao.h"
    29 #include "harvesterlog.h"
    30 #include "harvesterlog.h"
    32 #include "mdsutils.h"
    33 #include "mdsutils.h"
    33 #include "mdeconstants.h"
    34 #include "mdeconstants.h"
    34 #include "harvesterdata.h"
    35 #include "harvesterdata.h"
    35 #include "ondemandao.h"
    36 #include "ondemandao.h"
    36 #include "harvestercommon.h"
    37 #include "harvestercommon.h"
       
    38 #include "mdscommoninternal.h"
    37 #include "processoriginmapperinterface.h"
    39 #include "processoriginmapperinterface.h"
    38 #include "mdeobjecthandler.h"
    40 #include "mdeobjecthandler.h"
    39 #include "harvestereventmanager.h"
    41 #include "harvestereventmanager.h"
    40 #include "harvestercenreputil.h"
    42 #include "harvestercenreputil.h"
    41 #include "restorewatcher.h"
    43 #include "restorewatcher.h"
    77 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
    79 	iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
    78 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
    80 	iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
    79 	iOriginPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
    81 	iOriginPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KOriginProperty );
    80 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
    82 	iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
    81 	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
    83 	iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
       
    84 	iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder );
    82 	
    85 	
    83 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
    86 	CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
    84 	iPreinstalledPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KPreinstalledProperty );
    87 	iPreinstalledPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KPreinstalledProperty );
    85 	}
    88 	}
    86 
    89 
   214 	delete iUnmountHandlerAO;
   217 	delete iUnmountHandlerAO;
   215 	
   218 	
   216 	delete iPropDefs;
   219 	delete iPropDefs;
   217 	delete iCameraExtensionArray;
   220 	delete iCameraExtensionArray;
   218 	
   221 	
       
   222     delete iPhoneImagesPath;
       
   223     delete iMmcImagesPath;
       
   224     
       
   225     delete iPhoneVideosPath;
       
   226     delete iMmcVideosPath;
       
   227     
       
   228     delete iPhoneSoundsPath;
       
   229     delete iMmcSoundsPath;
       
   230 	
   219 	RMediaIdUtil::ReleaseInstance();
   231 	RMediaIdUtil::ReleaseInstance();
   220     
   232     
   221     REComSession::FinalClose();
   233     REComSession::FinalClose();
   222     }
   234     }
   223 
   235 
   270     iCameraExtensionArray->InsertIsqL( KExtensionMpg4 );
   282     iCameraExtensionArray->InsertIsqL( KExtensionMpg4 );
   271     iCameraExtensionArray->InsertIsqL( KExtensionMpeg4 );
   283     iCameraExtensionArray->InsertIsqL( KExtensionMpeg4 );
   272     iCameraExtensionArray->InsertIsqL( KExtension3gp );
   284     iCameraExtensionArray->InsertIsqL( KExtension3gp );
   273     iCameraExtensionArray->InsertIsqL( KExtension3gpp );
   285     iCameraExtensionArray->InsertIsqL( KExtension3gpp );
   274     iCameraExtensionArray->InsertIsqL( KExtension3g2 );
   286     iCameraExtensionArray->InsertIsqL( KExtension3g2 );
   275 	
   287 
       
   288     TFileName phoneRoot = PathInfo::PhoneMemoryRootPath();
       
   289     TFileName mmcRoot = PathInfo::MemoryCardRootPath();
       
   290     
       
   291     TFileName images = PathInfo::ImagesPath();
       
   292     
       
   293     TFileName phoneImagePath( phoneRoot );
       
   294     phoneImagePath.Append( images );
       
   295     iPhoneImagesPath = phoneImagePath.AllocL();
       
   296 
       
   297     TFileName mmcImagePath( mmcRoot );
       
   298     mmcImagePath.Append( images );
       
   299     iMmcImagesPath = mmcImagePath.Right( mmcImagePath.Length() - 1 ).AllocL();
       
   300     
       
   301     TFileName videos = PathInfo::VideosPath();
       
   302     
       
   303     TFileName phoneVideoPath( phoneRoot );
       
   304     phoneVideoPath.Append( videos );
       
   305     iPhoneVideosPath = phoneVideoPath.AllocL();
       
   306 
       
   307     TFileName mmcVideoPath( mmcRoot );
       
   308     mmcVideoPath.Append( videos );
       
   309     iMmcVideosPath = mmcVideoPath.Right( mmcVideoPath.Length() - 1 ).AllocL();
       
   310     
       
   311     TFileName sounds = PathInfo::SoundsPath();
       
   312     
       
   313     TFileName phoneSoundPath( phoneRoot );
       
   314     phoneSoundPath.Append( sounds );
       
   315     iPhoneSoundsPath = phoneSoundPath.AllocL();
       
   316 
       
   317     TFileName mmcSoundPath( mmcRoot );
       
   318     mmcSoundPath.Append( sounds );
       
   319     iMmcSoundsPath = mmcSoundPath.Right( mmcSoundPath.Length() - 1 ).AllocL();
       
   320     
   276     WRITELOG( "CHarvesterAO::ConstructL() - end" );
   321     WRITELOG( "CHarvesterAO::ConstructL() - end" );
   277     }
   322     }
   278 
   323 
   279 // ---------------------------------------------------------------------------
   324 // ---------------------------------------------------------------------------
   280 // LoadMonitorPluginsL
   325 // LoadMonitorPluginsL
   910         else
   955         else
   911             {
   956             {
   912             mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, KUndefinedMime );
   957             mdeObject->AddTextPropertyL( *iPropDefs->iItemTypePropertyDef, KUndefinedMime );
   913             }
   958             }
   914 		
   959 		
       
   960         if( hd->Origin() == MdeConstants::Object::ECamera )
       
   961             {
       
   962             TBool inDefaultFolder( ETrue );
       
   963             mdeObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
       
   964             }
       
   965         else
       
   966             {
       
   967             AddDefaultFolderDataL( mdeObject );
       
   968             }       
       
   969         
   915 	    TPtrC name;
   970 	    TPtrC name;
   916 	    TBool nameFound = MdsUtils::GetName( hd->Uri(), name );
   971 	    TBool nameFound = MdsUtils::GetName( hd->Uri(), name );
   917 
   972 
   918 	    if ( nameFound )
   973 	    if ( nameFound )
   919 	        {
   974 	        {
  2412                 else
  2467                 else
  2413                 	{
  2468                 	{
  2414                 	WRITELOG("CHarvesterAO::HarvestingCompleted() NOT COMPLETING AS msg->iMessage->IsNull returns ETrue");
  2469                 	WRITELOG("CHarvesterAO::HarvestingCompleted() NOT COMPLETING AS msg->iMessage->IsNull returns ETrue");
  2415                 	} 
  2470                 	} 
  2416                 iHarvestFileMessages.Remove( i );
  2471                 iHarvestFileMessages.Remove( i );
       
  2472                 if( iHarvestFileMessages.Count() == 0 )
       
  2473                     {
       
  2474                     iHarvestFileMessages.Compress();
       
  2475                     }
  2417                 }
  2476                 }
  2418             }
  2477             }
  2419         }
  2478         }
  2420 	}
  2479 	}
  2421 
  2480 
  2830         {
  2889         {
  2831         TRAP_IGNORE( iMdESession->RemoveObjectL( aItem->Uri() ) );
  2890         TRAP_IGNORE( iMdESession->RemoveObjectL( aItem->Uri() ) );
  2832         }
  2891         }
  2833     }
  2892     }
  2834 
  2893 
       
  2894 void CHarvesterAO::AddDefaultFolderDataL( CMdEObject* aObject )
       
  2895     {
       
  2896     TPtrC objectDefName( aObject->Def().Name() );
       
  2897     if( objectDefName == MdeConstants::Image::KImageObject )
       
  2898         {
       
  2899         const TDesC& uri = aObject->Uri();
       
  2900         if( uri.FindF( iMmcImagesPath->Des()) != KErrNotFound ||
       
  2901             uri.FindF( iPhoneImagesPath->Des()) != KErrNotFound ||
       
  2902             uri.FindF( KDCIMFolder ) != KErrNotFound )
       
  2903             {
       
  2904             TBool inDefaultFolder( ETrue );
       
  2905             aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
       
  2906             }
       
  2907         else
       
  2908             {
       
  2909             TBool inDefaultFolder( EFalse );
       
  2910             aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );  
       
  2911             }    
       
  2912         }
       
  2913     else if( objectDefName == MdeConstants::Video::KVideoObject )
       
  2914         {
       
  2915         const TDesC& uri = aObject->Uri();
       
  2916         if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound ||
       
  2917             uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound ||
       
  2918             uri.FindF( KDCIMFolder ) != KErrNotFound )
       
  2919             {
       
  2920             TBool inDefaultFolder( ETrue );
       
  2921             aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
       
  2922             }
       
  2923         else
       
  2924             {
       
  2925             TBool inDefaultFolder( EFalse );
       
  2926             aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );   
       
  2927             }    
       
  2928         }
       
  2929     else if( objectDefName == MdeConstants::Audio::KAudioObject )
       
  2930         {
       
  2931         const TDesC& uri = aObject->Uri();
       
  2932         if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound ||
       
  2933             uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound )
       
  2934             {
       
  2935             TBool inDefaultFolder( ETrue );
       
  2936             aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
       
  2937             }
       
  2938         else
       
  2939             {
       
  2940             TBool inDefaultFolder( EFalse );
       
  2941             aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );    
       
  2942             }     
       
  2943         }
       
  2944     else
       
  2945         {
       
  2946         // Other objects are set to be in default location by default
       
  2947         TBool inDefaultFolder( ETrue );
       
  2948         aObject->AddBoolPropertyL( *iPropDefs->iDefaultFolderPropertyDef, inDefaultFolder );
       
  2949         }
       
  2950     }