--- a/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp Thu Jul 15 19:07:24 2010 +0300
+++ b/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp Thu Aug 19 10:20:41 2010 +0300
@@ -16,6 +16,7 @@
#include <collate.h>
#include <mdeobject.h>
+#include <pathinfo.h>
#include "fileeventhandlerao.h"
#include "harvesterlog.h"
@@ -83,12 +84,46 @@
User::LeaveIfError( error );
TRAP( error, ReadCacheSizeFromCenrepL() );
+
if ( error == KErrNone )
{
iQueue.Reserve( iCacheSize );
}
iEventArray = new (ELeave) CArrayFixSeg< TMdsFSPStatus >( KMaxEventsGranularity );
+
+ 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();
}
// ---------------------------------------------------------------------------
@@ -104,16 +139,37 @@
iFs.Close();
delete iMapper;
+ iMapper = NULL;
+
delete iMoveTimer;
+ iMoveTimer = NULL;
+
delete iFolderRenamer;
+ iFolderRenamer = NULL;
delete iEventArray;
+ iEventArray = NULL;
iQueue.ResetAndDestroy();
iQueue.Close();
iUriArray.ResetAndDestroy();
iUriArray.Close();
+
+ delete iPhoneImagesPath;
+ iPhoneImagesPath = NULL;
+ delete iMmcImagesPath;
+ iMmcImagesPath = NULL;
+
+ delete iPhoneVideosPath;
+ iPhoneVideosPath = NULL;
+ delete iMmcVideosPath;
+ iMmcVideosPath = NULL;
+
+ delete iPhoneSoundsPath;
+ iPhoneSoundsPath = NULL;
+ delete iMmcSoundsPath;
+ iMmcSoundsPath = NULL;
}
@@ -146,6 +202,7 @@
ResetEvent();
item->GetAsFspStatus(iEvent);
delete item;
+ item = NULL;
if( iEvent.iFileEventType == EMdsFileDeleted )
{
@@ -243,6 +300,14 @@
WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored camera origin for %S", &status.iFileName );
return;
}
+
+ if( (origin == KOriginIgnoreAttribsChanged ||
+ origin == MdeConstants::Object::ECamera ) &&
+ aEvent.iFileEventType == EMdsFileAttribsChanged )
+ {
+ WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - ignored attribs changed event for %S", &status.iFileName );
+ return;
+ }
}
// ignore created file event if extension is not supported by any harverter plugin
@@ -281,6 +346,7 @@
break;
case EMdsFileModified:
+ case EMdsFileAttribsChanged:
{
WRITELOG1( "CFileEventHandlerAO::HandleNotificationL - EmdsFileModified: %S", &status.iFileName );
ModifyL( status.iFileName, origin, fastHarvest );
@@ -441,6 +507,7 @@
newObject->Id() );
if ( removedId != KNoId )
{
+ SetTitleL( oldObject , aNewUrl );
oldObject->SetUriL( aNewUrl );
TUint32 mediaId = FSUtil::MediaID( iFs, aNewUrl );
oldObject->SetMediaId( mediaId );
@@ -454,6 +521,7 @@
if ( oldObject )
{
+ CheckDefaultFolderL( oldObject );
SetModifiedTimeL( oldObject, aNewUrl );
TOrigin origin = OriginFromMdEObjectL( *oldObject );
if( origin == MdeConstants::Object::EOther)
@@ -631,8 +699,10 @@
CleanupStack::PushL( oldObject );
SetTitleL( oldObject , aNewUrl );
oldObject->SetUriL( aNewUrl );
+ CheckDefaultFolderL( oldObject );
TUint32 mediaId = FSUtil::MediaID( iFs, aNewUrl );
oldObject->SetMediaId( mediaId );
+ SetModifiedTimeL( oldObject, aNewUrl );
TOrigin origin = OriginFromMdEObjectL( *oldObject );
if( origin == MdeConstants::Object::EOther)
{
@@ -653,6 +723,7 @@
CleanupStack::PushL( oldObject );
SetTitleL( oldObject , aNewUrl );
oldObject->SetUriL( aNewUrl );
+ CheckDefaultFolderL( oldObject );
TUint32 mediaId = FSUtil::MediaID( iFs, aNewUrl );
oldObject->SetMediaId( mediaId );
SetModifiedTimeL( oldObject, aNewUrl );
@@ -973,3 +1044,60 @@
}
}
+//---------------------------------------------------------------------------
+// CFileEventHandlerAO::CheckDefaultFolderL()
+// ---------------------------------------------------------------------------
+//
+void CFileEventHandlerAO::CheckDefaultFolderL( CMdEObject* aOldObject )
+ {
+ if( !iDefaultFolderPropertyDef )
+ {
+ iDefaultFolderPropertyDef = &aOldObject->Def().GetPropertyDefL(
+ MdeConstants::Object::KInDefaultFolder );
+ }
+
+ CMdEProperty* folderProp = NULL;
+ aOldObject->Property( *iDefaultFolderPropertyDef, folderProp );
+
+ TBool inDefaultFolder( EFalse );
+ TPtrC objectDefName( aOldObject->Def().Name() );
+ if( objectDefName == MdeConstants::Image::KImageObject )
+ {
+ const TDesC& uri = aOldObject->Uri();
+ if( uri.FindF( iMmcImagesPath->Des()) != KErrNotFound ||
+ uri.FindF( iPhoneImagesPath->Des()) != KErrNotFound ||
+ uri.FindF( KDCIMFolder ) != KErrNotFound )
+ {
+ inDefaultFolder = ETrue;
+ }
+ }
+ else if( objectDefName == MdeConstants::Video::KVideoObject )
+ {
+ const TDesC& uri = aOldObject->Uri();
+ if( uri.FindF( iMmcVideosPath->Des()) != KErrNotFound ||
+ uri.FindF( iPhoneVideosPath->Des()) != KErrNotFound ||
+ uri.FindF( KDCIMFolder ) != KErrNotFound )
+ {
+ inDefaultFolder = ETrue;
+ }
+ }
+ else if( objectDefName == MdeConstants::Audio::KAudioObject )
+ {
+ const TDesC& uri = aOldObject->Uri();
+ if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound ||
+ uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound )
+ {
+ inDefaultFolder = ETrue;
+ }
+ }
+
+ if( folderProp )
+ {
+ folderProp->SetBoolValueL( inDefaultFolder );
+ }
+ else
+ {
+ aOldObject->AddBoolPropertyL( *iDefaultFolderPropertyDef, inDefaultFolder );
+ }
+ }
+