--- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Fri May 14 16:17:23 2010 +0300
+++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Thu May 27 13:18:43 2010 +0300
@@ -23,6 +23,7 @@
#include <mdeobject.h>
#include <centralrepository.h>
#include <caf/caf.h>
+#include <pathinfo.h>
#include "harvesteraudioplugin.h"
#include "harvesteraudiopluginutils.h"
@@ -35,8 +36,6 @@
const TUid KHarvesterRepoUid = { 0x200009FE };
const TUint32 KEnableAlbumArtHarvest = 0x00090001;
-_LIT( KExtensionWma, "wma" );
-
CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase()
{
}
@@ -53,6 +52,7 @@
iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTimeOffsetProperty );
+ iDefaultFolderPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder );
// Media property definitions
CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
@@ -120,6 +120,9 @@
delete iAudioParser;
delete iPropDefs;
delete iTNM;
+
+ delete iPhoneSoundsPath;
+ delete iMmcSoundsPath;
}
// ---------------------------------------------------------------------------
@@ -141,6 +144,17 @@
{
TRAP_IGNORE( iTNM = CThumbnailManager::NewL( *this ) );
}
+
+
+ TFileName sounds = PathInfo::SoundsPath();
+
+ TFileName phonePath = PathInfo::PhoneMemoryRootPath();
+ phonePath.Append( sounds );
+ iPhoneSoundsPath = phonePath.AllocL();
+
+ TFileName mmcPath = PathInfo::MemoryCardRootPath();
+ mmcPath.Append( sounds );
+ iMmcSoundsPath = mmcPath.Right( mmcPath.Length() - 1 ).AllocL();
}
// ---------------------------------------------------------------------------
@@ -245,7 +259,7 @@
// get properties for file types supported by CMetaDataUtility.
if( mapping->iHandler == EMetaDataUtilityHandling )
{
- GetMusicPropertiesL( aHD, aIsAdd );
+ GetMusicPropertiesL( aHD, aIsAdd, mapping->iMimeType );
}
}
}
@@ -328,7 +342,7 @@
// ---------------------------------------------------------------------------
//
void CHarvesterAudioPlugin::GetMusicPropertiesL( CHarvesterData* aHD,
- TBool aIsAdd )
+ TBool aIsAdd, TPtrC aMimeType )
{
#ifdef _DEBUG
TTime dStart, dStop;
@@ -347,12 +361,17 @@
// Prefetch max text lengt for validity checking
iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL();
}
-
- TPtrC ext;
- MdsUtils::GetExt( uri, ext );
-
- // Check for possibly protected content
- if( ext.CompareF( KExtensionWma ) == 0 )
+
+ TBool possiblyProtectedContent( EFalse );
+ if( aMimeType.Length() > 0 )
+ {
+ if( aMimeType == KMimeTypeWma )
+ {
+ possiblyProtectedContent = ETrue;
+ }
+ }
+
+ if( possiblyProtectedContent )
{
ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
@@ -366,7 +385,7 @@
}
CleanupStack::PopAndDestroy( 2 ); // content, data
}
-
+
TBool parsed( EFalse );
TRAPD( parseError, parsed = iAudioParser->ParseL( uri ) );
@@ -395,7 +414,22 @@
TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
TInt16 timeOffsetMinutes = timeOffsetSeconds.Int() / 60;
CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd );
-
+
+ if( !mdeObject.Placeholder() )
+ {
+ if( uri.FindF( iMmcSoundsPath->Des()) != KErrNotFound ||
+ uri.FindF( iPhoneSoundsPath->Des()) != KErrNotFound )
+ {
+ TBool inDefaultFolder( ETrue );
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+ }
+ else
+ {
+ TBool inDefaultFolder( EFalse );
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDefaultFolderPropertyDef, &inDefaultFolder, aIsAdd );
+ }
+ }
+
if ( song.Length() > 0
&& song.Length() < KMaxTitleFieldLength )
{