--- a/clfwrapper/ClientSrc/CCLFDefaultOperation.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFDefaultOperation.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -102,8 +102,7 @@
void AppendItemsToArrayL( const TArray<MCLFItem*>& aSourceArray,
RPointerArray<MCLFItem>& aDestArray )
{
- const TInt count( aSourceArray.Count() );
- for( TInt i = 0 ; i < count ; ++i )
+ for( TInt i = aSourceArray.Count() - 1; i >=0; i--)
{
aDestArray.AppendL( aSourceArray[ i ] );
}
--- a/clfwrapper/ClientSrc/CCLFEngineImpl.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFEngineImpl.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -308,8 +308,7 @@
if ( aError )
{
- const TInt count( iChangedItemObserverArray.Count() );
- for( TInt i = 0 ; i < count ; ++i )
+ for( TInt i = iChangedItemObserverArray.Count() - 1; i >=0; i--)
{
iChangedItemObserverArray[i]->HandleError( aError );
}
@@ -326,8 +325,7 @@
// notify changed item observers
if ( iChangedItemModel.iChangedItemIdArray.Count() > 0 )
{
- const TInt count( iChangedItemObserverArray.Count() );
- for( TInt i = 0 ; i < count ; ++i )
+ for( TInt i = iChangedItemObserverArray.Count() - 1; i >=0; i--)
{
iChangedItemObserverArray[i]->HandleItemChangeL(
iChangedItemModel.iChangedItemIdArray.Array() );
--- a/clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFItemListModelImpl.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -284,7 +284,7 @@
}
CDesCArray* array = new (ELeave) CDesCArrayFlat( mimeTypeCount );
CleanupStack::PushL( array );
- for( TInt i = 0 ; i < mimeTypeCount ; ++i )
+ for( TInt i = mimeTypeCount - 1; i >=0; i--)
{
array->AppendL( aMimeTypes.MdcaPoint( i ) );
}
@@ -335,7 +335,7 @@
CArrayFix<TInt>* array =
new ( ELeave ) CArrayFixFlat<TInt>( count );
CleanupStack::PushL( array );
- for( TInt i = 0 ; i < count ; ++i )
+ for(TInt i = count - 1; i >=0; i--)
{
array->AppendL( aMediaTypes[i] );
}
@@ -363,7 +363,7 @@
CArrayFix<TInt>* array =
new ( ELeave ) CArrayFixFlat<TInt>( numMediaTypes );
CleanupStack::PushL( array );
- for( TInt i = 0 ; i < numMediaTypes ; ++i )
+ for( TInt i = numMediaTypes - 1; i >=0; i--)
{
array->AppendL( aResource.ReadInt32() );
}
@@ -443,8 +443,7 @@
void CCLFItemListModelImpl::CopyArrayL( const TArray<MCLFItem*>& aSource,
RPointerArray<MCLFItem>& aDest )
{
- const TInt count( aSource.Count() );
- for( TInt i = 0 ; i < count ; ++i )
+ for( TInt i = aSource.Count() - 1; i >=0; i--)
{
aDest.AppendL( aSource[i] );
}
@@ -532,7 +531,7 @@
const TInt count( iItemArray.Count() );
RArray<TCLFItemId> idArray( count == 0 ? 1 : count );
CleanupClosePushL( idArray );
- for( TInt i = 0 ; i < count ; ++i )
+ for( TInt i = count - 1; i >=0; i--)
{
idArray.AppendL( iItemArray[i]->ItemId() );
}
--- a/clfwrapper/ClientSrc/CCLFSortingStyleImpl.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/clfwrapper/ClientSrc/CCLFSortingStyleImpl.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -127,8 +127,7 @@
//
void CCLFSortingStyleImpl::GetFieldsL( RArray<TCLFFieldId>& aArray ) const
{
- const TInt count( iFieldIDArray.Count() );
- for( TInt i = 0 ; i < count ; ++i )
+ for( TInt i = iFieldIDArray.Count() - 1; i >=0; i--)
{
aArray.AppendL( iFieldIDArray[i] );
}
--- a/contextengine/plugins/calendarplugin/group/calendarcontextplugin.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/contextengine/plugins/calendarplugin/group/calendarcontextplugin.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -61,5 +61,5 @@
PAGED
BYTEPAIRCOMPRESSTARGET
-OPTION ARMCC -O3 -OTime
+OPTION ARMCC -O2 -OTime
--- a/contextengine/plugins/contextplugininterface/group/contextplugininterface.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/contextengine/plugins/contextplugininterface/group/contextplugininterface.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -46,4 +46,5 @@
PAGED
BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O3 -OSpace
--- a/group/bld.inf Fri Mar 19 09:38:01 2010 +0200
+++ b/group/bld.inf Fri Apr 16 15:23:55 2010 +0300
@@ -47,3 +47,4 @@
PRJ_TESTEXPORTS
../rom/mds_testers.iby CORE_MW_LAYER_IBY_EXPORT_PATH(mds_testers.iby)
+
--- a/harvester/blacklistclient/src/blacklistclient.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/blacklistclient/src/blacklistclient.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -37,14 +37,14 @@
//
EXPORT_C RBlacklistClient::~RBlacklistClient()
{
- WRITELOG( "CBlacklistServer::~RBlacklistClient - begin" );
+ WRITELOG( "RBlacklistClient::~RBlacklistClient - begin" );
RSessionBase::Close();
iBlacklistMemoryTable.ResetAndDestroy();
iBlacklistMemoryTable.Close();
iBlacklistChunk.Close();
- WRITELOG( "CBlacklistServer::~RBlacklistClient - end" );
+ WRITELOG( "RBlacklistClient::~RBlacklistClient - end" );
}
// ---------------------------------------------------------------------------
@@ -53,35 +53,24 @@
//
EXPORT_C TInt RBlacklistClient::Connect()
{
- WRITELOG( "CBlacklistServer::Connect - begin" );
+ WRITELOG( "RBlacklistClient::Connect - begin" );
- TInt retryCount = 2;
- TInt error = KErrNone;
-
iSessionOk = EFalse;
-
- while ( retryCount )
+
+ TInt error = StartServer();
+
+ if ( error == KErrNone || error == KErrAlreadyExists )
{
- // try create session, if ok, then break out and return KErrNone
+ WRITELOG( "RBlacklistClient::Connect() - creating session" );
error = CreateSession( KBlacklistServerName, Version() );
- if( error != KErrNotFound && error != KErrServerTerminated )
- {
- iSessionOk = ETrue;
- break;
- }
-
- // Cannot create session, start server
- error = StartServer();
-
- if ( error != KErrNone && error != KErrAlreadyExists )
- {
- break;
- }
-
- --retryCount;
}
- WRITELOG( "CBlacklistServer::Connect - end" );
+ if( error == KErrNone )
+ {
+ iSessionOk = ETrue;
+ }
+
+ WRITELOG( "RBlacklistClient::Connect - end" );
return error;
}
@@ -92,7 +81,7 @@
//
TVersion RBlacklistClient::Version() const
{
- WRITELOG( "CBlacklistServer::Version - begin" );
+ WRITELOG( "RBlacklistClient::Version - begin" );
return TVersion( KBlacklistServerMajorVersion, KBlacklistServerMinorVersion,
KBlacklistServerBuildVersion );
@@ -105,10 +94,8 @@
//
TInt RBlacklistClient::StartServer()
{
- WRITELOG( "CBlacklistServer::CustomSecurityCheckL - begin" );
-
- const TUidType serverUid = ( KNullUid, KNullUid, KUidKBlacklistServer );
-
+ WRITELOG( "RBlacklistClient::StartServer - begin" );
+
RProcess server;
TInt error = server.Create( KBlacklistServerExe, KNullDesC );
if( error != KErrNone )
@@ -132,7 +119,7 @@
error = server.ExitType() == EExitPanic ? KErrGeneral : status.Int();
server.Close();
- WRITELOG( "CBlacklistServer::Version - end" );
+ WRITELOG( "RBlacklistClient::StartServer - end" );
return error;
}
@@ -143,7 +130,7 @@
//
void RBlacklistClient::RemoveFromDBL( const TDesC& aUri, TUint32 aMediaId ) const
{
- WRITELOG( "CBlacklistServer::RemoveFromDBL - begin" );
+ WRITELOG( "RBlacklistClient::RemoveFromDBL - begin" );
TPckgBuf<TUint32> mediaIdPckg( aMediaId );
@@ -154,7 +141,7 @@
const TInt err = SendReceive( EBlacklistRemoveFromDB, ipcArgs );
User::LeaveIfError( err );
- WRITELOG( "CBlacklistServer::RemoveFromDBL - end" );
+ WRITELOG( "RBlacklistClient::RemoveFromDBL - end" );
}
// ---------------------------------------------------------------------------
@@ -163,7 +150,7 @@
//
void RBlacklistClient::DoLoadBlacklistL( TInt& aHandle ) const
{
- WRITELOG( "CBlacklistServer::DoLoadBlacklistL - begin" );
+ WRITELOG( "RBlacklistClient::DoLoadBlacklistL - begin" );
TPckgBuf<TInt> handleBuf;
TIpcArgs ipcArgs;
@@ -172,7 +159,7 @@
User::LeaveIfError( err );
aHandle = handleBuf();
- WRITELOG( "CBlacklistServer::DoLoadBlacklistL - end" );
+ WRITELOG( "RBlacklistClient::DoLoadBlacklistL - end" );
}
// ---------------------------------------------------------------------------
@@ -181,7 +168,7 @@
//
EXPORT_C void RBlacklistClient::LoadBlacklistL()
{
- WRITELOG( "CBlacklistServer::LoadBlacklistL - begin" );
+ WRITELOG( "RBlacklistClient::LoadBlacklistL - begin" );
if ( !iSessionOk )
{
@@ -221,7 +208,7 @@
TUint32 mediaId ( 0 );
HBufC* uri = NULL;
- for( TInt i( 0 ); i < listCount; i++ )
+ for( TInt i = listCount - 1; i >=0; i-- )
{
// get modified and media id
buffer->ReceiveL( modified );
@@ -238,7 +225,7 @@
CleanupStack::PopAndDestroy( buffer );
CleanupStack::PopAndDestroy( name );
- WRITELOG( "CBlacklistServer::LoadBlacklistL - end" );
+ WRITELOG( "RBlacklistClient::LoadBlacklistL - end" );
}
// ---------------------------------------------------------------------------
@@ -248,7 +235,7 @@
void RBlacklistClient::AddToMemoryTableL( const TInt64& aModified,
const TDesC& aUri, const TUint32 aMediaId )
{
- WRITELOG( "CBlacklistServer::AddToMemoryTableL - begin" );
+ WRITELOG( "RBlacklistClient::AddToMemoryTableL - begin" );
CBlacklistItem* item = CBlacklistItem::NewL( aModified, aUri, aMediaId );
@@ -259,7 +246,7 @@
}
- WRITELOG( "CBlacklistServer::AddToMemoryTableL - end" );
+ WRITELOG( "RBlacklistClient::AddToMemoryTableL - end" );
}
// ---------------------------------------------------------------------------
@@ -268,7 +255,7 @@
//
void RBlacklistClient::RemoveFromMemoryTableL( const TDesC& aUri, const TUint32 aMediaId )
{
- WRITELOG( "CBlacklistServer::RemoveFromMemoryTableL - begin" );
+ WRITELOG( "RBlacklistClient::RemoveFromMemoryTableL - begin" );
const TInt index = GetListIndex( aUri, aMediaId );
if ( index >= 0 )
@@ -278,7 +265,7 @@
iBlacklistMemoryTable.Remove( index );
}
- WRITELOG( "CBlacklistServer::RemoveFromMemoryTableL - end" );
+ WRITELOG( "RBlacklistClient::RemoveFromMemoryTableL - end" );
}
@@ -288,7 +275,7 @@
//
EXPORT_C TBool RBlacklistClient::IsBlacklistedL( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime )
{
- WRITELOG( "CBlacklistServer::IsBlacklistedL - begin" );
+ WRITELOG( "RBlacklistClient::IsBlacklistedL - begin" );
const TInt index = GetListIndex( aUri, aMediaId );
if ( index >= 0 )
@@ -300,7 +287,7 @@
{
if ( modified == aLastModifiedTime.Int64() )
{
- WRITELOG( "CBlacklistServer::IsBlacklistedL - file is blacklisted, modification time is different" );
+ WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, modification time is different" );
return ETrue;
}
else
@@ -315,13 +302,13 @@
}
else
{
- WRITELOG( "CBlacklistServer::IsBlacklistedL - file is blacklisted, no modification time found" );
+ WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, no modification time found" );
return ETrue;
}
}
- WRITELOG( "CBlacklistServer::IsBlacklistedL - end" );
+ WRITELOG( "RBlacklistClient::IsBlacklistedL - end" );
return EFalse;
}
@@ -331,7 +318,7 @@
//
TInt RBlacklistClient::GetListIndex( const TDesC& aUri, TUint32 aMediaId )
{
- WRITELOG( "CBlacklistServer::GetListIndex - begin" );
+ WRITELOG( "RBlacklistClient::GetListIndex - begin" );
for ( TInt i( 0 ); i < iBlacklistMemoryTable.Count(); ++i )
{
@@ -341,7 +328,7 @@
}
}
- WRITELOG( "CBlacklistServer::GetListIndex - end" );
+ WRITELOG( "RBlacklistClient::GetListIndex - end" );
return KErrNotFound;
}
@@ -353,7 +340,7 @@
//
EXPORT_C void RBlacklistClient::AddL( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime ) const
{
- WRITELOG( "CBlacklistServer::AddL - begin" );
+ WRITELOG( "RBlacklistClient::AddL - begin" );
TPckgC<TUint32> mediaIdPckg( aMediaId );
TPckgC<TTime> lastModifiedTimePckg( aLastModifiedTime );
@@ -366,7 +353,7 @@
const TInt err = SendReceive( EBlacklistAdd, ipcArgs );
User::LeaveIfError( err );
- WRITELOG( "CBlacklistServer::AddL - end" );
+ WRITELOG( "RBlacklistClient::AddL - end" );
}
@@ -376,7 +363,7 @@
//
EXPORT_C void RBlacklistClient::RemoveL( const TDesC& aUri, TUint32 aMediaId ) const
{
- WRITELOG( "CBlacklistServer::RemoveL - begin" );
+ WRITELOG( "RBlacklistClient::RemoveL - begin" );
TPckgBuf<TUint32> mediaIdPckg( aMediaId );
@@ -387,7 +374,7 @@
const TInt err = SendReceive( EBlacklistRemove, ipcArgs );
User::LeaveIfError( err );
- WRITELOG( "CBlacklistServer::RemoveL - end" );
+ WRITELOG( "RBlacklistClient::RemoveL - end" );
}
// ---------------------------------------------------------------------------
@@ -396,7 +383,7 @@
//
EXPORT_C void RBlacklistClient::CloseDBL()
{
- WRITELOG( "CBlacklistServer::CloseDBL - begin" );
+ WRITELOG( "RBlacklistClient::CloseDBL - begin" );
if ( !iSessionOk )
{
@@ -407,7 +394,7 @@
Send( EBlacklistCloseDB );
}
- WRITELOG( "CBlacklistServer::CloseDBL - end" );
+ WRITELOG( "RBlacklistClient::CloseDBL - end" );
}
--- a/harvester/blacklistserver/src/blacklistserver.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/blacklistserver/src/blacklistserver.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -184,21 +184,16 @@
iBlacklistMemoryTable.ResetAndDestroy();
iBlacklistMemoryTable.Close();
-
-
- const TInt KRowCountRemovedItems = iBufferedRemoveItems.Count();
- for( TInt i = 0; i < KRowCountRemovedItems; i++ )
+ for( TInt i = iBufferedRemoveItems.Count() - 1; i >=0; i-- )
{
iBufferedRemoveItems[i]->Close();
}
iBufferedRemoveItems.ResetAndDestroy();
iBufferedRemoveItems.Close();
-
- const TInt KRowCountAddedItems = iBufferedAddedItems.Count();
- for( TInt i = 0; i < KRowCountAddedItems; i++ )
+ for( TInt i = iBufferedAddedItems.Count() - 1; i >=0; i-- )
{
iBufferedAddedItems[i]->Close();
}
--- a/harvester/client/src/harvesterclient.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/client/src/harvesterclient.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -261,9 +261,13 @@
//
EXPORT_C TInt RHarvesterClient::RemoveHarvesterEventObserver( MHarvesterEventObserver& aHarvesterEventObserver )
{
- TRAPD( err, iHEO->RemoveHarvesterEventObserverL( aHarvesterEventObserver ) );
+ if( iHEO )
+ {
+ TRAPD( err, iHEO->RemoveHarvesterEventObserverL( aHarvesterEventObserver ) );
+ return err;
+ }
- return err;
+ return KErrNone;
}
// ----------------------------------------------------------------------------------------
--- a/harvester/client/src/harvestereventobserverao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/client/src/harvestereventobserverao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -179,7 +179,7 @@
// Find smallest unused observer ID
const TUint count = iObservers.Count();
- for( TUint i = 0; i < count; i++ )
+ for( TInt i = count - 1; i >=0; i-- )
{
// Return first free observer ID
if( iObservers[i]->iObserverInfo.iObserverId != i )
--- a/harvester/client/src/harvesterrequestqueue.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/client/src/harvesterrequestqueue.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -224,8 +224,7 @@
iShutdown = ETrue;
- const TInt count( iRequests.Count() );
- for( TInt i = 0; i < count; i++ )
+ for( TInt i = iRequests.Count() - 1; i >=0; i-- )
{
CHarvesterRequestActive* request = iRequests[i];
if( request )
--- a/harvester/common/bwincw/harvestercommonwinscw.def Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/bwincw/harvestercommonwinscw.def Fri Apr 16 15:23:55 2010 +0300
@@ -65,4 +65,5 @@
?UnregisterEventObserver@CHarvesterEventManager@@QAEHABVRMessage2@@@Z @ 64 NONAME ; int CHarvesterEventManager::UnregisterEventObserver(class RMessage2 const &)
?HandleObjectPropertyL@CMdeObjectWrapper@@SAXAAVCMdEObject@@AAVCMdEPropertyDef@@PAXH@Z @ 65 NONAME ; void CMdeObjectWrapper::HandleObjectPropertyL(class CMdEObject &, class CMdEPropertyDef &, void *, int)
?SendHarvestingStatusEventL@CHarvesterPluginFactory@@QAEXH@Z @ 66 NONAME ; void CHarvesterPluginFactory::SendHarvestingStatusEventL(int)
+ ?PauseHarvester@CHarvesterPluginFactory@@QAEXH@Z @ 67 NONAME ; void CHarvesterPluginFactory::PauseHarvester(int)
--- a/harvester/common/eabi/harvestercommonarm.def Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/eabi/harvestercommonarm.def Fri Apr 16 15:23:55 2010 +0300
@@ -85,4 +85,5 @@
_ZN18CHarvesterExifUtilD0Ev @ 84 NONAME
_ZN18CHarvesterExifUtilD1Ev @ 85 NONAME
_ZN18CHarvesterExifUtilD2Ev @ 86 NONAME
+ _ZN23CHarvesterPluginFactory14PauseHarvesterEi @ 87 NONAME
--- a/harvester/common/group/harvesterplugininterface.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/group/harvesterplugininterface.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -53,4 +53,5 @@
BYTEPAIRCOMPRESSTARGET
PAGED
+OPTION ARMCC -O3 -OSpace
--- a/harvester/common/inc/harvestercommon.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/inc/harvestercommon.h Fri Apr 16 15:23:55 2010 +0300
@@ -86,8 +86,8 @@
enum TMdsOomStatus
{
- TMdsOomFreeRam,
- TMdsOomMemoryGood
+ EMdsOomFreeRam,
+ EMdsOomMemoryGood
};
const TInt KHarvesterGetRootDirFlags = EDirsFirst;
--- a/harvester/common/inc/harvesterpluginfactory.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/inc/harvesterpluginfactory.h Fri Apr 16 15:23:55 2010 +0300
@@ -43,6 +43,7 @@
IMPORT_C TBool IsContainerFileL( const TDesC& aURI );
IMPORT_C void SendHarvestingStatusEventL( TBool aStarted );
+ IMPORT_C void PauseHarvester( TBool aPaused );
private:
CHarvesterPluginFactory();
--- a/harvester/common/src/harvestercenreputil.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/src/harvestercenreputil.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -97,8 +97,7 @@
TInt ret = repo->FindL( KIgnorePathPartialKey, KSearchMask, ignoredKeys );
TBuf<KMaxFileName> path;
- const TInt count = ignoredKeys.Count();
- for( TInt i=0;i<count;i++ )
+ for( TInt i = ignoredKeys.Count() - 1; i >=0; i-- )
{
const TInt error( repo->Get( ignoredKeys[i], path ) );
if( error != KErrNone )
@@ -191,7 +190,7 @@
TBuf<KMaxFileName> path;
const TInt count = scanPathKeys.Count();
aPaths.ReserveL( count );
- for( TInt i = 0; i < count; i++ )
+ for( TInt i = count - 1; i >=0; i-- )
{
const TInt error( repo->Get( scanPathKeys[i], path ) );
if( error != KErrNone )
@@ -215,8 +214,7 @@
repo->FindL( aPartialKey, KSearchMask, scanPathKeys );
TBuf<KMaxFileName> path;
- const TInt count = scanPathKeys.Count();
- for( TInt i = 0; i < count; i++ )
+ for( TInt i = scanPathKeys.Count() - 1; i >=0; i-- )
{
const TInt error( repo->Get( scanPathKeys[i], path ) );
if( error != KErrNone )
--- a/harvester/common/src/harvesterplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/src/harvesterplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -220,7 +220,6 @@
//
EXPORT_C void CHarvesterPlugin::DoCancel()
{
-
}
// ---------------------------------------------------------------------------
--- a/harvester/common/src/harvesterpluginfactory.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/src/harvesterpluginfactory.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -111,7 +111,7 @@
return;
}
}
- for( TInt i = 0; i < sCount; i++ )
+ for( TInt i = sCount - 1; i >=0; i-- )
{
CHarvesterPluginInfo* info = supportedPlugins[i];
if ( !(info->iPlugin) )
@@ -148,8 +148,7 @@
RPointerArray<CHarvesterPluginInfo> supportedPlugins;
TRAP_IGNORE( GetSupportedPluginsL( supportedPlugins, extPtr ) );
- const TInt sCount = supportedPlugins.Count();
- for( TInt i = 0; i < sCount; i++ )
+ for( TInt i = supportedPlugins.Count() - 1; i >=0; i-- )
{
CHarvesterPluginInfo* info = supportedPlugins[i];
if ( !(info->iPlugin) )
@@ -164,11 +163,11 @@
info->iPlugin->SetHarvesterPluginFactory( *this );
info->iPlugin->SetBlacklist( *iBlacklist );
}
- info->iPlugin->GetMimeType( aUri, aMimeType );
- if( aMimeType.Length() > 0 )
- {
- break;
- }
+ info->iPlugin->GetMimeType( aUri, aMimeType );
+ if( aMimeType.Length() > 0 )
+ {
+ break;
+ }
}
supportedPlugins.Close();
}
@@ -210,7 +209,7 @@
hpi->iQueue.Insert( aHD, 0 );
if( !hpi->iPlugin->IsActive() )
{
- hpi->iPlugin->SetPriority( KHarvesterPriorityHarvestingPlugin + 2 );
+ hpi->iPlugin->SetPriority( KHarvesterPriorityHarvestingPlugin + 1 );
}
}
else
@@ -244,12 +243,14 @@
WRITELOG( "CHarvesterPluginFactory::SetBlacklist()" );
iBlacklist = &aBlacklist;
- TInt count = iHarvesterPluginInfoArray.Count();
- for ( TInt i = 0; i < count; i++ )
+ const TInt count = iHarvesterPluginInfoArray.Count();
+ for ( TInt i = count; --i >= 0; )
{
- iHarvesterPluginInfoArray[i]->iPlugin->SetBlacklist( *iBlacklist );
- }
-
+ if( iHarvesterPluginInfoArray[i]->iPlugin )
+ {
+ iHarvesterPluginInfoArray[i]->iPlugin->SetBlacklist( *iBlacklist );
+ }
+ }
}
// ---------------------------------------------------------------------------
@@ -324,10 +325,11 @@
pluginInfo->iPluginUid = aPluginUid;
- // Load plugin
+#ifdef MDS_HARVESTERPLUGINS_ON_BOOT
pluginInfo->iPlugin = CHarvesterPlugin::NewL( pluginInfo->iPluginUid );
pluginInfo->iPlugin->SetQueue( pluginInfo->iQueue );
- pluginInfo->iPlugin->SetHarvesterPluginFactory( *this );
+ pluginInfo->iPlugin->SetHarvesterPluginFactory( *this );
+#endif
iHarvesterPluginInfoArray.AppendL( pluginInfo );
CleanupStack::Pop( pluginInfo );
@@ -394,8 +396,7 @@
RPointerArray<CHarvesterPluginInfo> supportedPlugins;
CleanupClosePushL( supportedPlugins );
GetSupportedPluginsL( supportedPlugins, extPtr );
- const TInt sCount = supportedPlugins.Count();
- for( TInt i = 0; i < sCount; i++ )
+ for( TInt i = supportedPlugins.Count() - 1; i >=0; i-- )
{
CHarvesterPluginInfo* info = supportedPlugins[i];
if( info->iObjectTypes.Count() > 1 )
@@ -458,3 +459,19 @@
}
}
+EXPORT_C void CHarvesterPluginFactory::PauseHarvester( TBool aPaused )
+ {
+ const TInt count = iHarvesterPluginInfoArray.Count();
+ for ( TInt i = count; --i >= 0; )
+ {
+ if( iHarvesterPluginInfoArray[i]->iPlugin && aPaused )
+ {
+ iHarvesterPluginInfoArray[i]->iPlugin->Cancel();
+ }
+ else if( iHarvesterPluginInfoArray[i]->iPlugin )
+ {
+ iHarvesterPluginInfoArray[i]->iPlugin->StartHarvest();
+ }
+ }
+ }
+
--- a/harvester/common/src/listener.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/src/listener.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -48,7 +48,7 @@
CListener* CListener::NewLC( const TUid aPropertyCategory,
const TUint aKey )
{
- WRITELOG( "CHarvesterAO::NewLC() - begin" );
+ WRITELOG( "CListener::NewLC() - begin" );
CListener* self = new ( ELeave ) CListener( aPropertyCategory, aKey );
CleanupStack::PushL( self );
--- a/harvester/common/src/propertywatcher.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/common/src/propertywatcher.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -189,6 +189,7 @@
WRITELOG( "CPropertyWatcher::~CPropertyWatcher() - begin" );
iListenersArray.ResetAndDestroy(); // Clean array and objects.
+ iListenersArray.Close();
WRITELOG( "CPropertyWatcher::~CPropertyWatcher() - end" );
}
--- a/harvester/composerplugins/composerplugininterface/group/composerplugininterface.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/composerplugins/composerplugininterface/group/composerplugininterface.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -46,4 +46,5 @@
PAGED
BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O3 -OSpace
--- a/harvester/composerplugins/imagecomposer/src/composerimageplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/composerplugins/imagecomposer/src/composerimageplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -197,7 +197,9 @@
CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject );
CMdEObjectDef& locationObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Location::KLocationObject );
CMdEObject* object = iSession->GetObjectL( aObjectId, imageObjDef );
+ CleanupStack::PushL( object );
CMdEObject* location = iSession->GetObjectL( locationId, locationObjDef );
+ CleanupStack::PushL( location );
if( object && location )
{
@@ -208,7 +210,7 @@
iMdEHarvesterSession->ResetPendingL( objectId );
}
}
- CleanupStack::PopAndDestroy( &objectId );
+ CleanupStack::PopAndDestroy( 3, &objectId );
}
void CComposerImagePlugin::HandlePendingObjects( const RArray<TItemId>& aObjectIdArray )
--- a/harvester/composerplugins/imagecomposer/src/imagecomposerao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/composerplugins/imagecomposer/src/imagecomposerao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -871,6 +871,7 @@
if ( !cellIdProperty && !countryCodeProperty && !networkCodeProperty
&& !locationAreaCodeProperty && !speedProperty && !directionProperty && !qualityProperty )
{
+ // Ignore return value - if operation does not succeed, there is no much that can be done here
iSession->RemoveObjectL( aLocationObject->Id(), iDefaultNamespace );
}
}
--- a/harvester/data/default_origin_mappings.db Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/data/default_origin_mappings.db Fri Apr 16 15:23:55 2010 +0300
@@ -8,19 +8,21 @@
101FFA86 1
2000D16B 1
10208A6D 1
-101f857a 1
-10003a3f 2
-101f4d90 2
-1028242D 2
-1028242E 2
-10281F1D 2
-101FFB51 2
+101f857a 1
+10003a3f 2
+101f4d90 2
+1028242D 2
+1028242E 2
+101FFB51 2
101F8839 2
-101FFAAB 2
+101FFAAB 2
200071D8 2
10008D60 2
-10008d39 2
-1028190b 2
+10008d39 2
+1028190b 2
+10008D5F 2
+10008D60 2
+10008D61 2
100058CA 4
1028290B 4
10281FA8 4
--- a/harvester/harvesterplugins/AudioPlaylistPlugin/src/harvesteraudioplaylistplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlaylistPlugin/src/harvesteraudioplaylistplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -25,6 +25,7 @@
#include "harvesteraudioplaylistplugin.h"
#include "mdeobjectwrapper.h"
#include "mdsutils.h"
+#include "harvestercommon.h"
#include "harvesterlog.h"
@@ -112,6 +113,7 @@
void CHarvesterAudioPlaylistPlugin::ConstructL()
{
WRITELOG( "CHarvesterAudioPlaylistPlugin::ConstructL()" );
+ SetPriority( KHarvesterPriorityHarvestingPlugin - 1 );
iPlaylistParser = CHarvesterAudioPlaylistParser::NewL();
}
--- a/harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -58,6 +58,8 @@
LIBRARY metadatautility.lib
LIBRARY thumbnailmanager.lib
LIBRARY centralrepository.lib
+LIBRARY caf.lib
+LIBRARY cafutils.lib
PAGED
BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h Fri Apr 16 15:23:55 2010 +0300
@@ -44,6 +44,7 @@
CMdEPropertyDef* iSizePropertyDef;
CMdEPropertyDef* iItemTypePropertyDef;
CMdEPropertyDef* iTitlePropertyDef;
+ CMdEPropertyDef* iTimeOffsetPropertyDef;
// Media property definitions
CMdEPropertyDef* iRatingPropertyDef;
@@ -53,6 +54,7 @@
CMdEPropertyDef* iCopyrightPropertyDef;
CMdEPropertyDef* iThumbnailPropertyDef;
CMdEPropertyDef* iDatePropertyDef;
+ CMdEPropertyDef* iDrmPropertyDef;
// Audio property definitions
CMdEPropertyDef* iAlbumPropertyDef;
--- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -22,6 +22,7 @@
#include <mdeobjectdef.h>
#include <mdeobject.h>
#include <centralrepository.h>
+#include <caf/caf.h>
#include "harvesteraudioplugin.h"
#include "harvesteraudiopluginutils.h"
@@ -33,6 +34,8 @@
const TUid KHarvesterRepoUid = { 0x200009FE };
const TUint32 KEnableAlbumArtHarvest = 0x00090001;
+_LIT( KExtensionWma, "wma" );
+
CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase()
{
}
@@ -41,13 +44,14 @@
{
CMdENamespaceDef& nsDef = aObjectDef.NamespaceDef();
- // Image property definitions
+ // Common property definitions
CMdEObjectDef& objectDef = nsDef.GetObjectDefL( MdeConstants::Object::KBaseObject );
iCreationDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty );
iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+ iTimeOffsetPropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTimeOffsetProperty );
// Media property definitions
CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
@@ -59,6 +63,7 @@
iTrackPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KTrackProperty );
iThumbnailPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KThumbnailPresentProperty );
iDatePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KReleaseDateProperty );
+ iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
// Audio property definitions
CMdEObjectDef& audioDef = nsDef.GetObjectDefL( MdeConstants::Audio::KAudioObject );
@@ -125,6 +130,7 @@
WRITELOG( "CHarvesterAudioPlugin::ConstructL()" );
CRepository* rep = CRepository::NewLC( KHarvesterRepoUid );
+ // If data could not be fetched, default to non-album art mode
rep->Get( KEnableAlbumArtHarvest, iHarvestAlbumArt );
CleanupStack::PopAndDestroy( rep );
@@ -263,9 +269,9 @@
User::Leave( err ); // metadata cannot be gathered!
}
- TTime now;
- now.HomeTime();
-
+ TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
+ TTime localModifiedDate = entry.iModified + timeOffsetSeconds;
+
if( !iPropDefs )
{
CMdEObjectDef& objectDef = mdeObject.Def();
@@ -273,7 +279,7 @@
}
CMdeObjectWrapper::HandleObjectPropertyL(
- mdeObject, *iPropDefs->iCreationDatePropertyDef, &now, aIsAdd );
+ mdeObject, *iPropDefs->iCreationDatePropertyDef, &localModifiedDate, aIsAdd );
CMdeObjectWrapper::HandleObjectPropertyL(
mdeObject, *iPropDefs->iLastModifiedDatePropertyDef, &entry.iModified, aIsAdd );
@@ -328,6 +334,31 @@
CMdEObject& mdeObject = aHD->MdeObject();
const TDesC& uri = mdeObject.Uri();
+
+ if( !iPropDefs )
+ {
+ CMdEObjectDef& audioObjectDef = mdeObject.Def();
+ iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
+ }
+
+ TPtrC ext;
+ MdsUtils::GetExt( uri, ext );
+
+ // Check for possibly protected content
+ if( ext.CompareF( KExtensionWma ) == 0 )
+ {
+ ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+ ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+
+ TBool protectedContent( EFalse );
+ TInt err = data->GetAttribute( ContentAccess::EIsProtected, protectedContent );
+ if( err == KErrNone && protectedContent )
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL( mdeObject,
+ *iPropDefs->iDrmPropertyDef, &protectedContent, aIsAdd );
+ }
+ CleanupStack::PopAndDestroy( 2 ); // content, data
+ }
TBool parsed( EFalse );
TRAPD( parseError, parsed = iAudioParser->ParseL( uri ) );
@@ -348,17 +379,16 @@
TPtrC orgArtist = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldOriginalArtist );
TPtrC track = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldTrack );
TPtrC duration = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldDuration );
- TPtrC copyright = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldCopyright);
+ TPtrC copyright = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldCopyright );
TPtrC date = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldDate );
TPtrC8 jpeg = iAudioParser->MetaDataField8L( CAudioMDParser::EAudioMDFieldJpeg );
-
- if( !iPropDefs )
- {
- CMdEObjectDef& audioObjectDef = mdeObject.Def();
- iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef );
- }
-
+
+ // Time offset
+ TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset();
+ TInt16 timeOffsetMinutes = timeOffsetSeconds.Int() / 60;
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd );
+
if ( song.Length() > 0
&& song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() )
{
--- a/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -255,6 +255,7 @@
User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping<TImageMetadataHandling>(
KExtOtb(), KOtbMime(), EOtherHandling ), cmp ) );
+
}
void CHarvesterImagePlugin::HarvestL( CHarvesterData* aHD )
@@ -449,15 +450,59 @@
TPtr8 imageDataPtr = aFileData.iImageData->Des();
TRAP( err, iDecoder->OpenL(imageDataPtr, aFileData.iMime8,
CImageDecoder::TOptions( CImageDecoder::EPreferFastDecode | CImageDecoder::EOptionIgnoreExifMetaData ) ) );
- WRITELOG( "CHarvesterImagePlugin::GatherData() - Image decoder has opened the file." );
if ( err != KErrNone )
{
WRITELOG1( "CHarvesterImagePlugin::GatherData() - ERROR: Decoder could not open image data! Code %d", err );
+#ifdef _DEBUG
+ if( err == KErrInUse || err == KErrLocked )
+ {
+ TPtrC fileName( uri.Mid(2) );
+ WRITELOG1( "CHarvesterImagePlugin :: Checking open file handles to %S", &fileName );
+
+ CFileList* fileList = 0;
+ TOpenFileScan fileScan( iFs );
+
+ fileScan.NextL( fileList );
+
+ while ( fileList )
+ {
+ const TInt count( fileList->Count() );
+ for (TInt i = 0; i < count; i++ )
+ {
+ if ( (*fileList)[i].iName == uri.Mid(2) )
+ {
+ TFullName processName;
+ TFindThread find(_L("*"));
+ while( find.Next( processName ) == KErrNone )
+ {
+ RThread thread;
+ TInt err = thread.Open( processName );
+
+ if ( err == KErrNone )
+ {
+ if ( thread.Id().Id() == fileScan.ThreadId() )
+ {
+ processName = thread.Name();
+ thread.Close();
+ WRITELOG1( "CHarvesterImagePlugin:: %S has a file handle open", &processName );
+ break;
+ }
+ thread.Close();
+ }
+ }
+ }
+ }
+ fileScan.NextL( fileList );
+ }
+ }
+#endif
iDecoder->Reset();
return KErrCompletion; // metadata item still can be created, thus KErrCompletion
}
+ WRITELOG( "CHarvesterImagePlugin::GatherData() - Image decoder has opened the file." );
+
if ( !iDecoder->ValidDecoder() )
{
// read all remaining data from file
--- a/harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -30,6 +30,7 @@
#include <mdetextproperty.h>
#include "harvestermessageplugin.h"
+#include "harvestercommon.h"
#include "harvesterlog.h"
#include "mdsutils.h"
#include "mdeobjectdef.h"
@@ -283,9 +284,9 @@
void CHarvesterMessagePlugin::SetPropertiesL( CHarvesterData& aHD )
{
WRITELOG( "CHarvesterMessagePlugin::SetPropertiesL enter" );
- CMdEObject& aMetadataObject = aHD.MdeObject();
+ CMdEObject& metadataObject = aHD.MdeObject();
- CMdEObjectDef& messageObjectDef = aMetadataObject.Def();
+ CMdEObjectDef& messageObjectDef = metadataObject.Def();
CMdEPropertyDef& creationTimeDef = messageObjectDef.GetPropertyDefL(
MdeConstants::Object::KCreationDateProperty ) ;
@@ -318,19 +319,19 @@
if ( EHarvesterAdd == aHD.EventType() )
{
- aMetadataObject.AddTimePropertyL( creationTimeDef, now );
- aMetadataObject.AddTimePropertyL( lastModTimeDef, iDate );
- aMetadataObject.AddBoolPropertyL( receivedDef, iIncoming );
+ metadataObject.AddTimePropertyL( creationTimeDef, now );
+ metadataObject.AddTimePropertyL( lastModTimeDef, iDate );
+ metadataObject.AddBoolPropertyL( receivedDef, iIncoming );
if (iFromOrTo && iFromOrTo->Length())
{
- aMetadataObject.AddTextPropertyL( textDef, *iFromOrTo );
+ metadataObject.AddTextPropertyL( textDef, *iFromOrTo );
}
- aMetadataObject.AddTextPropertyL( ItemtypeDef, iItemType );
- aMetadataObject.AddUint32PropertyL( sizeDef, iSize );
- aMetadataObject.AddInt16PropertyL( offSetDef, timeOffset.Int() / 60 );
+ metadataObject.AddTextPropertyL( ItemtypeDef, iItemType );
+ metadataObject.AddUint32PropertyL( sizeDef, iSize );
+ metadataObject.AddInt16PropertyL( offSetDef, timeOffset.Int() / 60 );
CMdEProperty* prop = NULL;
- TInt index = aMetadataObject.Property( titleDef, prop );
+ TInt index = metadataObject.Property( titleDef, prop );
if (iSubject.Length())
{
@@ -340,7 +341,7 @@
}
else
{
- aMetadataObject.AddTextPropertyL( titleDef, iSubject );
+ metadataObject.AddTextPropertyL( titleDef, iSubject );
}
}
else
@@ -353,7 +354,7 @@
}
else
{
- aMetadataObject.AddTextPropertyL( titleDef, *iFromOrTo );
+ metadataObject.AddTextPropertyL( titleDef, *iFromOrTo );
}
}
}
@@ -361,7 +362,7 @@
else
{
CMdEProperty* prop = NULL;
- TInt index = aMetadataObject.Property( textDef, prop );
+ TInt index = metadataObject.Property( textDef, prop );
if (iFromOrTo && iFromOrTo->Length())
{
if (prop)
@@ -370,18 +371,18 @@
}
else
{
- aMetadataObject.AddTextPropertyL( textDef, *iFromOrTo );
+ metadataObject.AddTextPropertyL( textDef, *iFromOrTo );
}
}
else if (index >= 0)
{
- aMetadataObject.RemoveProperty(index);
+ metadataObject.RemoveProperty(index);
}
- aMetadataObject.Property( sizeDef, prop );
+ metadataObject.Property( sizeDef, prop );
static_cast<CMdEUint32Property *>(prop)->SetValueL( iSize );
- aMetadataObject.Property( lastModTimeDef, prop );
+ metadataObject.Property( lastModTimeDef, prop );
static_cast <CMdETimeProperty *>(prop)->SetValueL( iDate );
}
--- a/harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/group/harvesteromadrmplugin.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -48,11 +48,11 @@
LIBRARY euser.lib
LIBRARY efsrv.lib
LIBRARY caf.lib
-LIBRARY cafutils.lib
+LIBRARY cafutils.lib
LIBRARY harvesterplugininterface.lib
LIBRARY mdeclient.lib
-LIBRARY harvesterdata.lib
-LIBRARY harvestercommon.lib
+LIBRARY harvesterdata.lib
+LIBRARY harvestercommon.lib
PAGED
BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h Fri Apr 16 15:23:55 2010 +0300
@@ -58,6 +58,7 @@
TBuf<KMaxDataTypeLength> iDescription;
TBuf<KMaxDataTypeLength> iTitle;
TBuf<KMaxDataTypeLength> iAuthor;
+ TBuf<KMaxDataTypeLength> iGenre;
TInt64 iFileSize;
TTime iModified;
TBool iDrmProtected;
@@ -81,6 +82,7 @@
CMdEPropertyDef* iDrmPropertyDef;
CMdEPropertyDef* iDescriptionPropertyDef;
CMdEPropertyDef* iAuthorPropertyDef;
+ CMdEPropertyDef* iGenrePropertyDef;
private:
CHarvesterOmaDrmPluginPropertyDefs();
--- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -58,6 +58,7 @@
iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
+ iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
}
CHarvesterOmaDrmPluginPropertyDefs* CHarvesterOmaDrmPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
@@ -167,8 +168,8 @@
aVHD.iFileSize = (TUint)entry->iSize;
CleanupStack::PopAndDestroy( entry );
- ContentAccess::CContent* content = NULL;
- content = ContentAccess::CContent::NewLC( uri );
+ ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+ ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
ContentAccess::RStringAttributeSet attrSet;
CleanupClosePushL( attrSet );
@@ -177,8 +178,9 @@
attrSet.AddL( ContentAccess::EMimeType );
attrSet.AddL( ContentAccess::ETitle );
attrSet.AddL( ContentAccess::EAuthor );
-
- User::LeaveIfError( content->GetStringAttributeSet(attrSet) );
+ attrSet.AddL( ContentAccess::EGenre );
+
+ User::LeaveIfError( data->GetStringAttributeSet(attrSet) );
TInt err = attrSet.GetValue( ContentAccess::EDescription, aVHD.iDescription );
if ( err != KErrNone)
@@ -223,6 +225,17 @@
{
WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no author" );
}
+
+ err = attrSet.GetValue( ContentAccess::EGenre, aVHD.iGenre );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting genre failed %d", err );
+ }
+
+ if ( aVHD.iGenre.Length() <= 0 )
+ {
+ WRITELOG( "CHarvesterOMADRMPlugin::GatherDataL - no genre" );
+ }
err = content->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
if ( err != KErrNone)
@@ -230,7 +243,7 @@
WRITELOG1( "CHarvesterOMADRMPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
}
- CleanupStack::PopAndDestroy( 2, content );
+ CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet
}
// ---------------------------------------------------------------------------
@@ -303,6 +316,12 @@
CMdeObjectWrapper::HandleObjectPropertyL(mdeObject,
*iPropDefs->iAuthorPropertyDef, &aVHD.iAuthor, aIsAdd );
}
+ // Genre
+ if(aVHD.iGenre.Length() > 0)
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject,
+ *iPropDefs->iGenrePropertyDef, &aVHD.iGenre, aIsAdd );
+ }
}
// ---------------------------------------------------------------------------
--- a/harvester/harvesterplugins/RTPPlugin/group/harvesterrtpplugin.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/RTPPlugin/group/harvesterrtpplugin.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -56,4 +56,5 @@
PAGED
BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O2 -OTime
--- a/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -23,6 +23,7 @@
#include "harvesterlog.h"
#include "mdeobject.h"
#include "mdsutils.h"
+#include "harvestercommon.h"
#include "mdeobjectwrapper.h"
#include "harvesterrtpmetadatareader.h"
#include <mdenamespacedef.h>
@@ -86,6 +87,7 @@
void CHarvesterRtpPlugin::ConstructL()
{
WRITELOG( "CHarvesterRtpPlugin::ConstructL()" );
+ SetPriority( KHarvesterPriorityHarvestingPlugin - 1 );
}
// ---------------------------------------------------------------------------
--- a/harvester/harvesterplugins/VideoPlugin/group/harvestervideoplugin.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/group/harvestervideoplugin.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -34,7 +34,6 @@
SYSTEMINCLUDE /epoc32/include/ecom
SYSTEMINCLUDE /epoc32/include/libc
SYSTEMINCLUDE /epoc32/include/connect
-SYSTEMINCLUDE /epoc32/include/3gplibrary
USERINCLUDE ../inc
USERINCLUDE ../../../common/inc
@@ -51,8 +50,10 @@
LIBRARY 3GPMP4Lib.lib
LIBRARY harvesterplugininterface.lib
LIBRARY mdeclient.lib
-LIBRARY harvesterdata.lib
-LIBRARY harvestercommon.lib
+LIBRARY harvesterdata.lib
+LIBRARY harvestercommon.lib
+LIBRARY caf.lib
+LIBRARY cafutils.lib
STATICLIBRARY hxmetadatautil.lib
--- a/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h Fri Apr 16 15:23:55 2010 +0300
@@ -90,6 +90,8 @@
HBufC* iMimeBuf;
TUint32 iCodec;
+
+ TBool iDrmProtected;
CVideoHarvestData() : CBase()
{
@@ -135,6 +137,7 @@
CMdEPropertyDef* iGenrePropertyDef;
CMdEPropertyDef* iArtistPropertyDef;
CMdEPropertyDef* iDescriptionPropertyDef;
+ CMdEPropertyDef* iDrmPropertyDef;
CMdEPropertyDef* iAudioFourCCDef;
--- a/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -20,6 +20,7 @@
#include <3gplibrary/mp4lib.h>
#include <hxmetadatautil.h>
#include <hxmetadatakeys.h>
+#include <caf/caf.h>
#include "mdsutils.h"
#include "harvestervideoplugin.h"
@@ -109,6 +110,7 @@
iGenrePropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KGenreProperty );
iArtistPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KArtistProperty );
iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDescriptionProperty );
+ iDrmPropertyDef = &mediaDef.GetPropertyDefL( MediaObject::KDRMProperty );
iAudioFourCCDef = &mediaDef.GetPropertyDefL( MediaObject::KAudioFourCCProperty );
@@ -304,6 +306,47 @@
WRITELOG1( "CHarvesterVideoPlugin::GetObjectType - File open error: %d", error );
if( error == KErrInUse )
{
+#ifdef _DEBUG
+ TPtrC fileName( aUri.Mid(2) );
+ WRITELOG1( "CHarvesterVideoPlugin :: Checking open file handles to %S", &fileName );
+
+ CFileList* fileList = 0;
+ TOpenFileScan fileScan( iFs );
+
+ TRAP_IGNORE( fileScan.NextL( fileList ) );
+
+ while ( fileList )
+ {
+ const TInt count( fileList->Count() );
+ for (TInt i = 0; i < count; i++ )
+ {
+ if ( (*fileList)[i].iName == aUri.Mid(2) )
+ {
+ TFullName processName;
+ TFindThread find(_L("*"));
+ while( find.Next( processName ) == KErrNone )
+ {
+ RThread thread;
+ TInt err = thread.Open( processName );
+
+ if ( err == KErrNone )
+ {
+ if ( thread.Id().Id() == fileScan.ThreadId() )
+ {
+ processName = thread.Name();
+ thread.Close();
+ WRITELOG1( "CHarvesterVideoPlugin:: %S has a file handle open", &processName );
+ break;
+ }
+ thread.Close();
+ }
+ }
+ }
+ }
+ fileList = NULL;
+ TRAP_IGNORE( fileScan.NextL( fileList ) );
+ }
+#endif
aObjectType.Copy( KInUse() );
}
return;
@@ -399,6 +442,46 @@
error == KErrLocked )
{
WRITELOG( "CHarvesterVideoPlugin - File is open!" );
+#ifdef _DEBUG
+ TPtrC fileName( uri.Mid(2) );
+ WRITELOG1( "CHarvesterVideoPlugin :: Checking open file handles to %S", &fileName );
+
+ CFileList* fileList = 0;
+ TOpenFileScan fileScan( iFs );
+
+ fileScan.NextL( fileList );
+
+ while ( fileList )
+ {
+ const TInt count( fileList->Count() );
+ for (TInt i = 0; i < count; i++ )
+ {
+ if ( (*fileList)[i].iName == uri.Mid(2) )
+ {
+ TFullName processName;
+ TFindThread find(_L("*"));
+ while( find.Next( processName ) == KErrNone )
+ {
+ RThread thread;
+ TInt err = thread.Open( processName );
+
+ if ( err == KErrNone )
+ {
+ if ( thread.Id().Id() == fileScan.ThreadId() )
+ {
+ processName = thread.Name();
+ thread.Close();
+ WRITELOG1( "CHarvesterVideoPlugin:: %S has a file handle open", &processName );
+ break;
+ }
+ thread.Close();
+ }
+ }
+ }
+ }
+ fileScan.NextL( fileList );
+ }
+#endif
CleanupStack::PopAndDestroy( &file );
User::Leave( KErrInUse );
}
@@ -418,16 +501,6 @@
{
CMdEProperty* prop = NULL;
CMdEObjectDef& objectDef = aMetadataObject.Def();
- CMdEPropertyDef& sizeDef = objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
- aMetadataObject.Property( sizeDef, prop );
- if( prop )
- {
- aVHD.iFileSize = prop->Uint32ValueL();
- }
- else
- {
- dataExtracted = EFalse;
- }
CMdEPropertyDef& modifiedDef = objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
aMetadataObject.Property( modifiedDef, prop );
if( prop )
@@ -454,9 +527,9 @@
aVHD.iModified = entry.iModified;
aVHD.iFileSize = (TUint)entry.iSize;
+
+ WRITELOG1( "CHarvesterVideoPlugin - File size: %d", aVHD.iFileSize );
}
-
- WRITELOG1( "CHarvesterVideoPlugin - File size: %d", aVHD.iFileSize );
// now the minimum information has been harvested
// from now on the harvested data should always be stored
@@ -483,6 +556,19 @@
// doesn't own pointers to MIME types
RPointerArray<HBufC> mimes;
CleanupClosePushL( mimes );
+
+ TPtrC ext;
+ MdsUtils::GetExt( uri, ext );
+
+ // Check for possibly protected content
+ if( ext.CompareF( KExtensionWmv ) == 0 )
+ {
+ ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+ ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+
+ data->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
+ CleanupStack::PopAndDestroy( 2 ); // content, data
+ }
CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL();
CleanupStack::PushL( helixMetadata );
@@ -675,6 +761,77 @@
// don't destory mime type pointers just clean array
CleanupStack::PopAndDestroy( &mimes );
+
+ // If parsing failed, check for possible protected content
+ if( error == KErrNotSupported ||
+ error == KErrAccessDenied ||
+ error == KErrPermissionDenied )
+ {
+ ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+ ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+
+ if( !aVHD.iDrmProtected )
+ {
+ data->GetAttribute( ContentAccess::EIsProtected, aVHD.iDrmProtected );
+ }
+ if( aVHD.iDrmProtected )
+ {
+ ContentAccess::RStringAttributeSet attrSet;
+ CleanupClosePushL( attrSet );
+
+ attrSet.AddL( ContentAccess::EDescription );
+ attrSet.AddL( ContentAccess::ETitle );
+ attrSet.AddL( ContentAccess::EAuthor );
+ attrSet.AddL( ContentAccess::EGenre );
+
+ if( data->GetStringAttributeSet(attrSet) == KErrNone )
+ {
+ TBuf<KMaxDataTypeLength> value;
+
+ TInt err = attrSet.GetValue( ContentAccess::EDescription, value );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterVideoPlugin::GatherDataL - ERROR: getting description failed %d", err );
+ }
+ else if( value.Length() > 0 )
+ {
+ aVHD.iDescription = value.Alloc();
+ }
+
+ err = attrSet.GetValue( ContentAccess::ETitle, value );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterVideoPlugin::GatherDataL - ERROR: getting title failed %d", err );
+ }
+ else if( value.Length() > 0 )
+ {
+ aVHD.iTitle = value.Alloc();
+ }
+
+ err = attrSet.GetValue( ContentAccess::EAuthor, value );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterVideoPlugin::GatherDataL - ERROR: getting author failed %d", err );
+ }
+ else if( value.Length() > 0 )
+ {
+ aVHD.iAuthor = value.Alloc();
+ }
+
+ err = attrSet.GetValue( ContentAccess::EGenre, value );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterVideoPlugin::GatherDataL - ERROR: getting genre failed %d", err );
+ }
+ else if( value.Length() > 0 )
+ {
+ aVHD.iGenre = value.Alloc();
+ }
+ }
+ CleanupStack::PopAndDestroy(); // attrSet
+ }
+ CleanupStack::PopAndDestroy( 2 ); // content, data
+ }
}
else if( mapping->iHandler.iLibrary == TVideoMetadataHandling::EMp4LibHandling )
{
@@ -875,11 +1032,17 @@
{
if( aVHD.iVideoObject )
{
- CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iVideoBitrate, aIsAdd );
+ if( aVHD.iVideoBitrate != 0 )
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iVideoBitrate, aIsAdd );
+ }
}
else // audio object
{
- CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iAudioBitrate, aIsAdd );
+ if( aVHD.iAudioBitrate != 0 )
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iBitratePropertyDef, &aVHD.iAudioBitrate, aIsAdd );
+ }
}
}
@@ -924,6 +1087,12 @@
{
CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, aVHD.iTitle, EFalse );
}
+
+ // DRM protection
+ if( aVHD.iDrmProtected )
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDrmPropertyDef, &aVHD.iDrmProtected, aIsAdd );
+ }
}
void CHarvesterVideoPlugin::GetMp4Type( RFile64& aFile, TDes& aType )
--- a/harvester/harvesterplugins/WMVPlugin/group/harvesterwmvplugin.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/group/harvesterwmvplugin.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -43,15 +43,15 @@
MW_LAYER_SYSTEMINCLUDE
SYSTEMINCLUDE /epoc32/include/ecom
-SYSTEMINCLUDE /epoc32/include/caf
LIBRARY caf.lib
+LIBRARY cafutils.lib
LIBRARY euser.lib
LIBRARY efsrv.lib
LIBRARY harvestercommon.lib
LIBRARY harvesterplugininterface.lib
LIBRARY mdeclient.lib
-LIBRARY harvesterdata.lib
+LIBRARY harvesterdata.lib
PAGED
BYTEPAIRCOMPRESSTARGET
--- a/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h Fri Apr 16 15:23:55 2010 +0300
@@ -40,6 +40,13 @@
CMdEPropertyDef* iLastModifiedDatePropertyDef;
CMdEPropertyDef* iSizePropertyDef;
CMdEPropertyDef* iItemTypePropertyDef;
+ CMdEPropertyDef* iTitlePropertyDef;
+
+ // Media property definitions
+ CMdEPropertyDef* iDrmPropertyDef;
+ CMdEPropertyDef* iDescriptionPropertyDef;
+ CMdEPropertyDef* iAuthorPropertyDef;
+ CMdEPropertyDef* iGenrePropertyDef;
private:
CHarvesterWmvPluginPropertyDefs();
@@ -89,6 +96,12 @@
*/
TUint32 iFileSize;
+ TBuf<KMaxDataTypeLength> iDescription;
+ TBuf<KMaxDataTypeLength> iTitle;
+ TBuf<KMaxDataTypeLength> iAuthor;
+ TBuf<KMaxDataTypeLength> iGenre;
+ TBool iDrmProtected;
+
private:
/**
--- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -11,16 +11,17 @@
*
* Contributors:
*
-* Description: Harvests metadata from wmv video file
+* Description: Harvests metadata from wm video file
*
*/
#include <e32std.h>
-#include <caf/content.h>
+#include <caf/caf.h>
#include "mdsutils.h"
#include "harvesterdata.h"
#include "harvesterlog.h"
+#include "harvestercommon.h"
#include "harvesterwmvplugin.h"
#include <mdenamespacedef.h>
#include <mdeobjectdef.h>
@@ -42,6 +43,13 @@
iLastModifiedDatePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty );
iSizePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty );
iItemTypePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty );
+ iTitlePropertyDef = &objectDef.GetPropertyDefL( MdeConstants::Object::KTitleProperty );
+
+ CMdEObjectDef& mediaDef = nsDef.GetObjectDefL( MdeConstants::MediaObject::KMediaObject );
+ iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty );
+ iDescriptionPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty );
+ iAuthorPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KAuthorProperty );
+ iGenrePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KGenreProperty );
}
CHarvesterWmvPluginPropertyDefs* CHarvesterWmvPluginPropertyDefs::NewL(CMdEObjectDef& aObjectDef)
@@ -77,6 +85,7 @@
CHarvesterWMVPlugin::~CHarvesterWMVPlugin()
{
WRITELOG( "CHarvesterWMVPlugin::~CHarvesterWMVPlugin()" );
+ delete iPropDefs;
}
// ---------------------------------------------------------------------------
@@ -154,6 +163,7 @@
void CHarvesterWMVPlugin::ConstructL()
{
WRITELOG( "CHarvesterWMVPlugin::ConstructL()" );
+ SetPriority( KHarvesterPriorityHarvestingPlugin - 1 );
}
// ---------------------------------------------------------------------------
@@ -166,7 +176,6 @@
const TDesC& uri = aMetadataObject.Uri();
- TInt error ( KErrNone );
TEntry* entry = new (ELeave) TEntry();
CleanupStack::PushL( entry );
@@ -178,16 +187,81 @@
CleanupStack::PopAndDestroy( entry );
ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri );
+ ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek );
+
+ ContentAccess::RStringAttributeSet attrSet;
+ CleanupClosePushL( attrSet );
+
+ attrSet.AddL( ContentAccess::EDescription );
+ attrSet.AddL( ContentAccess::EMimeType );
+ attrSet.AddL( ContentAccess::ETitle );
+ attrSet.AddL( ContentAccess::EAuthor );
+ attrSet.AddL( ContentAccess::EGenre );
- //Mime type check
- error = content->GetStringAttribute( ContentAccess::EMimeType, aClipDetails.iMimeType );
- if ( error != KErrNone )
+ User::LeaveIfError( data->GetStringAttributeSet(attrSet) );
+
+ TInt err = attrSet.GetValue( ContentAccess::EMimeType, aClipDetails.iMimeType );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting mimetype failed %d", err );
+ }
+
+ if ( aClipDetails.iMimeType.Length() <= 0 )
+ {
+ WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no mimetype" );
+ }
+
+ err = attrSet.GetValue( ContentAccess::EDescription, aClipDetails.iDescription );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting description failed %d", err );
+ }
+
+ if ( aClipDetails.iDescription.Length() <= 0 )
{
- WRITELOG( "CHarvesterWMVPlugin - Could not resolve mime type, leave!" );
- User::Leave( KErrNotSupported );
+ WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no description" );
+ }
+
+ err = attrSet.GetValue( ContentAccess::ETitle, aClipDetails.iTitle );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting title failed %d", err );
+ }
+
+ if ( aClipDetails.iTitle.Length() <= 0 )
+ {
+ WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no title" );
+ }
+
+ err = attrSet.GetValue( ContentAccess::EAuthor, aClipDetails.iAuthor );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting author failed %d", err );
+ }
+
+ if ( aClipDetails.iAuthor.Length() <= 0 )
+ {
+ WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no author" );
}
- CleanupStack::PopAndDestroy( content );
+ err = attrSet.GetValue( ContentAccess::EGenre, aClipDetails.iGenre );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting genre failed %d", err );
+ }
+
+ if ( aClipDetails.iGenre.Length() <= 0 )
+ {
+ WRITELOG( "CHarvesterWMVPlugin::GatherDataL - no genre" );
+ }
+
+ err = content->GetAttribute( ContentAccess::EIsProtected, aClipDetails.iDrmProtected );
+ if ( err != KErrNone)
+ {
+ WRITELOG1( "CHarvesterWMVPlugin::GatherDataL - ERROR: getting protection info failed %d", err );
+ }
+
+ CleanupStack::PopAndDestroy( 3 ); // content, data, attrSet
}
// ---------------------------------------------------------------------------
@@ -226,5 +300,36 @@
CMdeObjectWrapper::HandleObjectPropertyL(mdeObject,
*iPropDefs->iItemTypePropertyDef, &aClipDetails.iMimeType, aIsAdd );
}
+
+ // DRM protection
+ if( aClipDetails.iDrmProtected )
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject,
+ *iPropDefs->iDrmPropertyDef, &aClipDetails.iDrmProtected, aIsAdd );
+ }
+ // Title (is set from URI by default)
+ if(aClipDetails.iTitle.Length() > 0)
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject,
+ *iPropDefs->iTitlePropertyDef, &aClipDetails.iTitle, EFalse );
+ }
+ // Description
+ if(aClipDetails.iDescription.Length() > 0)
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject,
+ *iPropDefs->iDescriptionPropertyDef, &aClipDetails.iDescription, aIsAdd );
+ }
+ // Author
+ if(aClipDetails.iAuthor.Length() > 0)
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject,
+ *iPropDefs->iAuthorPropertyDef, &aClipDetails.iAuthor, aIsAdd );
+ }
+ // Genre
+ if(aClipDetails.iGenre.Length() > 0)
+ {
+ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject,
+ *iPropDefs->iGenrePropertyDef, &aClipDetails.iGenre, aIsAdd );
+ }
}
--- a/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -110,6 +110,9 @@
delete iEventArray;
iQueue.ResetAndDestroy();
+ iQueue.Close();
+
+ iUriArray.ResetAndDestroy();
iUriArray.Close();
}
@@ -837,7 +840,7 @@
void CFileEventHandlerAO::AddToQueueL( TMdsFSPStatus& aEvent )
{
CMdsFSPQueueItem* item = CMdsFSPQueueItem::NewL(aEvent);
- iQueue.Append(item);
+ iQueue.AppendL(item);
if( iNextRequest == ERequestIdle && !iCacheEvents )
{
SetNextRequest( ERequestProcessing );
--- a/harvester/monitorplugins/inc/fsutil.inl Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/inc/fsutil.inl Fri Apr 16 15:23:55 2010 +0300
@@ -52,8 +52,7 @@
sess->GetPresentMediasL( presentMedias );
TUint32 mediaid = 0;
- TInt count = presentMedias.Count();
- for( TInt i=0;i<count;i++ )
+ for( TInt i = presentMedias.Count() - 1; i >=0; i-- )
{
TMdEMediaInfo info = presentMedias[i];
if( info.iDrive == aDrive )
--- a/harvester/monitorplugins/mdsoomplugin/group/mdsoomplugin.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mdsoomplugin/group/mdsoomplugin.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -49,5 +49,6 @@
PAGED
BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O2 -OTime
--- a/harvester/monitorplugins/mdsoomplugin/inc/mdsoomplugin.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mdsoomplugin/inc/mdsoomplugin.h Fri Apr 16 15:23:55 2010 +0300
@@ -45,14 +45,15 @@
/**
- * From COomMonitorPlugin
+ * From COomMonitorPlugin v2
* FreeRam is called when the system RAM level becomes
* low. This plugin is requested to help free some RAM.
+ * Paramater reserved for v2 plugin
*/
- void FreeRam();
+ void FreeRam( /*TInt aBytesToFree*/ );
/**
- * From COomMonitorPlugin
+ * From COomMonitorPlugin v2
* MemoryGood is called when the system RAM level becomes
* good after being low.The plugin may take this opportunity
* to start using RAM again.
--- a/harvester/monitorplugins/mdsoomplugin/src/mdsoomplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mdsoomplugin/src/mdsoomplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -49,11 +49,11 @@
}
-void CMdSOomPlugin::FreeRam()
+void CMdSOomPlugin::FreeRam( /*TInt aBytesToFree*/ )
{
WRITELOG("CMdSOomPlugin::FreeRam() - start");
- iOomMsgQueue.Send( TMdsOomFreeRam );
+ iOomMsgQueue.Send( EMdsOomFreeRam );
WRITELOG("CMdSOomPlugin::FreeRam() - end");
}
@@ -62,7 +62,7 @@
{
WRITELOG("CMdSOomPlugin::MemoryGood - start");
- iOomMsgQueue.Send( TMdsOomMemoryGood );
+ iOomMsgQueue.Send( EMdsOomMemoryGood );
WRITELOG("CMdSOomPlugin::MemoryGood - end ");
}
--- a/harvester/monitorplugins/messageplugin/group/messagemonitorplugin.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/messageplugin/group/messagemonitorplugin.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -59,4 +59,5 @@
PAGED
BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O2 -OTime
--- a/harvester/monitorplugins/mmcplugin/inc/mmcmonitorao.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/inc/mmcmonitorao.h Fri Apr 16 15:23:55 2010 +0300
@@ -75,20 +75,6 @@
TBool StopMonitoring();
/**
- * Resumes paused monitoring.
- *
- * @return ETrue if success, EFalse if not
- */
- TBool Resume();
-
- /**
- * Pauses monitoring.
- *
- * @return ETrue if success, EFalse if not
- */
- TBool Pause();
-
- /**
* Inherited from CActive. This method will be called on file server notifying.
*/
void RunL();
--- a/harvester/monitorplugins/mmcplugin/inc/mmcscannerao.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/inc/mmcscannerao.h Fri Apr 16 15:23:55 2010 +0300
@@ -28,7 +28,7 @@
// FORWARD DECLARATION
class MMonitorPluginObserver;
-class CMmcScannerAO : public CTimer
+class CMmcScannerAO : public CActive
{
public:
// Cancel and destroy
@@ -37,7 +37,7 @@
// Two-phased constructor.
static CMmcScannerAO* NewL( TUint32 aMediaId, CMdEHarvesterSession* aMdEClient,
MMonitorPluginObserver* aObserver, CHarvesterPluginFactory* aHarvesterPluginFactory,
- const TInt aPriority, TBool aAlreadyWaited );
+ const TInt aPriority );
public:
@@ -48,7 +48,7 @@
const TInt aPriority );
// Second-phase constructor
- void ConstructL( TBool aAlreadyWaited );
+ void ConstructL();
private:
enum TCMmcScannerAOState
@@ -75,6 +75,11 @@
void SetState( TCMmcScannerAOState aState );
+ /**
+ * From CActive
+ */
+ void DoCancel();
+
private:
TInt iState; // State of the active object
@@ -101,6 +106,8 @@
RPointerArray<CHarvesterData> iHdArray;
CHarvesterEventManager* iHEM;
+
+ RTimer iTimer;
};
#endif // CMMCSCANNERAO_H
--- a/harvester/monitorplugins/mmcplugin/src/mmcmonitorao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmonitorao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -44,7 +44,7 @@
User::LeaveIfError( iFs.Connect() );
CActiveScheduler::Add( this );
- for( TInt i=0; i<KMaxDrives; i++ )
+ for( TInt i = KMaxDrives - 1; i >=0; i-- )
{
iMediaIdList[i] = 0;
}
@@ -112,27 +112,6 @@
return ETrue;
}
-TBool CMMCMonitorAO::Resume()
- {
- WRITELOG( "CMMCMonitorAO::Resume" ); // DEBUG INFO
-
- iPreviousDriveList.Zero();
- iPreviousDriveList.Copy( iDriveList );
-
- BuildDriveList();
- CompareDriveLists();
- StartNotify();
-
- return ETrue;
- }
-
-TBool CMMCMonitorAO::Pause()
- {
- WRITELOG( "CMMCMonitorAO::Pause" ); // DEBUG INFO
-
- return StopMonitoring();
- }
-
void CMMCMonitorAO::RunL()
{
#ifdef _DEBUG
--- a/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmonitorplugin.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -112,7 +112,6 @@
TUint32 hdMediaId( 0 );
hdMediaId = iMountTask->GetInternalDriveMediaId();
- TBool alreadyWaited( EFalse );
const TInt count( medias.Count() );
for ( TInt i = 0; i < count; i++ )
@@ -130,8 +129,7 @@
iMmcScanner = NULL;
}
TRAP_IGNORE( iMmcScanner = CMmcScannerAO::NewL( medias[i].iMediaId, iMdEClient, iObserver,
- aHarvesterPluginFactory, CActive::EPriorityHigh, alreadyWaited ) );
- alreadyWaited = ETrue;
+ aHarvesterPluginFactory, CActive::EPriorityUserInput ) );
}
}
@@ -157,7 +155,7 @@
medias.Append( hdInfo );
TRAP_IGNORE( iHddScanner = CMmcScannerAO::NewL( hdMediaId, iMdEClient, iObserver,
- aHarvesterPluginFactory, KHarvesterCustomImportantPriority, alreadyWaited ));
+ aHarvesterPluginFactory, KHarvesterCustomImportantPriority ));
}
}
@@ -251,10 +249,6 @@
{
WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EMounted" );
mountData->iMountType = TMountData::EMount;
- if( !iMountTask->IsActive() )
- {
- iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
- }
iMountTask->StartMount( *mountData );
}
break;
@@ -269,10 +263,6 @@
{
WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EDismounted" );
mountData->iMountType = TMountData::EUnmount;
- if( !iMountTask->IsActive() )
- {
- iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
- }
iMountTask->StartUnmount( *mountData );
}
}
@@ -282,18 +272,16 @@
{
WRITELOG( "CMMCMonitorPlugin::MountEvent with parameter EFormatted" );
mountData->iMountType = TMountData::EFormat;
- if( !iMountTask->IsActive() )
- {
- iMountTask->SetPriority( KHarvesterPriorityMonitorPlugin );
- }
iMountTask->StartUnmount( *mountData );
}
break;
default:
{
+#ifdef _DEBUG
_LIT( KLogPanic, "unknown state" );
User::Panic( KLogPanic, KErrArgument );
+#endif
}
break;
}
--- a/harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -72,8 +72,11 @@
iFs.Close();
iMountDataQueue.ResetAndDestroy();
+ iMountDataQueue.Close();
iEntryArray.ResetAndDestroy();
+ iEntryArray.Close();
iHarvestEntryArray.ResetAndDestroy();
+ iHarvestEntryArray.Close();
delete iMdeSession;
@@ -126,7 +129,6 @@
{
Cancel();
Deinitialize();
- iNextRequest = ERequestIdle;
}
}
@@ -188,7 +190,6 @@
}
else
{
- SetPriority( KHarvesterCustomImportantPriority );
SetNextRequest( ERequestIdle );
iMountDataQueue.Compress();
}
@@ -349,7 +350,6 @@
WRITELOG( "CMMCMountTaskAO::RunL - ERequestCleanup" );
TBool present = (iMountData->iMountType == TMountData::EMount);
iMdeSession->SetMediaL( iMountData->iMediaID, iMountData->iDrivePath[0], present );
- SetPriority( KHarvesterCustomImportantPriority );
Deinitialize();
SetNextRequest( ERequestStartTask );
}
--- a/harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/src/mmcscannerao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -31,7 +31,7 @@
CMmcScannerAO::CMmcScannerAO( TUint32 aMediaId,
CMdEHarvesterSession* aMdEClient, MMonitorPluginObserver* aObserver,
CHarvesterPluginFactory* aHarvesterPluginFactory, const TInt aPriority ) :
- CTimer( aPriority ), iState( EUninitialized ), iMmcFileList( NULL )
+ CActive( aPriority ), iState( EUninitialized ), iMmcFileList( NULL )
{
iMediaId = aMediaId;
iMdEClient = aMdEClient;
@@ -41,45 +41,39 @@
CMmcScannerAO* CMmcScannerAO::NewL( TUint32 aMediaId, CMdEHarvesterSession* aMdEClient,
MMonitorPluginObserver* aObserver, CHarvesterPluginFactory* aHarvesterPluginFactory,
- const TInt aPriority, TBool aAlreadyWaited )
+ const TInt aPriority )
{
CMmcScannerAO* self = new ( ELeave ) CMmcScannerAO( aMediaId, aMdEClient, aObserver,
aHarvesterPluginFactory, aPriority );
CleanupStack::PushL( self );
- self->ConstructL( aAlreadyWaited );
+ self->ConstructL( );
CleanupStack::Pop( self );
return self;
}
-void CMmcScannerAO::ConstructL( TBool aAlreadyWaited )
+void CMmcScannerAO::ConstructL()
{
- CTimer::ConstructL();
- CActiveScheduler::Add( this ); // Add to scheduler
+ CActiveScheduler::Add( this ); // Add to scheduler
+ iTimer.CreateLocal();
iState = EUninitialized;
User::LeaveIfError( iFs.Connect() );
iMmcFileList = CMmcFileList::NewL();
- if( !aAlreadyWaited )
- {
- TInt tmpDelay( KDefaultDelay );
- TTimeIntervalMicroSeconds32 delay( tmpDelay * KMillion );
- CRepository* repo = CRepository::NewLC( KRepositoryUid );
- const TInt err = repo->Get( KScanDelayKey, tmpDelay );
- if ( err == KErrNone )
- {
- delay = tmpDelay * KMillion;
- }
- CleanupStack::PopAndDestroy( repo );
- After( delay );
- }
- else
- {
- TTimeIntervalMicroSeconds32 delay( 5 );
- After( delay );
- }
+ TInt tmpDelay( KDefaultDelay );
+ TTimeIntervalMicroSeconds32 delay( tmpDelay * KMillion );
+ CRepository* repo = CRepository::NewLC( KRepositoryUid );
+ const TInt err = repo->Get( KScanDelayKey, tmpDelay );
+ if ( err == KErrNone )
+ {
+ delay = tmpDelay * KMillion;
+ }
+ CleanupStack::PopAndDestroy( repo );
iHEM = CHarvesterEventManager::GetInstanceL();
+
+ iTimer.After( iStatus, delay );
+ SetActive();
}
CMmcScannerAO::~CMmcScannerAO()
@@ -207,10 +201,16 @@
case( EDone ):
{
iFs.Close();
+ iTimer.Close();
iHdArray.Reset();
iHdArray.Compress();
iEntryArray.Compress();
iHarvestEntryArray.Compress();
+ if (iHEM)
+ {
+ iHEM->ReleaseInstance();
+ iHEM = NULL;
+ }
break;
}
@@ -282,3 +282,10 @@
SetActive();
}
}
+
+void CMmcScannerAO::DoCancel()
+ {
+ iTimer.Cancel();
+ iTimer.Close();
+ }
+
--- a/harvester/monitorplugins/monitorplugininterface/group/monitorplugininterface.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/monitorplugins/monitorplugininterface/group/monitorplugininterface.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -50,4 +50,5 @@
PAGED
BYTEPAIRCOMPRESSTARGET
+OPTION ARMCC -O3 -OSpace
--- a/harvester/server/group/harvesterserver.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/group/harvesterserver.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -57,6 +57,7 @@
SOURCE harvesteroomao.cpp
SOURCE pauseobserverao.cpp
SOURCE harvestershutdownobserver.cpp
+SOURCE harvesterdiskspaceobserver.cpp
MW_LAYER_SYSTEMINCLUDE
--- a/harvester/server/inc/harvesterao.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/inc/harvesterao.h Fri Apr 16 15:23:55 2010 +0300
@@ -35,6 +35,7 @@
#include "harvesteroomao.h"
#include "backupsubscriber.h"
#include "harvestermediaidutil.h"
+#include "harvesterdiskspaceobserver.h"
// forward declarations
@@ -99,7 +100,8 @@
public MMdESessionObserver,
public MBackupRestoreObserver,
public MUnmountObserver,
- public MHarvesterOomObserver
+ public MHarvesterOomObserver,
+ public MMdSHarvesterDiskSpaceObserver
{
public:
@@ -279,6 +281,9 @@
* Backup&Restore has finished backup or restore.
*/
void BackupRestoreReady();
+
+ // From MMdSHarvesterDiskSpaceObserver
+ void HandleDiskSpaceNotificationL( TDiskSpaceDirection aCrossDirection );
/** */
void HandleUnmount( TUint32 aMediaId );
@@ -546,6 +551,21 @@
// Own.
CDesCArray* iCameraExtensionArray;
+
+ /**
+ * Notifier for situations where free disk space runs out. Own
+ */
+ CMdSHarvesterDiskspaceObserverAO* iDiskFullNotifier;
+
+ TBool iRamFull;
+
+ TBool iDiskFull;
+
+ TBool iManualPauseEnabled;
+
+ TBool iFastHarvestNeeded;
+
+ TBool iHarvestingPlaceholders;
};
#endif //__CHARVESTERAO_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/server/inc/harvesterdiskspaceobserver.h Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* 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: Low disk space observer for harvester server
+*
+*/
+
+
+#ifndef MDSHARVESTERDISKSPACEOBSERVERAO_H
+#define MDSHARVESTERDISKSPACEOBSERVERAO_H
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <f32file.h>
+
+/**
+* MMdSHarvesterDiskSpaceObserver
+* Observer interface for a disk space notifier.
+*/
+class MMdSHarvesterDiskSpaceObserver
+ {
+ public :
+ enum TDiskSpaceDirection
+ {
+ /** Disk space is larger than threshold level */
+ EMore,
+
+ /** Disk space is smaller than threshold level */
+ ELess
+ };
+
+ /**
+ * Called to notify the observer that disk space has crossed the specified threshold value.
+ *
+ * @param aCrossDirection threshold cross direction
+ */
+ virtual void HandleDiskSpaceNotificationL(TDiskSpaceDirection aDiskSpaceDirection) = 0;
+ };
+
+/**
+* CMSDiskSpaceNotifierAO.
+* A disk space notifier class
+*/
+class CMdSHarvesterDiskspaceObserverAO : public CActive
+ {
+ public:
+ enum TDiskSpaceNotifierState
+ {
+ ENormal,
+ EIterate
+ };
+
+ public : // Constructors and destructors
+ /**
+ * Constructs a disk space notifier implementation.
+ *
+ * @param aThreshold minimum free disk space threshold level in bytes
+ * @param aFilename filename which defines monitored drive's number
+ * @return metadata server implementation
+ */
+ static CMdSHarvesterDiskspaceObserverAO* NewL(
+ MMdSHarvesterDiskSpaceObserver& aObserver,
+ TInt64 aThreshold, const TDesC& aFilename);
+
+ /**
+ * Constructs a disk space notifier implementation and leaves it
+ * in the cleanup stack.
+ *
+ * @param aThreshold minimum free disk space threshold level in bytes
+ * @param aFilename filename which defines monitored drive's number
+ * @return metadata server implementation
+ */
+ static CMdSHarvesterDiskspaceObserverAO* NewLC(
+ MMdSHarvesterDiskSpaceObserver& aObserver,
+ TInt64 aThreshold, const TDesC& aFilename);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMdSHarvesterDiskspaceObserverAO();
+
+ protected: // Functions from base classes
+ /**
+ * From CActive
+ * Callback function.
+ * Invoked to handle responses from the server.
+ */
+ void RunL();
+
+ /**
+ * From CActive
+ * Handles errors that occur during notifying the observer.
+ */
+ TInt RunError(TInt aError);
+
+ /**
+ * From CActive
+ * Cancels any outstanding operation.
+ */
+ void DoCancel();
+
+ private: // Constructors and destructors
+
+ /**
+ * constructor
+ */
+ CMdSHarvesterDiskspaceObserverAO(
+ MMdSHarvesterDiskSpaceObserver& aObserver,
+ TInt64 aThreshold, TDriveNumber aDrive);
+
+ /**
+ * 2nd phase constructor
+ * @param aThreshold minimum free disk space threshold level in bytes
+ * @param aDrive monitored drive's number
+ */
+ void ConstructL();
+
+ private: // New methods
+
+ void StartNotifier();
+
+ static TDriveNumber GetDriveNumberL( const TDesC& aFilename );
+
+ private: // Data
+
+ MMdSHarvesterDiskSpaceObserver& iObserver;
+
+ RFs iFileServerSession;
+
+ const TInt64 iThreshold;
+
+ const TDriveNumber iDrive;
+
+ TDiskSpaceNotifierState iState;
+
+ TInt iIterationCount;
+ };
+
+#endif // MDSHARVESTERDISKSPACEOBSERVERAO_H
+
+// End of File
+
--- a/harvester/server/inc/restorewatcher.h Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/inc/restorewatcher.h Fri Apr 16 15:23:55 2010 +0300
@@ -139,6 +139,9 @@
/*iFileName - File used for restore flag.*/
TFileName iFileName;
+
+ /*iFs - File server session, own.*/
+ RFs iFs;
};
#endif // RESTOREWATCHER_H
--- a/harvester/server/src/harvesterao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/src/harvesterao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -125,7 +125,7 @@
// CHarvesterAO
// ---------------------------------------------------------------------------
//
-CHarvesterAO::CHarvesterAO() : CActive( KHarvesterCustomImportantPriority )
+CHarvesterAO::CHarvesterAO() : CActive( KHarvesterPriorityHarvestingPlugin )
{
WRITELOG( "CHarvesterAO::CHarvesterAO() - begin" );
@@ -134,6 +134,12 @@
iContextEngineInitialized = EFalse;
iMdeSessionInitialized = EFalse;
+
+ iRamFull = EFalse;
+ iDiskFull = EFalse;
+ iManualPauseEnabled = EFalse;
+ iFastHarvestNeeded = EFalse;
+ iHarvestingPlaceholders = EFalse;
}
// ---------------------------------------------------------------------------
@@ -164,6 +170,7 @@
StopComposers();
DeleteComposers();
+ delete iDiskFullNotifier;
delete iBackupSubscriber;
if (iBlacklist)
@@ -186,9 +193,6 @@
}
}
iHarvestFileMessages.Close();
-
- iMonitorPluginArray.ResetAndDestroy();
- iMonitorPluginArray.Close();
iPHArray.ResetAndDestroy();
iPHArray.Close();
@@ -231,10 +235,6 @@
// Setting up MdE Session
iMdESession = CMdESession::NewL( *this );
-
- RProcess process;
- process.SetPriority( EPriorityBackground );
- process.Close();
// Setting up context Engine (initialization is ready when ContextInitializationStatus -callback is called)
iCtxEngine = CContextEngine::GetInstanceL( this ); // Create the context engine
@@ -330,6 +330,8 @@
WRITELOG( "CHarvesterAO::DeleteMonitorPlugins()" );
iMonitorPluginArray.ResetAndDestroy();
+ iMonitorPluginArray.Close();
+ WRITELOG( "CHarvesterAO::DeleteMonitorPlugins() - end" );
}
// ---------------------------------------------------------------------------
@@ -405,7 +407,14 @@
//
void CHarvesterAO::HandleUnmount( TUint32 aMediaId )
{
- WRITELOG1( "CHarvesterAO::HandleUnmount(%d)", aMediaId );
+ WRITELOG1( "CHarvesterAO::HandleUnmount(%d)", aMediaId );
+
+ if( !iServerPaused )
+ {
+ // Stop harvesting for unmount
+ PauseMonitoring();
+ PauseHarvester();
+ }
TUint32 mediaId( 0 );
TUint removed( 0 );
@@ -421,7 +430,7 @@
{
for( TInt i=arrayCount-1; i>= 0; i--)
{
- hd = iPHArray[i];
+ hd = iReadyPHArray[i];
err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
if( err == KErrNone && mediaId == aMediaId )
@@ -434,6 +443,10 @@
arrayCount--;
}
}
+ if( iReadyPHArray.Count() == 0 )
+ {
+ iReadyPHArray.Compress();
+ }
WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iReadyPHArray %d", removed);
TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
}
@@ -461,6 +474,10 @@
arrayCount--;
}
}
+ if( iPHArray.Count() == 0 )
+ {
+ iPHArray.Compress();
+ }
WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iPHArray %d", removed);
TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
}
@@ -488,6 +505,10 @@
arrayCount--;
}
}
+ if( iContainerPHArray.Count() == 0 )
+ {
+ iContainerPHArray.Compress();
+ }
WRITELOG1( "CHarvesterAO::HandleUnmount() DecreaseItemCountL iContainerPHArray %d", removed);
TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed) );
}
@@ -513,8 +534,6 @@
const TInt hpiArrayCount( hpiArray.Count() );
if( hpiArrayCount > 0 )
{
- RArray<TItemId> placeholders;
-
TUint32 mediaId( 0 );
TInt err( KErrNone );
@@ -528,24 +547,22 @@
err = iMediaIdUtil->GetMediaId( mdeobj.Uri(), mediaId );
- if( mdeobj.Placeholder() && ( aMediaId == mediaId || err != KErrNone ))
+ if( aMediaId == mediaId || err != KErrNone )
{
+ hpi->iQueue.Remove(j);
removed++;
-
- TItemId id = mdeobj.Id();
- placeholders.Append( id );
+
TRAP_IGNORE( iMdESession->CancelObjectL( mdeobj ) );
delete hd;
hd = NULL;
- hpi->iQueue.Remove(j);
-
- if( hpi->iQueue.Count() == 0 )
- {
- hpi->iQueue.Compress();
- }
}
}
+
+ if( hpi->iQueue.Count() == 0 )
+ {
+ hpi->iQueue.Compress();
+ }
}
if( removed )
@@ -554,12 +571,15 @@
TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypePlaceholder, removed ) );
TRAP_IGNORE( iHarvesterEventManager->DecreaseItemCountL( EHEObserverTypeMMC, removed ) );
}
-
- RArray<TItemId> results;
- TRAP_IGNORE( iMdESession->RemoveObjectsL( placeholders, results, NULL ) );
- results.Close();
- placeholders.Close();
}
+
+ // resume harvesting from last state
+ if( !iRamFull && !iDiskFull )
+ {
+ // resume monitoring
+ ResumeMonitoring();
+ TRAP_IGNORE( ResumeHarvesterL() );
+ }
}
// ---------------------------------------------------------------------------
@@ -622,6 +642,7 @@
WRITELOG( "CHarvesterAO::DeleteComposers()" );
iComposerPluginArray.ResetAndDestroy();
+ iComposerPluginArray.Close();
WRITELOG( "CHarvesterAO::DeleteComposers() - end" );
}
@@ -659,14 +680,58 @@
if ( hd->ObjectType() == EPlaceholder )
{
+ iHarvestingPlaceholders = ETrue;
+ if( !iFastHarvestNeeded )
+ {
+ SetPriority( KHarvesterCustomImportantPriority );
+ }
while( hd != NULL &&
iPHArray.Count() < KPlaceholderQueueSize &&
hd->ObjectType() == EPlaceholder )
{
iPHArray.Append( hd );
+ if( hd->Origin() == MdeConstants::Object::ECamera ||
+ hd->ObjectType() == EFastHarvest )
+ {
+ if( !iFastHarvestNeeded )
+ {
+ iFastHarvestNeeded = ETrue;
+ // Fast harvest event must be handled even if MMC handling would be ongoing
+ SetPriority( KHarvesterPriorityMonitorPlugin );
+ }
+ break;
+ }
+ else if( iFastHarvestNeeded )
+ {
+ iFastHarvestNeeded = EFalse;
+ SetPriority( KHarvesterCustomImportantPriority );
+ }
hd = iQueue->GetNextItem();
}
+ if( iFastHarvestNeeded && iPHArray.Count() > 0 )
+ {
+ TRAPD( err, HandlePlaceholdersL( ETrue ) );
+
+ // make sure that when HandlePlaceholdersL leaves, iPHArray is cleared
+ if ( err != KErrNone )
+ {
+ iPHArray.ResetAndDestroy();
+ User::Leave( err );
+ }
+
+ TInt count( iReadyPHArray.Count() );
+ for( TInt i = 0; i < count; i++ )
+ {
+ CheckFileExtensionAndHarvestL( iReadyPHArray[i] );
+ iReadyPHArray.Remove( i );
+ // correct the index so harvesting order remains ok
+ i--;
+ count--;
+ }
+ return;
+ }
+
if( hd )
{
if( hd->ObjectType() == EPlaceholder )
@@ -693,6 +758,11 @@
}
else
{
+ if( iHarvestingPlaceholders && !iFastHarvestNeeded )
+ {
+ SetPriority( KHarvesterPriorityHarvestingPlugin );
+ }
+ iHarvestingPlaceholders = EFalse;
CheckFileExtensionAndHarvestL( hd );
}
}
@@ -1216,19 +1286,20 @@
WRITELOG( "CHarvesterAO::HandleSessionOpened() - ObjectHandler creation failed" );
}
+ // Setting up monitor plugins
+ TRAP( errorTrap, LoadMonitorPluginsL() );
+ if ( errorTrap != KErrNone )
+ {
+ WRITELOG( "CHarvesterAO::HandleSessionOpened() - error loading monitor plugins" );
+ }
+
+ // To check if the default namespace structure is in order
TRAP( errorTrap, PreallocateNamespaceL( aSession.GetDefaultNamespaceDefL() ) );
if ( errorTrap != KErrNone )
{
WRITELOG( "CHarvesterAO::HandleSessionOpened() - error loading default schema" );
}
- // Setting up monitor plugins
- TRAP( errorTrap, LoadMonitorPluginsL() );
- if ( errorTrap != KErrNone )
- {
- WRITELOG( "CHarvesterAO::HandleSessionOpened() - error loading monitor plugins" );
- }
-
TRAP( errorTrap, StartComposersL() );
if ( errorTrap != KErrNone )
{
@@ -1250,6 +1321,12 @@
// Starting monitor plugins
StartMonitoring();
+
+ TRAP( errorTrap, iDiskFullNotifier = CMdSHarvesterDiskspaceObserverAO::NewL( *this, KDiskFullThreshold, KMdsSqlDbDefaultName ) );
+ if ( errorTrap != KErrNone )
+ {
+ WRITELOG( "CHarvesterAO::HandleSessionOpened() - couldn't start diskspace observer" );
+ }
TRAP( errorTrap, iOnDemandAO = COnDemandAO::NewL( *iMdESession, *iQueue,
*iHarvesterPluginFactory, &iReadyPHArray ) );
@@ -1374,8 +1451,16 @@
{
WRITELOG( "CHarvesterAO::PauseHarvester()" );
+ Cancel();
+
+ iHarvesterPluginFactory->PauseHarvester( ETrue );
iServerPaused = ETrue;
+ if( !iRamFull && !iDiskFull )
+ {
+ iManualPauseEnabled = ETrue;
+ }
+
// Everything is paused
WRITELOG( "CHarvesterAO::PauseHarvester() - Moving paused state paused" );
@@ -1390,7 +1475,9 @@
{
WRITELOG( "CHarvesterAO::ResumeHarvesterL()" );
+ iHarvesterPluginFactory->PauseHarvester( EFalse );
iServerPaused = EFalse;
+ iManualPauseEnabled = EFalse;
SetNextRequest( ERequestHarvest );
}
@@ -1430,17 +1517,31 @@
{
ReadItemFromQueueL();
SetNextRequest( ERequestHarvest );
+ break;
}
- // no more items to harvest
+ // no more items to handle from main queue
else
{
- // if container files to harvest, handle those
+ // All registered fast harvested items or placeholders handled at this point
+ // if container files to harvest, handle those next
if( iContainerPHArray.Count() > 0 )
{
+ iFastHarvestNeeded = EFalse;
+ iHarvestingPlaceholders = EFalse;
+ SetPriority( KHarvesterPriorityHarvestingPlugin );
SetNextRequest( ERequestContainerPlaceholder );
break;
}
+ else if( iHarvestingPlaceholders || iFastHarvestNeeded )
+ {
+ // reset to default priority
+ iFastHarvestNeeded = EFalse;
+ iHarvestingPlaceholders = EFalse;
+ SetPriority( KHarvesterPriorityHarvestingPlugin );
+ SetNextRequest( ERequestHarvest );
+ break;
+ }
const TInt arrayCount( iReadyPHArray.Count() );
if( arrayCount > 0 )
@@ -1494,6 +1595,7 @@
// make sure that when HandlePlaceholdersL leaves, iPHArray is cleared
if ( err != KErrNone )
{
+ iContainerPHArray.ResetAndDestroy();
iPHArray.ResetAndDestroy();
User::Leave( err );
}
@@ -1650,6 +1752,43 @@
}
// ---------------------------------------------------------------------------
+// From MMdSHarvesterDiskSpaceObserver.
+// Called when change is disk space status occures
+// ---------------------------------------------------------------------------
+//
+void CHarvesterAO::HandleDiskSpaceNotificationL( TDiskSpaceDirection aDiskSpaceDirection )
+ {
+ WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL()");
+ if( MMdSHarvesterDiskSpaceObserver::EMore == aDiskSpaceDirection )
+ {
+ WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk full");
+ iDiskFull = EFalse;
+ }
+ else
+ {
+ WRITELOG("CHarvesterAO::HandleDiskSpaceNotificationL() - disk space available");
+ iDiskFull = ETrue;
+ if( iServerPaused )
+ {
+ return;
+ }
+ }
+
+ if( iDiskFull )
+ {
+ // cache monitored events
+ PauseMonitoring();
+ PauseHarvester();
+ }
+ else if( !iRamFull && !iManualPauseEnabled && iServerPaused )
+ {
+ // resume monitoring
+ ResumeMonitoring();
+ TRAP_IGNORE( ResumeHarvesterL() );
+ }
+ }
+
+// ---------------------------------------------------------------------------
// HarvestFile
// ---------------------------------------------------------------------------
//
@@ -2352,9 +2491,7 @@
TBool CHarvesterAO::IsDescInArray(const TPtrC& aSearch, const RPointerArray<HBufC>& aArray)
{
- const TInt count = aArray.Count();
-
- for( TInt i = 0; i < count; i++ )
+ for( TInt i = aArray.Count() - 1; i >=0; i-- )
{
const TDesC& ignorePath = aArray[i]->Des();
@@ -2584,17 +2721,14 @@
void CHarvesterAO::PreallocateNamespaceL( CMdENamespaceDef& aNamespaceDef )
{
- const TInt objectDefCount = aNamespaceDef.ObjectDefCount();
-
- for( TInt i = 0; i < objectDefCount; i++ )
+ for( TInt i = aNamespaceDef.ObjectDefCount() - 1; i >=0; i-- )
{
CMdEObjectDef& objectDef = aNamespaceDef.ObjectDefL( i );
- const TInt propertyDefCount = objectDef.PropertyDefCount();
-
- for( TInt j = 0; j < propertyDefCount; j++ )
+ for( TInt j = objectDef.PropertyDefCount() - 1; j >=0; j-- )
{
- CMdEPropertyDef& propertyDef = objectDef.PropertyDefL( j );
+ // No need for a local copy of the returned pointer
+ objectDef.PropertyDefL( j );
}
}
}
@@ -2639,20 +2773,35 @@
void CHarvesterAO::MemoryLow()
{
- WRITELOG("CHarvesterAO::MemoryLow()");
+ WRITELOG("CHarvesterAO::MemoryLow()");
+ iRamFull = ETrue;
+
+ if( iServerPaused )
+ {
+ return;
+ }
+
// cache monitored events
PauseMonitoring();
+ PauseHarvester();
- PauseHarvester();
+ iPHArray.Compress();
+ iReadyPHArray.Compress();
+ iContainerPHArray.Compress();
}
void CHarvesterAO::MemoryGood()
{
- WRITELOG("CHarvesterAO::MemoryGood()");
- // resume monitoring
- ResumeMonitoring();
-
- TRAP_IGNORE( ResumeHarvesterL() );
+ WRITELOG("CHarvesterAO::MemoryGood()");
+ iRamFull = EFalse;
+
+ if( !iDiskFull && !iManualPauseEnabled && iServerPaused )
+ {
+ // resume monitoring
+ ResumeMonitoring();
+
+ TRAP_IGNORE( ResumeHarvesterL() );
+ }
}
TBool CHarvesterAO::CheckForCameraItem( CHarvesterData* aHd, TDes& aObjectDef )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/harvester/server/src/harvesterdiskspaceobserver.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,189 @@
+/*
+* 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: Low disk space observer for harvester server
+*
+*/
+
+#include "harvesterdiskspaceobserver.h"
+#include "harvestercommon.h"
+
+CMdSHarvesterDiskspaceObserverAO* CMdSHarvesterDiskspaceObserverAO::NewL(
+ MMdSHarvesterDiskSpaceObserver& aObserver, TInt64 aThreshold, const TDesC& aFilename)
+ {
+ CMdSHarvesterDiskspaceObserverAO* self =
+ CMdSHarvesterDiskspaceObserverAO::NewLC( aObserver, aThreshold, aFilename );
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+CMdSHarvesterDiskspaceObserverAO* CMdSHarvesterDiskspaceObserverAO::NewLC(
+ MMdSHarvesterDiskSpaceObserver& aObserver, TInt64 aThreshold, const TDesC& aFilename)
+ {
+ TDriveNumber driveNumber = GetDriveNumberL( aFilename );
+
+ CMdSHarvesterDiskspaceObserverAO* self =
+ new ( ELeave ) CMdSHarvesterDiskspaceObserverAO( aObserver, aThreshold, driveNumber );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+CMdSHarvesterDiskspaceObserverAO::~CMdSHarvesterDiskspaceObserverAO()
+ {
+ Cancel();
+
+ iFileServerSession.Close();
+ }
+
+void CMdSHarvesterDiskspaceObserverAO::RunL()
+ {
+ TVolumeInfo volumeInfo;
+
+ if ( iState == CMdSHarvesterDiskspaceObserverAO::ENormal )
+ {
+ TInt status = iStatus.Int();
+
+ switch( status )
+ {
+ case KErrNone:
+ {
+ const TInt error = iFileServerSession.Volume( volumeInfo, iDrive );
+ if( error != KErrNone )
+ {
+ // Continue harvester if some error in accessing volume occures so that harvester does not remain paused forever
+ iObserver.HandleDiskSpaceNotificationL( MMdSHarvesterDiskSpaceObserver::EMore );
+ StartNotifier();
+ break;
+ }
+
+ // Check if free space is less than threshold level
+ if( volumeInfo.iFree < iThreshold )
+ {
+ iObserver.HandleDiskSpaceNotificationL( MMdSHarvesterDiskSpaceObserver::ELess );
+ iState = EIterate;
+ iIterationCount = 0;
+ SetActive();
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ return;
+ }
+ else
+ {
+ iObserver.HandleDiskSpaceNotificationL( MMdSHarvesterDiskSpaceObserver::EMore );
+ }
+ StartNotifier();
+ break;
+ }
+
+ default:
+ StartNotifier();
+ break;
+ }
+ }
+ else if ( iState == CMdSHarvesterDiskspaceObserverAO::EIterate )
+ {
+ const TInt KMaxIterations = 5;
+ TInt error = iFileServerSession.Volume( volumeInfo, iDrive );
+ if( error != KErrNone )
+ {
+ // Continue harvester if some error in accessing volume occures so that harvester does not remain paused forever
+ iObserver.HandleDiskSpaceNotificationL( MMdSHarvesterDiskSpaceObserver::EMore );
+ iState = ENormal;
+ iIterationCount = 0;
+ StartNotifier();
+ return;
+ }
+
+ if ( volumeInfo.iFree < iThreshold )
+ {
+ ++iIterationCount;
+ if ( iIterationCount < KMaxIterations )
+ {
+ SetActive();
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
+ return;
+ }
+ }
+ else
+ {
+ iObserver.HandleDiskSpaceNotificationL( MMdSHarvesterDiskSpaceObserver::EMore );
+ }
+ iState = ENormal;
+ iIterationCount = 0;
+ StartNotifier();
+ }
+ else
+ {
+ User::Leave( KErrGeneral );
+ }
+ }
+
+TInt CMdSHarvesterDiskspaceObserverAO::RunError(TInt /*aError*/)
+ {
+ StartNotifier();
+
+ return KErrNone;
+ }
+
+void CMdSHarvesterDiskspaceObserverAO::DoCancel()
+ {
+ if( IsActive() )
+ {
+ iFileServerSession.NotifyDiskSpaceCancel();
+ }
+ }
+
+CMdSHarvesterDiskspaceObserverAO::CMdSHarvesterDiskspaceObserverAO(
+ MMdSHarvesterDiskSpaceObserver& aObserver, TInt64 aThreshold, TDriveNumber aDrive)
+ : CActive( KHarvesterPriorityMonitorPlugin),
+ iObserver( aObserver ), iThreshold( aThreshold ), iDrive( aDrive ), iState( CMdSHarvesterDiskspaceObserverAO::ENormal )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+void CMdSHarvesterDiskspaceObserverAO::ConstructL()
+ {
+ TInt KMessageSlotCount = 2; // slots for NotifyDiskSpace and NotifyDiskSpaceCancel
+
+ User::LeaveIfError( iFileServerSession.Connect( KMessageSlotCount ) );
+
+ StartNotifier();
+ }
+
+void CMdSHarvesterDiskspaceObserverAO::StartNotifier()
+ {
+ iFileServerSession.NotifyDiskSpace( iThreshold, iDrive, iStatus );
+
+ SetActive();
+ }
+
+TDriveNumber CMdSHarvesterDiskspaceObserverAO::GetDriveNumberL( const TDesC& aFilename )
+ {
+ TLex driveParser( aFilename );
+
+ TChar driveChar = driveParser.Get();
+
+ if( 0 == driveChar || TChar( ':' ) != driveParser.Peek() )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ TInt driveNumber;
+
+ RFs::CharToDrive( driveChar, driveNumber );
+
+ return (TDriveNumber)driveNumber;
+ }
+
--- a/harvester/server/src/harvesteroomao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/src/harvesteroomao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -77,7 +77,7 @@
TInt oomStatus( 0 );
const TInt err = iOomMsgQueue.Receive( oomStatus );
- if( oomStatus == TMdsOomFreeRam )
+ if( oomStatus == EMdsOomFreeRam )
{
iObserver->MemoryLow();
}
--- a/harvester/server/src/harvesterqueue.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/src/harvesterqueue.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -20,6 +20,7 @@
#include "harvesterlog.h"
#include "harvesterblacklist.h"
#include "mdsutils.h"
+#include "harvestercommon.h"
// ---------------------------------------------------------------------------
// NewL
@@ -157,6 +158,10 @@
if ( aItem->ObjectType() == EFastHarvest || aItem->Origin() == MdeConstants::Object::ECamera )
{
err = iItemQueue.Insert( aItem, 0 );
+ if( !iHarvesterAO->IsActive() )
+ {
+ iHarvesterAO->SetPriority( KHarvesterPriorityMonitorPlugin );
+ }
}
else
{
@@ -188,7 +193,7 @@
TUint32 mediaId( 0 );
CHarvesterData* hd = NULL;
- for(TInt i = iItemQueue.Count() - 1; i >=0; i--)
+ for( TInt i = iItemQueue.Count() - 1; i >=0; i-- )
{
hd = iItemQueue[i];
err = iMediaIdUtil->GetMediaId( hd->Uri(), mediaId );
@@ -212,7 +217,10 @@
WRITELOG1( "CHarvesterQueue::RemoveItems( ) GetMediaId err == %d", err);
}
}
- iItemQueue.Compress();
+ if( removedCount > 0 )
+ {
+ iItemQueue.Compress();
+ }
#ifdef _DEBUG
WRITELOG2( "CHarvesterQueue::RemoveItems() iItemQueue.Count() = %d, removedCount = %d", iItemQueue.Count(), removedCount);
#endif
--- a/harvester/server/src/harvesterserver.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/src/harvesterserver.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -157,7 +157,7 @@
WRITELOG( "CHarvesterServer::NewLC() - begin" );
CHarvesterServer* self = new (ELeave) CHarvesterServer(
- CActive::EPriorityStandard, KHarvesterServerPolicy,
+ CActive::EPriorityUserInput, KHarvesterServerPolicy,
ESharableSessions );
CleanupStack::PushL( self );
self->ConstructL();
@@ -196,8 +196,12 @@
WRITELOG( "CHarvesterServer::ConstructL() - begin" );
StartL( KHarvesterServerName );
iHarvesterAO = CHarvesterAO::NewL();
- iHarvesterAO->SetHarvesterStatusObserver( this );
+ RProcess process;
+ process.SetPriority( EPriorityBackground );
+ process.Close();
+
+ iHarvesterAO->SetHarvesterStatusObserver( this );
iPauseObserverAO = CPauseObserverAO::NewL( *this );
// create shutdown observer
--- a/harvester/server/src/harvesterserversession.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/src/harvesterserversession.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -55,7 +55,6 @@
void CHarvesterServerSession::ConstructL()
{
WRITELOG( "CHarvesterServerSession::ConstructL()" );
-
}
// ---------------------------------------------------------------------------
--- a/harvester/server/src/mdeobjecthandler.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/src/mdeobjecthandler.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -127,7 +127,7 @@
iMdeSession->NewRelationLC(
albumRelationDef, albumId, objectId, 0 );
relationEventArray.Append( STATIC_CAST( CMdEInstanceItem*, relation ) );
- CleanupStack::Pop();
+ CleanupStack::Pop(); //relation
}
}
}
@@ -141,7 +141,7 @@
CMdEEvent* event = iMdeSession->NewEventLC(
*eventDef, objectId, time );
relationEventArray.Append( STATIC_CAST( CMdEInstanceItem*, event ) );
- CleanupStack::Pop();
+ CleanupStack::Pop(); // event
}
}
@@ -186,6 +186,49 @@
error = tempFile.Open( iFs, aHD.Uri(), EFileRead | EFileShareReadersOnly );
if( error != KErrNone )
{
+#ifdef _DEBUG
+ if( error == KErrInUse || error || KErrLocked )
+ {
+ TPtrC fileName( aHD.Uri().Mid(2) );
+ WRITELOG1( "CMdeObjectHandler :: Checking open file handles to %S", &fileName );
+
+ CFileList* fileList = 0;
+ TOpenFileScan fileScan( iFs );
+
+ fileScan.NextL( fileList );
+
+ while ( fileList )
+ {
+ const TInt count( fileList->Count() );
+ for (TInt i = 0; i < count; i++ )
+ {
+ if ( (*fileList)[i].iName == aHD.Uri().Mid(2) )
+ {
+ TFullName processName;
+ TFindThread find(_L("*"));
+ while( find.Next( processName ) == KErrNone )
+ {
+ RThread thread;
+ TInt err = thread.Open( processName );
+
+ if ( err == KErrNone )
+ {
+ if ( thread.Id().Id() == fileScan.ThreadId() )
+ {
+ processName = thread.Name();
+ thread.Close();
+ WRITELOG1( "CMdeObjectHandler:: %S has a file handle open", &processName );
+ break;
+ }
+ thread.Close();
+ }
+ }
+ }
+ }
+ fileScan.NextL( fileList );
+ }
+ }
+#endif
WRITELOG( "CMdeObjectHandler::GetMetadataObjectL() - file handle is open! Returning." );
return NULL;
}
--- a/harvester/server/src/pauseobserverao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/src/pauseobserverao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -57,7 +57,7 @@
WRITELOG1("CPauseObserverAO::ConstructL() Define error: %d", error);
- if( KErrAlreadyExists != error )
+ if( KErrAlreadyExists != error && KErrNone != error )
{
User::LeaveIfError( error );
}
--- a/harvester/server/src/restorewatcher.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/harvester/server/src/restorewatcher.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -66,7 +66,6 @@
//
CRestoreWatcher::~CRestoreWatcher()
{
-
if( iPropertyWatcher )
{
iPropertyWatcher->StopListeningKeyChanges(
@@ -80,6 +79,8 @@
iPropertyWatcher->Delete(); // Release connection to TLS object.
}
+
+ iFs.Close();
}
// -----------------------------------------------------------------------------
@@ -91,6 +92,8 @@
{
WRITELOG("CRestoreWatcher::ConstructL()");
+ User::LeaveIfError( iFs.Connect() );
+
CreateFileNameL();
CheckRestoreL();
WRITELOG1("CRestoreWatcher::ConstructL() - iRestoreDone: %d", iRestoreDone );
@@ -136,17 +139,12 @@
TInt drive ( 0 );
User::LeaveIfError(
DriveInfo::GetDefaultDrive( DriveInfo::EDefaultSystem, drive ) );
-
- RFs fsSession;
- User::LeaveIfError( fsSession.Connect() );
TChar driveLetter;
- fsSession.DriveToChar( drive, driveLetter );
+ iFs.DriveToChar( drive, driveLetter );
iFileName.Append( driveLetter );
iFileName.Append( KRestoreFile ); // result-> C:\\private\\200009F5\\restoredone
-
- fsSession.Close();
}
@@ -274,22 +272,17 @@
//
void CRestoreWatcher::SetRestoreFlagL( TBool aRestoreDone )
{
- RFs fs;
- User::LeaveIfError( fs.Connect() );
-
iRestoreDone = aRestoreDone;
if( aRestoreDone )
{
RFile64 file;
- file.Replace( fs, iFileName, EFileWrite );
+ file.Replace( iFs, iFileName, EFileWrite );
file.Close();
}
else
{
- fs.Delete( iFileName );
+ iFs.Delete( iFileName );
}
-
- fs.Close();
}
// -----------------------------------------------------------------------------
@@ -299,13 +292,10 @@
//
void CRestoreWatcher::CheckRestoreL()
{
- RFs fs;
RFile64 file;
- User::LeaveIfError( fs.Connect() );
TInt fileError( KErrNotFound );
- fileError = file.Open( fs, iFileName, EFileRead );
+ fileError = file.Open( iFs, iFileName, EFileRead );
file.Close();
- fs.Close();
WRITELOG1("CRestoreWatcher::StartMonitoring - fileError: %d", fileError);
--- a/inc/harvesterlog.h Fri Mar 19 09:38:01 2010 +0200
+++ b/inc/harvesterlog.h Fri Apr 16 15:23:55 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: Harvester server commands*
+* Description:
*/
--- a/inc/mdeharvestersession.h Fri Mar 19 09:38:01 2010 +0200
+++ b/inc/mdeharvestersession.h Fri Apr 16 15:23:55 2010 +0300
@@ -279,7 +279,7 @@
/**
* Update current C-drive media id to all objects in DB that have the old media id.
*/
- void ChangeCDriveMediaId();
+ IMPORT_C void ChangeCDriveMediaId();
/**
* Set "binary composing to file" pending flag to objects
@@ -329,7 +329,7 @@
/**
* Update DB with current internal mass storage media id
*/
- void CheckMassStorageMediaId( const TUint32 aMediaId );
+ IMPORT_C void CheckMassStorageMediaId( const TUint32 aMediaId );
private:
CMdESessionImpl* iSession;
--- a/inc/mdscommoninternal.h Fri Mar 19 09:38:01 2010 +0200
+++ b/inc/mdscommoninternal.h Fri Apr 16 15:23:55 2010 +0300
@@ -41,6 +41,8 @@
const TUint32 KBaseObjectBasicValueColumnOffset = 8;
+const TItemId KSystemFavouritesAlbumId = 1;
+
const TInt KMaxUintValueLength = 10;
const TInt KMaxUint64ValueLength = 20;
@@ -58,8 +60,9 @@
const TUint KMdSServMinorVersionNumber=5;
const TUint KMdSServBuildVersionNumber=0;
+const TUint32 KNokiaVendorId = 52487775;
-const TUint32 KNokiaVendorId = 52487775;
+const TInt64 KDiskFullThreshold = 1024*50; // 50 kB
// P&S stuff
static _LIT_SECURITY_POLICY_PASS(KAllowAllPolicy);
@@ -268,6 +271,10 @@
ESchemaModify = 0x01000000,
+ EObjectNotifyAddWithUri = 0x10000000,
+ EObjectNotifyModifyWithUri = 0x20000000,
+ EObjectNotifyRemoveWithUri = 0x40000000,
+
// 0x80000000 is not allowed (signed number is negative)
};
--- a/layers.sysdef.xml Fri Mar 19 09:38:01 2010 +0200
+++ b/layers.sysdef.xml Fri Apr 16 15:23:55 2010 +0300
@@ -22,6 +22,8 @@
<unit unitID="imm.mds.harvester_framework_api.monitorplugin" mrp="" bldFile="sf/mw/mds/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group" name="harvester_framework_api.monitorplugin" />
<unit unitID="imm.mds.location_manager_api" mrp="" bldFile="sf/mw/mds/mds_plat/location_manager_api/tsrc/group" name="location_manager_api" />
<unit unitID="imm.mds.metadata_engine_api" mrp="" bldFile="sf/mw/mds/mds_plat/metadata_engine_api/tsrc/group" name="metadata_engine_api" />
+
+ <unit unitID="imm.mds.content_listing_framework" mrp="" bldFile="sf/mw/mds/mds_pub/content_listing_framework_api/tsrc/group" name="content_listing_framework_api" />
</module>
</layer>
--- a/locationmanager/client/src/rlocationmanager.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/client/src/rlocationmanager.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -72,7 +72,6 @@
//
EXPORT_C RLocationManager::RLocationManager()
{
- iNameBuf = NULL;
}
// --------------------------------------------------------------------------
@@ -104,8 +103,6 @@
{
LOG( "RLocationManager::Close(), begin" );
// close session
- delete iNameBuf;
- iNameBuf = NULL;
RSessionBase::Close();
LOG( "RLocationManager::Close(), end" );
}
--- a/locationmanager/client/src/rlocationobjectmanipulator.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/client/src/rlocationobjectmanipulator.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -132,7 +132,7 @@
TInt urisRequiredSize = CMdCSerializationBuffer::KRequiredSizeForTInt32;
// and URIs
- for( TInt i = 0; i < uriCount; i++ )
+ for( TInt i = uriCount - 1; i >=0; i-- )
{
urisRequiredSize += CMdCSerializationBuffer::RequiredSize( *aTargetURIs[i] );
}
@@ -150,7 +150,7 @@
return;
}
- for( TInt i = 0; i < uriCount; i++ )
+ for( TInt i = uriCount - 1; i >=0; i-- )
{
TRAPD( err, uriBuffer->InsertL( *aTargetURIs[i] ) );
--- a/locationmanager/client/src/rtracklog.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/client/src/rtracklog.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -52,7 +52,7 @@
LOG( "RTrackLog::StopTrackLog()" );
if ( iHandle )
{
- SendReceive( ELocManStopTrackLog);
+ Send( ELocManStopTrackLog );
}
}
Binary file locationmanager/conf/200071BE.txt has changed
Binary file locationmanager/conf/locationmanager.confml has changed
Binary file locationmanager/data/200071BE.txt has changed
--- a/locationmanager/locationtrail/group/locationtrail.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/group/locationtrail.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -60,7 +60,4 @@
BYTEPAIRCOMPRESSTARGET
OPTION ARMCC -O3 -OTime
-#ifdef __VFP_HW_SUPPORT
-OPTION ARMCC --fpu vfpv2 --fpmode fast
-#endif
--- a/locationmanager/locationtrail/inc/clocationrecord.h Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/inc/clocationrecord.h Fri Apr 16 15:23:55 2010 +0300
@@ -54,13 +54,25 @@
/**
* This method is used to notify about location trail state changes.
*/
- virtual void LocationTrailStateChange() __SOFTFP = 0;
+ virtual void LocationTrailStateChange() = 0;
virtual void CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo,
const CTelephony::TNetworkInfoV1& aNetworkInfo,
- const TInt aError ) __SOFTFP = 0;
+ const TInt aError ) = 0;
+
+ virtual void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) = 0;
- virtual void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP = 0;
+ /**
+ * Callback method to notify observer that during waiting for positioning stop timeout remap is done.
+ */
+ virtual void RemapedCompleted() = 0;
+
+ /**
+ * Returns if in ETrialStopping state server waits for positioning stop timeout
+ * @returns <code>ETrue</code> if server is waiting for positioning stop timeout
+ * <code>EFalse</code>, otherwise.
+ */
+ virtual TBool WaitForPositioningStopTimeout() = 0;
};
/**
@@ -81,7 +93,7 @@
* This method is used to notify about new locations added to location trail
*/
virtual void LocationAdded( const TLocationTrailItem& aTrailItem,
- const TPositionSatelliteInfo& aSatellites ) __SOFTFP = 0;
+ const TPositionSatelliteInfo& aSatellites ) = 0;
};
/**
@@ -147,7 +159,7 @@
TLocationData& aLocationData,
/*TLocality& aPosition,
CTelephony::TNetworkInfoV1& aNetworkInfo,*/
- TLocTrailState& aState ) __SOFTFP;
+ TLocTrailState& aState );
/**
* Request location info. The result is returned by calllback method.
@@ -171,7 +183,7 @@
* @param aCellId, Network cell is written into this param.
* @return None.
*/
- IMPORT_C void GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP;
+ IMPORT_C void GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo );
/**
* Set observer for notifying state changes.
@@ -189,11 +201,11 @@
static TInt UpdateNetworkInfo( TAny* aAny );
IMPORT_C void CreateLocationObjectL( const TLocationData& aLocationData,
- const TUint& aObjectId ) __SOFTFP;
+ const TUint& aObjectId );
IMPORT_C void LocationSnapshotL( const TUint& aObjectId );
- TItemId DoCreateLocationL( const TLocationData& aLocationData ) __SOFTFP;
+ TItemId DoCreateLocationL( const TLocationData& aLocationData );
TItemId CreateRelationL( const TUint& aObjectId, const TUint& aLocationId );
@@ -212,7 +224,7 @@
* @param
* @return
*/
- void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError ) __SOFTFP;
+ void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, TInt aError );
public: // from MPositionInfoObserver
/**
@@ -221,7 +233,7 @@
* @param
* @return
*/
- void Position( const TPositionInfo& aPositionInfo, const TInt aError ) __SOFTFP;
+ void Position( const TPositionInfo& aPositionInfo, const TInt aError );
public: // From MMdEQueryObserver
--- a/locationmanager/locationtrail/inc/clocationwrite.h Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/inc/clocationwrite.h Fri Apr 16 15:23:55 2010 +0300
@@ -34,7 +34,7 @@
/**
* 2-phased constructor.
*/
- IMPORT_C static CLocationWrite* NewL( CLocationRecord& aLocRecord ) __SOFTFP;
+ IMPORT_C static CLocationWrite* NewL( CLocationRecord& aLocRecord );
/**
* C++ destructor.
--- a/locationmanager/locationtrail/inc/cnetworkinfo.h Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/inc/cnetworkinfo.h Fri Apr 16 15:23:55 2010 +0300
@@ -33,7 +33,7 @@
* This method is used for setting the network cell id to the
* location trail.
*/
- virtual void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, const TInt aError ) __SOFTFP = 0;
+ virtual void NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo, const TInt aError ) = 0;
};
/**
--- a/locationmanager/locationtrail/inc/cpositioninfo.h Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/inc/cpositioninfo.h Fri Apr 16 15:23:55 2010 +0300
@@ -36,7 +36,7 @@
* location trail.
*/
virtual void Position( const TPositionInfo& aPositionInfo,
- const TInt aError ) __SOFTFP = 0;
+ const TInt aError ) = 0;
};
/**
--- a/locationmanager/locationtrail/inc/ctracklog.h Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/inc/ctracklog.h Fri Apr 16 15:23:55 2010 +0300
@@ -66,7 +66,7 @@
* This method is used to notify about converted GPX files
*/
virtual void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength,
- TTime aStart, TTime aEnd ) __SOFTFP = 0;
+ TTime aStart, TTime aEnd ) = 0;
};
class CTrackLog : public CBase, public MLocationAddObserver
@@ -111,7 +111,7 @@
/*
* from MLocationAddObserver
*/
- void LocationAdded( const TLocationTrailItem& aTrailItem, const TPositionSatelliteInfo& aSatellites ) __SOFTFP;
+ void LocationAdded( const TLocationTrailItem& aTrailItem, const TPositionSatelliteInfo& aSatellites );
IMPORT_C void AddGpxObserver( MGpxConversionObserver* aObserver );
--- a/locationmanager/locationtrail/inc/locationtraildefs.h Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/inc/locationtraildefs.h Fri Apr 16 15:23:55 2010 +0300
@@ -34,13 +34,13 @@
const TInt KTrackLogBufSize = 10;
-const TInt KLocationTrailShutdownDelay = 60;
+const TInt KLocationTrailShutdownDelay = 30;
const TInt KLocationTrailRemappingCheckDelay = 15;
-const TInt KLocationTrailRemapShutdownDelay = 360;
+const TInt KLocationTrailRemapShutdownDelay = 320;
-const TInt KLocationDelta = 20;
+const TInt KLocationDelta = 25;
const TInt KRemappingTime = 480;
--- a/locationmanager/locationtrail/src/cgpxconverterao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/src/cgpxconverterao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -70,6 +70,12 @@
iObservers.Reset();
+ iFileQueue.ResetAndDestroy();
+ iFileQueue.Close();
+
+ iBoundQueue.ResetAndDestroy();
+ iBoundQueue.Close();
+
delete iWriteBuf;
delete iFormatBuf;
}
@@ -105,8 +111,10 @@
{
LOG("CGpxConverterAO::AddToQueueL");
TFileName *filename = new (ELeave) TFileName(aFileName);
- iFileQueue.Append(filename);
- iBoundQueue.Append( aBoundaries );
+ CleanupStack::PushL( filename );
+ iFileQueue.AppendL( filename );
+ CleanupStack::Pop( filename );
+ iBoundQueue.AppendL( aBoundaries );
if ( iState == EIdle )
{
@@ -275,8 +283,7 @@
distance = iBoundaries->distance;
}
- TInt count = iObservers.Count();
- for( TInt i = 0; i < count; i++ )
+ for( TInt i = iObservers.Count() - 1; i >=0; i-- )
{
iObservers[i]->GpxFileCreated( iGpxPath, iTagId, distance, iStartTime, iEndTime );
}
--- a/locationmanager/locationtrail/src/clocationrecord.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/src/clocationrecord.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -212,7 +212,7 @@
//
EXPORT_C void CLocationRecord::GetLocationByTimeL( const TTime aTime,
TLocationData& aLocationData,
- TLocTrailState& aState ) __SOFTFP
+ TLocTrailState& aState )
{
LOG( "CLocationRecord::GetLocationByTimeL(), begin" );
TInt posFound( EFalse );
@@ -317,7 +317,7 @@
// CLocationRecord::GetNetworkInfo
// --------------------------------------------------------------------------
//
-EXPORT_C void CLocationRecord::GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP
+EXPORT_C void CLocationRecord::GetNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo )
{
LOG("CLocationRecord::GetNetworkInfo");
@@ -348,7 +348,7 @@
// --------------------------------------------------------------------------
//
void CLocationRecord::Position( const TPositionInfo& aPositionInfo,
- const TInt aError ) __SOFTFP
+ const TInt aError )
{
const TPositionSatelliteInfo& positionSatelliteInfo =
static_cast<const TPositionSatelliteInfo&>(aPositionInfo);
@@ -403,6 +403,13 @@
)
}
iRemapper->StartRemappingObjects( iNewItem.iLocationData );
+
+ if( iObserver->WaitForPositioningStopTimeout() && !RemappingNeeded() )
+ {
+ iObserver->RemapedCompleted();
+ return;
+ }
+
}
if ( iState != RLocationTrail::ETrailStopping )
{
@@ -457,7 +464,7 @@
// --------------------------------------------------------------------------
//
void CLocationRecord::NetworkInfo( const CTelephony::TNetworkInfoV1 &aNetworkInfo,
- const TInt aError ) __SOFTFP
+ const TInt aError )
{
LOG("CLocationRecord::NetworkInfo");
if ( aError == KErrNone )
@@ -585,7 +592,7 @@
EXPORT_C void CLocationRecord::CreateLocationObjectL( const TLocationData& aLocationData,
- const TUint& aObjectId ) __SOFTFP
+ const TUint& aObjectId )
{
TItemId locationId = DoCreateLocationL( aLocationData );
CreateRelationL( aObjectId, locationId );
@@ -792,7 +799,7 @@
}
-TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData ) __SOFTFP
+TItemId CLocationRecord::DoCreateLocationL( const TLocationData& aLocationData )
{
LOG("CLocationRecord::DoCreateLocationL - start");
TItemId locationObjectId;
@@ -1094,12 +1101,16 @@
CMdEProperty* property = NULL;
object = iMdeSession->GetObjectL( aObjectId );
+ CleanupStack::PushL( object );
object->Property( timeDef, property, 0 );
if ( !property )
{
User::Leave( KErrNotFound );
}
- return property->TimeValueL();
+
+ const TTime timeValue( property->TimeValueL() );
+ CleanupStack::PopAndDestroy( object );
+ return timeValue;
}
EXPORT_C TBool CLocationRecord::RemappingNeeded()
--- a/locationmanager/locationtrail/src/cpositioninfo.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/src/cpositioninfo.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -45,6 +45,7 @@
: CActive( CActive::EPriorityStandard ),
iFirstInterval( ETrue )
{
+ LOG( "CPositionInfo::CPositionInfo()");
CActiveScheduler::Add( this );
iTrail = aTrail;
iTrailCaptureSetting = RLocationTrail::ECaptureAll;
@@ -101,7 +102,6 @@
iFirstInterval = ETrue;
iPositionInfo = TPositionSatelliteInfo();
-
// Set update interval.
iUpdateOptions.SetUpdateInterval( TTimeIntervalMicroSeconds(KFirstInterval) );
// Set time out level.
@@ -111,8 +111,6 @@
// Disables location framework to send partial position data
iUpdateOptions.SetAcceptPartialUpdates( EFalse );
-
-
if ( aCaptureSetting == RLocationTrail::ECaptureAll )
{
User::LeaveIfError( iPosServer.Connect() );
@@ -162,7 +160,7 @@
void CPositionInfo::Stop()
{
Cancel();
- // Start shutdown timer...
+
iPositioner.Close();
iPosServer.Close();
}
--- a/locationmanager/locationtrail/src/ctracklog.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/src/ctracklog.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -137,7 +137,7 @@
}
void CTrackLog::LocationAdded( const TLocationTrailItem& aTrailItem,
- const TPositionSatelliteInfo& aSatellites ) __SOFTFP
+ const TPositionSatelliteInfo& aSatellites )
{
LOG("CTrackLog::LocationAdded start");
@@ -230,8 +230,8 @@
{
User::Leave( err );
}
- writer << I64LOW( iTagId );
- writer << I64HIGH( iTagId );
+ writer << I64LOW( static_cast<TUint64>(iTagId) );
+ writer << I64HIGH( static_cast<TUint64>(iTagId) );
}
else
{
--- a/locationmanager/locationtrail/src/locationremappingao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/locationtrail/src/locationremappingao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -149,8 +149,7 @@
// clear all "old" location id's from remap items
if( removeLocations.Count() < 0 )
{
- index = iRemapItems.Count();
- for( TInt i = 0; i < index; i++ )
+ for( TInt i = iRemapItems.Count() - 1; i >=0; i-- )
{
TInt err = removeLocations.Find( iRemapItems[i].iLocationId );
if ( err != KErrNotFound )
@@ -273,33 +272,38 @@
for (TInt i = 0; i < count; i++)
{
CMdEObject* location = iMdEClient->OpenObjectL(iObjectIds[i], *iObjLocationDef);
- CleanupStack::PushL( location );
+
+ if(location)
+ {
+ CleanupStack::PushL( location );
- if (location->PropertyCount(*iPropLatDef) == 0)
- {
- location->AddReal64PropertyL(*iPropLatDef, iLocationData.iPosition.Latitude());
- LOG( "CLocationRemappingAO::RemapObjects - wrote latitude" );
- }
- if (location->PropertyCount(*iPropLongDef) == 0)
- {
- location->AddReal64PropertyL(*iPropLongDef, iLocationData.iPosition.Longitude());
- LOG( "CLocationRemappingAO::RemapObjects - wrote longitude" );
- }
- if (location->PropertyCount(*iPropAltDef) == 0)
- {
- location->AddReal64PropertyL(*iPropAltDef, iLocationData.iPosition.Altitude());
- LOG( "CLocationRemappingAO::RemapObjects - wrote altitude" );
- }
- CMdEProperty* modProp = NULL;
- location->Property( *iPropModifiedDef, modProp, 0 );
- if ( modProp )
- {
- TTime timestamp( 0 );
- timestamp.UniversalTime();
- modProp->SetTimeValueL( timestamp );
- }
- iObjects.AppendL(location);
- CleanupStack::Pop( location );
+ if (location->PropertyCount(*iPropLatDef) == 0)
+ {
+ location->AddReal64PropertyL(*iPropLatDef, iLocationData.iPosition.Latitude());
+ LOG( "CLocationRemappingAO::RemapObjects - wrote latitude" );
+ }
+ if (location->PropertyCount(*iPropLongDef) == 0)
+ {
+ location->AddReal64PropertyL(*iPropLongDef, iLocationData.iPosition.Longitude());
+ LOG( "CLocationRemappingAO::RemapObjects - wrote longitude" );
+ }
+ if (location->PropertyCount(*iPropAltDef) == 0)
+ {
+ location->AddReal64PropertyL(*iPropAltDef, iLocationData.iPosition.Altitude());
+ LOG( "CLocationRemappingAO::RemapObjects - wrote altitude" );
+ }
+ CMdEProperty* modProp = NULL;
+ location->Property( *iPropModifiedDef, modProp, 0 );
+ if ( modProp )
+ {
+ TTime timestamp( 0 );
+ timestamp.UniversalTime();
+ modProp->SetTimeValueL( timestamp );
+ }
+ iObjects.AppendL(location);
+ CleanupStack::Pop( location );
+
+ }
}
count = iRemapItems.Count();
LOG1("CLocationRemappingAO::RemapObjectsL - updating relations, count:%d", count);
@@ -309,12 +313,16 @@
CMdERelation* relation = NULL;
relation = iMdEClient->GetRelationL( iRemapItems[i].iRelationId );
- TTime timestamp( 0 );
- timestamp.UniversalTime();
- relation->SetLastModifiedDate( timestamp );
+ if(relation)
+ {
+ TTime timestamp( 0 );
+ timestamp.UniversalTime();
+ relation->SetLastModifiedDate( timestamp );
- iMdEClient->UpdateRelationL( *relation );
+ iMdEClient->UpdateRelationL( *relation );
+ }
}
+
LOG("CLocationRemappingAO::RemapObjectsL - relations updated");
iObjectIds.Reset();
--- a/locationmanager/server/group/locationmanagerserver.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/server/group/locationmanagerserver.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -57,8 +57,4 @@
BYTEPAIRCOMPRESSTARGET
OPTION ARMCC -O3 -OTime
-#ifdef __VFP_HW_SUPPORT
-OPTION ARMCC --fpu vfpv2 --fpmode fast
-#endif
-
EPOCPROCESSPRIORITY background
--- a/locationmanager/server/inc/clocationmanagerserver.h Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/server/inc/clocationmanagerserver.h Fri Apr 16 15:23:55 2010 +0300
@@ -201,7 +201,7 @@
TLocationData& aLocationData,
/*TLocality& aPosition,
CTelephony::TNetworkInfoV1& aNetworkInfo,*/
- TLocTrailState& aState ) __SOFTFP;
+ TLocTrailState& aState );
/**
* Get current location.
@@ -232,7 +232,7 @@
* @param aCurrLocReq
* @return None.
*/
- void GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP;
+ void GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo );
/**
* Create a location context object in DB and create relationships to objects
@@ -241,7 +241,7 @@
* @param aObjectId
*/
void CreateLocationObjectL( const TLocationData& aLocationData,
- const TUint& aObjectId ) __SOFTFP;
+ const TUint& aObjectId );
/**
* Create a location context object in DB and create relationships to objects
@@ -270,7 +270,7 @@
void IsTrackLogRecording( TBool &aRec );
- TInt GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) __SOFTFP;
+ TInt GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality);
TInt DeleteTrackLogL(const TDesC& aUri);
@@ -290,7 +290,7 @@
* @param None.
* @return None.
*/
- void LocationTrailStateChange() __SOFTFP;
+ void LocationTrailStateChange();
/**
* Callback method to return current location.
@@ -301,14 +301,26 @@
* @return None.
*/
void CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo,
- const CTelephony::TNetworkInfoV1& aNetworkInfo, const TInt aError ) __SOFTFP;
+ const CTelephony::TNetworkInfoV1& aNetworkInfo, const TInt aError );
/**
* Callback method to notify observer of changes in GPS signal quality.
* @param aSatelliteInfo, includes position and satellite info
* @return None.
*/
- void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP;
+ void GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo );
+
+ /**
+ * Callback method to notify observer that during waiting for positioning stop timeout remap is done.
+ */
+ void RemapedCompleted();
+
+ /**
+ * Returns if in ETrialStopping state server waits for positioning stop timeout
+ * @returns <code>ETrue</code> if server is waiting for positioning stop timeout
+ * <code>EFalse</code>, otherwise.
+ */
+ TBool WaitForPositioningStopTimeout();
public: // from MMdeObjectObserver
/**
@@ -326,7 +338,7 @@
public: // from MGpxConversionObserver
void GpxFileCreated( const TDesC& aFileName, TItemId aTagId, TReal32 aLength,
- TTime aStart, TTime aEnd ) __SOFTFP;
+ TTime aStart, TTime aEnd );
private:
/**
@@ -466,7 +478,12 @@
TInt iLocManStopRemapDelay;
RLocationTrail::TTrailCaptureSetting iCaptureSetting;
- TBool iRemoveLocation;
+ TBool iRemoveLocation;
+
+ /**
+ * A flag for state of waiting for position stop timeout.
+ */
+ TBool iWaitForPositioningStopTimeout;
};
--- a/locationmanager/server/src/clocationmanagerserver.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/server/src/clocationmanagerserver.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -100,7 +100,8 @@
iLocManStopDelay( 0 ),
iLocManStopRemapDelay( 0 ),
iCaptureSetting( RLocationTrail::EOff ),
- iRemoveLocation( EFalse )
+ iRemoveLocation( EFalse ),
+ iWaitForPositioningStopTimeout ( EFalse )
{
}
@@ -307,6 +308,8 @@
void CLocationManagerServer::StartGPSPositioningL( RLocationTrail::TTrailCaptureSetting aCaptureSetting )
{
LOG( "CLocationManagerServer::StartGPSPositioningL" );
+ iWaitForPositioningStopTimeout = EFalse;
+
if ( aCaptureSetting == RLocationTrail::EOff )
{
return;
@@ -338,14 +341,14 @@
{
LOG( "CLocationManagerServer::StopGPSPositioningL()" );
iCaptureSetting = RLocationTrail::EOff;
+ iWaitForPositioningStopTimeout = EFalse;
RLocationTrail::TTrailState state;
GetLocationTrailState( state );
-
-
+
if( state != RLocationTrail::ETrailStopped && state != RLocationTrail::ETrailStopping )
{
- TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityHigh ) );
+ TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) );
if ( error != KErrNone )
{
@@ -369,8 +372,9 @@
//
void CLocationManagerServer::StopRecording()
{
- LOG( "CLocationManagerServer::StopRecording()" );
- iLocationRecord->Stop();
+ LOG( "CLocationManagerServer::StopRecording()" );
+ iWaitForPositioningStopTimeout = EFalse;
+ iLocationRecord->Stop();
delete iTimer;
iTimer = NULL;
}
@@ -402,6 +406,7 @@
if ( self->iLocationRecord->RemappingNeeded() )
{
self->iTimer->Start( self->iLocManStopRemapDelay * 1000000, 0, TCallBack( PositioningStopTimeout, self ) );
+ self->iWaitForPositioningStopTimeout = ETrue;
}
else
{
@@ -475,7 +480,7 @@
//
void CLocationManagerServer::GetLocationByTimeL( const TTime& aTimeStamp,
TLocationData& aLocationData,
- TLocTrailState& aState ) __SOFTFP
+ TLocTrailState& aState )
{
iLocationRecord->GetLocationByTimeL( aTimeStamp,
aLocationData,
@@ -529,7 +534,7 @@
// CLocationManagerServer::GetCurrentCellId
// --------------------------------------------------------------------------
//
-void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo ) __SOFTFP
+void CLocationManagerServer::GetCurrentNetworkInfo( CTelephony::TNetworkInfoV1& aNetworkInfo )
{
iLocationRecord->GetNetworkInfo( aNetworkInfo );
}
@@ -538,7 +543,7 @@
// CLocationManagerServer::LocationTrailStateChange
// --------------------------------------------------------------------------
//
-void CLocationManagerServer::LocationTrailStateChange() __SOFTFP
+void CLocationManagerServer::LocationTrailStateChange()
{
LOG( "CLocationManagerServer::LocationTrailStateChange(), begin" );
@@ -561,7 +566,7 @@
//
void CLocationManagerServer::CurrentLocation( const TPositionSatelliteInfo& aSatelliteInfo,
const CTelephony::TNetworkInfoV1& aNetworkInfo,
- const TInt aError ) __SOFTFP
+ const TInt aError )
{
LOG( "CLocationManagerServer::CurrentLocation(), begin" );
const TInt KParamLocationData = 0;
@@ -608,7 +613,7 @@
LOG( "CLocationManagerServer::CurrentLocation(), end" );
}
-void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo ) __SOFTFP
+void CLocationManagerServer::GPSSignalQualityChanged( const TPositionSatelliteInfo& aSatelliteInfo )
{
LOG( "CLocationManagerServer::GPSSignalQualityChanged" );
const TInt KFixParam = 0;
@@ -683,7 +688,7 @@
}
void CLocationManagerServer::CreateLocationObjectL( const TLocationData& aLocationData,
- const TUint& aObjectId ) __SOFTFP
+ const TUint& aObjectId )
{
if ( !IsSessionReady() )
{
@@ -773,8 +778,7 @@
if( iTargetObjectIds.Count() <= 0 )
{
TInt err = 0;
- const TInt count = aTargets.Count();
- for( TInt i = 0 ; i < count ; i++ )
+ for( TInt i = aTargets.Count() - 1; i >=0; i-- )
{
TRAP( err, iMdeSession->CheckObjectL( obj, aTargets[i], &namespaceDef ) );
if ( err == KErrNone )
@@ -881,8 +885,7 @@
CMdERelationDef& containsRelDef = aQuery.NamespaceDef().GetRelationDefL(
Relations::KContainsLocation );
- const TInt count = iTargetObjectIds.Count();
- for( TInt i=0;i<count;i++ )
+ for( TInt i = iTargetObjectIds.Count() - 1; i >=0; i-- )
{
CMdERelation* relationObject = iMdeSession->NewRelationLC( containsRelDef, iTargetObjectIds[i],
rightId, 0 );
@@ -891,6 +894,7 @@
CleanupStack::PopAndDestroy( relationObject );
}
+
CleanupStack::PopAndDestroy( sourceLocation );
for ( TInt i = iCopyReqs.Count() - 1; i >= 0; --i )
@@ -967,9 +971,9 @@
targetUris.ReserveL( uriCount );
// deserialize URIs
- for( TInt i = 0; i < uriCount; i++ )
+ for( TInt i = uriCount- 1; i >=0; i-- )
{
- targetUris.Append( uriBuffer->ReceivePtr16L() );
+ targetUris.AppendL( uriBuffer->ReceivePtr16L() );
}
LOG1("CLocationManagerSession::CopyLocationDataByUriL ID count:%d", targetUris.Count());
@@ -1044,7 +1048,7 @@
}
void CLocationManagerServer::GpxFileCreated( const TDesC& aFileName, TItemId aTagId,
- TReal32 aLength, TTime aStart, TTime aEnd ) __SOFTFP
+ TReal32 aLength, TTime aStart, TTime aEnd )
{
TRAP_IGNORE( CreateTrackLogL( aTagId, aFileName, aLength, aStart, aEnd ) );
}
@@ -1132,7 +1136,7 @@
CleanupStack::PopAndDestroy( trackLog );
}
-TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality) __SOFTFP
+TInt CLocationManagerServer::GetTrackLogStatus( TBool& aRecording, TPositionSatelliteInfo& aFixQuality)
{
if ( !iTrackLog )
{
@@ -1271,4 +1275,17 @@
{
iTrackLog->AddGpxObserver( aObserver );
}
+
+void CLocationManagerServer::RemapedCompleted()
+ {
+ LOG( "CLocationManagerServer::RemapedCompleted()" );
+ StopRecording();
+ }
+
+TBool CLocationManagerServer::WaitForPositioningStopTimeout()
+ {
+ LOG( "CLocationManagerServer::WaitForPositioningStopTimeout()" );
+ return iWaitForPositioningStopTimeout;
+ }
+
// End of file
--- a/locationmanager/server/src/clocationmanagersession.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/locationmanager/server/src/clocationmanagersession.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -48,6 +48,7 @@
CLocationManagerSession::~CLocationManagerSession()
{
LOG( "CLocationManagerSession::~CLocationManagerSession(), begin" );
+ TRAP_IGNORE(Server().StopGPSPositioningL());
Server().CancelNotificationRequest( iNotificationHandle );
Server().CancelLocationRequest( iLocationHandle );
Server().CancelTrackLogNotificationRequest( iTrackLogNotificationHandle );
--- a/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg Fri Mar 19 09:38:01 2010 +0200
+++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg Fri Apr 16 15:23:55 2010 +0300
@@ -122,7 +122,7 @@
[Test]
title HarvestFile 2
-timeout 180000
+timeout 300000
create HarvesterClientTestScripter test
request Session
test SetUp
--- a/mds_plat/location_manager_api/inc/rlocationmanager.h Fri Mar 19 09:38:01 2010 +0200
+++ b/mds_plat/location_manager_api/inc/rlocationmanager.h Fri Apr 16 15:23:55 2010 +0300
@@ -64,13 +64,7 @@
* @param aError Symbian error code
*/
void CompleteRequest(TRequestStatus& aStatus, TInt aError);
-
-protected:
- /**
- * Buffer for names.
- * Own.
- */
- CBufFlat* iNameBuf;
+
};
#endif // R_RLOCATIONMANAGER_H
--- a/mds_plat/metadata_engine_api/inc/mdccommon.h Fri Mar 19 09:38:01 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdccommon.h Fri Apr 16 15:23:55 2010 +0300
@@ -31,6 +31,7 @@
typedef TUint32 TMdCOffset;
const TItemId KNoId = 0;
+const TItemId KSystemCapturedAlbumId = 2;
const TDefId KNoDefId = 0;
// CONSTANTS
--- a/mds_plat/metadata_engine_api/inc/mdeobjectdef.h Fri Mar 19 09:38:01 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdeobjectdef.h Fri Apr 16 15:23:55 2010 +0300
@@ -96,7 +96,7 @@
*/
virtual ~CMdEObjectDef();
- TDefId Id() const;
+ IMPORT_C TDefId Id() const;
/**
* Returns the property definition with the specified id
--- a/mds_plat/metadata_engine_api/inc/mdesession.h Fri Mar 19 09:38:01 2010 +0200
+++ b/mds_plat/metadata_engine_api/inc/mdesession.h Fri Apr 16 15:23:55 2010 +0300
@@ -222,6 +222,27 @@
TObserverNotificationType aType,
const RArray<TItemId>& aObjectIdArray) = 0;
};
+
+class MMdEObjectObserverWithUri
+ {
+public:
+
+ /**
+ * Called to notify the observer that new objects has been
+ * added/modified/removed in the metadata engine database.
+ *
+ * @param aSession session
+ * @param aType defines if object was added/modified/remove
+ * @param aObjectIdArray IDs of added object
+ * @param aUriArray Uris of added object
+ * @see CMdESession::AddObjectObserverL
+ * @see CMdELogicCondition
+ */
+ virtual void HandleUriObjectNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aObjectIdArray,
+ const RPointerArray<HBufC>& aObjectUriArray) = 0;
+ };
/**
* Observer interface for modifications of the objects in the metadata engine
@@ -1712,6 +1733,45 @@
virtual void SetObjectToPresentByGuidL(
const TInt64& aGuidHigh, const TInt64& aGuidLow ) = 0;
+ /**
+ * Adds a new object observer to the session. No duplicate observers are
+ * allowed.
+ *
+ * The following restrictions are placed on the condition nodes:
+ * - Only CMdEObjectCondition and CMdEPropertyCondition nodes can be
+ * used. CMdERangePropertyConditions are not allowed.
+ * - No nested logic conditions are allowed.
+ *
+ * Be adviced, this version with the URI in the callback is much less
+ * efficient than using version without the URI
+ *
+ * @param aObserver Observer.
+ * @param aCondition Condition that the objects, about which the observer
+ * wants to receive notifications, must fulfill or NULL,
+ * to receive notifications of all objects.
+ * Ownership of the condition is transferred to the
+ * session.
+ * @param aNotificationType what event type (add, modify, remove) should
+ * be notified to client
+ * @param aNamespaceDef specified namespace (if namespace is NULL, the
+ * default namespace is used)
+ * @param aUriRequired determines if uri is required in the callback
+ *
+ * @leave KErrAlreadyExists if the same observer has already been added
+ */
+ virtual void AddObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver,
+ CMdELogicCondition* aCondition = NULL,
+ TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove,
+ CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
+
+ /**
+ * Removes the specified object observer from the session.
+ *
+ * @param aObserver observer
+ */
+ virtual void RemoveObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver,
+ CMdENamespaceDef* aNamespaceDef = NULL ) = 0;
+
protected:
/* Constructors. */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/bwins/ContentListingFrameworkTestu.def Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- a/mds_pub/content_listing_framework_api/tsrc/bwins/T_CLFApiMdlTestu.def Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-EXPORTS
- ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/conf/ContentListingFrameworkTest.cfg Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,272 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "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: CLF Collection Manager API tests
+#
+
+// ---------------------------------------------------------------------------
+// CLF Collection Manager API test cases
+// ---------------------------------------------------------------------------
+
+// These should be run in sequential mode if several cases are run at the same
+// time! Be adviced, this API is no longer used or supported, it is present only
+// because of it's association to Content Listing Framework.
+
+[StifSettings]
+TestThreadStackSize= 32768
+TestThreadMinHeap= 4096
+TestThreadMaxHeap= 16777216
+[EndStifSettings]
+
+[Test]
+title Create engine
+create ContentListingFrameworkTest test
+test BaseSetup
+test CreateEngineTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create modifiable item
+create ContentListingFrameworkTest test
+test BaseSetup
+test CreateModifiableItemTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create sorting style
+create ContentListingFrameworkTest test
+test BaseSetup
+test CreateSortignStyleTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create sorting style from resource
+create ContentListingFrameworkTest test
+test SortingStyleResourceSetup
+test CreateSortignStyleFromResourceTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create list model
+create ContentListingFrameworkTest test
+test CreateModelSetup
+test CreateListModelTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Create list model from resource
+create ContentListingFrameworkTest test
+test CreateModelFromResourceSetup
+test CreateListModelFromResourceTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Engine update test
+create ContentListingFrameworkTest test
+test EngineTestSetup
+test UpdateItemsTest
+test Teardown
+delete test
+[Endtest]
+
+#[Test]
+#title Engine update test
+#create ContentListingFrameworkTest test
+#test EngineTestSetup
+#test UpdateItemsWithIdTest
+#test Teardown
+#delete test
+#[Endtest]
+
+[Test]
+title Engine update test
+create ContentListingFrameworkTest test
+test EngineTestSetup
+test UpdateItemsWithOpaqueDataFolderTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style from resource
+create ContentListingFrameworkTest test
+test SortingStyleResourceTestSetup
+test SortingStyleResourceTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style ordering test
+create ContentListingFrameworkTest test
+test SortingStyleTestSetup
+test SortingStyleOrderingTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style data type test
+create ContentListingFrameworkTest test
+test SortingStyleTestSetup
+test SortingStyleDataTypeTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style undefined item position test
+create ContentListingFrameworkTest test
+test SortingStyleTestSetup
+test SortingStyleUndefinedItemPositionTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title Sorting style field test
+create ContentListingFrameworkTest test
+test SortingStyleTestSetup
+test SortingStyleFieldTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model refresh test
+create ContentListingFrameworkTest test
+test ListModelSetup
+test RefreshTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model sorting style test
+create ContentListingFrameworkTest test
+test ListModelAllFileItemsSetup
+test SetSortingStyleTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model custom sorter test
+create ContentListingFrameworkTest test
+test ListModelAllFileItemsSetup
+test SetCustomSorterTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model grouping test
+create ContentListingFrameworkTest test
+test ListModelAllFileItemsSetup
+test GroupingTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model post filter test
+create ContentListingFrameworkTest test
+test ListModelAllFileItemsSetup
+test SetPostFilterTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model wanted mime types test
+create ContentListingFrameworkTest test
+test ListModelSetup
+test SetWantedMimeTypesTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model wanted media types test
+create ContentListingFrameworkTest test
+test ListModelSetup
+test SetWantedMediaTypesTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model wanted media and mime types
+create ContentListingFrameworkTest test
+test ListModelSetup
+test SetWantedMediaAndMimeTypesTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model multible sorters
+create ContentListingFrameworkTest test
+test MultibleSortingSetup
+test MultibleSortingTest
+test Teardown
+delete test
+[Endtest]
+
+[Test]
+title List model multible sorters
+create ContentListingFrameworkTest test
+test MultibleSortingResourceSetup
+test MultibleSortingTest
+test Teardown
+delete test
+[Endtest]
+
+#[Test]
+#title List model changed items
+#create ContentListingFrameworkTest test
+#test ListModelSetup
+#test ModelItemsChangedTest
+#test Teardown
+#delete test
+#[Endtest]
+
+[Test]
+title Modifiable item test
+create ContentListingFrameworkTest test
+test ModifiableItemTestSetup
+test MIFieldTest
+test Teardown
+delete test
+[Endtest]
+
+#[Test]
+#title Item test
+#create ContentListingFrameworkTest test
+#test ItemTestSetup
+#test ItemFieldTest
+#test Teardown
+#delete test
+#[Endtest]
--- a/mds_pub/content_listing_framework_api/tsrc/custom/preset_custom.xml Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-<test>
- <name>SP API Test Automation - Content Listing Framework Wrapper</name>
- <target>
- <device rank="none" alias="DEFAULT">
- <property name="HARNESS" value="EUNIT" />
- </device>
- </target>
- <plan name="Public API automatic tests" harness="EUNIT" enabled="true" passrate="100">
- <session name="EUnit tests" harness="EUNIT" enabled="true" passrate="100">
- <set name="API tests" harness="EUNIT" enabled="true" passrate="100">
- <target>
- <device rank="master" alias="DEFAULT"/>
- </target>
- <case name="Testrun" harness="EUNIT" enabled="true" passrate="100">
- <step name="Create CTC log dir" harness="EUNIT" enabled="true" passrate="100" significant="false">
- <command>makedir</command>
- <params>
- <param dir="c:\data\ctc\"/>
- </params>
- </step>
- <step name="CTC start" harness="EUNIT" enabled="true" passrate="100" significant="false">
- <command>execute</command>
- <params>
- <param file="z:\sys\bin\ctcman.exe"/>
- </params>
- </step>
- <step name="Create EUnit log dir" harness="EUNIT" enabled="true" passrate="100" significant="false">
- <command>makedir</command>
- <params>
- <param dir="c:\DigiaEUnit\logs\"/>
- </params>
- </step>
- <step name="Execute Client API tests" harness="EUNIT" enabled="true" passrate="100" significant="true">
- <command>execute</command>
- <params>
- <param parameters="/l xml T_CLFApiMdlTest.dll"/>
- <param timeout="7200"/>
- <param result-file="c:\Shared\EUnit\logs\T_CLFApiMdlTest_log.xml"/>
- <param file="z:\sys\bin\EUNITEXERUNNER.EXE"/>
- </params>
- </step>
- <step name="Save CTC data" harness="EUNIT" enabled="true" passrate="100" significant="false">
- <command>execute</command>
- <params>
- <param parameters="writelocal"/>
- <param file="z:\sys\bin\ctcman.exe"/>
- </params>
- </step>
- <step name="Fetch and clean CTC data" harness="EUNIT" enabled="true" passrate="100" significant="false">
- <command>fetch-log</command>
- <params>
- <param delete="true"/>
- <param path="c:\data\ctc\ctcdata.txt"/>
- </params>
- </step>
- </case>
- </set>
- </session>
- </plan>
-</test>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/eabi/ContentListingFrameworkTestu.def Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- a/mds_pub/content_listing_framework_api/tsrc/eabi/T_CLFApiMdlTestu.def Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-EXPORTS
- _Z16CreateTestSuiteLv @ 1 NONAME
- _ZTI19T_CLFApiModuleTests @ 2 NONAME ; #<TI>#
- _ZTV19T_CLFApiModuleTests @ 3 NONAME ; #<VT>#
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/group/ContentListingFramework.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2007 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+// DEFINES
+#define KEUnitUid3 0x1000af59
+#define KEUnitTestDllUid2 0x1000af5a
+
+// Build target
+//TARGET CLFApiMdlTest.dll
+TARGET ContentListingFrameworkTest.dll
+TARGETTYPE dll
+UID KEUnitTestDllUid2 KEUnitUid3
+
+//CAPABILITY ALL -TCB -DRM
+CAPABILITY ALL -TCB
+VENDORID VID_DEFAULT
+
+DEFFILE ContentListingFrameworkTest.def
+
+SOURCEPATH ../src
+SOURCE ContentListingFrameworkTest.cpp
+SOURCE ContentListingFrameworkTestBlocks.cpp
+
+START RESOURCE ContentListingFrameworkTest.rss
+ HEADER
+ TARGETPATH RESOURCE_FILES_DIR
+ LANGUAGE_IDS
+END
+
+SYSTEMINCLUDE /epoc32/include/ecom
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY stiftestinterface.lib
+LIBRARY stiftestengine.lib
+LIBRARY platformenv.lib
+LIBRARY ContentListingFramework.lib
+LIBRARY estor.lib
+LIBRARY efsrv.lib
+LIBRARY bafl.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/group/ContentListingFramework.pkg Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,34 @@
+;
+; 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:
+;
+; Installation file for API test
+
+; Languages
+&EN
+
+; Header
+#{"ContentListingFrameworkTest"},(0x1000af59),1,0,1,TYPE=SA
+
+; Localised Vendor name
+%{"Nokia-EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Files
+"\epoc32\release\armv5\urel\ContentListingFrameworkTest.dll" -"C:\sys\bin\ContentListingFrameworkTest.dll"
+"..\init\ContentListingFrameworkTest.ini" -"C:\testframework\ContentListingFrameworkTest.ini"
+"..\conf\ContentListingFrameworkTest.cfg" -"C:\testframework\ContentListingFrameworkTest.cfg"
+"\epoc32\data\z\resource\ContentListingFrameworkTest.rsc" -"!:\resource\ContentListingFrameworkTest.rsc"
\ No newline at end of file
--- a/mds_pub/content_listing_framework_api/tsrc/group/T_ContentListingFramework.mmp Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2007 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 <platform_paths.hrh>
-#include <data_caging_paths.hrh>
-
-// DEFINES
-#define KEUnitUid3 0x1000af59
-#define KEUnitTestDllUid2 0x1000af5a
-
-// Build target
-TARGET T_CLFApiMdlTest.dll
-TARGETTYPE dll
-UID KEUnitTestDllUid2 KEUnitUid3
-CAPABILITY ALL -TCB -DRM
-VENDORID VID_DEFAULT
-
-APP_LAYER_SYSTEMINCLUDE
-
-// Source files
-SOURCEPATH ../src
-SOURCE CreateTestSuite.cpp
-SOURCE T_CLFApiModuleTests.cpp
-
-START RESOURCE T_ContentListingFramework.rss
- HEADER
- TARGETPATH RESOURCE_FILES_DIR
- LANGUAGE_IDS
-END
-
-// Include paths
-USERINCLUDE ../inc
-
-SYSTEMINCLUDE /epoc32/include/platform/digia/eunit
-
-// Dependencies to system components
-LIBRARY euser.lib
-LIBRARY EUnit.lib
-LIBRARY efsrv.lib
-LIBRARY bafl.lib
-LIBRARY platformenv.lib
-LIBRARY ContentListingFramework.lib
-LIBRARY estor.lib
--- a/mds_pub/content_listing_framework_api/tsrc/group/T_ContentListingFramework.pkg Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-;
-; 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:
-;
-; Installation file for API test
-
-; Languages
-&EN
-
-; Header
-#{"ContentListingFrameworkAPItest"},(0x1000af59),1,0,1,TYPE=SA
-
-; Localised Vendor name
-%{"Nokia-EN"}
-
-; Unique Vendor name
-:"Nokia"
-
-; Files
-"\epoc32\release\armv5\urel\T_CLFApiMdlTest.dll" -"C:\sys\bin\T_CLFApiMdlTest.dll"
-
--- a/mds_pub/content_listing_framework_api/tsrc/group/bld.inf Fri Mar 19 09:38:01 2010 +0200
+++ b/mds_pub/content_listing_framework_api/tsrc/group/bld.inf Fri Apr 16 15:23:55 2010 +0300
@@ -22,4 +22,12 @@
PRJ_EXPORTS
PRJ_TESTMMPFILES
- T_ContentListingFramework.mmp
+ ContentListingFramework.mmp
+
+PRJ_TESTEXPORTS
+../conf/ContentListingFrameworkTest.cfg /epoc32/winscw/c/TestFramework/ContentListingFrameworkTest.cfg
+../init/ContentListingFrameworkTest.ini /epoc32/winscw/c/TestFramework/ContentListingFrameworkTest.ini
+
+// End of File
+
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/inc/ContentListingFrameworkTest.h Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2008-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 CONTENTLISTINGFRAMEWORKTEST_H
+#define CONTENTLISTINGFRAMEWORKTEST_H
+
+// INCLUDES
+#include <bautils.h>
+#include <barsc.h>
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <CLFContentListing.hrh>
+#include <CLFContentListing.h>
+
+// Logging path
+_LIT( KContentListingFrameworkTestLogPath, "\\logs\\testframework\\ContentListingFrameworkTest\\" );
+// Log file
+_LIT( KContentListingFrameworkTestLogFile, "ContentListingFrameworkTest.txt" );
+_LIT( KContentListingFrameworkTestLogFileWithTitle, "ContentListingFrameworkTest_[%S].txt" );
+
+// FORWARD DECLARATIONS
+class MCLFContentListingEngine;
+class MCLFItemListModel;
+class MCLFSortingStyle;
+class TTestOperationObserver;
+class TTestCustomSorter;
+class TTestCustomGrouper;
+class TTestPostFilter;
+class TTestChangedItemObserver;
+class MCLFModifiableItem;
+class TTestCLFProcessObserver;
+class MCLFItem;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS(CContentListingFrameworkTest) : public CScriptBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CContentListingFrameworkTest* NewL( CTestModuleIf& aTestModuleIf );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CContentListingFrameworkTest();
+
+ public: // Functions from base classes
+
+ virtual TInt RunMethodL( CStifItemParser& aItem );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CContentListingFrameworkTest( CTestModuleIf& aTestModuleIf );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * Frees all resources allocated from test methods.
+ */
+ void Delete();
+
+ /**
+ * Test methods are listed below.
+ */
+ // setups
+ virtual TInt BaseSetupL( CStifItemParser& aItem );
+ virtual TInt SortingStyleResourceSetupL( CStifItemParser& aItem );
+ virtual TInt CreateModelSetupL( CStifItemParser& aItem );
+ virtual TInt CreateModelFromResourceSetupL( CStifItemParser& aItem );
+ virtual TInt ListModelSetupL( CStifItemParser& aItem );
+ virtual TInt ListModelSetupFromResourceL( CStifItemParser& aItem );
+ virtual TInt ListModelAllFileItemsSetupL( CStifItemParser& aItem );
+ virtual TInt EngineTestSetupL( CStifItemParser& aItem );
+ virtual TInt SortingStyleTestSetupL( CStifItemParser& aItem );
+ virtual TInt SortingStyleResourceTestSetupL( CStifItemParser& aItem );
+ virtual TInt ModifiableItemTestSetupL( CStifItemParser& aItem );
+ virtual TInt ItemTestSetupL( CStifItemParser& aItem );
+ virtual TInt MultibleSortingSetupL( CStifItemParser& aItem );
+ virtual TInt MultibleSortingResourceSetupL( CStifItemParser& aItem );
+
+ // teardowns
+ virtual TInt Teardown( CStifItemParser& aItem );
+
+ // tests
+ // Constructor test
+ virtual TInt CreateEngineTestL( CStifItemParser& aItem );
+ virtual TInt CreateModifiableItemTestL( CStifItemParser& aItem );
+ virtual TInt CreateSortignStyleTestL( CStifItemParser& aItem );
+ virtual TInt CreateSortignStyleFromResourceTestL( CStifItemParser& aItem );
+ virtual TInt CreateListModelTestL( CStifItemParser& aItem );
+ virtual TInt CreateListModelFromResourceTestL( CStifItemParser& aItem );
+
+ // Engine test
+ virtual TInt UpdateItemsTestL( CStifItemParser& aItem );
+ virtual TInt UpdateItemsWithIdTestL( CStifItemParser& aItem );
+ virtual TInt UpdateItemsWithOpaqueDataFolderTestL( CStifItemParser& aItem );
+
+ // Sorting Style test;
+ virtual TInt SortingStyleResourceTestL( CStifItemParser& aItem );
+ virtual TInt SortingStyleOrderingTestL( CStifItemParser& aItem );
+ virtual TInt SortingStyleDataTypeTestL( CStifItemParser& aItem );
+ virtual TInt SortingStyleUndefinedItemPositionTestL( CStifItemParser& aItem );
+ virtual TInt SortingStyleFieldTestL( CStifItemParser& aItem );
+
+ // List model test
+ virtual TInt RefreshTestL( CStifItemParser& aItem );
+ virtual TInt SetSortingStyleTestL( CStifItemParser& aItem );
+ virtual TInt SetCustomSorterTestL( CStifItemParser& aItem );
+ virtual TInt GroupingTestL( CStifItemParser& aItem );
+ virtual TInt SetPostFilterTestL( CStifItemParser& aItem );
+ virtual TInt SetWantedMimeTypesTestL( CStifItemParser& aItem );
+ virtual TInt SetWantedMediaTypesTestL( CStifItemParser& aItem );
+ virtual TInt SetWantedMediaAndMimeTypesTestL( CStifItemParser& aItem );
+ virtual TInt MultibleSortingTestL( CStifItemParser& aItem );
+ virtual TInt ModelItemsChangedTestL( CStifItemParser& aItem );
+
+ // item test
+ virtual TInt ItemFieldTestL( CStifItemParser& aItem );
+
+ // Modifiable item test
+ virtual TInt MIFieldTestL( CStifItemParser& aItem );
+
+ private: // Assistance methods
+ void ResourceL( TInt aResourceId );
+ void SortingStyleResourceL();
+ void ListModelResourceL();
+ void CreateNewFileL( TInt aNumber, TDes& aFileName );
+ TCLFItemId FindTestFileIdL( TInt aNumber );
+ TBool CheckFileNameShortingL();
+ TBool CheckFileSizeShortingL();
+ TBool CheckFileDateShortingL();
+ TBool CheckFileTypesL( const MDesCArray& aMimeTypeArray, const TArray<TInt>& aMediaTypes );
+ TBool CheckMimeTypesL( const MDesCArray& aMimeTypeArray, const TDesC& aMimeType );
+ TBool CheckMediaTypesL( const TArray<TInt>& aMediaTypes, TCLFMediaType aMediaType );
+ HBufC8* MakeOpaqueDataL( const MDesCArray& aFiles );
+ void MakeMultibleSortingItemsL( RPointerArray<MCLFModifiableItem>& aItemArray );
+ TBool CheckMultibleSortingShortingL();
+ TBool CheckMultibleSortingShorting2L();
+ const MCLFItem* FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId );
+
+ private: // Data
+ MCLFContentListingEngine* iEngine;
+ MCLFItemListModel* iListModel;
+ MCLFSortingStyle* iSortingStyle;
+ MCLFSortingStyle* iSortingStyle1;
+ MCLFSortingStyle* iSortingStyle2;
+ MCLFSortingStyle* iSortingStyle3;
+ MCLFModifiableItem* iModifiableItem;
+ const MCLFItem* iItem; // ref. not owned
+
+ TTestOperationObserver* iTestObserver;
+ TTestCustomSorter* iTestSorter;
+ TTestCustomSorter* iTestSorter1;
+ TTestCustomGrouper* iTestGrouper;
+ TTestCustomGrouper* iTestGrouper1;
+ TTestPostFilter* iTestFilter;
+ TTestPostFilter* iTestFilter1;
+ TTestCLFProcessObserver* iTestCLFProcessObserver;
+ TTestCLFProcessObserver* iTestCLFProcessObserver1;
+
+ CDesCArray* iMimeTypeArray;
+ CDesCArray* iMimeTypeArray1;
+ RArray<TInt> iMediaTypeArray;
+ RArray<TInt> iMediaTypeArray1;
+
+ TTestChangedItemObserver* iChangedItemObserver;
+ TTestChangedItemObserver* iChangedItemObserver1;
+ RArray<TCLFItemId> iUpdateItemIdArray;
+ HBufC8* iOpaqueData;
+ TInt iSemanticId;
+
+ RFs iFs;
+ RResourceFile iResourceFile;
+ HBufC8* iDataBuffer;
+ TResourceReader iResourceReader;
+ CActiveSchedulerWait iWait;
+ RArray<TCLFItemId> iChangedArray;
+ TInt iItemCount;
+ RPointerArray<MCLFModifiableItem> iModifiableItems;
+ TFileName iFileName;
+ };
+
+#endif // CONTENTLISTINGFRAMEWORKTEST_H
+
+// End of File
--- a/mds_pub/content_listing_framework_api/tsrc/inc/T_CLFApiModuleTests.h Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
-* Copyright (c) 2007 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: Part of CLF API tests
-*
-*/
-
-
-// INCLUDES
-#include <ceunittestsuiteclass.h>
-#include <bautils.h>
-#include <barsc.h>
-#include <CLFContentListing.hrh>
-#include <CLFContentListing.h>
-
-// FORWARD DECLARATION
-class MCLFContentListingEngine;
-class MCLFItemListModel;
-class MCLFSortingStyle;
-class TTestOperationObserver;
-class TTestCustomSorter;
-class TTestCustomGrouper;
-class TTestPostFilter;
-class TTestChangedItemObserver;
-class MCLFModifiableItem;
-class TTestCLFProcessObserver;
-class MCLFItem;
-
-/**
- * Test suite for Content Listing Framework API
- */
-class T_CLFApiModuleTests : public CEUnitTestSuiteClass
- {
- public: // Construct / destruct
- static T_CLFApiModuleTests* NewLC();
- ~T_CLFApiModuleTests();
-
- private:
- void ConstructL();
-
- private: // Assistance methods
- void ResourceL( TInt aResourceId );
- void SortingStyleResourceL();
- void ListModelResourceL();
- void CreateNewFileL( TInt aNumber, TDes& aFileName );
- TCLFItemId FindTestFileIdL( TInt aNumber );
- TBool CheckFileNameShortingL();
- TBool CheckFileSizeShortingL();
- TBool CheckFileDateShortingL();
- TBool CheckFileTypesL( const MDesCArray& aMimeTypeArray, const TArray<TInt>& aMediaTypes );
- TBool CheckMimeTypesL( const MDesCArray& aMimeTypeArray, const TDesC& aMimeType );
- TBool CheckMediaTypesL( const TArray<TInt>& aMediaTypes, TCLFMediaType aMediaType );
- HBufC8* MakeOpaqueDataL( const MDesCArray& aFiles );
- void MakeMultibleSortingItemsL( RPointerArray<MCLFModifiableItem>& aItemArray );
- TBool CheckMultibleSortingShortingL();
- TBool CheckMultibleSortingShorting2L();
- const MCLFItem* FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId );
-
-
- private: // test methods
- // setups
- void BaseSetupL();
- void SortingStyleResourceSetupL();
- void CreateModelSetupL();
- void CreateModelFromResourceSetupL();
- void ListModelSetupL();
- void ListModelSetupFromResourceL();
- void ListModelAllFileItemsSetupL();
- void EngineTestSetupL();
- void SortingStyleTestSetupL();
- void SortingStyleResourceTestSetupL();
- void ModifiableItemTestSetupL();
- void ItemTestSetupL();
- void MultibleSortingSetupL();
- void MultibleSortingResourceSetupL();
-
- // teardowns
- void Teardown();
-
- // tests
- // Constructor test
- void CreateEngineTestL();
- void CreateModifiableItemTestL();
- void CreateSortignStyleTestL();
- void CreateSortignStyleFromResourceTestL();
- void CreateListModelTestL();
- void CreateListModelFromResourceTestL();
-
- // Engine test
- void UpdateItemsTestL();
- void UpdateItemsWithIdTestL();
- void UpdateItemsWithOpaqueDataFolderTestL();
-
- // Sorting Style test;
- void SortingStyleResourceTestL();
- void SortingStyleOrderingTestL();
- void SortingStyleDataTypeTestL();
- void SortingStyleUndefinedItemPositionTestL();
- void SortingStyleFieldTestL();
-
- // List model test
- void RefreshTestL();
- void SetSortingStyleTestL();
- void SetCustomSorterTestL();
- void GroupingTestL();
- void SetPostFilterTestL();
- void SetWantedMimeTypesTestL();
- void SetWantedMediaTypesTestL();
- void SetWantedMediaAndMimeTypesTestL();
- void MultibleSortingTestL();
- void ModelItemsChangedTestL();
-
-
- // item test
- void ItemFieldTestL();
-
- // Modifiable item test
- void MIFieldTestL();
-
- private: // Implementation
-
- EUNIT_DECLARE_TEST_TABLE;
-
- private: // Data
- MCLFContentListingEngine* iEngine;
- MCLFItemListModel* iListModel;
- MCLFSortingStyle* iSortingStyle;
- MCLFSortingStyle* iSortingStyle1;
- MCLFSortingStyle* iSortingStyle2;
- MCLFSortingStyle* iSortingStyle3;
- MCLFModifiableItem* iModifiableItem;
- const MCLFItem* iItem; // ref. not owned
-
- TTestOperationObserver* iTestObserver;
- TTestCustomSorter* iTestSorter;
- TTestCustomSorter* iTestSorter1;
- TTestCustomGrouper* iTestGrouper;
- TTestCustomGrouper* iTestGrouper1;
- TTestPostFilter* iTestFilter;
- TTestPostFilter* iTestFilter1;
- TTestCLFProcessObserver* iTestCLFProcessObserver;
- TTestCLFProcessObserver* iTestCLFProcessObserver1;
-
- CDesCArray* iMimeTypeArray;
- CDesCArray* iMimeTypeArray1;
- RArray<TInt> iMediaTypeArray;
- RArray<TInt> iMediaTypeArray1;
-
- TTestChangedItemObserver* iChangedItemObserver;
- TTestChangedItemObserver* iChangedItemObserver1;
- RArray<TCLFItemId> iUpdateItemIdArray;
- HBufC8* iOpaqueData;
- TInt iSemanticId;
-
- RFs iFs;
- RResourceFile iResourceFile;
- HBufC8* iDataBuffer;
- TResourceReader iResourceReader;
- CActiveSchedulerWait iWait;
- RArray<TCLFItemId> iChangedArray;
- TInt iItemCount;
- RPointerArray<MCLFModifiableItem> iModifiableItems;
- TFileName iFileName;
-
- };
-
-// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/init/ContentListingFrameworkTest.ini Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,80 @@
+#
+# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of the License "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:
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment',
+ 'TestCases' or 'FullReport'
+
+CreateTestReport= YES # Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= ContentListingFrameworkAPItestLog
+
+TestReportFormat= TXT # Possible values: TXT or HTML
+TestReportOutput= FILE # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone # Possible values are:
+ # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+ # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+ # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+ # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 600000 # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES # Possible values: YES or NO
+#SeparateProcesses= YES # Possible values: YES or NO (default: NO)
+[End_Defaults]
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[New_Module]
+ModuleName= TestScripter
+TestCaseFile= c:\testframework\ContentListingFrameworkTest.cfg
+[End_Module]
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+CreateLogDirectories= YES # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML # Possible values: TXT or HTML
+#EmulatorOutput= FILE # Possible values: FILE or RDEBUG
+
+HardwareBasePath= C:\
+#HardwareFormat= HTML # Possible values: TXT or HTML
+#HardwareOutput= FILE # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES # Possible values: YES or NO
+#WithTimeStamp= YES # Possible values: YES or NO
+#WithLineBreak= YES # Possible values: YES or NO
+#WithEventRanking= YES # Possible values: YES or NO
+
+#FileUnicode= YES # Possible values: YES or NO
+AddTestCaseTitle= YES # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTest.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2008-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:
+*
+*/
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "ContentListingFrameworkTest.h"
+#include <SettingServerClient.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CContentListingFrameworkTest::CContentListingFrameworkTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CContentListingFrameworkTest::CContentListingFrameworkTest(
+ CTestModuleIf& aTestModuleIf ):
+ CScriptBase( aTestModuleIf )
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CContentListingFrameworkTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::ConstructL()
+ {
+ //Read logger settings to check whether test case name is to be
+ //appended to log file name.
+ RSettingServer settingServer;
+ TInt ret = settingServer.Connect();
+ if(ret != KErrNone)
+ {
+ User::Leave(ret);
+ }
+ // Struct to StifLogger settigs.
+ TLoggerSettings loggerSettings;
+ // Parse StifLogger defaults from STIF initialization file.
+ ret = settingServer.GetLoggerSettings(loggerSettings);
+ if(ret != KErrNone)
+ {
+ User::Leave(ret);
+ }
+ // Close Setting server session
+ settingServer.Close();
+
+ TFileName logFileName;
+
+ if(loggerSettings.iAddTestCaseTitle)
+ {
+ TName title;
+ TestModuleIf().GetTestCaseTitleL(title);
+ logFileName.Format(KContentListingFrameworkTestLogFileWithTitle, &title);
+ }
+ else
+ {
+ logFileName.Copy(KContentListingFrameworkTestLogFile);
+ }
+
+ iLog = CStifLogger::NewL( KContentListingFrameworkTestLogPath,
+ logFileName,
+ CStifLogger::ETxt,
+ CStifLogger::EFile,
+ EFalse );
+ }
+
+// -----------------------------------------------------------------------------
+// CContentListingFrameworkTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CContentListingFrameworkTest* CContentListingFrameworkTest::NewL(
+ CTestModuleIf& aTestModuleIf )
+ {
+ CContentListingFrameworkTest* self = new (ELeave) CContentListingFrameworkTest( aTestModuleIf );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+
+ return self;
+ }
+
+// Destructor
+CContentListingFrameworkTest::~CContentListingFrameworkTest()
+ {
+ // Delete resources allocated from test methods
+ Delete();
+
+ // Delete logger
+ delete iLog;
+ }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL(
+ CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+ {
+ return ( CScriptBase* ) CContentListingFrameworkTest::NewL( aTestModuleIf );
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTest.rss Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2002-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:
+*
+*/
+
+
+
+// RESOURCE IDENTIFIER
+NAME CLFT
+
+// INCLUDES
+#include <eikon.rh>
+#include <PathConfiguration.hrh>
+#include <CLFContentListing.rh>
+#include <CLFContentListing.hrh>
+#include <CLFContentListingExtended.hrh>
+
+// CONSTANTS
+// MACROS
+
+// RESOURCE DEFINITIONS
+// -----------------------------------------------------------------------------
+//
+// ?resource_name
+// ?description
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE RSS_SIGNATURE { signature = 0; }
+
+// -----------------------------------------------------------------------------
+//
+// ?resource_name
+// ?description
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CLF_SORTING_STYLE r_sorting_style
+ {
+ ordering = ECLFOrderingDescending;
+ data_type = ECLFItemDataTypeDesC;
+ fields =
+ {
+ CLF_FIELD_ID { field_id = ECLFFieldIdFileName; },
+ CLF_FIELD_ID { field_id = ECLFFieldIdCollectionName; },
+ CLF_FIELD_ID { field_id = ECLFFieldIdMimeType; },
+ CLF_FIELD_ID { field_id = ECLFFieldIdArtist; }
+ };
+ }
+
+RESOURCE CLF_SORTING_STYLE r_sorting_style_empty
+ {
+ ordering = ECLFOrderingAscending;
+ data_type = ECLFItemDataTypeTInt32;
+ fields =
+ {
+ };
+ }
+
+RESOURCE CLF_SORTING_STYLE r_sorting_style_undefineditem
+ {
+ ordering = ECLFOrderingDescending;
+ data_type = ECLFItemDataTypeDesC;
+ undefined_item_position = ECLFSortingStyleUndefinedFirst;
+ fields =
+ {
+ CLF_FIELD_ID { field_id = ECLFFieldIdArtist; }
+ };
+ }
+
+RESOURCE CLF_LIST_MODEL r_list_model
+ {
+ mime_type_array = CLF_MIME_TYPE_ARRAY
+ {
+ mime_types =
+ {
+ LBUF { txt = "image/*"; }
+ };
+ };
+ media_type_array = CLF_MEDIA_TYPE_ARRAY
+ {
+ media_types =
+ {
+ CLF_MEDIA_TYPE { media_type = ECLFMediaTypeCollection; }
+ };
+ };
+ sorting_style = CLF_SORTING_STYLE
+ {
+ ordering = ECLFOrderingAscending;
+ data_type = ECLFItemDataTypeDesC;
+ fields =
+ {
+ CLF_FIELD_ID { field_id = ECLFFieldIdFileName; },
+ CLF_FIELD_ID { field_id = ECLFFieldIdCollectionName; },
+ CLF_FIELD_ID { field_id = ECLFFieldIdAlbum; }
+ };
+ };
+ }
+
+RESOURCE CLF_LIST_MODEL r_list_model_incorrect_version
+ {
+ version = 88;
+ mime_type_array = CLF_MIME_TYPE_ARRAY
+ {
+ mime_types =
+ {
+ };
+ };
+ media_type_array = CLF_MEDIA_TYPE_ARRAY
+ {
+ media_types =
+ {
+ };
+ };
+ sorting_style = CLF_SORTING_STYLE
+ {
+ ordering = ECLFOrderingAscending;
+ data_type = ECLFItemDataTypeDesC;
+ fields =
+ {
+ };
+ };
+ }
+
+
+RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array
+ {
+ mime_types =
+ {
+ LBUF { txt = "image/*"; },
+ LBUF { txt = "audio/*"; }
+ };
+ }
+
+RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array_empty
+ {
+ mime_types =
+ {
+ };
+ }
+
+RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array_incorrect_version
+ {
+ version = 88;
+ mime_types =
+ {
+ };
+ }
+
+RESOURCE CLF_MEDIA_TYPE_ARRAY r_media_type_array
+ {
+ media_types =
+ {
+ CLF_MEDIA_TYPE { media_type = ECLFMediaTypeImage; },
+ CLF_MEDIA_TYPE { media_type = ECLFMediaTypeCollection; }
+ };
+ }
+
+RESOURCE CLF_MEDIA_TYPE_ARRAY r_media_type_array_empty
+ {
+ media_types =
+ {
+ };
+ }
+
+RESOURCE CLF_LIST_MODEL_V2 r_list_model_multible
+ {
+ mime_type_array = CLF_MIME_TYPE_ARRAY
+ {
+ mime_types =
+ {
+ };
+ };
+ media_type_array = CLF_MEDIA_TYPE_ARRAY
+ {
+ media_types =
+ {
+ };
+ };
+ sorting_style_array =
+ {
+ CLF_SORTING_STYLE
+ {
+ ordering = ECLFOrderingAscending;
+ data_type = ECLFItemDataTypeTInt32;
+ undefined_item_position = ECLFSortingStyleUndefinedFirst;
+ fields =
+ {
+ CLF_FIELD_ID { field_id = 0x80000001; }
+ };
+ },
+ CLF_SORTING_STYLE
+ {
+ ordering = ECLFOrderingDescending;
+ data_type = ECLFItemDataTypeTInt32;
+ undefined_item_position = ECLFSortingStyleUndefinedEnd;
+ fields =
+ {
+ CLF_FIELD_ID { field_id = 0x80000002; }
+ };
+ },
+ CLF_SORTING_STYLE
+ {
+ ordering = ECLFOrderingAscending;
+ data_type = ECLFItemDataTypeTInt32;
+ undefined_item_position = ECLFSortingStyleUndefinedEnd;
+ fields =
+ {
+ CLF_FIELD_ID { field_id = 0x80000003; },
+ CLF_FIELD_ID { field_id = 0x80000004; }
+ };
+ },
+ CLF_SORTING_STYLE
+ {
+ ordering = ECLFOrderingAscending;
+ data_type = ECLFItemDataTypeTInt32;
+ undefined_item_position = ECLFSortingStyleUndefinedFirst;
+ fields =
+ {
+ CLF_FIELD_ID { field_id = 0x80000005; }
+ };
+ }
+ };
+ }
+
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mds_pub/content_listing_framework_api/tsrc/src/ContentListingFrameworkTestBlocks.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -0,0 +1,2772 @@
+/*
+* Copyright (c) 2008-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: Implementation of CLF API test
+*
+*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <s32mem.h>
+#include <ecom.h>
+#include <StifParser.h>
+#include <StifTestEventInterface.h>
+#include <Stiftestinterface.h>
+#include "ContentListingFrameworkTest.h"
+
+// the header for the tested class
+#include <ContentListingFactory.h>
+#include <MCLFChangedItemObserver.h>
+#include <MCLFContentListingEngine.h>
+#include <MCLFCustomGrouper.h>
+#include <MCLFCustomSorter.h>
+#include <MCLFItem.h>
+#include <MCLFItemListModel.h>
+#include <MCLFModifiableItem.h>
+#include <MCLFOperationObserver.h>
+#include <MCLFPostFilter.h>
+#include <MCLFSortingStyle.h>
+#include <ContentListingFrameworkTest.rsg>
+#include <collate.h>
+#include <pathInfo.h>
+#include <MCLFProcessObserver.h>
+#include <CLFContentListingExtended.hrh>
+
+// CONSTANTS
+#ifdef __WINSCW__
+_LIT( KTestResourceFile, "z:\\resource\\ContentListingFrameworkTest.rsc" );
+#else
+_LIT( KTestResourceFile, "c:\\resource\\ContentListingFrameworkTest.rsc" );
+#endif
+_LIT( KTestFileNameBase, "CLFTestFiles\\TestFile" );
+_LIT( KTestFileExt, ".txt" );
+
+const TCLFFieldId KMultibleSortingTestField1 = 0x80000001;
+const TCLFFieldId KMultibleSortingTestField2 = 0x80000002;
+const TCLFFieldId KMultibleSortingTestField3 = 0x80000003;
+const TCLFFieldId KMultibleSortingTestField4 = 0x80000004;
+const TCLFFieldId KMultibleSortingTestField5 = 0x80000005;
+const TCLFFieldId KMultibleSortingTestField6 = 0x80000006;
+
+const TInt KCLFUpdateFoldersSemanticId = 0x1000;
+
+// ---------------------------------------------------------------------------
+// class CMGXAsyncCallback
+// ---------------------------------------------------------------------------
+//
+class CCLFAsyncCallback : public CBase
+ {
+ public:
+ ~CCLFAsyncCallback()
+ {
+ if ( iActiveWait.IsStarted() )
+ {
+ iActiveWait.AsyncStop();
+ }
+ }
+ public:
+ static void AfterL( TTimeIntervalMicroSeconds32 aInterval )
+ {
+ CCLFAsyncCallback* self = new( ELeave ) CCLFAsyncCallback();
+ CleanupStack::PushL( self );
+ CPeriodic* periodic = CPeriodic::NewL( CActive::EPriorityIdle );
+ CleanupStack::PushL( periodic );
+ TCallBack callBack( CallBackL, self );
+ TTimeIntervalMicroSeconds32 interval( 1000000 );
+ periodic->Start( aInterval, aInterval, callBack );
+ self->iActiveWait.Start();
+ periodic->Cancel();
+ CleanupStack::PopAndDestroy( 2 ); // periodic, self
+ }
+
+ static TInt CallBackL( TAny* aObject )
+ {
+ CCLFAsyncCallback* self = reinterpret_cast< CCLFAsyncCallback* >( aObject );
+ if ( self->iActiveWait.IsStarted() )
+ {
+ self->iActiveWait.AsyncStop();
+ }
+ return EFalse;
+ }
+
+ private:
+ CActiveSchedulerWait iActiveWait;
+ };
+
+// ---------------------------------------------------------------------------
+// class TTestOperationObserver
+// ---------------------------------------------------------------------------
+//
+class TTestOperationObserver : public MCLFOperationObserver
+ {
+ public:
+ TTestOperationObserver()
+ // set invalid values
+ : iOperationEvent( TCLFOperationEvent( -1 ) ), iError( 1 ), iWait( NULL )
+ {}
+ void HandleOperationEventL( TCLFOperationEvent aOperationEvent,
+ TInt aError )
+ {
+ iError = aError;
+ iOperationEvent = aOperationEvent;
+ if( iWait &&
+ iWait->IsStarted() )
+ {
+ iWait->AsyncStop();
+ }
+ }
+ TCLFOperationEvent iOperationEvent;
+ TInt iError;
+ CActiveSchedulerWait* iWait;
+
+ };
+
+// ---------------------------------------------------------------------------
+// class TTestCustomSorter
+// ---------------------------------------------------------------------------
+//
+class TTestCustomSorter : public MCLFCustomSorter
+ {
+ public:
+ TTestCustomSorter() : iSortItems( EFalse )
+ {
+ }
+ void SortItemsL( RPointerArray<MCLFItem>& /*aItemArray*/ )
+ {
+ //aItemArray;
+ iSortItems = ETrue;
+ }
+ TBool iSortItems;
+
+ };
+
+// ---------------------------------------------------------------------------
+// class TTestCustomGrouper
+// ---------------------------------------------------------------------------
+//
+class TTestCustomGrouper : public MCLFCustomGrouper
+ {
+ public:
+ TTestCustomGrouper() : iGroupCount( 2 ), iCopyItems( EFalse ), iModifiableItems( NULL )
+ {
+ }
+ void GroupItemsL( const TArray<MCLFItem*>& /*aSourceList*/,
+ RPointerArray<MCLFItem>& aGroupedList )
+ {
+ //aSourceList;
+ if( iCopyItems )
+ {
+ TInt count( iModifiableItems->Count() );
+ for( TInt i = 0 ; i < count ; ++i )
+ {
+ aGroupedList.AppendL( (*iModifiableItems)[i] );
+ }
+ }
+ else if( iModifiableItems )
+ {
+ iModifiableItems->ResetAndDestroy();
+ for( TInt i = 0 ; i < iGroupCount ; ++i )
+ {
+ MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
+ iModifiableItems->AppendL( item );
+ CleanupStack::Pop(); // item
+ aGroupedList.AppendL( item );
+ }
+ }
+ }
+ TInt iGroupCount;
+ TBool iCopyItems;
+ RPointerArray<MCLFModifiableItem>* iModifiableItems;
+ };
+
+// ---------------------------------------------------------------------------
+// class TTestPostFilter
+// ---------------------------------------------------------------------------
+//
+class TTestPostFilter : public MCLFPostFilter
+ {
+ public:
+ TTestPostFilter() : iShouldFilterCount( 5 ), iAllFilter( EFalse ), iFilteredCount( 0 )
+ {
+ }
+
+ void FilterItemsL( const TArray<MCLFItem*>& aItemList,
+ RPointerArray<MCLFItem>& aFilteredItemList )
+ {
+ iFilteredCount = 0;
+ if( iAllFilter )
+ {
+ iFilteredCount = aItemList.Count();
+ return;
+ }
+ for( TInt i = 0 ; i < aItemList.Count() ; ++i )
+ {
+ if( i < iShouldFilterCount )
+ {
+ iFilteredCount++;
+ }
+ else
+ {
+ aFilteredItemList.AppendL( aItemList[i] );
+ }
+ }
+ }
+ TInt iShouldFilterCount;
+ TBool iAllFilter;
+ TInt iFilteredCount;
+
+ };
+
+// ---------------------------------------------------------------------------
+// class TTestChangedItemObserver
+// ---------------------------------------------------------------------------
+//
+class TTestChangedItemObserver : public MCLFChangedItemObserver
+ {
+ public:
+ TTestChangedItemObserver()
+ : iHandleItemChange( EFalse ),
+ iLastError( KErrNone ),
+ iChangedArray( NULL ),
+ iWait( NULL )
+ {
+ }
+ void HandleItemChangeL( const TArray<TCLFItemId>& aItemIDArray )
+ {
+ iHandleItemChange = ETrue;
+ if( iChangedArray )
+ {
+ iChangedArray->Reset();
+ for( TInt i = 0 ; i < aItemIDArray.Count() ; ++i )
+ {
+ iChangedArray->AppendL( aItemIDArray[i] );
+ }
+ }
+ if( iWait && iWait->IsStarted() )
+ {
+ iWait->AsyncStop();
+ }
+
+ }
+ void HandleError( TInt aError )
+ {
+ iLastError = aError;
+ if( iWait && iWait->IsStarted() )
+ {
+ iWait->AsyncStop();
+ }
+ }
+ TInt iHandleItemChange;
+ TInt iLastError;
+ RArray<TCLFItemId>* iChangedArray;
+ CActiveSchedulerWait* iWait;
+ };
+
+// ---------------------------------------------------------------------------
+// class TTestCLFProcessObserver
+// ---------------------------------------------------------------------------
+//
+class TTestCLFProcessObserver : public MCLFProcessObserver
+ {
+ public:
+ TTestCLFProcessObserver()
+ : iStartEvent( EFalse ), iEndEvent( EFalse )
+ {}
+ void HandleCLFProcessEventL( TCLFProcessEvent aProcessEvent )
+ {
+ switch ( aProcessEvent )
+ {
+ case ECLFUpdateStart:
+ {
+ iStartEvent = ETrue;
+ break;
+ }
+ case ECLFUpdateStop:
+ {
+ iEndEvent = ETrue;
+ break;
+ }
+ default:
+ {
+ User::Panic( _L("CLF module test"), 1 );
+ }
+ }
+ }
+ void Reset()
+ {
+ iStartEvent = EFalse;
+ iEndEvent = EFalse;
+ }
+ TBool iStartEvent;
+ TBool iEndEvent;
+ };
+
+void SerializeL( const MDesCArray& aDataArray, CBufBase& aBuffer )
+ {
+ const TInt count( aDataArray.MdcaCount() );
+ RBufWriteStream writeStream( aBuffer );
+ CleanupClosePushL( writeStream );
+ writeStream.WriteInt32L( count );
+ for( TInt i = 0 ; i < count ; ++i )
+ {
+ const TDesC& des = aDataArray.MdcaPoint( i );
+ TInt length( des.Length() );
+ writeStream.WriteInt32L( length );
+ writeStream.WriteL( des, length );
+ }
+ CleanupStack::PopAndDestroy( &writeStream );
+ }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CContentListingFrameworkTest::Delete
+// Delete here all resources allocated and opened from test methods.
+// Called from destructor.
+// -----------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::Delete()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CCollectionManagerTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::RunMethodL(
+ CStifItemParser& aItem )
+ {
+
+ static TStifFunctionInfo const KFunctions[] =
+ {
+ // 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.
+
+ // engine
+ ENTRY( "BaseSetup", CContentListingFrameworkTest::BaseSetupL ),
+ ENTRY( "SortingStyleResourceSetup", CContentListingFrameworkTest::SortingStyleResourceSetupL ),
+ ENTRY( "CreateModelSetup", CContentListingFrameworkTest::CreateModelSetupL ),
+ ENTRY( "CreateModelFromResourceSetup", CContentListingFrameworkTest::CreateModelFromResourceSetupL ),
+ ENTRY( "ListModelSetup", CContentListingFrameworkTest::ListModelSetupL ),
+ ENTRY( "ListModelSetupFromResource", CContentListingFrameworkTest::ListModelSetupFromResourceL ),
+ ENTRY( "ListModelAllFileItemsSetup", CContentListingFrameworkTest::ListModelAllFileItemsSetupL ),
+ ENTRY( "EngineTestSetup", CContentListingFrameworkTest::EngineTestSetupL ),
+ ENTRY( "SortingStyleTestSetup", CContentListingFrameworkTest::SortingStyleTestSetupL ),
+ ENTRY( "SortingStyleResourceTestSetup", CContentListingFrameworkTest::SortingStyleResourceTestSetupL ),
+ ENTRY( "ModifiableItemTestSetup", CContentListingFrameworkTest::ModifiableItemTestSetupL ),
+ ENTRY( "ItemTestSetup", CContentListingFrameworkTest::ItemTestSetupL ),
+ ENTRY( "MultibleSortingSetup", CContentListingFrameworkTest::MultibleSortingSetupL ),
+ ENTRY( "MultibleSortingResourceSetup", CContentListingFrameworkTest::MultibleSortingResourceSetupL ),
+ ENTRY( "Teardown", CContentListingFrameworkTest::Teardown ),
+ ENTRY( "CreateEngineTest", CContentListingFrameworkTest::CreateEngineTestL ),
+ ENTRY( "CreateModifiableItemTest", CContentListingFrameworkTest::CreateModifiableItemTestL ),
+ ENTRY( "CreateSortignStyleTest", CContentListingFrameworkTest::CreateSortignStyleTestL ),
+ ENTRY( "CreateSortignStyleFromResourceTest", CContentListingFrameworkTest::CreateSortignStyleFromResourceTestL ),
+ ENTRY( "CreateListModelTest", CContentListingFrameworkTest::CreateListModelTestL ),
+ ENTRY( "CreateListModelFromResourceTest", CContentListingFrameworkTest::CreateListModelFromResourceTestL ),
+ ENTRY( "UpdateItemsTest", CContentListingFrameworkTest::UpdateItemsTestL ),
+ ENTRY( "UpdateItemsWithIdTest", CContentListingFrameworkTest::UpdateItemsWithIdTestL ),
+ ENTRY( "UpdateItemsWithOpaqueDataFolderTest", CContentListingFrameworkTest::UpdateItemsWithOpaqueDataFolderTestL ),
+ ENTRY( "SortingStyleResourceTest", CContentListingFrameworkTest::SortingStyleResourceTestL ),
+ ENTRY( "SortingStyleOrderingTest", CContentListingFrameworkTest::SortingStyleOrderingTestL ),
+ ENTRY( "SortingStyleDataTypeTest", CContentListingFrameworkTest::SortingStyleDataTypeTestL ),
+ ENTRY( "SortingStyleUndefinedItemPositionTest", CContentListingFrameworkTest::SortingStyleUndefinedItemPositionTestL ),
+ ENTRY( "SortingStyleFieldTest", CContentListingFrameworkTest::SortingStyleFieldTestL ),
+ ENTRY( "RefreshTest", CContentListingFrameworkTest::RefreshTestL ),
+ ENTRY( "SetSortingStyleTest", CContentListingFrameworkTest::SetSortingStyleTestL ),
+ ENTRY( "SetCustomSorterTest", CContentListingFrameworkTest::SetCustomSorterTestL ),
+ ENTRY( "GroupingTest", CContentListingFrameworkTest::GroupingTestL ),
+ ENTRY( "SetPostFilterTest", CContentListingFrameworkTest::SetPostFilterTestL ),
+ ENTRY( "SetWantedMimeTypesTest", CContentListingFrameworkTest::SetWantedMimeTypesTestL ),
+ ENTRY( "SetWantedMediaTypesTest", CContentListingFrameworkTest::SetWantedMediaTypesTestL ),
+ ENTRY( "SetWantedMediaAndMimeTypesTest", CContentListingFrameworkTest::SetWantedMediaAndMimeTypesTestL ),
+ ENTRY( "MultibleSortingTest", CContentListingFrameworkTest::MultibleSortingTestL ),
+ ENTRY( "ModelItemsChangedTest", CContentListingFrameworkTest::ModelItemsChangedTestL ),
+ ENTRY( "ItemFieldTest", CContentListingFrameworkTest::ItemFieldTestL ),
+ ENTRY( "MIFieldTest", CContentListingFrameworkTest::MIFieldTestL ),
+ };
+
+ const TInt count = sizeof( KFunctions ) /
+ sizeof( TStifFunctionInfo );
+
+ return RunInternalL( KFunctions, count, aItem );
+
+ }
+
+/**
+ * Assistance methods
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ResourceL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::ResourceL( TInt aResourceId )
+ {
+ delete iDataBuffer;
+ iDataBuffer = NULL;
+ iDataBuffer = iResourceFile.AllocReadL( aResourceId );
+ iResourceReader.SetBuffer( iDataBuffer );
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleResourceL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::SortingStyleResourceL()
+ {
+ ResourceL( R_SORTING_STYLE );
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ListModelResourceL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::ListModelResourceL()
+ {
+ ResourceL( R_LIST_MODEL );
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateNewFileL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::CreateNewFileL( TInt aNumber, TDes& aFileName )
+ {
+ aFileName.Copy( PathInfo::PhoneMemoryRootPath() );
+ aFileName.Append( KTestFileNameBase );
+ TBuf<125> buf;
+ buf.Num( aNumber );
+ aFileName.Append( buf );
+ aFileName.Append( KTestFileExt );
+
+ RFile file;
+ BaflUtils::EnsurePathExistsL( iFs, aFileName );
+ TInt error( file.Replace( iFs, aFileName, EFileShareAny | EFileWrite ) );
+ if( error == KErrNone )
+ {
+ error = file.Write( _L8("Test data") );
+ }
+ file.Close();
+ User::LeaveIfError( error );
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::FindTestFileIdL
+// ---------------------------------------------------------------------------
+//
+TCLFItemId CContentListingFrameworkTest::FindTestFileIdL( TInt aNumber )
+ {
+ TCLFItemId id( 0 );
+ MCLFItemListModel* model = iEngine->CreateListModelLC( *iTestObserver );
+ iMimeTypeArray->AppendL( _L("*") );
+
+ iTestObserver->iWait = &iWait;
+ model->SetWantedMimeTypesL( *iMimeTypeArray );
+ model->RefreshL();
+ iWait.Start();
+
+ TFileName testFileName( PathInfo::PhoneMemoryRootPath() );
+ testFileName.Append( KTestFileNameBase );
+ TBuf<125> buf;
+ buf.Num( aNumber );
+ testFileName.Append( buf );
+ testFileName.Append( KTestFileExt );
+ for( TInt i = 0 ; i < model->ItemCount() ; ++i )
+ {
+ const MCLFItem& item = model->Item( i );
+ TPtrC fileName;
+ if( item.GetField( ECLFFieldIdFileNameAndPath, fileName ) != KErrNone )
+ {
+ continue;
+ }
+ if( fileName.CompareF( testFileName ) == 0 )
+ {
+ id = item.ItemId();
+ break;
+ }
+ }
+ CleanupStack::PopAndDestroy(); // model
+ return id;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckFileNameShortingL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckFileNameShortingL()
+ {
+ TCollationMethod m = *Mem::CollationMethodByIndex( 0 );
+ m.iFlags |= TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase;
+
+ for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
+ {
+ const MCLFItem& item = iListModel->Item( i );
+ const MCLFItem& item1 = iListModel->Item( i + 1 );
+ TPtrC name;
+ TPtrC name1;
+
+ if( item.GetField( ECLFFieldIdFileName, name ) != KErrNone ||
+ item1.GetField( ECLFFieldIdFileName, name1 ) != KErrNone )
+ {
+ return EFalse;
+ }
+ if( name.CompareC( name1, 3, &m ) > 0 )
+ {
+ return EFalse;
+ }
+ }
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckFileSizeShortingL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckFileSizeShortingL()
+ {
+ for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
+ {
+ const MCLFItem& item = iListModel->Item( i );
+ const MCLFItem& item1 = iListModel->Item( i + 1 );
+ TInt32 size;
+ TInt32 size1;
+ if( item.GetField( ECLFFieldIdFileSize, size ) != KErrNone ||
+ item1.GetField( ECLFFieldIdFileSize, size1 ) != KErrNone )
+ {
+ return EFalse;
+ }
+ if( size < size1 )
+ {
+ return EFalse;
+ }
+ }
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckMultibleSortingShortingL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckMultibleSortingShortingL()
+ {
+ const MCLFItem* item = &( iListModel->Item( 0 ) );
+ TInt32 data( 0 );
+ if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
+ data != 5 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 1 ) );
+ if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
+ data != 4 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 2 ) );
+ if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
+ data != 3 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 3 ) );
+ if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
+ data != 6 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 4 ) );
+ if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
+ data != 7 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 5 ) );
+ if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
+ data != 8 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 6 ) );
+ if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
+ data != 9 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 7 ) );
+ if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
+ data != 10 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 8 ) );
+ if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
+ data != 11 )
+ {
+ return EFalse;
+ }
+// unsorted start
+ item = &( iListModel->Item( 9 ) );
+ if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+ ( data < 15 || data > 17 ) )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 10 ) );
+ if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+ ( data < 15 || data > 17 ) )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 11 ) );
+ if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+ ( data < 15 || data > 17 ) )
+ {
+ return EFalse;
+ }
+// unsorted end
+ item = &( iListModel->Item( 12 ) );
+ if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+ data != 12 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 13 ) );
+ if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+ data != 13 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 14 ) );
+ if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+ data != 14 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 15 ) );
+ if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
+ data != 0 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 16 ) );
+ if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
+ data != 1 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 17 ) );
+ if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
+ data != 2 )
+ {
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckMultibleSortingShorting2L
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckMultibleSortingShorting2L()
+ {
+// check sorted
+ const MCLFItem* item = &( iListModel->Item( 0 ) );
+ TInt32 data( 0 );
+ if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+ data != 12 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 1 ) );
+ if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+ data != 13 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 2 ) );
+ if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
+ data != 14 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 3 ) );
+ if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+ data != 15 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 4 ) );
+ if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+ data != 16 )
+ {
+ return EFalse;
+ }
+ item = &( iListModel->Item( 5 ) );
+ if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
+ data != 17 )
+ {
+ return EFalse;
+ }
+// check unsorted
+ for( TInt i = 6 ; i < 18 ; ++i )
+ {
+ item = &( iListModel->Item( i ) );
+ if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone )
+ {
+ if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone )
+ {
+ if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone )
+ {
+ if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone )
+ {
+ return EFalse;
+ }
+ }
+ }
+ }
+ if( data < 0 || data > 11 )
+ {
+ return EFalse;
+ }
+ }
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckFileDateShortingL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckFileDateShortingL()
+ {
+ for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
+ {
+ const MCLFItem& item = iListModel->Item( i );
+ const MCLFItem& item1 = iListModel->Item( i + 1 );
+ TTime date;
+ TTime date1;
+ if( item.GetField( ECLFFieldIdFileDate, date ) != KErrNone ||
+ item1.GetField( ECLFFieldIdFileDate, date1 ) != KErrNone )
+ {
+ return EFalse;
+ }
+ if( date > date1 )
+ {
+ return EFalse;
+ }
+ }
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckFileTypesL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckFileTypesL( const MDesCArray& aMimeTypeArray,
+ const TArray<TInt>& aMediaTypes )
+ {
+ for( TInt i = 0 ; i < iListModel->ItemCount() ; ++i )
+ {
+ TPtrC mimeType;
+ TInt32 mediaType;
+ TInt error = iListModel->Item( i ).GetField( ECLFFieldIdMimeType, mimeType );
+ if( iListModel->Item( i ).GetField( ECLFFieldIdMediaType, mediaType ) != KErrNone )
+ {
+ return EFalse;
+ }
+ TBool mimeTypeVal( EFalse );
+ TBool mediaTypeVal( EFalse );
+ if( error == KErrNone )
+ {
+ mimeTypeVal = CheckMimeTypesL( aMimeTypeArray, mimeType );
+ }
+ mediaTypeVal = CheckMediaTypesL( aMediaTypes, TCLFMediaType( mediaType ) );
+ if( !( mimeTypeVal || mediaTypeVal ) )
+ {
+ return EFalse;
+ }
+ }
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckMimeTypesL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckMimeTypesL( const MDesCArray& aMimeTypeArray,
+ const TDesC& aMimeType )
+ {
+ for( TInt j = 0 ; j < aMimeTypeArray.MdcaCount() ; ++j )
+ {
+ if( aMimeTypeArray.MdcaPoint( j ).Match( aMimeType ) == KErrNotFound )
+ {
+ return ETrue;
+ }
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CheckMediaTypesL
+// ---------------------------------------------------------------------------
+//
+TBool CContentListingFrameworkTest::CheckMediaTypesL( const TArray<TInt>& aMediaTypes,
+ TCLFMediaType aMediaType )
+ {
+ for( TInt j = 0 ; j < aMediaTypes.Count() ; ++j )
+ {
+ if( aMediaTypes[j] == aMediaType )
+ {
+ return ETrue;
+ }
+ }
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MakeOpaqueDataL
+// ---------------------------------------------------------------------------
+//
+HBufC8* CContentListingFrameworkTest::MakeOpaqueDataL( const MDesCArray& aFiles )
+ {
+ CDesCArray* folderArray = new ( ELeave ) CDesCArraySeg( 8 );
+ CleanupStack::PushL( folderArray );
+ TInt count( aFiles.MdcaCount() );
+ for( TInt i = 0 ; i < count ; ++i )
+ {
+ TPtrC folderPath( TParsePtrC(
+ aFiles.MdcaPoint( i ) ).DriveAndPath() );
+ TInt tmp( 0 );
+ if( folderArray->Find( folderPath, tmp, ECmpFolded ) != 0 )
+ {
+ folderArray->AppendL( folderPath );
+ }
+ }
+
+ CBufBase* dynBuffer = CBufFlat::NewL( 64 );
+ CleanupStack::PushL( dynBuffer );
+ SerializeL( *folderArray, *dynBuffer );
+ HBufC8* ret = dynBuffer->Ptr( 0 ).AllocL();
+ CleanupStack::PopAndDestroy( 2, folderArray );
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MakeMultibleSortingItemsL
+// ---------------------------------------------------------------------------
+//
+void CContentListingFrameworkTest::MakeMultibleSortingItemsL(
+ RPointerArray<MCLFModifiableItem>& aItemArray )
+ {
+ for( TInt i = 0 ; i < 18 ; ++i )
+ {
+ MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
+ aItemArray.AppendL( item );
+ CleanupStack::Pop(); //item
+
+ if( i < 3 )
+ {
+ item->AddFieldL( KMultibleSortingTestField1, i );
+ }
+ else if( i < 6 )
+ {
+ item->AddFieldL( KMultibleSortingTestField2, i );
+ }
+ else if( i < 9 )
+ {
+ item->AddFieldL( KMultibleSortingTestField3, i );
+ }
+ else if( i < 12 )
+ {
+ item->AddFieldL( KMultibleSortingTestField4, i );
+ }
+ else if( i < 15 )
+ {
+ item->AddFieldL( KMultibleSortingTestField5, i );
+ }
+ else
+ {
+ item->AddFieldL( KMultibleSortingTestField6, i );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::FindItem
+// ---------------------------------------------------------------------------
+//
+const MCLFItem* CContentListingFrameworkTest::FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId )
+ {
+ for( TInt i = 0 ; i < aModel.ItemCount() ; ++i )
+ {
+ const MCLFItem& item = aModel.Item( i );
+ if( item.ItemId() == aItemId )
+ {
+ return &item;
+ }
+ }
+ return NULL;
+ }
+
+/**
+ * Setup
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::BaseSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::BaseSetupL( CStifItemParser& /* aItem */ )
+ {
+ iFs.Close();
+ iResourceFile.Close();
+
+ User::LeaveIfError( iFs.Connect() );
+ TFileName fileName( KTestResourceFile );
+ BaflUtils::NearestLanguageFile( iFs, fileName );
+ iResourceFile.OpenL( iFs, KTestResourceFile );
+ iResourceFile.ConfirmSignatureL( 0 );
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleResourceSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SortingStyleResourceSetupL( CStifItemParser& aItem )
+ {
+ BaseSetupL( aItem );
+ SortingStyleResourceL();
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateModelSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::CreateModelSetupL( CStifItemParser& /* aItem */ )
+ {
+ iEngine = ContentListingFactory::NewContentListingEngineLC();
+ CleanupStack::Pop(); //engine
+ iTestObserver = new (ELeave) TTestOperationObserver;
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateModelFromResourceSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::CreateModelFromResourceSetupL( CStifItemParser& aItem )
+ {
+ BaseSetupL( aItem );
+ CreateModelSetupL( aItem );
+ ListModelResourceL();
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ListModelSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::ListModelSetupL( CStifItemParser& aItem )
+ {
+ BaseSetupL( aItem );
+ CreateModelSetupL( aItem );
+ iListModel = iEngine->CreateListModelLC( *iTestObserver );
+ CleanupStack::Pop(); //listModel
+
+ iSortingStyle = ContentListingFactory::NewSortingStyleLC();
+ CleanupStack::Pop(); // sortingStyle
+ iSortingStyle1 = ContentListingFactory::NewSortingStyleLC();
+ CleanupStack::Pop(); // sortingStyle
+ iSortingStyle2 = ContentListingFactory::NewSortingStyleLC();
+ CleanupStack::Pop(); // sortingStyle
+ iSortingStyle3 = ContentListingFactory::NewSortingStyleLC();
+ CleanupStack::Pop(); // sortingStyle
+
+ iTestSorter = new (ELeave) TTestCustomSorter;
+ iTestSorter1 = new (ELeave) TTestCustomSorter;
+ iTestGrouper = new (ELeave) TTestCustomGrouper;
+ iTestGrouper1 = new (ELeave) TTestCustomGrouper;
+ iTestFilter = new (ELeave) TTestPostFilter;
+ iTestFilter1 = new (ELeave) TTestPostFilter;
+ iMimeTypeArray = new (ELeave) CDesCArrayFlat( 8 );
+ iMimeTypeArray1 = new (ELeave) CDesCArrayFlat( 8 );
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MultibleSortingSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::MultibleSortingSetupL( CStifItemParser& aItem )
+ {
+ ListModelSetupL( aItem );
+ MakeMultibleSortingItemsL( iModifiableItems );
+
+// use custom grouper to make own items
+ iTestGrouper->iModifiableItems = &iModifiableItems;
+ iTestGrouper->iCopyItems = ETrue;
+ iListModel->SetCustomGrouper( iTestGrouper );
+
+// set sorters
+ iSortingStyle->ResetL();
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
+ iSortingStyle->AddFieldL( KMultibleSortingTestField1 );
+ iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
+
+ iSortingStyle1->ResetL();
+ iSortingStyle1->SetSortingDataType( ECLFItemDataTypeTInt32 );
+ iSortingStyle1->AddFieldL( KMultibleSortingTestField2 );
+ iSortingStyle1->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+ iSortingStyle1->SetOrdering( ECLFOrderingDescending );
+
+ iSortingStyle2->ResetL();
+ iSortingStyle2->SetSortingDataType( ECLFItemDataTypeTInt32 );
+ iSortingStyle2->AddFieldL( KMultibleSortingTestField3 );
+ iSortingStyle2->AddFieldL( KMultibleSortingTestField4 );
+ iSortingStyle2->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+
+ iSortingStyle3->ResetL();
+ iSortingStyle3->SetSortingDataType( ECLFItemDataTypeTInt32 );
+ iSortingStyle3->AddFieldL( KMultibleSortingTestField5 );
+ iSortingStyle3->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
+
+ iListModel->SetSortingStyle( iSortingStyle );
+ iListModel->AppendSecondarySortingStyleL( *iSortingStyle1 );
+ iListModel->AppendSecondarySortingStyleL( *iSortingStyle2 );
+ iListModel->AppendSecondarySortingStyleL( *iSortingStyle3 );
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MultibleSortingResourceSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::MultibleSortingResourceSetupL( CStifItemParser& aItem )
+ {
+ ListModelSetupL( aItem );
+ delete iListModel;
+ iListModel = NULL;
+ ResourceL( R_LIST_MODEL_MULTIBLE );
+ iListModel = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
+ CleanupStack::Pop(); //listModel
+
+// use custom grouper to make own items
+ MakeMultibleSortingItemsL( iModifiableItems );
+ iTestGrouper->iModifiableItems = &iModifiableItems;
+ iTestGrouper->iCopyItems = ETrue;
+ iListModel->SetCustomGrouper( iTestGrouper );
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ListModelAllFileItemsSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::ListModelAllFileItemsSetupL( CStifItemParser& aItem )
+ {
+ ListModelSetupL( aItem );
+ iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
+ iMediaTypeArray.AppendL( ECLFMediaTypeImage );
+ iMediaTypeArray.AppendL( ECLFMediaTypeSound );
+ iMediaTypeArray.AppendL( ECLFMediaTypeMusic );
+ iMediaTypeArray.AppendL( ECLFMediaTypeStreamingURL );
+ iMediaTypeArray.AppendL( ECLFMediaTypePlaylist );
+ iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
+ iTestObserver->iWait = &iWait;
+ iListModel->RefreshL();
+ iWait.Start();
+ iItemCount = iListModel->ItemCount();
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ListModelSetupFromResourceL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::ListModelSetupFromResourceL( CStifItemParser& aItem )
+ {
+ BaseSetupL( aItem );
+ CreateModelSetupL( aItem );
+ ListModelResourceL();
+ iListModel = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
+ CleanupStack::Pop(); //listModel
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::EngineTestSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::EngineTestSetupL( CStifItemParser& /* aItem */ )
+ {
+ User::LeaveIfError( iFs.Connect() );
+ iTestObserver = new (ELeave) TTestOperationObserver;
+ iMimeTypeArray = new (ELeave) CDesCArrayFlat( 8 );
+ iEngine = ContentListingFactory::NewContentListingEngineLC();
+ CleanupStack::Pop(); //engine
+ iChangedItemObserver = new (ELeave) TTestChangedItemObserver;
+ iChangedItemObserver1 = new (ELeave) TTestChangedItemObserver;
+ iTestCLFProcessObserver = new (ELeave) TTestCLFProcessObserver;
+ iTestCLFProcessObserver1 = new (ELeave) TTestCLFProcessObserver;
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleTestSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SortingStyleTestSetupL( CStifItemParser& /* aItem */ )
+ {
+ iSortingStyle = ContentListingFactory::NewSortingStyleLC();
+ CleanupStack::Pop(); // sortingStyle
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleResourceTestSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SortingStyleResourceTestSetupL( CStifItemParser& aItem )
+ {
+ SortingStyleResourceSetupL( aItem );
+ iSortingStyle1 = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+ CleanupStack::Pop(); // sortingStyle
+
+ ResourceL( R_SORTING_STYLE_EMPTY );
+ iSortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+ CleanupStack::Pop(); // sortingStyle
+
+ ResourceL( R_SORTING_STYLE_UNDEFINEDITEM );
+ iSortingStyle2 = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+ CleanupStack::Pop(); // sortingStyle
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ModifiableItemTestSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::ModifiableItemTestSetupL( CStifItemParser& /* aItem */ )
+ {
+ iModifiableItem = ContentListingFactory::NewModifiableItemLC();
+ CleanupStack::Pop(); //item
+
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ItemTestSetupL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::ItemTestSetupL( CStifItemParser& aItem )
+ {
+ TInt ret = KErrNone;
+
+ ListModelSetupL( aItem );
+ CreateNewFileL( 12, iFileName );
+ iEngine->UpdateItemsL();
+ iMimeTypeArray->Reset();
+ iMimeTypeArray->AppendL( _L("*") );
+ iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+
+ iTestObserver->iWait = &iWait;
+ iListModel->RefreshL();
+ iWait.Start();
+
+ for( TInt i = 0 ; i < iListModel->ItemCount() ; ++i )
+ {
+ const MCLFItem& item = iListModel->Item( i );
+ TPtrC fn;
+ item.GetField( ECLFFieldIdFileNameAndPath, fn );
+ if( iFileName.CompareF( fn ) == 0 )
+ {
+ iItem = &item;
+ }
+ }
+
+ if (!iItem)
+ {
+ ret = KErrUnknown;
+ }
+ return ret;
+ }
+
+/**
+ * Teardown
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::Teardown
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::Teardown( CStifItemParser& /* aItem */ )
+ {
+ iResourceFile.Close();
+ iFs.Close();
+ iMediaTypeArray.Reset();
+ iMediaTypeArray.Close();
+ iMediaTypeArray1.Reset();
+ iMediaTypeArray1.Close();
+ iUpdateItemIdArray.Reset();
+ iUpdateItemIdArray.Close();
+ iChangedArray.Reset();
+ iChangedArray.Close();
+ iModifiableItems.ResetAndDestroy();
+ iModifiableItems.Close();
+
+ delete iListModel;
+ iListModel = NULL;
+ delete iEngine;
+ iEngine = NULL;
+ delete iSortingStyle;
+ iSortingStyle = NULL;
+ delete iSortingStyle1;
+ iSortingStyle1 = NULL;
+ delete iSortingStyle2;
+ iSortingStyle2 = NULL;
+ delete iSortingStyle3;
+ iSortingStyle3 = NULL;
+ delete iDataBuffer;
+ iDataBuffer = NULL;
+ delete iTestObserver;
+ iTestObserver = NULL;
+ delete iTestSorter;
+ iTestSorter = NULL;
+ delete iTestSorter1;
+ iTestSorter1 = NULL;
+ delete iTestGrouper;
+ iTestGrouper = NULL;
+ delete iTestGrouper1;
+ iTestGrouper1 = NULL;
+ delete iTestFilter;
+ iTestFilter = NULL;
+ delete iTestFilter1;
+ iTestFilter1 = NULL;
+ delete iMimeTypeArray;
+ iMimeTypeArray = NULL;
+ delete iMimeTypeArray1;
+ iMimeTypeArray1 = NULL;
+ delete iChangedItemObserver;
+ iChangedItemObserver = NULL;
+ delete iChangedItemObserver1;
+ iChangedItemObserver1 = NULL;
+ delete iOpaqueData;
+ iOpaqueData = NULL;
+ delete iModifiableItem;
+ iModifiableItem = NULL;
+ delete iTestCLFProcessObserver1;
+ iTestCLFProcessObserver1 = NULL;
+ delete iTestCLFProcessObserver;
+ iTestCLFProcessObserver = NULL;
+
+ TTimeIntervalMicroSeconds32 time = 1000000;
+ TRAP_IGNORE( CCLFAsyncCallback::AfterL( time ) );
+
+ return KErrNone;
+ }
+
+/**
+ * Tests, construction
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateEngineTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::CreateEngineTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iEngine = ContentListingFactory::NewContentListingEngineLC();
+ if (!iEngine)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::PopAndDestroy(); //engine
+ iEngine = NULL;
+ iEngine = ContentListingFactory::NewContentListingEngineLC();
+ if (!iEngine)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::Pop(); // engine
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateModifiableItemTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::CreateModifiableItemTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ MCLFModifiableItem* item = NULL;
+ item = ContentListingFactory::NewModifiableItemLC();
+ if (!item)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::PopAndDestroy(); // item
+ item = NULL;
+ item = ContentListingFactory::NewModifiableItemLC();
+ if (!item)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::Pop(); // item
+ delete item;
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateSortignStyleTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::CreateSortignStyleTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ MCLFSortingStyle* sortingStyle = NULL;
+ sortingStyle = ContentListingFactory::NewSortingStyleLC();
+ if (!sortingStyle)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::PopAndDestroy(); // sortingStyle
+ sortingStyle = NULL;
+ sortingStyle = ContentListingFactory::NewSortingStyleLC();
+ if (!sortingStyle)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::Pop(); // sortingStyle
+ delete sortingStyle;
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateSortignStyleFromResourceTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::CreateSortignStyleFromResourceTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ MCLFSortingStyle* sortingStyle = NULL;
+ sortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+ if (!sortingStyle)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::PopAndDestroy(); // sortingStyle
+ sortingStyle = NULL;
+
+ SortingStyleResourceL(); // refresh resource reader
+ sortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
+ if (!sortingStyle)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::Pop(); // sortingStyle
+ delete sortingStyle;
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateListModelTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::CreateListModelTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ MCLFItemListModel* model = NULL;
+ model = iEngine->CreateListModelLC( *iTestObserver );
+ if (!model)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::PopAndDestroy(); //listModel
+ model = NULL;
+
+ model = iEngine->CreateListModelLC( *iTestObserver );
+ if (!model)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::Pop(); // listModel
+ delete model;
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::CreateListModelFromResourceTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::CreateListModelFromResourceTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ MCLFItemListModel* model = NULL;
+ model = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
+ if (!model)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::PopAndDestroy(); //listModel
+ model = NULL;
+
+ ListModelResourceL();
+ model = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
+ if (!model)
+ {
+ ret = KErrUnknown;
+ }
+ CleanupStack::Pop(); // listModel
+ delete model;
+
+ ResourceL( R_LIST_MODEL_INCORRECT_VERSION );
+ TRAPD(error, iEngine->CreateListModelLC( *iTestObserver, iResourceReader ));
+ if (error != KErrNotSupported)
+ {
+ ret = KErrUnknown;
+ CleanupStack::Pop(); // listModel
+ }
+
+ return ret;
+ }
+
+/**
+ * Tests, engine
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::UpdateItemsTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::UpdateItemsTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ // MDS will do the updating automatically in the background,
+ // thus only checking that the methods return correctly
+ iChangedItemObserver->iWait = &iWait;
+ iChangedItemObserver->iChangedArray = &iChangedArray;
+ iEngine->AddChangedItemObserverL( *iChangedItemObserver );
+ iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver );
+ iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver1 );
+
+ CreateNewFileL( 0, iFileName );
+ CreateNewFileL( 1, iFileName );
+ CreateNewFileL( 2, iFileName );
+ CreateNewFileL( 3, iFileName );
+ CreateNewFileL( 4, iFileName );
+ CreateNewFileL( 5, iFileName );
+
+// update server
+// to aTInt incorrect test result
+ CreateNewFileL( 0, iFileName );
+ iEngine->UpdateItemsL();
+
+ ret = iChangedItemObserver->iLastError;
+
+ iChangedArray.Reset();
+ iEngine->RemoveCLFProcessObserver( *iTestCLFProcessObserver1 );
+ iChangedItemObserver->iHandleItemChange = EFalse;
+ iChangedItemObserver1->iHandleItemChange = EFalse;
+ iTestCLFProcessObserver->Reset();
+ iTestCLFProcessObserver1->Reset();
+ iEngine->UpdateItemsL();
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::UpdateItemsWithIdTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::UpdateItemsWithIdTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ // MDS will do the updating automatically in the background,
+ // thus only checking that the methods return correctly
+ iChangedItemObserver->iWait = &iWait;
+ iChangedItemObserver->iChangedArray = &iChangedArray;
+ iEngine->AddChangedItemObserverL( *iChangedItemObserver );
+ iEngine->AddChangedItemObserverL( *iChangedItemObserver1 );
+ iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver );
+
+ CreateNewFileL( 6, iFileName );
+ CreateNewFileL( 7, iFileName );
+ CreateNewFileL( 8, iFileName );
+
+// update server
+// to aTInt incorrect test result
+ CreateNewFileL( 6, iFileName );
+ iEngine->UpdateItemsL();
+
+ if (iChangedItemObserver->iLastError != KErrNone)
+ {
+ ret = KErrUnknown;
+ }
+
+// start testing
+// update by id
+ TUint id1 = FindTestFileIdL( 7 );
+ TUint id0 = FindTestFileIdL( 6 );
+ TUint id2 = FindTestFileIdL( 8 );
+ iUpdateItemIdArray.AppendL( id1 );
+ iChangedItemObserver->iHandleItemChange = EFalse;
+ iChangedItemObserver1->iHandleItemChange = EFalse;
+ iTestCLFProcessObserver->Reset();
+ iTestCLFProcessObserver1->Reset();
+ CreateNewFileL( 6, iFileName );
+ CreateNewFileL( 7, iFileName );
+ iEngine->UpdateItemsL( iUpdateItemIdArray.Array() );
+
+ if (iChangedItemObserver->iLastError != KErrNone)
+ {
+ ret = KErrUnknown;
+ }
+
+ iEngine->RemoveChangedItemObserver( *iChangedItemObserver1 );
+ iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver1 );
+
+ iChangedItemObserver->iHandleItemChange = EFalse;
+ iChangedItemObserver1->iHandleItemChange = EFalse;
+ iTestCLFProcessObserver->Reset();
+ iTestCLFProcessObserver1->Reset();
+ iUpdateItemIdArray.AppendL( id0 );
+ iUpdateItemIdArray.AppendL( id2 );
+
+// update server
+// to aTInt incorrect test result
+ iEngine->UpdateItemsL();
+
+ if (iChangedItemObserver->iLastError != KErrNone)
+ {
+ ret = KErrUnknown;
+ }
+
+ CreateNewFileL( 6, iFileName );
+ CreateNewFileL( 7, iFileName );
+ CreateNewFileL( 8, iFileName );
+ iChangedArray.Reset();
+
+ iEngine->UpdateItemsL( iUpdateItemIdArray.Array() );
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::UpdateItemsWithOpaqueDataFolderTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::UpdateItemsWithOpaqueDataFolderTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ // start testing
+ // update by opaque data
+ // folders data
+ iSemanticId = KCLFUpdateFoldersSemanticId;
+ delete iOpaqueData;
+ iOpaqueData = NULL;
+
+ CDesCArray* fileArray = new (ELeave) CDesCArraySeg( 8 );
+ iOpaqueData = MakeOpaqueDataL( *fileArray );
+ // Calls internally same MDS method as when updating all data
+ // thus only interested if this call leaves
+ iEngine->UpdateItemsL( iSemanticId, *iOpaqueData );
+
+ return ret;
+ }
+
+/**
+ * Tests, list model
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::RefreshTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::RefreshTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iMimeTypeArray->Reset();
+ iMimeTypeArray->AppendL( _L("*") );
+ iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+
+ iTestObserver->iWait = &iWait;
+ iTestObserver->iError = 100;
+ iListModel->RefreshL();
+ iWait.Start();
+
+ if (iTestObserver->iOperationEvent != ECLFRefreshComplete)
+ {
+ ret = KErrUnknown;
+ }
+ if (iTestObserver->iError != KErrNone)
+ {
+ ret = KErrUnknown;
+ }
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+// cancel refresh
+ iListModel->RefreshL();
+ iListModel->CancelRefresh();
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetSortingStyleTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetSortingStyleTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iListModel->SetSortingStyle( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (CheckFileNameShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+// file name sorting
+ iSortingStyle->ResetL();
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
+ iSortingStyle->AddFieldL( ECLFFieldIdFileName );
+ iListModel->SetSortingStyle( iSortingStyle );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (!CheckFileNameShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+// file size sorting
+ iSortingStyle1->ResetL();
+ iSortingStyle1->SetOrdering( ECLFOrderingDescending );
+ iSortingStyle1->SetSortingDataType( ECLFItemDataTypeTInt32 );
+ iSortingStyle1->AddFieldL( ECLFFieldIdFileSize );
+ iListModel->SetSortingStyle( iSortingStyle1 );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (CheckFileNameShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+ iListModel->SetSortingStyle( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+// time sorting
+ iSortingStyle->ResetL();
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeTTime );
+ iSortingStyle->AddFieldL( ECLFFieldIdFileDate );
+ iListModel->SetSortingStyle( iSortingStyle );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (!CheckFileDateShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+// parameter test (time)
+ iListModel->SetSortingStyle( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+ iListModel->SetSortingStyle( iSortingStyle );
+ iListModel->RefreshL( ECLFRefreshPostFilter );
+ if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+ iListModel->RefreshL( ECLFRefreshGrouping );
+ if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+ iListModel->RefreshL( ECLFRefreshSorting );
+ if (CheckFileNameShortingL() || CheckFileSizeShortingL() || !CheckFileDateShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+// custom sorter (overwrite sorting style)
+ iTestSorter->iSortItems = EFalse;
+ iListModel->SetCustomSorter( iTestSorter );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (!(iTestSorter->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+ if (CheckFileNameShortingL() || CheckFileSizeShortingL() || CheckFileDateShortingL())
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetCustomSorterTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetCustomSorterTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iTestSorter->iSortItems = EFalse;
+ iTestSorter1->iSortItems = EFalse;
+
+ iListModel->SetCustomSorter( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+ iTestSorter->iSortItems = EFalse;
+ iTestSorter1->iSortItems = EFalse;
+
+ iListModel->SetCustomSorter( iTestSorter );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (!(iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+ iTestSorter->iSortItems = EFalse;
+ iTestSorter1->iSortItems = EFalse;
+
+ iListModel->SetCustomSorter( iTestSorter1 );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ((iTestSorter->iSortItems) || !(iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+ iTestSorter->iSortItems = EFalse;
+ iTestSorter1->iSortItems = EFalse;
+
+ iListModel->SetCustomSorter( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+ iTestSorter->iSortItems = EFalse;
+ iTestSorter1->iSortItems = EFalse;
+
+ iListModel->SetCustomSorter( iTestSorter );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (!(iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+ iTestSorter->iSortItems = EFalse;
+ iTestSorter1->iSortItems = EFalse;
+
+ iListModel->SetCustomSorter( iTestSorter1 );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ((iTestSorter->iSortItems) || !(iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+// parameter test
+ iTestSorter->iSortItems = EFalse;
+ iTestSorter1->iSortItems = EFalse;
+
+ iListModel->SetCustomSorter( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+
+ iTestSorter->iSortItems = EFalse;
+ iTestSorter1->iSortItems = EFalse;
+
+ iListModel->SetCustomSorter( iTestSorter );
+ iListModel->RefreshL( ECLFRefreshPostFilter );
+ if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+ iListModel->RefreshL( ECLFRefreshGrouping );
+ if ((iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+ iListModel->RefreshL( ECLFRefreshSorting );
+ if (!(iTestSorter->iSortItems) || (iTestSorter1->iSortItems))
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::GroupingTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::GroupingTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iTestGrouper->iModifiableItems = &iModifiableItems;
+ iTestGrouper1->iModifiableItems = &iModifiableItems;
+
+// No grouping
+ iListModel->SetCustomGrouper( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+
+// couple groups
+ iListModel->SetCustomGrouper( iTestGrouper );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() != iModifiableItems.Count())
+ {
+ ret = KErrUnknown;
+ }
+
+// 0 groups
+ iTestGrouper1->iGroupCount = 0;
+ iListModel->SetCustomGrouper( iTestGrouper1 );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() != iModifiableItems.Count())
+ {
+ ret = KErrUnknown;
+ }
+
+// No grouping
+ iListModel->SetCustomGrouper( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+// Music album grouping
+ iListModel->SetGroupingStyle( ECLFMusicAlbumGrouping );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() == iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+// No grouping
+ iListModel->SetGroupingStyle( ECLFNoGrouping );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+
+// test parameters
+ iTestGrouper->iGroupCount = 1000;
+ iListModel->SetCustomGrouper( iTestGrouper );
+ iListModel->RefreshL( ECLFRefreshPostFilter );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+ iListModel->RefreshL( ECLFRefreshSorting );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+ iListModel->RefreshL( ECLFRefreshGrouping );
+ if (iListModel->ItemCount() != iModifiableItems.Count())
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetPostFilterTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetPostFilterTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+// no filter
+ iListModel->SetPostFilter( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+
+// filter couple items
+ iListModel->SetPostFilter( iTestFilter );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount )
+ {
+ ret = KErrUnknown;
+ }
+
+// filter all items
+ iListModel->SetPostFilter( iTestFilter1 );
+ iTestFilter1->iAllFilter = ETrue;
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) != iItemCount )
+ {
+ ret = KErrUnknown;
+ }
+
+// no filter
+ iListModel->SetPostFilter( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+
+// filter one item
+ iListModel->SetPostFilter( iTestFilter );
+ iTestFilter->iShouldFilterCount = 1;
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount )
+ {
+ ret = KErrUnknown;
+ }
+
+// filter couple items
+ iListModel->SetPostFilter( iTestFilter1 );
+ iTestFilter1->iAllFilter = EFalse;
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) != iItemCount )
+ {
+ ret = KErrUnknown;
+ }
+
+// test parameters
+ iListModel->SetPostFilter( NULL );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+ iListModel->SetPostFilter( iTestFilter1 );
+ iTestFilter1->iAllFilter = ETrue;
+ iListModel->RefreshL( ECLFRefreshSorting );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+ iListModel->RefreshL( ECLFRefreshGrouping );
+ if (iListModel->ItemCount() != iItemCount)
+ {
+ ret = KErrUnknown;
+ }
+ iListModel->RefreshL( ECLFRefreshPostFilter );
+ if ( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) != iItemCount )
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetWantedMimeTypesTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetWantedMimeTypesTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iTestObserver->iWait = &iWait;
+
+// list not defined (mimetype)
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+// couple mime types
+ iMimeTypeArray->Reset();
+ iMimeTypeArray->AppendL( _L( "audio/mpeg" ) );
+ iMimeTypeArray->AppendL( _L( "audio/aac" ) );
+ iMimeTypeArray->AppendL( _L( "audio/mp3" ) );
+ iMimeTypeArray->AppendL( _L( "audio/x-mp3" ) );
+ iMimeTypeArray->AppendL( _L( "audio/mp4" ) );
+ iMimeTypeArray->AppendL( _L( "audio/3gpp" ) );
+ iMimeTypeArray->AppendL( _L( "audio/m4a" ) );
+ iMimeTypeArray->AppendL( _L( "audio/3gpp2" ) );
+ iMimeTypeArray->AppendL( _L( "audio/mpeg4") );
+ iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+ iListModel->RefreshL();
+ iWait.Start();
+ if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+ {
+ ret = KErrUnknown;
+ }
+
+// unsupported mimetype
+ iMimeTypeArray1->Reset();
+ iMimeTypeArray1->AppendL( _L("__not_supported__") );
+ iListModel->SetWantedMimeTypesL( *iMimeTypeArray1 );
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+// empty mimetype list
+ iMimeTypeArray1->Reset();
+ iListModel->SetWantedMimeTypesL( *iMimeTypeArray1 );
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+// from resource (mimetype)
+ iMimeTypeArray->Reset();
+ iMimeTypeArray->AppendL( _L("image/*") );
+ iMimeTypeArray->AppendL( _L("audio/*") );
+
+ ResourceL( R_MIME_TYPE_ARRAY );
+ iListModel->SetWantedMimeTypesL( iResourceReader );
+ iListModel->RefreshL();
+ iWait.Start();
+ if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+ {
+ ret = KErrUnknown;
+ }
+
+ ResourceL( R_MIME_TYPE_ARRAY_EMPTY );
+ iListModel->SetWantedMimeTypesL( iResourceReader );
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+// incorrect resource version
+ ResourceL( R_MIME_TYPE_ARRAY_INCORRECT_VERSION );
+ TRAPD(error, iListModel->SetWantedMimeTypesL( iResourceReader ));
+ if (error != KErrNotSupported)
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetWantedMediaTypesTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetWantedMediaTypesTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iTestObserver->iWait = &iWait;
+
+// list not defined (mediatype)
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+// couple media types
+ iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
+ iMediaTypeArray.AppendL( ECLFMediaTypeImage );
+ iMediaTypeArray.AppendL( ECLFMediaTypeSound );
+ iMediaTypeArray.AppendL( ECLFMediaTypeMusic );
+ iMediaTypeArray.AppendL( ECLFMediaTypeStreamingURL );
+ iMediaTypeArray.AppendL( ECLFMediaTypePlaylist );
+ iMediaTypeArray.AppendL( TCLFMediaType( ECLFMediaTypeCollection ) );
+
+ iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
+ iListModel->RefreshL();
+ iWait.Start();
+ if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+ {
+ ret = KErrUnknown;
+ }
+
+// empty media type list list
+ iListModel->SetWantedMediaTypesL( iMediaTypeArray1.Array() );
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+// media type list from resource
+ iMediaTypeArray.Reset();
+ iMediaTypeArray.AppendL( ECLFMediaTypeImage );
+ iMediaTypeArray.AppendL( TCLFMediaType( ECLFMediaTypeCollection ) );
+ ResourceL( R_MEDIA_TYPE_ARRAY );
+ iListModel->SetWantedMediaTypesL( iResourceReader );
+ iListModel->RefreshL();
+ iWait.Start();
+ if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+ {
+ ret = KErrUnknown;
+ }
+
+// empty media type list from resource
+ ResourceL( R_MEDIA_TYPE_ARRAY_EMPTY );
+ iListModel->SetWantedMediaTypesL( iResourceReader );
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SetWantedMediaAndMimeTypesTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SetWantedMediaAndMimeTypesTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iTestObserver->iWait = &iWait;
+
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+// couple types
+ iMimeTypeArray->AppendL( _L( "audio/mpeg" ) );
+ iMimeTypeArray->AppendL( _L( "audio/aac" ) );
+ iMimeTypeArray->AppendL( _L( "audio/mp3" ) );
+ iMimeTypeArray->AppendL( _L( "audio/x-mp3" ) );
+ iMimeTypeArray->AppendL( _L( "audio/mp4" ) );
+ iMimeTypeArray->AppendL( _L( "audio/3gpp" ) );
+ iMimeTypeArray->AppendL( _L( "audio/m4a" ) );
+ iMimeTypeArray->AppendL( _L( "audio/3gpp2" ) );
+ iMimeTypeArray->AppendL( _L( "audio/mpeg4") );
+ iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+
+ iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
+ iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
+ iListModel->RefreshL();
+ iWait.Start();
+ if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+ {
+ ret = KErrUnknown;
+ }
+
+// refresh again
+ iListModel->RefreshL();
+ iWait.Start();
+ if ( !CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) )
+ {
+ ret = KErrUnknown;
+ }
+
+// empty lists
+ iMediaTypeArray.Reset();
+ iMimeTypeArray->Reset();
+ iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
+ iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+ iListModel->RefreshL();
+ iWait.Start();
+ if (iListModel->ItemCount() != 0)
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MultibleSortingTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::MultibleSortingTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ( !CheckMultibleSortingShortingL() )
+ {
+ ret = KErrUnknown;
+ }
+
+// resort
+
+ iSortingStyle->ResetL();
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
+ iSortingStyle->AddFieldL( KMultibleSortingTestField6 );
+ iSortingStyle->AddFieldL( KMultibleSortingTestField5 );
+ iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+ iListModel->SetSortingStyle( iSortingStyle );
+ iListModel->RefreshL( ECLFRefreshAll );
+ if ( CheckMultibleSortingShortingL() )
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+/*
+* Test model item(s) obsolate functionality
+*/
+
+// ---------------------------------------------------------------------------
+// ModelItemsChangedTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::ModelItemsChangedTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ const TInt newFileNumber( 13 );
+
+// create test files
+ CreateNewFileL( 9, iFileName );
+ CreateNewFileL( 10, iFileName );
+ CreateNewFileL( 11, iFileName );
+ CreateNewFileL( newFileNumber, iFileName );
+ User::LeaveIfError( iFs.Delete( iFileName ) );
+
+// update server
+// to aTInt incorrect test result
+ CreateNewFileL( 0, iFileName );
+ iEngine->UpdateItemsL();
+
+// create list model with all files
+ iMimeTypeArray->Reset();
+ iMimeTypeArray->AppendL( _L("*") );
+ iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
+
+ iTestObserver->iWait = &iWait;
+ iTestObserver->iError = 100;
+ iListModel->RefreshL();
+ iWait.Start(); // wait until model is refreshed
+
+ if ( iTestObserver->iOperationEvent != ECLFRefreshComplete
+ || iTestObserver->iError != KErrNone
+ || iListModel->ItemCount() != 0 )
+ {
+ ret = KErrUnknown;
+ }
+
+ const TInt listModelItemCount( iListModel->ItemCount() );
+ const TCLFItemId testId( FindTestFileIdL( 0 ) );
+
+// test with modified item
+ CreateNewFileL( 0, iFileName );
+ iEngine->UpdateItemsL();
+ iWait.Start(); // wait until model outdated event is received
+
+ if ( iTestObserver->iOperationEvent != ECLFModelOutdated
+ || iTestObserver->iError != KErrNone
+ || iListModel->ItemCount() != listModelItemCount
+ || FindItem( *iListModel, testId ) == NULL )
+ {
+ ret = KErrUnknown;
+ }
+
+ iTestObserver->iError = 100;
+ iListModel->RefreshL();
+ iWait.Start(); // wait until model is refreshed
+ if ( iTestObserver->iOperationEvent != ECLFRefreshComplete
+ || iTestObserver->iError != KErrNone
+ || iListModel->ItemCount() != listModelItemCount
+ || FindItem( *iListModel, testId ) == NULL )
+ {
+ ret = KErrUnknown;
+ }
+
+// test with new item
+ CreateNewFileL( newFileNumber, iFileName );
+ iEngine->UpdateItemsL();
+ iWait.Start(); // wait until model outdated event is received
+
+ if ( iTestObserver->iOperationEvent != ECLFModelOutdated
+ || iTestObserver->iError != KErrNone
+ || iListModel->ItemCount() != listModelItemCount )
+ {
+ ret = KErrUnknown;
+ }
+
+ iTestObserver->iError = 100;
+ iListModel->RefreshL();
+ iWait.Start(); // wait until model is refreshed
+ if ( iTestObserver->iOperationEvent != ECLFRefreshComplete
+ || iTestObserver->iError != KErrNone
+ || iListModel->ItemCount() != listModelItemCount + 1 )
+ {
+ ret = KErrUnknown;
+ }
+
+// delete file
+ User::LeaveIfError( iFs.Delete( iFileName ) );
+ iEngine->UpdateItemsL();
+ iWait.Start(); // wait until model outdated event is received
+
+ if ( iTestObserver->iOperationEvent != ECLFModelOutdated
+ || iTestObserver->iError != KErrNone
+ || iListModel->ItemCount() != listModelItemCount + 1 )
+ {
+ ret = KErrUnknown;
+ }
+
+ iTestObserver->iError = 100;
+ iListModel->RefreshL();
+ iWait.Start(); // wait until model is refreshed
+ if ( iTestObserver->iOperationEvent != ECLFRefreshComplete
+ || iTestObserver->iError != KErrNone
+ || iListModel->ItemCount() != listModelItemCount )
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+/**
+ * Tests, Modifiable item
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::MIFieldTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::MIFieldTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ const TUint KTestField1 = 1;
+ const TUint KTestField2 = 112312312;
+ const TUint KTestField3 = 13333;
+ const TUint KTestFieldIncorrect = 2;
+
+ TTime time( 100 );
+ TInt32 integer( 12 );
+ TBuf<30> data( _L("data") );
+ iModifiableItem->AddFieldL( KTestField1, time );
+ iModifiableItem->AddFieldL( KTestField2, integer );
+ iModifiableItem->AddFieldL( KTestField3, data );
+
+// data type test
+ if ( iModifiableItem->DataType( KTestField1 ) != ECLFItemDataTypeTTime
+ || iModifiableItem->DataType( KTestField2 ) != ECLFItemDataTypeTInt32
+ || iModifiableItem->DataType( KTestField3 ) != ECLFItemDataTypeDesC
+ || iModifiableItem->DataType( KTestFieldIncorrect ) != ECLFItemDataTypeNull
+ || iModifiableItem->DataType( ECLFFieldIdNull ) != ECLFItemDataTypeNull )
+ {
+ ret = KErrUnknown;
+ }
+
+// get field
+ TTime time1( 0 );
+ TInt32 integer1( 0 );
+ TPtrC ptr;
+ if ( iModifiableItem->GetField( KTestField1, time1 ) != KErrNone
+ || time != time1 )
+ {
+ ret = KErrUnknown;
+ }
+ if ( iModifiableItem->GetField( KTestField2, integer1 ) != KErrNone
+ || integer != integer1 )
+ {
+ ret = KErrUnknown;
+ }
+ if ( iModifiableItem->GetField( KTestField3, ptr ) != KErrNone
+ || data != ptr )
+ {
+ ret = KErrUnknown;
+ }
+
+// incorrect field id
+ if ( iModifiableItem->GetField( KTestFieldIncorrect, ptr ) != KErrNotFound
+ || iModifiableItem->GetField( KTestFieldIncorrect, integer1 ) != KErrNotFound
+ || iModifiableItem->GetField( KTestFieldIncorrect, time1 ) != KErrNotFound )
+ {
+ ret = KErrUnknown;
+ }
+
+// incorrect field type
+ if ( iModifiableItem->GetField( KTestField1, ptr ) != KErrNotFound
+ || iModifiableItem->GetField( KTestField3, integer1 ) != KErrNotFound
+ || iModifiableItem->GetField( KTestField2, time1 ) != KErrNotFound )
+ {
+ ret = KErrUnknown;
+ }
+
+ if ( iModifiableItem->ItemId() == 0 )
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+/**
+ * Tests, item
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::ItemFieldTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::ItemFieldTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+// data type test
+ if ( iItem->DataType( ECLFFieldIdFileDate ) != ECLFItemDataTypeTTime
+ || iItem->DataType( ECLFFieldIdFileSize ) != ECLFItemDataTypeTInt32
+ || iItem->DataType( ECLFFieldIdFileNameAndPath ) != ECLFItemDataTypeDesC
+ || iItem->DataType( ECLFFieldIdNull ) != ECLFItemDataTypeNull )
+ {
+ ret = KErrUnknown;
+ }
+
+// get field
+ TTime time1( 0 );
+ TInt32 integer1( 0 );
+ TPtrC ptr;
+ TEntry entry;
+ User::LeaveIfError( iFs.Entry( iFileName, entry ) );
+
+ if ( iModifiableItem->GetField( ECLFFieldIdFileDate, time1 ) != KErrNone
+ || entry.iModified != time1 )
+ {
+ ret = KErrUnknown;
+ }
+ if ( iModifiableItem->GetField( ECLFFieldIdFileSize, integer1 ) != KErrNone
+ || entry.iSize != integer1 )
+ {
+ ret = KErrUnknown;
+ }
+ if ( iModifiableItem->GetField( ECLFFieldIdFileNameAndPath, ptr ) != KErrNone
+ || iFileName != ptr )
+ {
+ ret = KErrUnknown;
+ }
+
+ TParsePtrC parse( iFileName );
+
+ if ( iModifiableItem->GetField( ECLFFieldIdFileExtension, ptr ) != KErrNone
+ || parse.Ext() != ptr )
+ {
+ ret = KErrUnknown;
+ }
+ if ( iModifiableItem->GetField( ECLFFieldIdFileName, ptr ) != KErrNone
+ || parse.Name() != ptr )
+ {
+ ret = KErrUnknown;
+ }
+ if ( iModifiableItem->GetField( ECLFFieldIdPath, ptr ) != KErrNone
+ || parse.Path() != ptr )
+ {
+ ret = KErrUnknown;
+ }
+ if ( iModifiableItem->GetField( ECLFFieldIdDrive, ptr ) != KErrNone
+ || parse.Drive() != ptr )
+ {
+ ret = KErrUnknown;
+ }
+
+// incorrect field id
+ if ( iItem->GetField( ECLFFieldIdNull, ptr ) != KErrNotFound
+ || iItem->GetField( ECLFFieldIdNull, integer1 ) != KErrNotFound
+ || iItem->GetField( ECLFFieldIdNull, time1 ) != KErrNotFound )
+ {
+ ret = KErrUnknown;
+ }
+
+// incorrect field type
+ if ( iItem->GetField( ECLFFieldIdFileSize, ptr ) != KErrNotSupported
+ || iItem->GetField( ECLFFieldIdFileDate, integer1 ) != KErrNotSupported
+ || iItem->GetField( ECLFFieldIdFileNameAndPath, time1 ) != KErrNotSupported )
+ {
+ ret = KErrUnknown;
+ }
+
+ if ( iItem->ItemId() == 0 )
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+/**
+ * Tests, Sorting style
+ */
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleResourceTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SortingStyleResourceTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ const TInt KArray1IdCount( 4 );
+ const TInt KArray2IdCount( 1 );
+
+
+ RArray<TCLFItemId> itemIdArray;
+ CleanupClosePushL( itemIdArray );
+
+ if ( iSortingStyle->Ordering() != ECLFOrderingAscending
+ || iSortingStyle1->Ordering() != ECLFOrderingDescending
+ || iSortingStyle2->Ordering() != ECLFOrderingDescending )
+ {
+ ret = KErrUnknown;
+ }
+ if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeTInt32
+ || iSortingStyle1->SortingDataType() != ECLFItemDataTypeDesC
+ || iSortingStyle2->SortingDataType() != ECLFItemDataTypeDesC )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->GetFieldsL( itemIdArray );
+
+ if ( itemIdArray.Count() != 0 )
+ {
+ ret = KErrUnknown;
+ }
+
+ itemIdArray.Reset();
+ iSortingStyle1->GetFieldsL( itemIdArray );
+
+ if ( itemIdArray.Count() != KArray1IdCount )
+ {
+ ret = KErrUnknown;
+ }
+
+ itemIdArray.Reset();
+ iSortingStyle2->GetFieldsL( itemIdArray );
+
+ if ( itemIdArray.Count() != KArray2IdCount )
+ {
+ ret = KErrUnknown;
+ }
+
+ CleanupStack::PopAndDestroy( &itemIdArray ); // itemIdArray.Close
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleOrderingTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SortingStyleOrderingTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iSortingStyle->SetOrdering( ECLFOrderingAscending );
+ if ( iSortingStyle->Ordering() != ECLFOrderingAscending )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->SetOrdering( ECLFOrderingDescending );
+ if ( iSortingStyle->Ordering() != ECLFOrderingDescending )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->SetOrdering( ECLFOrderingAscending );
+ if ( iSortingStyle->Ordering() != ECLFOrderingAscending )
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleDataTypeTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SortingStyleDataTypeTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
+ if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeTInt32 )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
+ if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeDesC )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeTTime );
+ if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeTTime )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeNull );
+ if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeNull )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
+ if ( iSortingStyle->SortingDataType() != ECLFItemDataTypeTInt32 )
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleUndefinedItemPositionTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SortingStyleUndefinedItemPositionTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+ if ( iSortingStyle->UndefinedItemPosition() != ECLFSortingStyleUndefinedEnd )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
+ if ( iSortingStyle->UndefinedItemPosition() != ECLFSortingStyleUndefinedFirst )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
+ if ( iSortingStyle->UndefinedItemPosition() != ECLFSortingStyleUndefinedEnd )
+ {
+ ret = KErrUnknown;
+ }
+
+ return ret;
+ }
+
+// ---------------------------------------------------------------------------
+// CContentListingFrameworkTest::SortingStyleFieldTestL
+// ---------------------------------------------------------------------------
+//
+TInt CContentListingFrameworkTest::SortingStyleFieldTestL( CStifItemParser& /* aItem */ )
+ {
+ TInt ret = KErrNone;
+
+ RArray<TCLFItemId> itemIdArray;
+ CleanupClosePushL( itemIdArray );
+
+ iSortingStyle->GetFieldsL( itemIdArray );
+ if ( itemIdArray.Count() != 0 )
+ {
+ ret = KErrUnknown;
+ }
+
+ iSortingStyle->AddFieldL( ECLFFieldIdFileName );
+ iSortingStyle->AddFieldL( ECLFFieldIdCollectionId );
+ iSortingStyle->AddFieldL( ECLFFieldIdCollectionName );
+ iSortingStyle->AddFieldL( ECLFFieldIdArtist );
+
+ iSortingStyle->GetFieldsL( itemIdArray );
+
+ if ( itemIdArray.Count() != 4 )
+ {
+ ret = KErrUnknown;
+ }
+
+ itemIdArray.Reset();
+ iSortingStyle->ResetL();
+ iSortingStyle->GetFieldsL( itemIdArray );
+ if ( itemIdArray.Count() != 0 )
+ {
+ ret = KErrUnknown;
+ }
+
+ CleanupStack::PopAndDestroy( &itemIdArray ); // itemIdArray.Close
+
+ return ret;
+ }
+
+// [End of File] - Do not remove
--- a/mds_pub/content_listing_framework_api/tsrc/src/CreateTestSuite.cpp Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2007 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:
-*
-*/
-
-
-// INCLUDES
-#include <ceunittestsuite.h>
-#include "T_CLFApiModuleTests.h"
-
-/**
- * Test suite factory function.
- */
-EXPORT_C MEUnitTest* CreateTestSuiteL()
- {
- CEUnitTestSuite* mainSuite = CEUnitTestSuite::NewLC(_L("Content Listing Framework API Module Tests"));
-
- // NewLC leaves the pointer to cleanupstack until AddL finishes
- mainSuite->AddL( T_CLFApiModuleTests::NewLC() );
- CleanupStack::Pop();
-
- CleanupStack::Pop( mainSuite );
- return mainSuite;
- }
-
--- a/mds_pub/content_listing_framework_api/tsrc/src/T_CLFApiModuleTests.cpp Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2513 +0,0 @@
-/*
-* Copyright (c) 2007 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: Implementation of CLF API test
-*
-*/
-
-
-// INCLUDES
-#include "T_CLFApiModuleTests.h"
-#include <s32mem.h>
-#include <eunitmacros.h>
-
-// the header for the tested class
-#include <ContentListingFactory.h>
-#include <MCLFChangedItemObserver.h>
-#include <MCLFContentListingEngine.h>
-#include <MCLFCustomGrouper.h>
-#include <MCLFCustomSorter.h>
-#include <MCLFItem.h>
-#include <MCLFItemListModel.h>
-#include <MCLFModifiableItem.h>
-#include <MCLFOperationObserver.h>
-#include <MCLFPostFilter.h>
-#include <MCLFSortingStyle.h>
-#include <T_ContentListingFramework.rsg>
-#include <collate.h>
-#include <pathInfo.h>
-#include <MCLFProcessObserver.h>
-#include <CLFContentListingExtended.hrh>
-
-//CONSTS
-#ifdef __WINSCW__
-_LIT( KTestResourceFile, "z:\\resource\\T_ContentListingFramework.rsc" );
-#else
-_LIT( KTestResourceFile, "c:\\sys\\bin\\T_ContentListingFramework.rsc" );
-#endif
-_LIT( KTestFileNameBase, "CLFTestFiles\\TestFile" );
-_LIT( KTestFileExt, ".txt" );
-
-const TCLFFieldId KMultibleSortingTestField1 = 0x80000001;
-const TCLFFieldId KMultibleSortingTestField2 = 0x80000002;
-const TCLFFieldId KMultibleSortingTestField3 = 0x80000003;
-const TCLFFieldId KMultibleSortingTestField4 = 0x80000004;
-const TCLFFieldId KMultibleSortingTestField5 = 0x80000005;
-const TCLFFieldId KMultibleSortingTestField6 = 0x80000006;
-
-const TInt KCLFUpdateFoldersSemanticId = 0x1000;
-
-// ---------------------------------------------------------------------------
-// class CMGXAsyncCallback
-// ---------------------------------------------------------------------------
-//
-class CCLFAsyncCallback : public CBase
- {
- public:
- ~CCLFAsyncCallback()
- {
- if ( iActiveWait.IsStarted() )
- {
- iActiveWait.AsyncStop();
- }
- }
- public:
- static void AfterL( TTimeIntervalMicroSeconds32 aInterval )
- {
- CCLFAsyncCallback* self = new( ELeave ) CCLFAsyncCallback();
- CleanupStack::PushL( self );
- CPeriodic* periodic = CPeriodic::NewL( CActive::EPriorityIdle );
- CleanupStack::PushL( periodic );
- TCallBack callBack( CallBackL, self );
- TTimeIntervalMicroSeconds32 interval( 1000000 );
- periodic->Start( aInterval, aInterval, callBack );
- self->iActiveWait.Start();
- periodic->Cancel();
- CleanupStack::PopAndDestroy( 2 ); // periodic, self
- }
-
- static TInt CallBackL( TAny* aObject )
- {
- CCLFAsyncCallback* self = reinterpret_cast< CCLFAsyncCallback* >( aObject );
- if ( self->iActiveWait.IsStarted() )
- {
- self->iActiveWait.AsyncStop();
- }
- return EFalse;
- }
-
- private:
- CActiveSchedulerWait iActiveWait;
- };
-
-// ---------------------------------------------------------------------------
-// class TTestOperationObserver
-// ---------------------------------------------------------------------------
-//
-class TTestOperationObserver : public MCLFOperationObserver
- {
- public:
- TTestOperationObserver()
- // set invalid values
- : iOperationEvent( TCLFOperationEvent( -1 ) ), iError( 1 ), iWait( NULL )
- {}
- void HandleOperationEventL( TCLFOperationEvent aOperationEvent,
- TInt aError )
- {
- iError = aError;
- iOperationEvent = aOperationEvent;
- if( iWait &&
- iWait->IsStarted() )
- {
- iWait->AsyncStop();
- }
- }
- TCLFOperationEvent iOperationEvent;
- TInt iError;
- CActiveSchedulerWait* iWait;
-
- };
-
-// ---------------------------------------------------------------------------
-// class TTestCustomSorter
-// ---------------------------------------------------------------------------
-//
-class TTestCustomSorter : public MCLFCustomSorter
- {
- public:
- TTestCustomSorter() : iSortItems( EFalse )
- {
- }
- void SortItemsL( RPointerArray<MCLFItem>& /*aItemArray*/ )
- {
- //aItemArray;
- iSortItems = ETrue;
- }
- TBool iSortItems;
-
- };
-
-// ---------------------------------------------------------------------------
-// class TTestCustomGrouper
-// ---------------------------------------------------------------------------
-//
-class TTestCustomGrouper : public MCLFCustomGrouper
- {
- public:
- TTestCustomGrouper() : iGroupCount( 2 ), iCopyItems( EFalse ), iModifiableItems( NULL )
- {
- }
- void GroupItemsL( const TArray<MCLFItem*>& /*aSourceList*/,
- RPointerArray<MCLFItem>& aGroupedList )
- {
- //aSourceList;
- if( iCopyItems )
- {
- TInt count( iModifiableItems->Count() );
- for( TInt i = 0 ; i < count ; ++i )
- {
- aGroupedList.AppendL( (*iModifiableItems)[i] );
- }
- }
- else if( iModifiableItems )
- {
- iModifiableItems->ResetAndDestroy();
- for( TInt i = 0 ; i < iGroupCount ; ++i )
- {
- MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
- iModifiableItems->AppendL( item );
- CleanupStack::Pop(); // item
- aGroupedList.AppendL( item );
- }
- }
- }
- TInt iGroupCount;
- TBool iCopyItems;
- RPointerArray<MCLFModifiableItem>* iModifiableItems;
- };
-
-// ---------------------------------------------------------------------------
-// class TTestPostFilter
-// ---------------------------------------------------------------------------
-//
-class TTestPostFilter : public MCLFPostFilter
- {
- public:
- TTestPostFilter() : iShouldFilterCount( 5 ), iAllFilter( EFalse )
- {
- }
-
- void FilterItemsL( const TArray<MCLFItem*>& aItemList,
- RPointerArray<MCLFItem>& aFilteredItemList )
- {
- iFilteredCount = 0;
- if( iAllFilter )
- {
- iFilteredCount = aItemList.Count();
- return;
- }
- for( TInt i = 0 ; i < aItemList.Count() ; ++i )
- {
- if( i < iShouldFilterCount )
- {
- iFilteredCount++;
- }
- else
- {
- aFilteredItemList.AppendL( aItemList[i] );
- }
- }
- }
- TInt iShouldFilterCount;
- TBool iAllFilter;
- TInt iFilteredCount;
-
- };
-
-// ---------------------------------------------------------------------------
-// class TTestChangedItemObserver
-// ---------------------------------------------------------------------------
-//
-class TTestChangedItemObserver : public MCLFChangedItemObserver
- {
- public:
- TTestChangedItemObserver()
- : iHandleItemChange( EFalse ),
- iLastError( KErrNone ),
- iChangedArray( NULL ),
- iWait( NULL )
- {
- }
- void HandleItemChangeL( const TArray<TCLFItemId>& aItemIDArray )
- {
- iHandleItemChange = ETrue;
- if( iChangedArray )
- {
- iChangedArray->Reset();
- for( TInt i = 0 ; i < aItemIDArray.Count() ; ++i )
- {
- iChangedArray->AppendL( aItemIDArray[i] );
- }
- }
- if( iWait && iWait->IsStarted() )
- {
- iWait->AsyncStop();
- }
-
- }
- void HandleError( TInt aError )
- {
- iLastError = aError;
- if( iWait && iWait->IsStarted() )
- {
- iWait->AsyncStop();
- }
- }
- TInt iHandleItemChange;
- TInt iLastError;
- RArray<TCLFItemId>* iChangedArray;
- CActiveSchedulerWait* iWait;
- };
-
-// ---------------------------------------------------------------------------
-// class TTestCLFProcessObserver
-// ---------------------------------------------------------------------------
-//
-class TTestCLFProcessObserver : public MCLFProcessObserver
- {
- public:
- TTestCLFProcessObserver()
- : iStartEvent( EFalse ), iEndEvent( EFalse )
- {}
- void HandleCLFProcessEventL( TCLFProcessEvent aProcessEvent )
- {
- switch ( aProcessEvent )
- {
- case ECLFUpdateStart:
- {
- iStartEvent = ETrue;
- break;
- }
- case ECLFUpdateStop:
- {
- iEndEvent = ETrue;
- break;
- }
- default:
- {
- User::Panic( _L("CLF module test"), 1 );
- }
- }
- }
- void Reset()
- {
- iStartEvent = EFalse;
- iEndEvent = EFalse;
- }
- TBool iStartEvent;
- TBool iEndEvent;
- };
-
-void SerializeL( const MDesCArray& aDataArray, CBufBase& aBuffer )
- {
- const TInt count( aDataArray.MdcaCount() );
- RBufWriteStream writeStream( aBuffer );
- CleanupClosePushL( writeStream );
- writeStream.WriteInt32L( count );
- for( TInt i = 0 ; i < count ; ++i )
- {
- const TDesC& des = aDataArray.MdcaPoint( i );
- TInt length( des.Length() );
- writeStream.WriteInt32L( length );
- writeStream.WriteL( des, length );
- }
- CleanupStack::PopAndDestroy( &writeStream );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::NewLC()
-// Create the testing class
-// ---------------------------------------------------------------------------
-//
-T_CLFApiModuleTests* T_CLFApiModuleTests::NewLC()
- {
- T_CLFApiModuleTests* self = new(ELeave) T_CLFApiModuleTests;
-
- CleanupStack::PushL( self );
- // need to generate the table, so call base classes
- // second phase constructor
- self->ConstructL();
- return self;
- }
-
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ConstructL()
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ConstructL()
- {
- CEUnitTestSuiteClass::ConstructL();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::~T_CLFApiModuleTests()
-// ---------------------------------------------------------------------------
-//
-T_CLFApiModuleTests::~T_CLFApiModuleTests()
- {
- Teardown();
- }
-
-/**
- * Assistance methods
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ResourceL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ResourceL( TInt aResourceId )
- {
- delete iDataBuffer;
- iDataBuffer = NULL;
- iDataBuffer = iResourceFile.AllocReadL( aResourceId );
- iResourceReader.SetBuffer( iDataBuffer );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleResourceL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleResourceL()
- {
- ResourceL( R_SORTING_STYLE );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ListModelResourceL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ListModelResourceL()
- {
- ResourceL( R_LIST_MODEL );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateNewFileL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateNewFileL( TInt aNumber, TDes& aFileName )
- {
- aFileName.Copy( PathInfo::PhoneMemoryRootPath() );
- aFileName.Append( KTestFileNameBase );
- TBuf<125> buf;
- buf.Num( aNumber );
- aFileName.Append( buf );
- aFileName.Append( KTestFileExt );
-
- RFile file;
- BaflUtils::EnsurePathExistsL( iFs, aFileName );
- TInt error( file.Replace( iFs, aFileName, EFileShareAny | EFileWrite ) );
- if( error == KErrNone )
- {
- error = file.Write( _L8("Test data") );
- }
- file.Close();
- User::LeaveIfError( error );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::FindTestFileIdL
-// ---------------------------------------------------------------------------
-//
-TCLFItemId T_CLFApiModuleTests::FindTestFileIdL( TInt aNumber )
- {
- TCLFItemId id( 0 );
- MCLFItemListModel* model = iEngine->CreateListModelLC( *iTestObserver );
- iMimeTypeArray->AppendL( _L("*") );
-
- iTestObserver->iWait = &iWait;
- model->SetWantedMimeTypesL( *iMimeTypeArray );
- model->RefreshL();
- iWait.Start();
-
- TFileName testFileName( PathInfo::PhoneMemoryRootPath() );
- testFileName.Append( KTestFileNameBase );
- TBuf<125> buf;
- buf.Num( aNumber );
- testFileName.Append( buf );
- testFileName.Append( KTestFileExt );
- for( TInt i = 0 ; i < model->ItemCount() ; ++i )
- {
- const MCLFItem& item = model->Item( i );
- TPtrC fileName;
- if( item.GetField( ECLFFieldIdFileNameAndPath, fileName ) != KErrNone )
- {
- continue;
- }
- if( fileName.CompareF( testFileName ) == 0 )
- {
- id = item.ItemId();
- break;
- }
- }
- CleanupStack::PopAndDestroy(); // model
- return id;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckFileNameShortingL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckFileNameShortingL()
- {
- TCollationMethod m = *Mem::CollationMethodByIndex( 0 );
- m.iFlags |= TCollationMethod::EIgnoreNone | TCollationMethod::EFoldCase;
-
- for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
- {
- const MCLFItem& item = iListModel->Item( i );
- const MCLFItem& item1 = iListModel->Item( i + 1 );
- TPtrC name;
- TPtrC name1;
-
- if( item.GetField( ECLFFieldIdFileName, name ) != KErrNone ||
- item1.GetField( ECLFFieldIdFileName, name1 ) != KErrNone )
- {
- return EFalse;
- }
- if( name.CompareC( name1, 3, &m ) > 0 )
- {
- return EFalse;
- }
- }
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckFileSizeShortingL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckFileSizeShortingL()
- {
- for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
- {
- const MCLFItem& item = iListModel->Item( i );
- const MCLFItem& item1 = iListModel->Item( i + 1 );
- TInt32 size;
- TInt32 size1;
- if( item.GetField( ECLFFieldIdFileSize, size ) != KErrNone ||
- item1.GetField( ECLFFieldIdFileSize, size1 ) != KErrNone )
- {
- return EFalse;
- }
- if( size < size1 )
- {
- return EFalse;
- }
- }
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckMultibleSortingShortingL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckMultibleSortingShortingL()
- {
- const MCLFItem* item = &( iListModel->Item( 0 ) );
- TInt32 data( 0 );
- if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
- data != 5 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 1 ) );
- if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
- data != 4 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 2 ) );
- if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone ||
- data != 3 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 3 ) );
- if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
- data != 6 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 4 ) );
- if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
- data != 7 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 5 ) );
- if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone ||
- data != 8 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 6 ) );
- if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
- data != 9 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 7 ) );
- if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
- data != 10 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 8 ) );
- if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone ||
- data != 11 )
- {
- return EFalse;
- }
-// unsorted start
- item = &( iListModel->Item( 9 ) );
- if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
- ( data < 15 || data > 17 ) )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 10 ) );
- if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
- ( data < 15 || data > 17 ) )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 11 ) );
- if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
- ( data < 15 || data > 17 ) )
- {
- return EFalse;
- }
-// unsorted end
- item = &( iListModel->Item( 12 ) );
- if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
- data != 12 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 13 ) );
- if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
- data != 13 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 14 ) );
- if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
- data != 14 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 15 ) );
- if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
- data != 0 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 16 ) );
- if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
- data != 1 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 17 ) );
- if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone ||
- data != 2 )
- {
- return EFalse;
- }
-
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckMultibleSortingShorting2L
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckMultibleSortingShorting2L()
- {
-// check sorted
- const MCLFItem* item = &( iListModel->Item( 0 ) );
- TInt32 data( 0 );
- if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
- data != 12 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 1 ) );
- if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
- data != 13 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 2 ) );
- if( item->GetField( KMultibleSortingTestField5, data ) != KErrNone ||
- data != 14 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 3 ) );
- if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
- data != 15 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 4 ) );
- if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
- data != 16 )
- {
- return EFalse;
- }
- item = &( iListModel->Item( 5 ) );
- if( item->GetField( KMultibleSortingTestField6, data ) != KErrNone ||
- data != 17 )
- {
- return EFalse;
- }
-// check unsorted
- for( TInt i = 6 ; i < 18 ; ++i )
- {
- item = &( iListModel->Item( i ) );
- if( item->GetField( KMultibleSortingTestField1, data ) != KErrNone )
- {
- if( item->GetField( KMultibleSortingTestField2, data ) != KErrNone )
- {
- if( item->GetField( KMultibleSortingTestField3, data ) != KErrNone )
- {
- if( item->GetField( KMultibleSortingTestField4, data ) != KErrNone )
- {
- return EFalse;
- }
- }
- }
- }
- if( data < 0 || data > 11 )
- {
- return EFalse;
- }
- }
-
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckFileDateShortingL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckFileDateShortingL()
- {
- for( TInt i = 0 ; i < iListModel->ItemCount() -1 ; ++i )
- {
- const MCLFItem& item = iListModel->Item( i );
- const MCLFItem& item1 = iListModel->Item( i + 1 );
- TTime date;
- TTime date1;
- if( item.GetField( ECLFFieldIdFileDate, date ) != KErrNone ||
- item1.GetField( ECLFFieldIdFileDate, date1 ) != KErrNone )
- {
- return EFalse;
- }
- if( date > date1 )
- {
- return EFalse;
- }
- }
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckFileTypesL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckFileTypesL( const MDesCArray& aMimeTypeArray,
- const TArray<TInt>& aMediaTypes )
- {
- for( TInt i = 0 ; i < iListModel->ItemCount() ; ++i )
- {
- TPtrC mimeType;
- TInt32 mediaType;
- TInt error = iListModel->Item( i ).GetField( ECLFFieldIdMimeType, mimeType );
- if( iListModel->Item( i ).GetField( ECLFFieldIdMediaType, mediaType ) != KErrNone )
- {
- return EFalse;
- }
- TBool mimeTypeVal( EFalse );
- TBool mediaTypeVal( EFalse );
- if( error == KErrNone )
- {
- mimeTypeVal = CheckMimeTypesL( aMimeTypeArray, mimeType );
- }
- mediaTypeVal = CheckMediaTypesL( aMediaTypes, TCLFMediaType( mediaType ) );
- if( !( mimeTypeVal || mediaTypeVal ) )
- {
- return EFalse;
- }
- }
- return ETrue;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckMimeTypesL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckMimeTypesL( const MDesCArray& aMimeTypeArray,
- const TDesC& aMimeType )
- {
- for( TInt j = 0 ; j < aMimeTypeArray.MdcaCount() ; ++j )
- {
- if( aMimeTypeArray.MdcaPoint( j ).Match( aMimeType ) == KErrNotFound )
- {
- return ETrue;
- }
- }
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CheckMediaTypesL
-// ---------------------------------------------------------------------------
-//
-TBool T_CLFApiModuleTests::CheckMediaTypesL( const TArray<TInt>& aMediaTypes,
- TCLFMediaType aMediaType )
- {
- for( TInt j = 0 ; j < aMediaTypes.Count() ; ++j )
- {
- if( aMediaTypes[j] == aMediaType )
- {
- return ETrue;
- }
- }
- return EFalse;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MakeOpaqueDataL
-// ---------------------------------------------------------------------------
-//
-HBufC8* T_CLFApiModuleTests::MakeOpaqueDataL( const MDesCArray& aFiles )
- {
- CDesCArray* folderArray = new ( ELeave ) CDesCArraySeg( 8 );
- CleanupStack::PushL( folderArray );
- TInt count( aFiles.MdcaCount() );
- for( TInt i = 0 ; i < count ; ++i )
- {
- TPtrC folderPath( TParsePtrC(
- aFiles.MdcaPoint( i ) ).DriveAndPath() );
- TInt tmp( 0 );
- if( folderArray->Find( folderPath, tmp, ECmpFolded ) != 0 )
- {
- folderArray->AppendL( folderPath );
- }
- }
-
- CBufBase* dynBuffer = CBufFlat::NewL( 64 );
- CleanupStack::PushL( dynBuffer );
- SerializeL( *folderArray, *dynBuffer );
- HBufC8* ret = dynBuffer->Ptr( 0 ).AllocL();
- CleanupStack::PopAndDestroy( 2, folderArray );
- return ret;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MakeMultibleSortingItemsL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::MakeMultibleSortingItemsL(
- RPointerArray<MCLFModifiableItem>& aItemArray )
- {
- for( TInt i = 0 ; i < 18 ; ++i )
- {
- MCLFModifiableItem* item = ContentListingFactory::NewModifiableItemLC();
- aItemArray.AppendL( item );
- CleanupStack::Pop();
-
- if( i < 3 )
- {
- item->AddFieldL( KMultibleSortingTestField1, i );
- }
- else if( i < 6 )
- {
- item->AddFieldL( KMultibleSortingTestField2, i );
- }
- else if( i < 9 )
- {
- item->AddFieldL( KMultibleSortingTestField3, i );
- }
- else if( i < 12 )
- {
- item->AddFieldL( KMultibleSortingTestField4, i );
- }
- else if( i < 15 )
- {
- item->AddFieldL( KMultibleSortingTestField5, i );
- }
- else
- {
- item->AddFieldL( KMultibleSortingTestField6, i );
- }
- }
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::FindItem
-// ---------------------------------------------------------------------------
-//
-const MCLFItem* T_CLFApiModuleTests::FindItem( MCLFItemListModel& aModel, TCLFItemId aItemId )
- {
- for( TInt i = 0 ; i < aModel.ItemCount() ; ++i )
- {
- const MCLFItem& item = aModel.Item( i );
- if( item.ItemId() == aItemId )
- {
- return &item;
- }
- }
- return NULL;
- }
-
-/**
- * Setup
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::BaseSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::BaseSetupL()
- {
- iFs.Close();
- iResourceFile.Close();
-
- User::LeaveIfError( iFs.Connect() );
- TFileName fileName( KTestResourceFile );
- BaflUtils::NearestLanguageFile( iFs, fileName );
- iResourceFile.OpenL( iFs, KTestResourceFile );
- iResourceFile.ConfirmSignatureL( 0 );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleResourceSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleResourceSetupL()
- {
- BaseSetupL();
- SortingStyleResourceL();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateModelSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateModelSetupL()
- {
- iEngine = ContentListingFactory::NewContentListingEngineLC();
- CleanupStack::Pop();
- iTestObserver = new (ELeave) TTestOperationObserver;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateModelFromResourceSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateModelFromResourceSetupL()
- {
- BaseSetupL();
- CreateModelSetupL();
- ListModelResourceL();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ListModelSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ListModelSetupL()
- {
- BaseSetupL();
- CreateModelSetupL();
- iListModel = iEngine->CreateListModelLC( *iTestObserver );
- CleanupStack::Pop();
-
- iSortingStyle = ContentListingFactory::NewSortingStyleLC();
- CleanupStack::Pop();
- iSortingStyle1 = ContentListingFactory::NewSortingStyleLC();
- CleanupStack::Pop();
- iSortingStyle2 = ContentListingFactory::NewSortingStyleLC();
- CleanupStack::Pop();
- iSortingStyle3 = ContentListingFactory::NewSortingStyleLC();
- CleanupStack::Pop();
-
- iTestSorter = new (ELeave) TTestCustomSorter;
- iTestSorter1 = new (ELeave) TTestCustomSorter;
- iTestGrouper = new (ELeave) TTestCustomGrouper;
- iTestGrouper1 = new (ELeave) TTestCustomGrouper;
- iTestFilter = new (ELeave) TTestPostFilter;
- iTestFilter1 = new (ELeave) TTestPostFilter;
- iMimeTypeArray = new (ELeave) CDesCArrayFlat( 8 );
- iMimeTypeArray1 = new (ELeave) CDesCArrayFlat( 8 );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MultibleSortingSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::MultibleSortingSetupL()
- {
- ListModelSetupL();
- MakeMultibleSortingItemsL( iModifiableItems );
-
-// use custom grouper to make own items
- iTestGrouper->iModifiableItems = &iModifiableItems;
- iTestGrouper->iCopyItems = ETrue;
- iListModel->SetCustomGrouper( iTestGrouper );
-
-// set sorters
- iSortingStyle->ResetL();
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
- iSortingStyle->AddFieldL( KMultibleSortingTestField1 );
- iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
-
- iSortingStyle1->ResetL();
- iSortingStyle1->SetSortingDataType( ECLFItemDataTypeTInt32 );
- iSortingStyle1->AddFieldL( KMultibleSortingTestField2 );
- iSortingStyle1->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
- iSortingStyle1->SetOrdering( ECLFOrderingDescending );
-
- iSortingStyle2->ResetL();
- iSortingStyle2->SetSortingDataType( ECLFItemDataTypeTInt32 );
- iSortingStyle2->AddFieldL( KMultibleSortingTestField3 );
- iSortingStyle2->AddFieldL( KMultibleSortingTestField4 );
- iSortingStyle2->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
-
- iSortingStyle3->ResetL();
- iSortingStyle3->SetSortingDataType( ECLFItemDataTypeTInt32 );
- iSortingStyle3->AddFieldL( KMultibleSortingTestField5 );
- iSortingStyle3->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
-
- iListModel->SetSortingStyle( iSortingStyle );
- iListModel->AppendSecondarySortingStyleL( *iSortingStyle1 );
- iListModel->AppendSecondarySortingStyleL( *iSortingStyle2 );
- iListModel->AppendSecondarySortingStyleL( *iSortingStyle3 );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MultibleSortingResourceSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::MultibleSortingResourceSetupL()
- {
- ListModelSetupL();
- delete iListModel;
- iListModel = NULL;
- ResourceL( R_LIST_MODEL_MULTIBLE );
- iListModel = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
- CleanupStack::Pop();
-
-// use custom grouper to make own items
- MakeMultibleSortingItemsL( iModifiableItems );
- iTestGrouper->iModifiableItems = &iModifiableItems;
- iTestGrouper->iCopyItems = ETrue;
- iListModel->SetCustomGrouper( iTestGrouper );
-
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ListModelAllFileItemsSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ListModelAllFileItemsSetupL()
- {
- ListModelSetupL();
- iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
- iMediaTypeArray.AppendL( ECLFMediaTypeImage );
- iMediaTypeArray.AppendL( ECLFMediaTypeSound );
- iMediaTypeArray.AppendL( ECLFMediaTypeMusic );
- iMediaTypeArray.AppendL( ECLFMediaTypeStreamingURL );
- iMediaTypeArray.AppendL( ECLFMediaTypePlaylist );
- iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
- iTestObserver->iWait = &iWait;
- iListModel->RefreshL();
- iWait.Start();
- iItemCount = iListModel->ItemCount();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ListModelSetupFromResourceL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ListModelSetupFromResourceL()
- {
- BaseSetupL();
- CreateModelSetupL();
- ListModelResourceL();
- iListModel = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
- CleanupStack::Pop();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::EngineTestSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::EngineTestSetupL()
- {
- User::LeaveIfError( iFs.Connect() );
- iTestObserver = new (ELeave) TTestOperationObserver;
- iMimeTypeArray = new (ELeave) CDesCArrayFlat( 8 );
- iEngine = ContentListingFactory::NewContentListingEngineLC();
- CleanupStack::Pop();
- iChangedItemObserver = new (ELeave) TTestChangedItemObserver;
- iChangedItemObserver1 = new (ELeave) TTestChangedItemObserver;
- iTestCLFProcessObserver = new (ELeave) TTestCLFProcessObserver;
- iTestCLFProcessObserver1 = new (ELeave) TTestCLFProcessObserver;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleTestSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleTestSetupL()
- {
- iSortingStyle = ContentListingFactory::NewSortingStyleLC();
- CleanupStack::Pop();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleResourceTestSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleResourceTestSetupL()
- {
- SortingStyleResourceSetupL();
- iSortingStyle1 = ContentListingFactory::NewSortingStyleLC( iResourceReader );
- CleanupStack::Pop();
-
- ResourceL( R_SORTING_STYLE_EMPTY );
- iSortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
- CleanupStack::Pop();
-
- ResourceL( R_SORTING_STYLE_UNDEFINEDITEM );
- iSortingStyle2 = ContentListingFactory::NewSortingStyleLC( iResourceReader );
- CleanupStack::Pop();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ModifiableItemTestSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ModifiableItemTestSetupL()
- {
- iModifiableItem = ContentListingFactory::NewModifiableItemLC();
- CleanupStack::Pop();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ItemTestSetupL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ItemTestSetupL()
- {
- ListModelSetupL();
- CreateNewFileL( 12, iFileName );
- iEngine->UpdateItemsL();
- iMimeTypeArray->Reset();
- iMimeTypeArray->AppendL( _L("*") );
- iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-
- iTestObserver->iWait = &iWait;
- iListModel->RefreshL();
- iWait.Start();
-
- for( TInt i = 0 ; i < iListModel->ItemCount() ; ++i )
- {
- const MCLFItem& item = iListModel->Item( i );
- TPtrC fn;
- item.GetField( ECLFFieldIdFileNameAndPath, fn );
- if( iFileName.CompareF( fn ) == 0 )
- {
- iItem = &item;
- }
- }
-
- EUNIT_ASSERT( iItem ); // Item should be in model
-
- }
-
-/**
- * Teardown
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::Teardown
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::Teardown()
- {
- iResourceFile.Close();
- iFs.Close();
- iMediaTypeArray.Reset();
- iMediaTypeArray.Close();
- iMediaTypeArray1.Reset();
- iMediaTypeArray1.Close();
- iUpdateItemIdArray.Reset();
- iUpdateItemIdArray.Close();
- iChangedArray.Reset();
- iChangedArray.Close();
- iModifiableItems.ResetAndDestroy();
- iModifiableItems.Close();
-
- delete iListModel;
- iListModel = NULL;
- delete iEngine;
- iEngine = NULL;
- delete iSortingStyle;
- iSortingStyle = NULL;
- delete iSortingStyle1;
- iSortingStyle1 = NULL;
- delete iSortingStyle2;
- iSortingStyle2 = NULL;
- delete iSortingStyle3;
- iSortingStyle3 = NULL;
- delete iDataBuffer;
- iDataBuffer = NULL;
- delete iTestObserver;
- iTestObserver = NULL;
- delete iTestSorter;
- iTestSorter = NULL;
- delete iTestSorter1;
- iTestSorter1 = NULL;
- delete iTestGrouper;
- iTestGrouper = NULL;
- delete iTestGrouper1;
- iTestGrouper1 = NULL;
- delete iTestFilter;
- iTestFilter = NULL;
- delete iTestFilter1;
- iTestFilter1 = NULL;
- delete iMimeTypeArray;
- iMimeTypeArray = NULL;
- delete iMimeTypeArray1;
- iMimeTypeArray1 = NULL;
- delete iChangedItemObserver;
- iChangedItemObserver = NULL;
- delete iChangedItemObserver1;
- iChangedItemObserver1 = NULL;
- delete iOpaqueData;
- iOpaqueData = NULL;
- delete iModifiableItem;
- iModifiableItem = NULL;
- delete iTestCLFProcessObserver1;
- iTestCLFProcessObserver1 = NULL;
- delete iTestCLFProcessObserver;
- iTestCLFProcessObserver = NULL;
-
- TTimeIntervalMicroSeconds32 time = 1000000;
- TRAP_IGNORE( CCLFAsyncCallback::AfterL( time ) );
- }
-
-/**
- * Tests, construction
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateEngineTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateEngineTestL()
- {
- MCLFContentListingEngine* engine = NULL;
- engine = ContentListingFactory::NewContentListingEngineLC();
- EUNIT_ASSERT( engine );
- CleanupStack::PopAndDestroy();
- engine = NULL;
- engine = ContentListingFactory::NewContentListingEngineLC();
- CleanupStack::Pop();
- EUNIT_ASSERT( engine );
- delete engine;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateModifiableItemTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateModifiableItemTestL()
- {
- MCLFModifiableItem* item = NULL;
- item = ContentListingFactory::NewModifiableItemLC();
- EUNIT_ASSERT( item );
- CleanupStack::PopAndDestroy();
- item = NULL;
- item = ContentListingFactory::NewModifiableItemLC();
- CleanupStack::Pop();
- EUNIT_ASSERT( item );
- delete item;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateSortignStyleTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateSortignStyleTestL()
- {
- MCLFSortingStyle* sortingStyle = NULL;
- sortingStyle = ContentListingFactory::NewSortingStyleLC();
- EUNIT_ASSERT( sortingStyle );
- CleanupStack::PopAndDestroy();
- sortingStyle = NULL;
- sortingStyle = ContentListingFactory::NewSortingStyleLC();
- CleanupStack::Pop();
- EUNIT_ASSERT( sortingStyle );
- delete sortingStyle;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateSortignStyleFromResourceTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateSortignStyleFromResourceTestL()
- {
- MCLFSortingStyle* sortingStyle = NULL;
- sortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
- EUNIT_ASSERT( sortingStyle );
- CleanupStack::PopAndDestroy();
- sortingStyle = NULL;
-
- SortingStyleResourceL(); // refresh resource reader
- sortingStyle = ContentListingFactory::NewSortingStyleLC( iResourceReader );
- CleanupStack::Pop();
- EUNIT_ASSERT( sortingStyle );
- delete sortingStyle;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateListModelTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateListModelTestL()
- {
- MCLFItemListModel* model = NULL;
- model = iEngine->CreateListModelLC( *iTestObserver );
- EUNIT_ASSERT( model );
- CleanupStack::PopAndDestroy();
- model = NULL;
-
- model = iEngine->CreateListModelLC( *iTestObserver );
- CleanupStack::Pop();
- EUNIT_ASSERT( model );
- delete model;
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::CreateListModelFromResourceTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::CreateListModelFromResourceTestL()
- {
- MCLFItemListModel* model = NULL;
- model = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
- EUNIT_ASSERT( model );
- CleanupStack::PopAndDestroy();
- model = NULL;
-
- ListModelResourceL();
- model = iEngine->CreateListModelLC( *iTestObserver, iResourceReader );
- CleanupStack::Pop();
- EUNIT_ASSERT( model );
- delete model;
-
-
- ResourceL( R_LIST_MODEL_INCORRECT_VERSION );
- EUNIT_ASSERT_SPECIFIC_LEAVE( iEngine->CreateListModelLC( *iTestObserver, iResourceReader ), KErrNotSupported );
- }
-
-/**
- * Tests, engine
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::UpdateItemsTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::UpdateItemsTestL()
- {
- // MDS will do the updating automatically in the background,
- // thus only checking that the methods return correctly
- iChangedItemObserver->iWait = &iWait;
- iChangedItemObserver->iChangedArray = &iChangedArray;
- iEngine->AddChangedItemObserverL( *iChangedItemObserver );
- iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver );
- iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver1 );
-
- CreateNewFileL( 0, iFileName );
- CreateNewFileL( 1, iFileName );
- CreateNewFileL( 2, iFileName );
- CreateNewFileL( 3, iFileName );
- CreateNewFileL( 4, iFileName );
- CreateNewFileL( 5, iFileName );
-
-// update server
-// to avoid incorrect test result
- CreateNewFileL( 0, iFileName );
- iEngine->UpdateItemsL();
-
- EUNIT_ASSERT( iChangedItemObserver->iLastError == KErrNone );
-
- iChangedArray.Reset();
- iEngine->RemoveCLFProcessObserver( *iTestCLFProcessObserver1 );
- iChangedItemObserver->iHandleItemChange = EFalse;
- iChangedItemObserver1->iHandleItemChange = EFalse;
- iTestCLFProcessObserver->Reset();
- iTestCLFProcessObserver1->Reset();
- iEngine->UpdateItemsL();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::UpdateItemsWithIdTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::UpdateItemsWithIdTestL()
- {
- // MDS will do the updating automatically in the background,
- // thus only checking that the methods return correctly
- iChangedItemObserver->iWait = &iWait;
- iChangedItemObserver->iChangedArray = &iChangedArray;
- iEngine->AddChangedItemObserverL( *iChangedItemObserver );
- iEngine->AddChangedItemObserverL( *iChangedItemObserver1 );
- iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver );
-
- CreateNewFileL( 0, iFileName );
- CreateNewFileL( 1, iFileName );
- CreateNewFileL( 2, iFileName );
-
-// update server
-// to avoid incorrect test result
- CreateNewFileL( 0, iFileName );
- iEngine->UpdateItemsL();
-
- EUNIT_ASSERT( iChangedItemObserver->iLastError == KErrNone );
-
-// start testing
-// update by id
- TUint id1 = FindTestFileIdL( 1 );
- TUint id0 = FindTestFileIdL( 0 );
- TUint id2 = FindTestFileIdL( 2 );
- iUpdateItemIdArray.AppendL( id1 );
- iChangedItemObserver->iHandleItemChange = EFalse;
- iChangedItemObserver1->iHandleItemChange = EFalse;
- iTestCLFProcessObserver->Reset();
- iTestCLFProcessObserver1->Reset();
- CreateNewFileL( 0, iFileName );
- CreateNewFileL( 1, iFileName );
- iEngine->UpdateItemsL( iUpdateItemIdArray.Array() );
-
- EUNIT_ASSERT( iChangedItemObserver->iLastError == KErrNone );
-
- iEngine->RemoveChangedItemObserver( *iChangedItemObserver1 );
- iEngine->AddCLFProcessObserverL( *iTestCLFProcessObserver1 );
-
- iChangedItemObserver->iHandleItemChange = EFalse;
- iChangedItemObserver1->iHandleItemChange = EFalse;
- iTestCLFProcessObserver->Reset();
- iTestCLFProcessObserver1->Reset();
- iUpdateItemIdArray.AppendL( id0 );
- iUpdateItemIdArray.AppendL( id2 );
-
-// update server
-// to avoid incorrect test result
- iEngine->UpdateItemsL();
-
- EUNIT_ASSERT( iChangedItemObserver->iLastError == KErrNone );
-
- CreateNewFileL( 0, iFileName );
- CreateNewFileL( 1, iFileName );
- CreateNewFileL( 2, iFileName );
- iChangedArray.Reset();
-
- iEngine->UpdateItemsL( iUpdateItemIdArray.Array() );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::UpdateItemsWithOpaqueDataFolderTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::UpdateItemsWithOpaqueDataFolderTestL()
- {
- // update server
- // to avoid incorrect test result
- iEngine->UpdateItemsL();
- iWait.Start();
-
- // start testing
- // update by opaque data
- // folders data
- iSemanticId = KCLFUpdateFoldersSemanticId;
- delete iOpaqueData;
- iOpaqueData = NULL;
-
- CDesCArray* fileArray = new (ELeave) CDesCArraySeg( 8 );
- iOpaqueData = MakeOpaqueDataL( *fileArray );
- // Calls internally same MDS method as when updating all data
- // thus only interested if this call leaves
- iEngine->UpdateItemsL( iSemanticId, *iOpaqueData );
- }
-
-/**
- * Tests, list model
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::RefreshTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::RefreshTestL()
- {
- iMimeTypeArray->Reset();
- iMimeTypeArray->AppendL( _L("*") );
- iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-
- iTestObserver->iWait = &iWait;
- iTestObserver->iError = 100;
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
- EUNIT_ASSERT( iTestObserver->iError == KErrNone );
- EUNIT_ASSERT( iListModel->ItemCount() > 0 );
-
-// cancel refresh
- iListModel->RefreshL();
- iListModel->CancelRefresh();
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetSortingStyleTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetSortingStyleTestL()
- {
- iListModel->SetSortingStyle( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( !CheckFileNameShortingL() );
-
-// file name sorting
- iSortingStyle->ResetL();
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
- iSortingStyle->AddFieldL( ECLFFieldIdFileName );
- iListModel->SetSortingStyle( iSortingStyle );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( CheckFileNameShortingL() );
-
-// file size sorting
- iSortingStyle1->ResetL();
- iSortingStyle1->SetOrdering( ECLFOrderingDescending );
- iSortingStyle1->SetSortingDataType( ECLFItemDataTypeTInt32 );
- iSortingStyle1->AddFieldL( ECLFFieldIdFileSize );
- iListModel->SetSortingStyle( iSortingStyle1 );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( CheckFileSizeShortingL() );
-
- iListModel->SetSortingStyle( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( !CheckFileNameShortingL() );
- EUNIT_ASSERT( !CheckFileSizeShortingL() );
- EUNIT_ASSERT( !CheckFileDateShortingL() );
-
-// time sorting
- iSortingStyle->ResetL();
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeTTime );
- iSortingStyle->AddFieldL( ECLFFieldIdFileDate );
- iListModel->SetSortingStyle( iSortingStyle );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( CheckFileDateShortingL() );
-
-// parameter test (time)
- iListModel->SetSortingStyle( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( !CheckFileNameShortingL() );
- EUNIT_ASSERT( !CheckFileSizeShortingL() );
- EUNIT_ASSERT( !CheckFileDateShortingL() );
-
- iListModel->SetSortingStyle( iSortingStyle );
- iListModel->RefreshL( ECLFRefreshPostFilter );
- EUNIT_ASSERT( !CheckFileNameShortingL() );
- EUNIT_ASSERT( !CheckFileSizeShortingL() );
- EUNIT_ASSERT( !CheckFileDateShortingL() );
-
- iListModel->RefreshL( ECLFRefreshGrouping );
- EUNIT_ASSERT( !CheckFileNameShortingL() );
- EUNIT_ASSERT( !CheckFileSizeShortingL() );
- EUNIT_ASSERT( !CheckFileDateShortingL() );
-
- iListModel->RefreshL( ECLFRefreshSorting );
- EUNIT_ASSERT( !CheckFileNameShortingL() );
- EUNIT_ASSERT( !CheckFileSizeShortingL() );
- EUNIT_ASSERT( CheckFileDateShortingL() );
-
-// custom sorter (overwrite sorting style)
- iTestSorter->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( iTestSorter );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iTestSorter->iSortItems );
- EUNIT_ASSERT( !CheckFileNameShortingL() );
- EUNIT_ASSERT( !CheckFileSizeShortingL() );
- EUNIT_ASSERT( !CheckFileDateShortingL() );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetCustomSorterTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetCustomSorterTestL()
- {
- iTestSorter->iSortItems = EFalse;
- iTestSorter1->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( !iTestSorter->iSortItems );
- EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
- iTestSorter->iSortItems = EFalse;
- iTestSorter1->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( iTestSorter );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iTestSorter->iSortItems );
- EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
- iTestSorter->iSortItems = EFalse;
- iTestSorter1->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( iTestSorter1 );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( !iTestSorter->iSortItems );
- EUNIT_ASSERT( iTestSorter1->iSortItems );
-
- iTestSorter->iSortItems = EFalse;
- iTestSorter1->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( !iTestSorter->iSortItems );
- EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
- iTestSorter->iSortItems = EFalse;
- iTestSorter1->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( iTestSorter );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iTestSorter->iSortItems );
- EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
- iTestSorter->iSortItems = EFalse;
- iTestSorter1->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( iTestSorter1 );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( !iTestSorter->iSortItems );
- EUNIT_ASSERT( iTestSorter1->iSortItems );
-
-// parameter test
- iTestSorter->iSortItems = EFalse;
- iTestSorter1->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( !iTestSorter->iSortItems );
- EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
-
- iTestSorter->iSortItems = EFalse;
- iTestSorter1->iSortItems = EFalse;
-
- iListModel->SetCustomSorter( iTestSorter );
- iListModel->RefreshL( ECLFRefreshPostFilter );
- EUNIT_ASSERT( !iTestSorter->iSortItems );
- EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
- iListModel->RefreshL( ECLFRefreshGrouping );
- EUNIT_ASSERT( !iTestSorter->iSortItems );
- EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
- iListModel->RefreshL( ECLFRefreshSorting );
- EUNIT_ASSERT( iTestSorter->iSortItems );
- EUNIT_ASSERT( !iTestSorter1->iSortItems );
-
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::GroupingTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::GroupingTestL()
- {
- iTestGrouper->iModifiableItems = &iModifiableItems;
- iTestGrouper1->iModifiableItems = &iModifiableItems;
-
-// No grouping
- iListModel->SetCustomGrouper( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-
-// couple groups
- iListModel->SetCustomGrouper( iTestGrouper );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() == iModifiableItems.Count() );
-
-// 0 groups
- iTestGrouper1->iGroupCount = 0;
- iListModel->SetCustomGrouper( iTestGrouper1 );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() == iModifiableItems.Count() );
-
-// No grouping
- iListModel->SetCustomGrouper( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-// Music album grouping
- iListModel->SetGroupingStyle( ECLFMusicAlbumGrouping );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() != iItemCount );
-// No grouping
- iListModel->SetGroupingStyle( ECLFNoGrouping );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-
-// test parameters
- iTestGrouper->iGroupCount = 1000;
- iListModel->SetCustomGrouper( iTestGrouper );
- iListModel->RefreshL( ECLFRefreshPostFilter );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
- iListModel->RefreshL( ECLFRefreshSorting );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
- iListModel->RefreshL( ECLFRefreshGrouping );
- EUNIT_ASSERT( iListModel->ItemCount() == iModifiableItems.Count() );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetPostFilterTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetPostFilterTestL()
- {
-// no filter
- iListModel->SetPostFilter( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-
-// filter couple items
- iListModel->SetPostFilter( iTestFilter );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter->iFilteredCount ) == iItemCount );
-
-// filter all items
- iListModel->SetPostFilter( iTestFilter1 );
- iTestFilter1->iAllFilter = ETrue;
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount );
-
-// no filter
- iListModel->SetPostFilter( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
-
-// filter one item
- iListModel->SetPostFilter( iTestFilter );
- iTestFilter->iShouldFilterCount = 1;
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter->iFilteredCount ) == iItemCount );
-
-// filter couple items
- iListModel->SetPostFilter( iTestFilter1 );
- iTestFilter1->iAllFilter = EFalse;
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount );
-
-// test parameters
- iListModel->SetPostFilter( NULL );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
- iListModel->SetPostFilter( iTestFilter1 );
- iTestFilter1->iAllFilter = ETrue;
- iListModel->RefreshL( ECLFRefreshSorting );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
- iListModel->RefreshL( ECLFRefreshGrouping );
- EUNIT_ASSERT( iListModel->ItemCount() == iItemCount );
- iListModel->RefreshL( ECLFRefreshPostFilter );
- EUNIT_ASSERT( ( iListModel->ItemCount() + iTestFilter1->iFilteredCount ) == iItemCount );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetWantedMimeTypesTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetWantedMimeTypesTestL()
- {
- iTestObserver->iWait = &iWait;
-
-// list not defined (mimetype)
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// couple mime types
- iMimeTypeArray->Reset();
- iMimeTypeArray->AppendL( _L( "audio/mpeg" ) );
- iMimeTypeArray->AppendL( _L( "audio/aac" ) );
- iMimeTypeArray->AppendL( _L( "audio/mp3" ) );
- iMimeTypeArray->AppendL( _L( "audio/x-mp3" ) );
- iMimeTypeArray->AppendL( _L( "audio/mp4" ) );
- iMimeTypeArray->AppendL( _L( "audio/3gpp" ) );
- iMimeTypeArray->AppendL( _L( "audio/m4a" ) );
- iMimeTypeArray->AppendL( _L( "audio/3gpp2" ) );
- iMimeTypeArray->AppendL( _L( "audio/mpeg4") );
- iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// unsupported mimetype
- iMimeTypeArray1->Reset();
- iMimeTypeArray1->AppendL( _L("ei tämmöstä ees pitäis olla") );
- iListModel->SetWantedMimeTypesL( *iMimeTypeArray1 );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// empty mimetype list
- iMimeTypeArray1->Reset();
- iListModel->SetWantedMimeTypesL( *iMimeTypeArray1 );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// from resource (mimetype)
- iMimeTypeArray->Reset();
- iMimeTypeArray->AppendL( _L("image/*") );
- iMimeTypeArray->AppendL( _L("audio/*") );
-
- ResourceL( R_MIME_TYPE_ARRAY );
- iListModel->SetWantedMimeTypesL( iResourceReader );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
- ResourceL( R_MIME_TYPE_ARRAY_EMPTY );
- iListModel->SetWantedMimeTypesL( iResourceReader );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// incorrect resource version
- ResourceL( R_MIME_TYPE_ARRAY_INCORRECT_VERSION );
- EUNIT_ASSERT_SPECIFIC_LEAVE( iListModel->SetWantedMimeTypesL( iResourceReader ), KErrNotSupported );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetWantedMediaTypesTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetWantedMediaTypesTestL()
- {
- iTestObserver->iWait = &iWait;
-
-// list not defined (mediatype)
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// couple media types
- iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
- iMediaTypeArray.AppendL( ECLFMediaTypeImage );
- iMediaTypeArray.AppendL( ECLFMediaTypeSound );
- iMediaTypeArray.AppendL( ECLFMediaTypeMusic );
- iMediaTypeArray.AppendL( ECLFMediaTypeStreamingURL );
- iMediaTypeArray.AppendL( ECLFMediaTypePlaylist );
- iMediaTypeArray.AppendL( TCLFMediaType( ECLFMediaTypeCollection ) );
-
- iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// empty media type list list
- iListModel->SetWantedMediaTypesL( iMediaTypeArray1.Array() );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// media type list from resource
- iMediaTypeArray.Reset();
- iMediaTypeArray.AppendL( ECLFMediaTypeImage );
- iMediaTypeArray.AppendL( TCLFMediaType( ECLFMediaTypeCollection ) );
- ResourceL( R_MEDIA_TYPE_ARRAY );
- iListModel->SetWantedMediaTypesL( iResourceReader );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// empty media type list from resource
- ResourceL( R_MEDIA_TYPE_ARRAY_EMPTY );
- iListModel->SetWantedMediaTypesL( iResourceReader );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SetWantedMediaAndMimeTypesTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SetWantedMediaAndMimeTypesTestL()
- {
- iTestObserver->iWait = &iWait;
-
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
-
-// couple types
- iMimeTypeArray->AppendL( _L( "audio/mpeg" ) );
- iMimeTypeArray->AppendL( _L( "audio/aac" ) );
- iMimeTypeArray->AppendL( _L( "audio/mp3" ) );
- iMimeTypeArray->AppendL( _L( "audio/x-mp3" ) );
- iMimeTypeArray->AppendL( _L( "audio/mp4" ) );
- iMimeTypeArray->AppendL( _L( "audio/3gpp" ) );
- iMimeTypeArray->AppendL( _L( "audio/m4a" ) );
- iMimeTypeArray->AppendL( _L( "audio/3gpp2" ) );
- iMimeTypeArray->AppendL( _L( "audio/mpeg4") );
- iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-
- iMediaTypeArray.AppendL( ECLFMediaTypeVideo );
- iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// refresh again
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( CheckFileTypesL( *iMimeTypeArray, iMediaTypeArray.Array() ) );
-
-// empty lists
- iMediaTypeArray.Reset();
- iMimeTypeArray->Reset();
- iListModel->SetWantedMediaTypesL( iMediaTypeArray.Array() );
- iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
- iListModel->RefreshL();
- iWait.Start();
- EUNIT_ASSERT( iListModel->ItemCount() == 0 );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MultibleSortingTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::MultibleSortingTestL()
- {
-
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( CheckMultibleSortingShortingL() );
-
-// resort
-
- iSortingStyle->ResetL();
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
- iSortingStyle->AddFieldL( KMultibleSortingTestField6 );
- iSortingStyle->AddFieldL( KMultibleSortingTestField5 );
- iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
- iListModel->SetSortingStyle( iSortingStyle );
- iListModel->RefreshL( ECLFRefreshAll );
- EUNIT_ASSERT( CheckMultibleSortingShorting2L() );
-
- }
-
-/*
-* Test model item(s) obsolate functionality
-*/
-
-// ---------------------------------------------------------------------------
-// ModelItemsChangedTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ModelItemsChangedTestL()
- {
- const TInt newFileNumber( 10 );
-
-// create test files
- CreateNewFileL( 0, iFileName );
- CreateNewFileL( 1, iFileName );
- CreateNewFileL( 2, iFileName );
- CreateNewFileL( newFileNumber, iFileName );
- User::LeaveIfError( iFs.Delete( iFileName ) );
-
-// update server
-// to avoid incorrect test result
- CreateNewFileL( 0, iFileName );
- iEngine->UpdateItemsL();
-
-// create list model with all files
- iMimeTypeArray->Reset();
- iMimeTypeArray->AppendL( _L("*") );
- iListModel->SetWantedMimeTypesL( *iMimeTypeArray );
-
- iTestObserver->iWait = &iWait;
- iTestObserver->iError = 100;
- iListModel->RefreshL();
- iWait.Start(); // wait until model is refreshed
- EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
- EUNIT_ASSERT( iTestObserver->iError == KErrNone );
- EUNIT_ASSERT( iListModel->ItemCount() > 0 );
-
- const TInt listModelItemCount( iListModel->ItemCount() );
- const TCLFItemId testId( FindTestFileIdL( 0 ) );
-
-// test with modified item
- CreateNewFileL( 0, iFileName );
- iEngine->UpdateItemsL();
- iWait.Start(); // wait until model outdated event is received
-
- EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFModelOutdated );
- EUNIT_ASSERT( iTestObserver->iError == KErrNone );
- EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount );
- EUNIT_ASSERT( NULL != FindItem( *iListModel, testId ) );
-
- iTestObserver->iError = 100;
- iListModel->RefreshL();
- iWait.Start(); // wait until model is refreshed
- EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
- EUNIT_ASSERT( iTestObserver->iError == KErrNone );
- EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount );
- EUNIT_ASSERT( NULL != FindItem( *iListModel, testId ) );
-
-// test with new item
- CreateNewFileL( newFileNumber, iFileName );
- iEngine->UpdateItemsL();
- iWait.Start(); // wait until model outdated event is received
-
- EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFModelOutdated );
- EUNIT_ASSERT( iTestObserver->iError == KErrNone );
- EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount );
-
- iTestObserver->iError = 100;
- iListModel->RefreshL();
- iWait.Start(); // wait until model is refreshed
- EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
- EUNIT_ASSERT( iTestObserver->iError == KErrNone );
- EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount + 1 );
-
-// delete file
- User::LeaveIfError( iFs.Delete( iFileName ) );
- iEngine->UpdateItemsL();
- iWait.Start(); // wait until model outdated event is received
-
- EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFModelOutdated );
- EUNIT_ASSERT( iTestObserver->iError == KErrNone );
- EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount + 1 );
-
- iTestObserver->iError = 100;
- iListModel->RefreshL();
- iWait.Start(); // wait until model is refreshed
- EUNIT_ASSERT( iTestObserver->iOperationEvent == ECLFRefreshComplete );
- EUNIT_ASSERT( iTestObserver->iError == KErrNone );
- EUNIT_ASSERT( iListModel->ItemCount() == listModelItemCount );
- }
-
-/**
- * Tests, Modifiable item
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::MIFieldTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::MIFieldTestL()
- {
- const TUint KTestField1 = 1;
- const TUint KTestField2 = 112312312;
- const TUint KTestField3 = 13333;
- const TUint KTestFieldIncorrect = 2;
-
- TTime time( 100 );
- TInt32 integer( 12 );
- TBuf<30> data( _L("data") );
- iModifiableItem->AddFieldL( KTestField1, time );
- iModifiableItem->AddFieldL( KTestField2, integer );
- iModifiableItem->AddFieldL( KTestField3, data );
-
-// data type test
- EUNIT_ASSERT( iModifiableItem->DataType(
- KTestField1 ) == ECLFItemDataTypeTTime );
- EUNIT_ASSERT( iModifiableItem->DataType(
- KTestField2 ) == ECLFItemDataTypeTInt32 );
- EUNIT_ASSERT( iModifiableItem->DataType(
- KTestField3 ) == ECLFItemDataTypeDesC );
- EUNIT_ASSERT( iModifiableItem->DataType(
- KTestFieldIncorrect ) == ECLFItemDataTypeNull );
- EUNIT_ASSERT( iModifiableItem->DataType(
- ECLFFieldIdNull ) == ECLFItemDataTypeNull );
-
-// get field
- TTime time1( 0 );
- TInt32 integer1( 0 );
- TPtrC ptr;
- EUNIT_ASSERT( KErrNone == iModifiableItem->GetField(
- KTestField1, time1 ) );
- EUNIT_ASSERT( time == time1 );
- EUNIT_ASSERT( KErrNone == iModifiableItem->GetField(
- KTestField2, integer1 ) );
- EUNIT_ASSERT( integer == integer1 );
- EUNIT_ASSERT( KErrNone == iModifiableItem->GetField(
- KTestField3, ptr ) );
- EUNIT_ASSERT( data == ptr );
-
-// incorrect field id
- EUNIT_ASSERT( KErrNotFound == iModifiableItem->GetField(
- KTestFieldIncorrect, ptr ) );
- EUNIT_ASSERT( KErrNotFound == iModifiableItem->GetField(
- KTestFieldIncorrect, integer1 ) );
- EUNIT_ASSERT( KErrNotFound == iModifiableItem->GetField(
- KTestFieldIncorrect, time1 ) );
-
-// incorrect field type
- EUNIT_ASSERT( KErrNotSupported == iModifiableItem->GetField(
- KTestField1, ptr ) );
- EUNIT_ASSERT( KErrNotSupported == iModifiableItem->GetField(
- KTestField3, integer1 ) );
- EUNIT_ASSERT( KErrNotSupported == iModifiableItem->GetField(
- KTestField2, time1 ) );
-
-
- EUNIT_ASSERT( iModifiableItem->ItemId() == 0 );
- }
-
-/**
- * Tests, item
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::ItemFieldTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::ItemFieldTestL()
- {
-// data type test
- EUNIT_ASSERT( iItem->DataType(
- ECLFFieldIdFileDate ) == ECLFItemDataTypeTTime );
- EUNIT_ASSERT( iItem->DataType(
- ECLFFieldIdFileSize ) == ECLFItemDataTypeTInt32 );
- EUNIT_ASSERT( iItem->DataType(
- ECLFFieldIdFileNameAndPath ) == ECLFItemDataTypeDesC );
- EUNIT_ASSERT( iItem->DataType(
- ECLFFieldIdNull ) == ECLFItemDataTypeNull );
-
-// get field
- TTime time1( 0 );
- TInt32 integer1( 0 );
- TPtrC ptr;
- TEntry entry;
- User::LeaveIfError( iFs.Entry( iFileName, entry ) );
-
- EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileDate, time1 ) );
- EUNIT_ASSERT( entry.iModified == time1 );
- EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileSize, integer1 ) );
- EUNIT_ASSERT( entry.iSize == integer1 );
- EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileNameAndPath, ptr ) );
- EUNIT_ASSERT( iFileName == ptr );
-
- TParsePtrC parse( iFileName );
-
- EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileExtension, ptr ) );
- EUNIT_ASSERT( parse.Ext() == ptr );
-
- EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdFileName, ptr ) );
- EUNIT_ASSERT( parse.Name() == ptr );
-
- EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdPath, ptr ) );
- EUNIT_ASSERT( parse.Path() == ptr );
-
- EUNIT_ASSERT( KErrNone == iItem->GetField( ECLFFieldIdDrive, ptr ) );
- EUNIT_ASSERT( parse.Drive() == ptr );
-
-
-// incorrect field id
- EUNIT_ASSERT( KErrNotFound == iItem->GetField(
- ECLFFieldIdNull, ptr ) );
- EUNIT_ASSERT( KErrNotFound == iItem->GetField(
- ECLFFieldIdNull, integer1 ) );
- EUNIT_ASSERT( KErrNotFound == iItem->GetField(
- ECLFFieldIdNull, time1 ) );
-
-// incorrect field type
- EUNIT_ASSERT( KErrNotSupported == iItem->GetField(
- ECLFFieldIdFileSize, ptr ) );
- EUNIT_ASSERT( KErrNotSupported == iItem->GetField(
- ECLFFieldIdFileDate, integer1 ) );
- EUNIT_ASSERT( KErrNotSupported == iItem->GetField(
- ECLFFieldIdFileNameAndPath, time1 ) );
-
-
- EUNIT_ASSERT( iItem->ItemId() != 0 );
- }
-
-/**
- * Tests, Sorting style
- */
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleResourceTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleResourceTestL()
- {
- const TInt KArray1IdCount( 4 );
- const TInt KArray2IdCount( 1 );
-
-
- RArray<TCLFItemId> itemIdArray;
- CleanupClosePushL( itemIdArray );
-
- EUNIT_ASSERT( iSortingStyle->Ordering() == ECLFOrderingAscending );
- EUNIT_ASSERT( iSortingStyle1->Ordering() == ECLFOrderingDescending );
- EUNIT_ASSERT( iSortingStyle2->Ordering() == ECLFOrderingDescending );
- EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeTInt32 );
- EUNIT_ASSERT( iSortingStyle1->SortingDataType() == ECLFItemDataTypeDesC );
- EUNIT_ASSERT( iSortingStyle2->SortingDataType() == ECLFItemDataTypeDesC );
-
- iSortingStyle->GetFieldsL( itemIdArray );
-
- EUNIT_ASSERT( itemIdArray.Count() == 0 );
-
- itemIdArray.Reset();
- iSortingStyle1->GetFieldsL( itemIdArray );
-
- EUNIT_ASSERT( itemIdArray.Count() == KArray1IdCount );
-
- itemIdArray.Reset();
- iSortingStyle2->GetFieldsL( itemIdArray );
-
- EUNIT_ASSERT( itemIdArray.Count() == KArray2IdCount );
-
- CleanupStack::PopAndDestroy( &itemIdArray ); // itemIdArray.Close
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleOrderingTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleOrderingTestL()
- {
- iSortingStyle->SetOrdering( ECLFOrderingAscending );
- EUNIT_ASSERT( iSortingStyle->Ordering() == ECLFOrderingAscending );
- iSortingStyle->SetOrdering( ECLFOrderingDescending );
- EUNIT_ASSERT( iSortingStyle->Ordering() == ECLFOrderingDescending );
- iSortingStyle->SetOrdering( ECLFOrderingAscending );
- EUNIT_ASSERT( iSortingStyle->Ordering() == ECLFOrderingAscending );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleDataTypeTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleDataTypeTestL()
- {
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
- EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeTInt32 );
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeDesC );
- EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeDesC );
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeTTime );
- EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeTTime );
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeNull );
- EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeNull );
- iSortingStyle->SetSortingDataType( ECLFItemDataTypeTInt32 );
- EUNIT_ASSERT( iSortingStyle->SortingDataType() == ECLFItemDataTypeTInt32 );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleUndefinedItemPositionTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleUndefinedItemPositionTestL()
- {
- iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
- EUNIT_ASSERT( iSortingStyle->UndefinedItemPosition() == ECLFSortingStyleUndefinedEnd );
- iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedFirst );
- EUNIT_ASSERT( iSortingStyle->UndefinedItemPosition() == ECLFSortingStyleUndefinedFirst );
- iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
- EUNIT_ASSERT( iSortingStyle->UndefinedItemPosition() == ECLFSortingStyleUndefinedEnd );
- }
-
-// ---------------------------------------------------------------------------
-// T_CLFApiModuleTests::SortingStyleFieldTestL
-// ---------------------------------------------------------------------------
-//
-void T_CLFApiModuleTests::SortingStyleFieldTestL()
- {
- RArray<TCLFItemId> itemIdArray;
- CleanupClosePushL( itemIdArray );
-
- iSortingStyle->GetFieldsL( itemIdArray );
- EUNIT_ASSERT( itemIdArray.Count() == 0 );
-
- iSortingStyle->AddFieldL( ECLFFieldIdFileName );
- iSortingStyle->AddFieldL( ECLFFieldIdCollectionId );
- iSortingStyle->AddFieldL( ECLFFieldIdCollectionName );
- iSortingStyle->AddFieldL( ECLFFieldIdArtist );
-
- iSortingStyle->GetFieldsL( itemIdArray );
-
- EUNIT_ASSERT( itemIdArray.Count() == 4 );
-
- itemIdArray.Reset();
- iSortingStyle->ResetL();
- iSortingStyle->GetFieldsL( itemIdArray );
- EUNIT_ASSERT( itemIdArray.Count() == 0 );
-
- CleanupStack::PopAndDestroy( &itemIdArray ); // itemIdArray.Close
- }
-
-// ---------------------------------------------------------------------------
-// Test case table for this test suite class
-// ---------------------------------------------------------------------------
-//
-
-EUNIT_BEGIN_TEST_TABLE( T_CLFApiModuleTests, "T_CLFApiModuleTests", "MODULE" )
-
-// Constructor tests
- EUNIT_TEST( "Create engine",
- "",
- "",
- "FUNCTIONALITY",
- BaseSetupL,
- CreateEngineTestL,
- Teardown )
-
- EUNIT_TEST( "Create modifiable item",
- "",
- "",
- "FUNCTIONALITY",
- BaseSetupL,
- CreateModifiableItemTestL,
- Teardown )
-
- EUNIT_TEST( "Create sorting style",
- "",
- "",
- "FUNCTIONALITY",
- BaseSetupL,
- CreateSortignStyleTestL,
- Teardown )
-
- EUNIT_TEST( "Create sorting style from resource",
- "",
- "",
- "FUNCTIONALITY",
- SortingStyleResourceSetupL,
- CreateSortignStyleFromResourceTestL,
- Teardown )
-
- EUNIT_TEST( "Create list model",
- "",
- "",
- "FUNCTIONALITY",
- CreateModelSetupL,
- CreateListModelTestL,
- Teardown )
-
- EUNIT_TEST( "Create list model from resource",
- "",
- "",
- "FUNCTIONALITY",
- CreateModelFromResourceSetupL,
- CreateListModelFromResourceTestL,
- Teardown )
-
-// Engine tests
-
- EUNIT_TEST( "Engine update test",
- "",
- "",
- "FUNCTIONALITY",
- EngineTestSetupL,
- UpdateItemsTestL,
- Teardown )
-
- EUNIT_TEST( "Engine update test",
- "",
- "",
- "FUNCTIONALITY",
- EngineTestSetupL,
- UpdateItemsWithIdTestL,
- Teardown )
-
- EUNIT_TEST( "Engine update test",
- "",
- "",
- "FUNCTIONALITY",
- EngineTestSetupL,
- UpdateItemsWithOpaqueDataFolderTestL,
- Teardown )
-
-// Sorting Style tests
- EUNIT_TEST( "Sorting style from resource",
- "",
- "",
- "FUNCTIONALITY",
- SortingStyleResourceTestSetupL,
- SortingStyleResourceTestL,
- Teardown )
-
- EUNIT_TEST( "Sorting style ordering test",
- "",
- "",
- "FUNCTIONALITY",
- SortingStyleTestSetupL,
- SortingStyleOrderingTestL,
- Teardown )
-
- EUNIT_TEST( "Sorting style data type test",
- "",
- "",
- "FUNCTIONALITY",
- SortingStyleTestSetupL,
- SortingStyleDataTypeTestL,
- Teardown )
-
- EUNIT_TEST( "Sorting style undefined item position test",
- "",
- "",
- "FUNCTIONALITY",
- SortingStyleTestSetupL,
- SortingStyleUndefinedItemPositionTestL,
- Teardown )
-
- EUNIT_TEST( "Sorting style field test",
- "",
- "",
- "FUNCTIONALITY",
- SortingStyleTestSetupL,
- SortingStyleFieldTestL,
- Teardown )
-
-// List model tests
- EUNIT_TEST( "List model refresh test",
- "",
- "",
- "FUNCTIONALITY",
- ListModelSetupL,
- RefreshTestL,
- Teardown )
-
- EUNIT_TEST( "List model sorting style test",
- "",
- "",
- "FUNCTIONALITY",
- ListModelAllFileItemsSetupL,
- SetSortingStyleTestL,
- Teardown )
-
- EUNIT_TEST( "List model custom sorter test",
- "",
- "",
- "FUNCTIONALITY",
- ListModelAllFileItemsSetupL,
- SetCustomSorterTestL,
- Teardown )
-
- EUNIT_TEST( "List model grouping test",
- "",
- "",
- "FUNCTIONALITY",
- ListModelAllFileItemsSetupL,
- GroupingTestL,
- Teardown )
-
- EUNIT_TEST( "List model post filter test",
- "",
- "",
- "FUNCTIONALITY",
- ListModelAllFileItemsSetupL,
- SetPostFilterTestL,
- Teardown )
-
- EUNIT_TEST( "List model wanted mime types test",
- "",
- "",
- "FUNCTIONALITY",
- ListModelSetupL,
- SetWantedMimeTypesTestL,
- Teardown )
-
- EUNIT_TEST( "List model wanted media types test",
- "",
- "",
- "FUNCTIONALITY",
- ListModelSetupL,
- SetWantedMediaTypesTestL,
- Teardown )
-
- EUNIT_TEST( "List model wanted media and mime types",
- "",
- "",
- "FUNCTIONALITY",
- ListModelSetupL,
- SetWantedMediaAndMimeTypesTestL,
- Teardown )
-
- EUNIT_TEST( "List model multible sorters",
- "",
- "",
- "FUNCTIONALITY",
- MultibleSortingSetupL,
- MultibleSortingTestL,
- Teardown )
-
- EUNIT_TEST( "List model multible sorters",
- "",
- "",
- "FUNCTIONALITY",
- MultibleSortingResourceSetupL,
- MultibleSortingTestL,
- Teardown )
-
- EUNIT_TEST( "List model changed items",
- "",
- "",
- "FUNCTIONALITY",
- ListModelSetupL,
- ModelItemsChangedTestL,
- Teardown )
-
-
-// Modifiable item tests
- EUNIT_TEST( "Modifiable item test",
- "",
- "",
- "FUNCTIONALITY",
- ModifiableItemTestSetupL,
- MIFieldTestL,
- Teardown )
-
-// Item tests
- EUNIT_TEST( "Item test",
- "",
- "",
- "FUNCTIONALITY",
- ItemTestSetupL,
- ItemFieldTestL,
- Teardown )
-
-
-EUNIT_END_TEST_TABLE
-
-// End of File
--- a/mds_pub/content_listing_framework_api/tsrc/src/T_ContentListingFramework.rss Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
-* Copyright (c) 2002-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:
-*
-*/
-
-
-
-// RESOURCE IDENTIFIER
-NAME CLFT
-
-// INCLUDES
-#include <eikon.rh>
-#include <PathConfiguration.hrh>
-#include <CLFContentListing.rh>
-#include <CLFContentListing.hrh>
-#include <CLFContentListingExtended.hrh>
-
-// CONSTANTS
-// MACROS
-
-// RESOURCE DEFINITIONS
-// -----------------------------------------------------------------------------
-//
-// ?resource_name
-// ?description
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE { signature = 0; }
-
-// -----------------------------------------------------------------------------
-//
-// ?resource_name
-// ?description
-//
-// -----------------------------------------------------------------------------
-//
-RESOURCE CLF_SORTING_STYLE r_sorting_style
- {
- ordering = ECLFOrderingDescending;
- data_type = ECLFItemDataTypeDesC;
- fields =
- {
- CLF_FIELD_ID { field_id = ECLFFieldIdFileName; },
- CLF_FIELD_ID { field_id = ECLFFieldIdCollectionName; },
- CLF_FIELD_ID { field_id = ECLFFieldIdMimeType; },
- CLF_FIELD_ID { field_id = ECLFFieldIdArtist; }
- };
- }
-
-RESOURCE CLF_SORTING_STYLE r_sorting_style_empty
- {
- ordering = ECLFOrderingAscending;
- data_type = ECLFItemDataTypeTInt32;
- fields =
- {
- };
- }
-
-RESOURCE CLF_SORTING_STYLE r_sorting_style_undefineditem
- {
- ordering = ECLFOrderingDescending;
- data_type = ECLFItemDataTypeDesC;
- undefined_item_position = ECLFSortingStyleUndefinedFirst;
- fields =
- {
- CLF_FIELD_ID { field_id = ECLFFieldIdArtist; }
- };
- }
-
-RESOURCE CLF_LIST_MODEL r_list_model
- {
- mime_type_array = CLF_MIME_TYPE_ARRAY
- {
- mime_types =
- {
- LBUF { txt = "image/*"; }
- };
- };
- media_type_array = CLF_MEDIA_TYPE_ARRAY
- {
- media_types =
- {
- CLF_MEDIA_TYPE { media_type = ECLFMediaTypeCollection; }
- };
- };
- sorting_style = CLF_SORTING_STYLE
- {
- ordering = ECLFOrderingAscending;
- data_type = ECLFItemDataTypeDesC;
- fields =
- {
- CLF_FIELD_ID { field_id = ECLFFieldIdFileName; },
- CLF_FIELD_ID { field_id = ECLFFieldIdCollectionName; },
- CLF_FIELD_ID { field_id = ECLFFieldIdAlbum; }
- };
- };
- }
-
-RESOURCE CLF_LIST_MODEL r_list_model_incorrect_version
- {
- version = 88;
- mime_type_array = CLF_MIME_TYPE_ARRAY
- {
- mime_types =
- {
- };
- };
- media_type_array = CLF_MEDIA_TYPE_ARRAY
- {
- media_types =
- {
- };
- };
- sorting_style = CLF_SORTING_STYLE
- {
- ordering = ECLFOrderingAscending;
- data_type = ECLFItemDataTypeDesC;
- fields =
- {
- };
- };
- }
-
-
-RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array
- {
- mime_types =
- {
- LBUF { txt = "image/*"; },
- LBUF { txt = "audio/*"; }
- };
- }
-
-RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array_empty
- {
- mime_types =
- {
- };
- }
-
-RESOURCE CLF_MIME_TYPE_ARRAY r_mime_type_array_incorrect_version
- {
- version = 88;
- mime_types =
- {
- };
- }
-
-RESOURCE CLF_MEDIA_TYPE_ARRAY r_media_type_array
- {
- media_types =
- {
- CLF_MEDIA_TYPE { media_type = ECLFMediaTypeImage; },
- CLF_MEDIA_TYPE { media_type = ECLFMediaTypeCollection; }
- };
- }
-
-RESOURCE CLF_MEDIA_TYPE_ARRAY r_media_type_array_empty
- {
- media_types =
- {
- };
- }
-
-RESOURCE CLF_LIST_MODEL_V2 r_list_model_multible
- {
- mime_type_array = CLF_MIME_TYPE_ARRAY
- {
- mime_types =
- {
- };
- };
- media_type_array = CLF_MEDIA_TYPE_ARRAY
- {
- media_types =
- {
- };
- };
- sorting_style_array =
- {
- CLF_SORTING_STYLE
- {
- ordering = ECLFOrderingAscending;
- data_type = ECLFItemDataTypeTInt32;
- undefined_item_position = ECLFSortingStyleUndefinedFirst;
- fields =
- {
- CLF_FIELD_ID { field_id = 0x80000001; }
- };
- },
- CLF_SORTING_STYLE
- {
- ordering = ECLFOrderingDescending;
- data_type = ECLFItemDataTypeTInt32;
- undefined_item_position = ECLFSortingStyleUndefinedEnd;
- fields =
- {
- CLF_FIELD_ID { field_id = 0x80000002; }
- };
- },
- CLF_SORTING_STYLE
- {
- ordering = ECLFOrderingAscending;
- data_type = ECLFItemDataTypeTInt32;
- undefined_item_position = ECLFSortingStyleUndefinedEnd;
- fields =
- {
- CLF_FIELD_ID { field_id = 0x80000003; },
- CLF_FIELD_ID { field_id = 0x80000004; }
- };
- },
- CLF_SORTING_STYLE
- {
- ordering = ECLFOrderingAscending;
- data_type = ECLFItemDataTypeTInt32;
- undefined_item_position = ECLFSortingStyleUndefinedFirst;
- fields =
- {
- CLF_FIELD_ID { field_id = 0x80000005; }
- };
- }
- };
- }
-
-
-// End of File
-
-
--- a/metadataengine/client/group/mdeclient.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/group/mdeclient.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -85,5 +85,3 @@
DEBUGLIBRARY flogger.lib
-
-
--- a/metadataengine/client/inc/mdenotifierao.h Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/inc/mdenotifierao.h Fri Apr 16 15:23:55 2010 +0300
@@ -131,6 +131,7 @@
void DoNotifyObserver();
void DecodeIdBufferL();
+ void DecodeDataBufferL();
void DecodeRelationItemBufferL();
private: // Data
@@ -156,6 +157,8 @@
CMdCSerializationBuffer* iDataBuffer;
RArray<TItemId> iIdArray;
+
+ RPointerArray<HBufC> iUriArray;
RArray<TMdERelation> iRelationItemArray;
};
--- a/metadataengine/client/inc/mdesessionimpl.h Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/inc/mdesessionimpl.h Fri Apr 16 15:23:55 2010 +0300
@@ -517,6 +517,15 @@
*/
void NotifyError(TInt aError);
+ /* From MdESession. */
+ void AddObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver,
+ CMdELogicCondition* aCondition,
+ TUint32 aNotificationType,
+ CMdENamespaceDef* aNamespaceDef );
+
+ /* From MdESession. */
+ void RemoveObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver,
+ CMdENamespaceDef* aNamespaceDef );
protected:
/*
--- a/metadataengine/client/src/mdeharvestersession.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/src/mdeharvestersession.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -139,7 +139,7 @@
TInt urisSize = CMdCSerializationBuffer::KRequiredSizeForTUint32;
WRITELOG( "CMdEHarvesterSession::SetFilesToPresentL -- Loop urisSize" );
- for( TInt i = 0; i < fileCount; i++ )
+ for( TInt i = fileCount - 1; i >=0; i-- )
{
urisSize += CMdCSerializationBuffer::RequiredSize( aUris[i] );
}
@@ -298,9 +298,7 @@
EXPORT_C void CMdEHarvesterSession::AutoLockL(
RPointerArray<CMdEObject>& aObjects )
{
- const TInt objectCount = aObjects.Count();
-
- for( TInt i = 0; i < objectCount; i++ )
+ for( TInt i = aObjects.Count() - 1; i >=0; i-- )
{
aObjects[i]->AutoLockL();
}
--- a/metadataengine/client/src/mdelogiccondition.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/src/mdelogiccondition.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -111,10 +111,8 @@
// Base class locking.
CMdECondition::SetLocked(aLocked);
- const TInt count = iChildren.Count();
-
// Lock children as well.
- for(TInt i = 0; i < count; ++i)
+ for( TInt i = iChildren.Count()- 1; i >=0; i-- )
{
iChildren[i]->SetLocked(aLocked);
}
@@ -122,10 +120,8 @@
TUint32 CMdELogicCondition::InternalQueryOptimizationFlags(TUint32& aFlags)
{
- const TInt count = iChildren.Count();
-
// get flag from childrens
- for( TInt i = 0 ; i < count; i++)
+ for( TInt i = iChildren.Count() - 1; i >=0; i-- )
{
iOptimizationFlags |= iChildren[i]->InternalQueryOptimizationFlags(aFlags);
}
@@ -144,7 +140,7 @@
bufferSize += count * CMdCSerializationBuffer::KRequiredSizeForTUint32;
// Required size for childrens
- for( TInt i = 0 ; i < count; i++)
+ for( TInt i = count - 1; i >=0; i-- )
{
bufferSize += iChildren[i]->RequiredBufferSize();
}
@@ -338,8 +334,8 @@
{
AssertNotLocked();
- CMdETextPropertyCondition* condition
- = CMdETextPropertyCondition::NewLC(aPropertyDef, aCompareMethod, aText);
+ CMdETextPropertyCondition* condition = CMdETextPropertyCondition::NewLC( aPropertyDef,
+ aCompareMethod, aText );
AddL(condition);
CleanupStack::Pop(condition);
return *condition;
--- a/metadataengine/client/src/mdenotifierao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/src/mdenotifierao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -165,8 +165,7 @@
iSession.DoListen( Id(), &iResultSize, iStatus ); // continue listening for events
SetActive();
}
- else if ( status & ( /*ERelationItemNotifyAdd | ERelationItemNotifyModify
- |*/ ERelationItemNotifyRemove ) ) // a relation was removed
+ else if ( status & ( ERelationItemNotifyRemove ) ) // a relation was removed
{
if( !iDataBuffer )
{
@@ -198,6 +197,33 @@
iSession.DoListen( Id(), &iResultSize, iStatus ); // continue listening for events
SetActive();
}
+ else if ( status & ( EObjectNotifyAddWithUri | EObjectNotifyModifyWithUri
+ | EObjectNotifyRemoveWithUri ) )
+ {
+ if( !iDataBuffer )
+ {
+ iDataBuffer = CMdCSerializationBuffer::NewL( iResultSize() );
+ }
+ else if( iDataBuffer->Buffer().MaxSize() < iResultSize() )
+ {
+ delete iDataBuffer;
+ iDataBuffer = NULL;
+ iDataBuffer = CMdCSerializationBuffer::NewL( iResultSize() );
+ }
+
+ if( iResultSize() )
+ {
+ iSession.DoGetDataL( *iDataBuffer, Id() ); // reads data to the buffer
+ DecodeDataBufferL(); // decodes ids and uri from the data buffer
+
+ delete iDataBuffer;
+ iDataBuffer = NULL;
+
+ DoNotifyObserver(); // notifies the observer about the event
+ }
+ iSession.DoListen( Id(), &iResultSize, iStatus ); // continue listening for events
+ SetActive();
+ }
}
else
{
@@ -327,7 +353,32 @@
obs->HandleSchemaModified();
break;
}
-
+
+ case EObjectNotifyAddWithUri:
+ {
+ MMdEObjectObserverWithUri* obs = static_cast<MMdEObjectObserverWithUri*>( iObserver );
+ obs->HandleUriObjectNotification( iSessionImpl, ENotifyAdd, iIdArray, iUriArray );
+ iUriArray.ResetAndDestroy();
+ iUriArray.Compress();
+ break;
+ }
+ case EObjectNotifyModifyWithUri:
+ {
+ MMdEObjectObserverWithUri* obs = static_cast<MMdEObjectObserverWithUri*>( iObserver );
+ obs->HandleUriObjectNotification( iSessionImpl, ENotifyModify, iIdArray, iUriArray );
+ iUriArray.ResetAndDestroy();
+ iUriArray.Compress();
+ break;
+ }
+ case EObjectNotifyRemoveWithUri:
+ {
+ MMdEObjectObserverWithUri* obs = static_cast<MMdEObjectObserverWithUri*>( iObserver );
+ obs->HandleUriObjectNotification( iSessionImpl, ENotifyRemove, iIdArray, iUriArray );
+ iUriArray.ResetAndDestroy();
+ iUriArray.Compress();
+ break;
+ }
+
default:
// no observer to call - this should be skipped on server side!
break;
@@ -356,6 +407,42 @@
}
}
+void CMdENotifierAO::DecodeDataBufferL()
+ {
+ iIdArray.Reset();
+ iUriArray.ResetAndDestroy();
+
+ iDataBuffer->PositionL( KNoOffset );
+
+ const TMdCItemIds& itemIds = TMdCItemIds::GetFromBufferL( *iDataBuffer );
+ __ASSERT_DEBUG( iNamespaceDefId == itemIds.iNamespaceDefId, User::Panic( _L("Incorrect namespaceDef from returned items!"), KErrCorrupt ) );
+
+ // Get IDs
+ iDataBuffer->PositionL( itemIds.iObjectIds.iPtr.iOffset );
+ iIdArray.ReserveL( itemIds.iObjectIds.iPtr.iCount );
+ for( TUint32 i = 0; i < itemIds.iObjectIds.iPtr.iCount; ++i )
+ {
+ TItemId id;
+ iDataBuffer->ReceiveL( id );
+ iIdArray.AppendL( id );
+ }
+
+ // Get uri count
+ TUint32 uriCount ( 0 );
+ iDataBuffer->ReceiveL( uriCount );
+
+ HBufC* uri = NULL;
+
+ for( TInt i( 0 ); i < uriCount; i++ )
+ {
+ //Get uri
+ uri = iDataBuffer->ReceiveDes16L();
+ CleanupStack::PushL( uri );
+ iUriArray.AppendL( uri );
+ CleanupStack::Pop( uri );
+ }
+ }
+
void CMdENotifierAO::DecodeRelationItemBufferL()
{
iRelationItemArray.Reset();
@@ -376,3 +463,4 @@
}
}
}
+
--- a/metadataengine/client/src/mdeobjectcondition.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/src/mdeobjectcondition.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -128,7 +128,7 @@
for( TInt i = 0; i < objectIdCount; i++ )
{
- iObjectIds->Append( (*aObjectIds)[i] );
+ iObjectIds->AppendL( (*aObjectIds)[i] );
}
}
else if ( aRange )
--- a/metadataengine/client/src/mdeobjectdef.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/src/mdeobjectdef.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -174,7 +174,7 @@
break;
}
- TInt compare( aId - iPropertyDefs[mid]->Id() );
+ const TInt compare( aId - iPropertyDefs[mid]->Id() );
if( compare == 0 )
{
return iPropertyDefs[mid];
--- a/metadataengine/client/src/mdequery.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/src/mdequery.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -47,10 +47,8 @@
// This will destroy the entire conditions tree.
delete iConditions;
- const TInt count = iResults.Count();
-
// Destroy all result items this query instance owns.
- for(TInt i = 0; i < count; ++i)
+ for( TInt i = iResults.Count() - 1; i >=0; i-- )
{
if(iResults[i].iOwned)
{
@@ -149,11 +147,9 @@
User::Leave(KErrNotReady);
}
- const TInt count = iResults.Count();
-
// clear old results
// Destroy all result items this query instance owns.
- for(TInt i = 0; i < count; ++i)
+ for( TInt i = iResults.Count() - 1; i >=0; i-- )
{
if(iResults[i].iOwned)
{
--- a/metadataengine/client/src/mdequerycriteriaserialization.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/src/mdequerycriteriaserialization.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -170,7 +170,7 @@
CMdCSerializationBuffer::KRequiredSizeForTUint32;
// Required size for order rules
- for( TInt i = 0; i < orderRuleCount; i++ )
+ for( TInt i = orderRuleCount - 1; i >=0; i-- )
{
criteriaBufferSize += aOrderRules[i].RequiredBufferSize();
}
--- a/metadataengine/client/src/mdesessionimpl.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/client/src/mdesessionimpl.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -2678,8 +2678,7 @@
TInt CMdESessionImpl::FindNotifier( TUint32 aNotifyType, TAny* aObserver,
CMdENamespaceDef& aNamespaceDef )
{
- const TInt notifiersCount = iNotifiers.Count();
- for( TInt i = 0; i < notifiersCount; ++i )
+ for( TInt i = iNotifiers.Count() - 1; i >=0; i-- )
{
if ( iNotifiers[i]->Match( aNotifyType, aObserver, aNamespaceDef ) )
{
@@ -2944,3 +2943,93 @@
return &GetDefaultNamespaceDefL();
}
}
+
+void CMdESessionImpl::AddObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver,
+ CMdELogicCondition* aCondition,
+ TUint32 aNotificationType,
+ CMdENamespaceDef* aNamespaceDef )
+ {
+ CleanupStack::PushL( aCondition );
+
+ // if condition is given, check that it is correct type
+ if( aCondition && ( EConditionTypeLogic != aCondition->Type() ) )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ // if namespace is not given get default namespace definition
+ CMdENamespaceDef* namespaceDef = NULL;
+ if ( !aNamespaceDef )
+ {
+ namespaceDef = &GetDefaultNamespaceDefL();
+ }
+ else
+ {
+ namespaceDef = aNamespaceDef;
+ }
+
+ TUint32 type = 0;
+ if ( aNotificationType & ENotifyAdd )
+ {
+ type |= EObjectNotifyAddWithUri;
+ }
+ if ( aNotificationType & ENotifyModify )
+ {
+ type |= EObjectNotifyModifyWithUri;
+ }
+ if ( aNotificationType & ENotifyRemove )
+ {
+ type |= EObjectNotifyRemoveWithUri;
+ }
+
+ TInt err = FindNotifier( type, &aObserver, *namespaceDef );
+
+ if ( err != KErrNotFound )
+ {
+ if ( err >= 0 )
+ {
+ err = KErrAlreadyExists;
+ }
+ User::LeaveIfError( err );
+ }
+
+ CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession );
+ notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef );
+
+ CleanupStack::Pop( notifier );
+ iNotifiers.Append( notifier );
+
+ CleanupStack::PopAndDestroy( aCondition );
+ }
+
+void CMdESessionImpl::RemoveObjectObserverWithUriL(
+ MMdEObjectObserverWithUri& aObserver, CMdENamespaceDef* aNamespaceDef )
+ {
+ // if namespace is not given get default namespace definition
+ CMdENamespaceDef* namespaceDef = NULL;
+ if ( !aNamespaceDef )
+ {
+ namespaceDef = &GetDefaultNamespaceDefL();
+ }
+ else
+ {
+ namespaceDef = aNamespaceDef;
+ }
+
+ const TInt index = FindNotifier(
+ EObjectNotifyAddWithUri | EObjectNotifyModifyWithUri | EObjectNotifyRemoveWithUri,
+ &aObserver, *namespaceDef );
+ if ( index != KErrNotFound )
+ {
+ iNotifiers[index]->Cancel();
+ delete iNotifiers[index];
+ iNotifiers[index] = NULL;
+ iNotifiers.Remove( index );
+ iNotifiers.Compress();
+ }
+ else
+ {
+ User::Leave( KErrNotFound );
+ }
+ }
+
--- a/metadataengine/common/src/mdcserializationbuffer.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/common/src/mdcserializationbuffer.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -992,7 +992,7 @@
#ifdef _DEBUG
// for testing initilize to 0x99
TUint8* ptr = (TUint8*)(iBuffer.Ptr());
- for(TInt32 i = 0; i < aSize; i++)
+ for( TInt32 i = aSize - 1; i >=0; i-- )
{
ptr[i] = 0x99;
}
--- a/metadataengine/server/group/mdsserver.mmp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/group/mdsserver.mmp Fri Apr 16 15:23:55 2010 +0300
@@ -99,3 +99,5 @@
OPTION ARMCC -O3 -OTime
+EPOCPROCESSPRIORITY background
+
--- a/metadataengine/server/inc/mdsmanipulationengine.h Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/inc/mdsmanipulationengine.h Fri Apr 16 15:23:55 2010 +0300
@@ -292,6 +292,14 @@
TInt GetPendingL( TDefId aObjectDefId, TInt aBufferSize,
RArray<TItemId>& aObjectIds );
+ /**
+ * Fetches object uris based on id array
+ * @param aObjectIds list of object ids.
+ * @param aObjectUris array for object uris.
+ */
+ void GetObjectUrisByIdsL( const RArray<TItemId>& aObjectIds,
+ RPointerArray<HBufC>& aUriArray );
+
protected:
TBool StartGarbageCollectionL();
--- a/metadataengine/server/inc/mdsnamespacedef.h Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/inc/mdsnamespacedef.h Fri Apr 16 15:23:55 2010 +0300
@@ -213,6 +213,10 @@
void MergeRelationsL( CMdsNamespaceDef* aNamespace, const TBool& aDryRun );
void MergeEventsL( CMdsNamespaceDef* aNamespace, const TBool& aDryRun );
+ static TInt CompareObjectDefId(const CMdsObjectDef& aFirst, const CMdsObjectDef& aSecond);
+ static TInt CompareEventDefId(const CMdsEventDef& aFirst, const CMdsEventDef& aSecond);
+ static TInt CompareRelationDefId(const CMdsRelationDef& aFirst, const CMdsRelationDef& aSecond);
+
private:
enum TNamespaceDefFlags
{
--- a/metadataengine/server/inc/mdsnotifier.h Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/inc/mdsnotifier.h Fri Apr 16 15:23:55 2010 +0300
@@ -27,6 +27,7 @@
class CMdSNotifyComparator;
class CMdSSchema;
class CMdCSerializationBuffer;
+class CMdSManipulationEngine;
/**
* A class that contains notification profiles for clients.
@@ -140,10 +141,12 @@
* Triggers the notifier causing the observer to be
* notifier with the given code.
* @param aCompleteCode either added/removed/modified
- * @param aItem the target of the event
+ * @param aIdArray ids of matching results
+ * @param aUriArray uris of matching results
*/
void TriggerL( TUint32 aCompleteCode,
- const RArray<TItemId>& aIdArray );
+ const RArray<TItemId>& aIdArray,
+ RPointerArray<HBufC>& aUriArray );
/**
* Triggers the notifier causing the observer to be
@@ -166,7 +169,9 @@
* The entry has currently no message active,
* wait until one is available.
*/
- void CacheL(TUint32 aCompleteCode, const RArray<TItemId>& aIdArray );
+ void CacheL(TUint32 aCompleteCode,
+ const RArray<TItemId>& aIdArray,
+ const RPointerArray<HBufC>& aUriArray);
/**
* The entry has currently no message active,
@@ -195,6 +200,15 @@
*/
CMdCSerializationBuffer* CopyToBufferL(
const RArray<TItemId>& aIdArray);
+
+ /**
+ * Copy all URIs from the array in to the buffer
+ *
+ * @param aUriArray URI array
+ * @return new buffer
+ */
+ CMdCSerializationBuffer* CopyToBufferL(const RArray<TItemId>& aIdArray,
+ const RPointerArray<HBufC>& aUriArray);
/**
* Copy matched relation IDs to a buffer
@@ -290,8 +304,10 @@
/**
* notifiers that items has been modified
* @param aObjectIds object IDs
+ * @param aMEngine pointer to manipulator class for utility functions
*/
- void NotifyModifiedL(const RArray<TItemId>& aObjectIds);
+ void NotifyModifiedL( const RArray<TItemId>& aObjectIds,
+ CMdSManipulationEngine* aMEngine );
/**
* notifiers that objects has been set to present or not present state
@@ -320,15 +336,21 @@
* Can be only used for default namespace.
*
* @param aItemIdArray modified item IDs
+ * @param aMEngine pointer to manipulator class for utility functions
*/
- void NotifyRemovedL(const RArray<TItemId>& aItemIdArray);
+ void NotifyRemovedL( const RArray<TItemId>& aItemIdArray,
+ CMdSManipulationEngine* aMEngine );
/**
* notifiers that items has been removed
* @param aSerializedItemIds serialized item IDs
* @param aItemIsConfidential are items confidential
+ * @param aRemovedItemUriArray uri array if uris are present
+ * @param aMEngine pointer to manipulator class for utility functions
*/
- void NotifyRemovedL(CMdCSerializationBuffer& aSerializedItemIds, TBool aItemIsConfidential );
+ void NotifyRemovedL(CMdCSerializationBuffer& aSerializedItemIds, TBool aItemIsConfidential,
+ RPointerArray<HBufC>& aRemovedItemUriArray,
+ CMdSManipulationEngine* aMEngine );
void NotifySchemaAddedL();
--- a/metadataengine/server/inc/mdsnotifycomparator.h Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/inc/mdsnotifycomparator.h Fri Apr 16 15:23:55 2010 +0300
@@ -60,6 +60,11 @@
* @param aSerializedItems the items to compare
* @param aSerializedItemIds the item IDs (successful and failed IDs)
* @param aMatchingItemIdArray matching object IDs
+ * @param aAllItemsIdArray array to store the ids if all matched
+ * @param aMatchingItemUriArray matching object URIs
+ * @param aAllItemsUriArray array to store the uris if all matched
+ * @param aAllMatched to determine if there is no specific conditions to match
+ * @param aAllUrisFetched to determine if all uris have been previously fetched
*
* @return If true at least some item matches.
*/
@@ -67,8 +72,14 @@
CMdCSerializationBuffer& aSerializedCondition,
CMdCSerializationBuffer& aSerializedItems,
CMdCSerializationBuffer& aSerializedItemIds,
- RArray<TItemId>& aMatchingItemIdArray,
- TBool aAllowConfidential);
+ RArray<TItemId>& aMatchingItemIdArray,
+ RArray<TItemId>& aAllItemsIdArray,
+ RPointerArray<HBufC>& aMatchingItemUriArray,
+ RPointerArray<HBufC>& aAllItemsUriArray,
+ TBool aAllowConfidential,
+ TBool uriNotify,
+ TBool& aAllMatched,
+ TBool& aAllUrisFetched);
/**
* Matches object against the given condition. This variant matches only
--- a/metadataengine/server/inc/mdsserver.h Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/inc/mdsserver.h Fri Apr 16 15:23:55 2010 +0300
@@ -151,6 +151,8 @@
TBool DiskFull() const;
TBool BackupOrRestoreRunning() const;
+
+ TBool ShutdownInProgress() const;
TInt SetHarvestingPrioritizationChunkL( const RMessagePtr2 aMessage, TInt aParam );
--- a/metadataengine/server/inc/mdssqlobjectmanipulate.h Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/inc/mdssqlobjectmanipulate.h Fri Apr 16 15:23:55 2010 +0300
@@ -215,25 +215,32 @@
* @param aBuffer id's to remove
* @param aCount id's count
* @param aIdArray result id's
- * @param aUserLevel not used - delete
- * @param aLockList list of locked objects
+ * @param aRelationIds result relation id's
+ * @param aEventIds result event id's
+ * @param aUrisRequired determines if uris are to be fetched
+ * @param aRemovedItemUriArray result uris
*/
void RemoveObjectsByIdL( CMdCSerializationBuffer& aBuffer, TInt aCount,
RArray<TItemId>& aIdArray, RArray<TItemId>& aRelationIds,
- RArray<TItemId>& aEventIds );
+ RArray<TItemId>& aEventIds,
+ TBool aUrisRequired,
+ RPointerArray<HBufC>& aRemovedItemUriArray);
/**
* Remove object using it's URI's
*
* @param aBuffer URI's to remove
* @param aCount URI's count
- * @param aIdArray result id's
- * @param aUserLevel not used - delete
- * @param aLockList list of locked objects
- */
+ * @param aIdArray result object id's
+ * @param aRelationIds result relation id's
+ * @param aEventIds result event id's
+ * @param aRemovedItemUriArray result uris
+ */
void RemoveObjectsByUriL( CMdCSerializationBuffer& aBuffer, TInt aCount,
RArray<TItemId>& aIdArray, RArray<TItemId>& aRelationIds,
- RArray<TItemId>& aEventIds );
+ RArray<TItemId>& aEventIds,
+ TBool aUrisRequired,
+ RPointerArray<HBufC>& aRemovedItemUriArray );
/**
* search for object uri
@@ -244,6 +251,15 @@
*/
TItemId SearchObjectByUriL( const TDesC16& aUri, TUint32& aFlags );
+ /**
+ * search for object uri
+ *
+ * @param aId object id to search uri for
+ * @param aFlags return found object flags
+ * @return reference to object uri
+ */
+ HBufC*& SearchObjectUriByIdL( const TItemId aId, TUint32& aFlags );
+
/**
* update freetext (add and remove)
*/
@@ -538,7 +554,6 @@
/**
* common usage buffers (initial size = 1024)
- * NOT THREAD SAFE!
*/
RArray<TLockBuffer> iBuffers;
@@ -559,11 +574,13 @@
CMdSObjectLockList& iLockList;
+ // Last handled uri.
+ HBufC* iUri;
+
TBuf<256> iLastAddedObjName;
private:
class RClauseBuffer
- // NOT THREAD SAFE !!!!!
{
public:
RClauseBuffer(CMdSSqlObjectManipulate& aSOM, TInt aSize = 1024);
--- a/metadataengine/server/src/mdsdiskspacenotifier.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsdiskspacenotifier.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -57,6 +57,7 @@
switch( status )
{
case KErrNone:
+ {
const TInt error = iFileServerSession.Volume( volumeInfo, iDrive );
if( error != KErrNone )
{
@@ -83,6 +84,7 @@
}
StartNotifier();
break;
+ }
case KErrArgument:
User::Leave( status );
--- a/metadataengine/server/src/mdsfindsqlclause.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsfindsqlclause.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -266,7 +266,7 @@
{
TDefId objectDefId;
iSerializedBuffer->ReceiveL( objectDefId );
- iSourceObjectDefs->Append( objectDefId );
+ iSourceObjectDefs->AppendL( objectDefId );
}
}
else
@@ -558,6 +558,11 @@
{
// No property filters so get all properties
+ if( !iObjectDef )
+ {
+ User::Leave( KErrMdEUnknownObjectDef );
+ }
+
// "SELECT BO.* "
iQueryBuf->AppendL( KSelectAllFromBaseObject );
--- a/metadataengine/server/src/mdsgetimeiao.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsgetimeiao.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -24,7 +24,7 @@
CMdsGetImeiAO* CMdsGetImeiAO::NewL()
{
CMdsGetImeiAO *self = CMdsGetImeiAO::NewLC();
- CleanupStack::Pop();
+ CleanupStack::Pop(); //self
return self;
}
--- a/metadataengine/server/src/mdsmaintenanceengine.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsmaintenanceengine.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -116,6 +116,7 @@
//
void CMdSMaintenanceEngine::InstallL( CMdSManipulationEngine& aManipulate, CMdsSchema& aSchema )
{
+ __LOG1( ELogAlways, "Trying to validate MDS DB, error expected if not created(first boot): %d", 0 );
if ( !(iMaintenance->ValidateL( ) ) )
{
// first-time init: re-form the database completely
--- a/metadataengine/server/src/mdsmanipulationengine.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsmanipulationengine.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -32,6 +32,9 @@
#include "mdeinternalerror.h"
#include "mdeerror.h"
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
__USES_LOGGER
// ---------------------------------------------------------------------------
@@ -326,8 +329,12 @@
CleanupClosePushL( removedRelations );
RArray<TItemId> removedEvents;
CleanupClosePushL( removedEvents );
+ RPointerArray<HBufC> removedItemUriArray;
+ CleanupResetAndDestroyPushL( removedItemUriArray );
CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
+
+ const TBool uriNotify = iNotifier.CheckForNotifier(EObjectNotifyRemoveWithUri);
// Remove objects by id or URI.
if (itemIds.iObjectIds.iPtr.iCount + itemIds.iObjectUris.iPtr.iCount > 0)
@@ -340,13 +347,19 @@
{
aBuffer.PositionL( itemIds.iObjectUris.iPtr.iOffset );
iManipulate->RemoveObjectsByUriL( aBuffer, itemIds.iObjectUris.iPtr.iCount,
- idArray, removedRelations, removedEvents );
+ idArray, removedRelations, removedEvents, uriNotify, removedItemUriArray );
}
else
{
+ // pause garbage collector so it does not remove the objects
+ // before uris are read
+ if( iGarbageCollector && uriNotify )
+ {
+ iGarbageCollector->Pause();
+ }
aBuffer.PositionL( itemIds.iObjectIds.iPtr.iOffset );
iManipulate->RemoveObjectsByIdL( aBuffer, itemIds.iObjectIds.iPtr.iCount,
- idArray, removedRelations, removedEvents );
+ idArray, removedRelations, removedEvents, uriNotify, removedItemUriArray );
}
transaction.CommitL();
@@ -445,13 +458,15 @@
aResultBuffer.PositionL( KNoOffset );
resultIds.SerializeL( aResultBuffer );
- // notify about items removed
- const TBool notify = iNotifier.CheckForNotifier(EObjectNotifyRemove|EEventNotifyRemove|ERelationNotifyRemove);
- if (notify)
- {
- iNotifier.NotifyRemovedL( aResultBuffer, EFalse );
- }
-
+ TBool notify = iNotifier.CheckForNotifier(EObjectNotifyRemove|EEventNotifyRemove|ERelationNotifyRemove);
+
+ // notify about items removed
+ if( uriNotify || notify )
+ {
+ iNotifier.NotifyRemovedL( aResultBuffer, EFalse, removedItemUriArray, this );
+ notify = ETrue;
+ }
+
// notify about additional items removed
const TInt KRemovedItemsCount = removedRelations.Count() + removedEvents.Count();
if ( notify && KRemovedItemsCount > 0 )
@@ -505,7 +520,14 @@
buffer->PositionL( KNoOffset );
additResultIds.SerializeL( *buffer );
- iNotifier.NotifyRemovedL( *buffer, EFalse );
+ const TBool notifyEnabled = iNotifier.CheckForNotifier(EEventNotifyRemove|ERelationNotifyRemove);
+ if (notifyEnabled)
+ {
+ RPointerArray<HBufC> nullArray; // For when uris are not available or needed
+ CleanupResetAndDestroyPushL( nullArray );
+ iNotifier.NotifyRemovedL( *buffer, EFalse, nullArray, this );
+ CleanupStack::PopAndDestroy( &nullArray );
+ }
CleanupStack::PopAndDestroy( buffer );
}
@@ -532,8 +554,8 @@
iGarbageCollector->Start( KGarbageCollectionDelay );
}
- // removedEvents, removedRelations, idArray
- CleanupStack::PopAndDestroy( 3, &idArray );
+ // removedItemUriArray, removedEvents, removedRelations, idArray
+ CleanupStack::PopAndDestroy( 4, &idArray );
}
void CMdSManipulationEngine::UpdateL( CMdCSerializationBuffer& aBuffer,
@@ -611,6 +633,14 @@
resultIds.iRelationIds.iPtr.iOffset = aResultBuffer.Position();
resultIds.iRelationIds.iPtr.iCount = items.iRelations.iPtr.iCount;
+ RMdSTransaction transaction( connection );
+ CleanupClosePushL(transaction);
+ const TInt beginError( transaction.Error() );
+ if( beginError != KErrNone )
+ {
+ CleanupStack::PopAndDestroy( &transaction );
+ }
+
for ( TInt i = 0; i < items.iRelations.iPtr.iCount; ++i )
{
aBuffer.PositionL( items.iRelations.iPtr.iOffset + i * sizeof(TMdCRelation) );
@@ -630,6 +660,11 @@
}
}
}
+ if( beginError == KErrNone )
+ {
+ transaction.CommitL();
+ CleanupStack::PopAndDestroy( &transaction );
+ }
}
else
{
@@ -879,7 +914,7 @@
if( objectIds.Count() > 0 )
{
- iNotifier.NotifyRemovedL( objectIds );
+ iNotifier.NotifyRemovedL( objectIds, this );
}
CleanupStack::PopAndDestroy( &objectIds );
@@ -963,7 +998,7 @@
iManipulate->ChangePathL( aOldPath, aNewPath, objectIds );
- iNotifier.NotifyModifiedL( objectIds );
+ iNotifier.NotifyModifiedL( objectIds, this );
CleanupStack::PopAndDestroy( &objectIds );
@@ -1059,3 +1094,17 @@
{
return iManipulate->GetPendingL( aObjectDefId, aBufferSize, aObjectIds );
}
+
+void CMdSManipulationEngine::GetObjectUrisByIdsL( const RArray<TItemId>& aObjectIds,
+ RPointerArray<HBufC>& aUriArray )
+ {
+ const TInt count( aObjectIds.Count() );
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ TUint32 flags;
+ HBufC* uri = iManipulate->SearchObjectUriByIdL( aObjectIds[i], flags );
+ aUriArray.AppendL( uri );
+ uri = NULL;
+ }
+ }
+
--- a/metadataengine/server/src/mdsnamespacedef.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsnamespacedef.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -101,7 +101,6 @@
CMdsObjectDef* parent = GetObjectDef( aParentName );
if ( !parent )
{
- /* testing */
// found namespace in default schema
if ( aDefaultSchema )
{
@@ -118,7 +117,7 @@
}
}
CMdsObjectDef* object = CMdsObjectDef::NewLC( aObjectName, parent );
- iObjectDefs.AppendL( object );
+ User::LeaveIfError( iObjectDefs.InsertInOrderAllowRepeats(object, TLinearOrder<CMdsObjectDef>(CMdsNamespaceDef::CompareObjectDefId) ) );
CleanupStack::Pop( object );
return object;
}
@@ -135,8 +134,8 @@
}
CMdsObjectDef* object = CMdsObjectDef::NewLC( aName, parent );
object->SetFlags( (CMdsObjectDef::TObjectDefFlags)aFlags );
- iObjectDefs.AppendL( object );
object->SetId(aId);
+ User::LeaveIfError( iObjectDefs.InsertInOrderAllowRepeats(object, TLinearOrder<CMdsObjectDef>(CMdsNamespaceDef::CompareObjectDefId) ) );
object->SetStoredInDB();
CleanupStack::Pop( object );
}
@@ -170,7 +169,7 @@
User::Leave( KErrAlreadyExists );
}
CMdsRelationDef* relation = CMdsRelationDef::NewLC( aRelationName );
- iRelationDefs.AppendL( relation );
+ User::LeaveIfError( iRelationDefs.InsertInOrderAllowRepeats(relation, TLinearOrder<CMdsRelationDef>(CMdsNamespaceDef::CompareRelationDefId) ) );
CleanupStack::Pop( relation );
}
@@ -179,7 +178,7 @@
{
CMdsRelationDef* relation = CMdsRelationDef::NewLC( aRelationName );
relation->SetId(aId);
- iRelationDefs.AppendL( relation );
+ User::LeaveIfError( iRelationDefs.InsertInOrderAllowRepeats(relation, TLinearOrder<CMdsRelationDef>(CMdsNamespaceDef::CompareRelationDefId) ) );
relation->SetStoredInDB();
CleanupStack::Pop( relation );
}
@@ -206,7 +205,7 @@
User::Leave( KErrAlreadyExists );
}
CMdsEventDef* event = CMdsEventDef::NewLC( aEventName, aPriority );
- iEventDefs.AppendL( event );
+ User::LeaveIfError( iEventDefs.InsertInOrderAllowRepeats(event, TLinearOrder<CMdsEventDef>(CMdsNamespaceDef::CompareEventDefId) ) );
CleanupStack::Pop( event );
}
@@ -214,7 +213,7 @@
{
CMdsEventDef* event = CMdsEventDef::NewLC( aEventName, aPriority );
event->SetId(aId);
- iEventDefs.AppendL( event );
+ User::LeaveIfError( iEventDefs.InsertInOrderAllowRepeats(event, TLinearOrder<CMdsEventDef>(CMdsNamespaceDef::CompareEventDefId) ) );
event->SetStoredInDB();
CleanupStack::Pop( event );
}
@@ -239,44 +238,80 @@
{
return iBaseObject;
}
-
- const TInt count = iObjectDefs.Count();
-
- for ( TInt i = 0; i < count; ++i )
- {
- if( iObjectDefs[i]->GetId() == aId )
- {
- return iObjectDefs[i];
- }
- }
+
+ TInt low( 0 );
+ TInt high( iObjectDefs.Count() );
+
+ while( low < high )
+ {
+ TInt mid( (low+high)>>1 );
+
+ const TInt compare( aId - iObjectDefs[mid]->GetId() );
+ if( compare == 0 )
+ {
+ return iObjectDefs[mid];
+ }
+ else if( compare > 0 )
+ {
+ low = mid + 1;
+ }
+ else
+ {
+ high = mid;
+ }
+ }
return NULL;
}
const CMdsEventDef* CMdsNamespaceDef::GetEventByIdL( TDefId aId ) const
{
- const TInt count = iEventDefs.Count();
-
- for ( TInt i = 0; i < count; ++i )
- {
- if( iEventDefs[i]->GetId() == aId )
- {
- return iEventDefs[i];
- }
- }
+ TInt low( 0 );
+ TInt high( iEventDefs.Count() );
+
+ while( low < high )
+ {
+ TInt mid( (low+high)>>1 );
+
+ const TInt compare( aId - iEventDefs[mid]->GetId() );
+ if( compare == 0 )
+ {
+ return iEventDefs[mid];
+ }
+ else if( compare > 0 )
+ {
+ low = mid + 1;
+ }
+ else
+ {
+ high = mid;
+ }
+ }
return NULL;
}
const CMdsRelationDef* CMdsNamespaceDef::GetRelationByIdL( TDefId aId ) const
{
- const TInt count = iRelationDefs.Count();
-
- for ( TInt i = 0; i < count; ++i )
- {
- if( iRelationDefs[i]->GetId() == aId )
- {
- return iRelationDefs[i];
- }
- }
+ TInt low( 0 );
+ TInt high( iRelationDefs.Count() );
+
+ while( low < high )
+ {
+ TInt mid( (low+high)>>1 );
+
+ const TInt compare( aId - iRelationDefs[mid]->GetId() );
+ if( compare == 0 )
+ {
+ return iRelationDefs[mid];
+ }
+ else if( compare > 0 )
+ {
+ low = mid + 1;
+ }
+ else
+ {
+ high = mid;
+ }
+ }
return NULL;
}
@@ -312,6 +347,7 @@
{
iObjectDefs[i]->StoreToDBL( GetId() );
}
+ iObjectDefs.Sort( TLinearOrder<CMdsObjectDef>(CMdsNamespaceDef::CompareObjectDefId) );
const TInt eventDefCount = iEventDefs.Count();
@@ -320,6 +356,7 @@
{
iEventDefs[i]->StoreToDBL( GetId() );
}
+ iEventDefs.Sort( TLinearOrder<CMdsEventDef>(CMdsNamespaceDef::CompareEventDefId) );
const TInt relationDefCount = iRelationDefs.Count();
@@ -328,6 +365,7 @@
{
iRelationDefs[i]->StoreToDBL( GetId() );
}
+ iRelationDefs.Sort( TLinearOrder<CMdsRelationDef>(CMdsNamespaceDef::CompareRelationDefId) );
CleanupStack::PopAndDestroy( &rowData );
}
@@ -346,7 +384,8 @@
}
else if ( !aDryRun )
{
- iObjectDefs.AppendL( aNamespace->iObjectDefs[i] );
+ User::LeaveIfError( iObjectDefs.InsertInOrderAllowRepeats(aNamespace->iObjectDefs[i],
+ TLinearOrder<CMdsObjectDef>(CMdsNamespaceDef::CompareObjectDefId) ) );
aNamespace->iObjectDefs[i]->SetAllNotStoredInDB();
aNamespace->iObjectDefs[i] = NULL;
}
@@ -369,7 +408,8 @@
}
else if ( !aDryRun )
{
- iRelationDefs.AppendL( aNamespace->iRelationDefs[i] );
+ User::LeaveIfError( iRelationDefs.InsertInOrderAllowRepeats(aNamespace->iRelationDefs[i],
+ TLinearOrder<CMdsRelationDef>(CMdsNamespaceDef::CompareRelationDefId) ) );
aNamespace->iRelationDefs[i]->SetAllNotStoredInDB();
aNamespace->iRelationDefs[i] = NULL;
}
@@ -392,7 +432,7 @@
}
else if ( !aDryRun )
{
- iEventDefs.AppendL( aNamespace->iEventDefs[i] );
+ User::LeaveIfError( iEventDefs.InsertInOrderAllowRepeats(aNamespace->iEventDefs[i], TLinearOrder<CMdsEventDef>(CMdsNamespaceDef::CompareEventDefId) ) );
aNamespace->iEventDefs[i]->SetAllNotStoredInDB();
aNamespace->iEventDefs[i] = NULL;
}
@@ -480,6 +520,7 @@
{
iObjectDefs[i]->ImportFromDBL();
}
+ iObjectDefs.Sort( TLinearOrder<CMdsObjectDef>(CMdsNamespaceDef::CompareObjectDefId) );
// everything is ok, so set the flags
SetStoredInDB();
@@ -612,6 +653,21 @@
return NULL;
}
+TInt CMdsNamespaceDef::CompareObjectDefId(const CMdsObjectDef& aFirst, const CMdsObjectDef& aSecond)
+ {
+ return aFirst.GetId() - aSecond.GetId();
+ }
+
+TInt CMdsNamespaceDef::CompareEventDefId(const CMdsEventDef& aFirst, const CMdsEventDef& aSecond)
+ {
+ return aFirst.GetId() - aSecond.GetId();
+ }
+
+TInt CMdsNamespaceDef::CompareRelationDefId(const CMdsRelationDef& aFirst, const CMdsRelationDef& aSecond)
+ {
+ return aFirst.GetId() - aSecond.GetId();
+ }
+
/**
* Initialize static variables
*/
--- a/metadataengine/server/src/mdsnotifier.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsnotifier.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -22,8 +22,12 @@
#include "mdsnotifycomparator.h"
#include "mdslogger.h"
#include "mdcserializationbuffer.h"
+#include "mdsmanipulationengine.h"
#include "mdccommon.pan"
+// for CleanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
__USES_LOGGER
// ------------------------------------------------
@@ -125,21 +129,34 @@
//
void CMdSNotifier::TEntry::TriggerL(
TUint32 aCompleteCode,
- const RArray<TItemId>& aIdArray )
+ const RArray<TItemId>& aIdArray,
+ RPointerArray<HBufC>& aUriArray )
{
const TInt remoteSizeMsgSlot = iRemoteSizeMsgSlot;
iRemoteSizeMsgSlot = KErrNotFound;
__ASSERT_DEBUG( !iDataBuffer, MMdCCommon::Panic( KErrCorrupt ) );
- if(aIdArray.Count())
+ if( iMessage.IsNull() )
+ {
+ return;
+ }
+
+ if( aIdArray.Count() )
{
- iDataBuffer = CopyToBufferL( aIdArray );
+ if( iType & ( EObjectNotifyAddWithUri | EObjectNotifyModifyWithUri | EObjectNotifyRemoveWithUri ) )
+ {
+ iDataBuffer = CopyToBufferL( aIdArray, aUriArray );
+ }
+ else
+ {
+ iDataBuffer = CopyToBufferL( aIdArray );
+ }
iSession.SizeToRemoteL( iMessage, remoteSizeMsgSlot, iDataBuffer->Size());
}
else
{
- iSession.SizeToRemoteL( iMessage, remoteSizeMsgSlot, 0);
+ iSession.SizeToRemoteL( iMessage, remoteSizeMsgSlot, 0 );
}
__LOG2( ELogServer, "<- Notify trigger %d (%d)", iId, aCompleteCode );
@@ -161,6 +178,11 @@
__ASSERT_DEBUG( !iDataBuffer, MMdCCommon::Panic( KErrCorrupt ) );
+ if( iMessage.IsNull() )
+ {
+ return;
+ }
+
if(aRelationIdArray.Count())
{
iDataBuffer = CopyItemsToBufferL( aBuffer, aRelationIdArray );
@@ -180,7 +202,12 @@
// ------------------------------------------------
//
void CMdSNotifier::TEntry::TriggerSchema()
- {
+ {
+ if( iMessage.IsNull() )
+ {
+ return;
+ }
+
iRemoteSizeMsgSlot = KErrNotFound;
iMessage.Complete( ESchemaModify );
}
@@ -233,6 +260,59 @@
}
// ------------------------------------------------
+// CopyToBufferL copies ids and uris to buffer
+// ------------------------------------------------
+//
+CMdCSerializationBuffer* CMdSNotifier::TEntry::CopyToBufferL(const RArray<TItemId>& aIdArray,
+ const RPointerArray<HBufC>& aUriArray)
+ {
+ const TUint32 count = aIdArray.Count();
+ const TUint32 uriCount = aUriArray.Count();
+
+ TInt urisSize = CMdCSerializationBuffer::KRequiredSizeForTUint32;
+
+ for( TInt i = uriCount - 1; i >=0; i-- )
+ {
+ urisSize += CMdCSerializationBuffer::RequiredSize( *aUriArray[i] );
+ }
+
+ TInt idsSize( sizeof( TMdCItemIds ) + count * CMdCSerializationBuffer::KRequiredSizeForTItemId );
+
+ CMdCSerializationBuffer* buffer = CMdCSerializationBuffer::NewLC(
+ urisSize + idsSize );
+
+ TMdCItemIds itemIds;
+ itemIds.iNamespaceDefId = NamespaceDefId();
+ itemIds.iObjectIds.iPtr.iCount = count;
+ itemIds.iObjectIds.iPtr.iOffset = sizeof(TMdCItemIds);
+ itemIds.SerializeL( *buffer );
+
+ // Insert IDs
+ for( TInt i = 0; i < count; ++i )
+ {
+ buffer->InsertL( aIdArray[i] );
+ }
+
+ // Insert uri count
+ buffer->InsertL( uriCount );
+
+ // Insert uris
+ for( TInt i = 0; i < uriCount; ++i )
+ {
+ // add uri
+ const TDesC& uri = *aUriArray[i];
+ HBufC* lcUri = HBufC::NewLC( uri.Length() );
+ lcUri->Des().Append( uri );
+ buffer->InsertL( *lcUri );
+ CleanupStack::PopAndDestroy( lcUri );
+ lcUri = NULL;
+ }
+
+ CleanupStack::Pop( buffer );
+ return buffer;
+ }
+
+// ------------------------------------------------
// CopyItemsToBufferL copies relation items to buffer
// ------------------------------------------------
//
@@ -282,14 +362,25 @@
// CacheL caches the notification
// ------------------------------------------------
//
-void CMdSNotifier::TEntry::CacheL(TUint32 aCompleteCode, const RArray<TItemId>& aIdArray )
+void CMdSNotifier::TEntry::CacheL(TUint32 aCompleteCode,
+ const RArray<TItemId>& aIdArray,
+ const RPointerArray<HBufC>& aUriArray)
{
if ( aIdArray.Count() <= 0 )
{
return;
}
- CMdCSerializationBuffer* data = CopyToBufferL( aIdArray );
+ CMdCSerializationBuffer* data( NULL );
+
+ if( iType & ( EObjectNotifyAddWithUri | EObjectNotifyModifyWithUri | EObjectNotifyRemoveWithUri ) )
+ {
+ data = CopyToBufferL( aIdArray, aUriArray );
+ }
+ else
+ {
+ data = CopyToBufferL( aIdArray );
+ }
iSession.CacheNotificationL( iId, aCompleteCode, data );
}
@@ -327,6 +418,11 @@
__ASSERT_DEBUG( !iDataBuffer, MMdCCommon::Panic( KErrCorrupt ) );
+ if( iMessage.IsNull() )
+ {
+ return;
+ }
+
if( aData )
{
iSession.SizeToRemoteL( iMessage, remoteSizeMsgSlot, aData->Size());
@@ -470,49 +566,82 @@
void CMdSNotifier::NotifyAddedL(CMdCSerializationBuffer& aSerializedItems,
CMdCSerializationBuffer& aSerializedItemIds)
{
- const TInt count = iEntries.Count();
+ const TBool uriNotify = CheckForNotifier(EObjectNotifyAddWithUri);
+ TBool allMatched( EFalse );
+ TBool allItemsFetched( EFalse );
- for( TInt i = 0; i < count; ++i )
+ RArray<TItemId> allItemsIdArray;
+ CleanupClosePushL( allItemsIdArray );
+ RPointerArray<HBufC> allItemsUriArray;
+ CleanupResetAndDestroyPushL( allItemsUriArray );
+
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
- if ( ! (e.iType & ( EObjectNotifyAdd | ERelationNotifyAdd | EEventNotifyAdd ) ) )
+ if ( ! (e.iType & ( EObjectNotifyAdd | ERelationNotifyAdd | EEventNotifyAdd | EObjectNotifyAddWithUri ) ) )
{
continue;
}
RArray<TItemId> matchingItemIdArray;
+ RPointerArray<HBufC> matchingItemUriArray;
CleanupClosePushL( matchingItemIdArray );
+ CleanupResetAndDestroyPushL( matchingItemUriArray );
aSerializedItems.PositionL( KNoOffset );
aSerializedItemIds.PositionL( KNoOffset );
const TBool someMatches = iComparator->MatchL( e.NamespaceDefId(), e.iType, e.Condition(),
- aSerializedItems, aSerializedItemIds,
- matchingItemIdArray,
- e.AllowConfidential() );
+ aSerializedItems, aSerializedItemIds,
+ matchingItemIdArray,
+ allItemsIdArray,
+ matchingItemUriArray,
+ allItemsUriArray,
+ e.AllowConfidential(),
+ uriNotify,
+ allMatched,
+ allItemsFetched );
if( someMatches ) // check if there is some matches
{
if( e.IsPending() )
{
+ TInt err( KErrNone );
// match found. trigger notifier entry !
- TRAPD( err, e.TriggerL( EObjectNotifyAdd | ERelationNotifyAdd | EEventNotifyAdd,
- matchingItemIdArray ) );
- if( err != KErrNone )
- {
- e.TriggerError( err );
- }
+ if( allMatched )
+ {
+ TRAP( err, e.TriggerL( EObjectNotifyAdd | ERelationNotifyAdd | EEventNotifyAdd | EObjectNotifyAddWithUri,
+ allItemsIdArray, allItemsUriArray ) );
+ }
+ else
+ {
+ TRAP( err, e.TriggerL( EObjectNotifyAdd | ERelationNotifyAdd | EEventNotifyAdd | EObjectNotifyAddWithUri,
+ matchingItemIdArray, matchingItemUriArray ) );
+ }
+ if( err != KErrNone )
+ {
+ e.TriggerError( err );
+ }
}
else
{
- TRAP_IGNORE( e.CacheL( EObjectNotifyAdd | ERelationNotifyAdd | EEventNotifyAdd,
- matchingItemIdArray ) );
+ if( allMatched )
+ {
+ TRAP_IGNORE( e.CacheL( EObjectNotifyAdd | ERelationNotifyAdd | EEventNotifyAdd | EObjectNotifyAddWithUri,
+ allItemsIdArray, allItemsUriArray ) );
+ }
+ else
+ {
+ TRAP_IGNORE( e.CacheL( EObjectNotifyAdd | ERelationNotifyAdd | EEventNotifyAdd | EObjectNotifyAddWithUri,
+ matchingItemIdArray, matchingItemUriArray ) );
+ }
}
}
- CleanupStack::PopAndDestroy( &matchingItemIdArray );
+ CleanupStack::PopAndDestroy( 2, &matchingItemIdArray ); // matchingItemIdArray, matchingItemUriArray
}
+ CleanupStack::PopAndDestroy( 2, &allItemsIdArray ); // allItemsIdArray, allItemsUriArray
}
// ------------------------------------------------
@@ -520,7 +649,9 @@
// ------------------------------------------------
//
void CMdSNotifier::NotifyRemovedL(CMdCSerializationBuffer& aSerializedItemIds,
- TBool aItemIsConfidential)
+ TBool aItemIsConfidential,
+ RPointerArray<HBufC>& aRemovedItemUriArray,
+ CMdSManipulationEngine* aMEngine )
{
aSerializedItemIds.PositionL( KNoOffset );
@@ -587,8 +718,7 @@
|| eventCount != 0
|| relationCount != 0 )
{
- const TInt entriesCount = iEntries.Count();
- for( TInt i=0; i < entriesCount; ++i )
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
@@ -603,6 +733,9 @@
continue;
}
+ RPointerArray<HBufC> uriArray;
+ CleanupResetAndDestroyPushL( uriArray );
+
if( e.iType & EObjectNotifyRemove && objectCount > 0 )
{
// collect matching object IDs
@@ -624,12 +757,12 @@
{
// all matches so send whole object ID array
TRAP( err, e.TriggerL( EObjectNotifyRemove,
- objectIdArray ) );
+ objectIdArray, uriArray ) );
}
else
{
TRAP( err, e.TriggerL( EObjectNotifyRemove,
- matchingObjectIdArray ) );
+ matchingObjectIdArray, uriArray ) );
}
if( err != KErrNone )
@@ -643,18 +776,72 @@
{
// all matches so send whole object ID array
TRAP_IGNORE( e.CacheL( EObjectNotifyRemove,
- objectIdArray ) );
+ objectIdArray, uriArray ) );
}
else
{
TRAP_IGNORE( e.CacheL( EObjectNotifyRemove,
- matchingObjectIdArray ) );
+ matchingObjectIdArray, uriArray ) );
}
}
}
CleanupStack::PopAndDestroy( &matchingObjectIdArray );
}
+ else if( e.iType & EObjectNotifyRemoveWithUri && objectCount > 0 )
+ {
+ // collect matching object IDs
+ RArray<TItemId> matchingObjectIdArray;
+ CleanupClosePushL( matchingObjectIdArray );
+
+ const TBool allMatches = iComparator->MatchObjectIdsL( e.Condition(),
+ objectIdArray, matchingObjectIdArray );
+
+ // check is there any matches
+ if( allMatches || matchingObjectIdArray.Count() > 0 )
+ {
+ if(e.IsPending())
+ {
+ // Match found. Trigger notifier entry.
+ TInt err( KErrNone );
+
+ if( allMatches )
+ {
+ // all matches so send whole object ID array
+ TRAP( err, e.TriggerL( EObjectNotifyRemoveWithUri,
+ objectIdArray, aRemovedItemUriArray ) );
+ }
+ else
+ {
+ aMEngine->GetObjectUrisByIdsL( objectIdArray, uriArray );
+ TRAP( err, e.TriggerL( EObjectNotifyRemoveWithUri,
+ matchingObjectIdArray, uriArray ) );
+ }
+
+ if( err != KErrNone )
+ {
+ e.TriggerError( err );
+ }
+ }
+ else
+ {
+ if( allMatches )
+ {
+ // all matches so send whole object ID array
+ TRAP_IGNORE( e.CacheL( EObjectNotifyRemoveWithUri,
+ objectIdArray, aRemovedItemUriArray ) );
+ }
+ else
+ {
+ aMEngine->GetObjectUrisByIdsL( objectIdArray, uriArray );
+ TRAP_IGNORE( e.CacheL( EObjectNotifyRemoveWithUri,
+ matchingObjectIdArray, uriArray ) );
+ }
+ }
+ }
+
+ CleanupStack::PopAndDestroy( &matchingObjectIdArray );
+ }
else if( ( e.iType & EEventNotifyRemove )
&& eventCount > 0 )
{
@@ -664,7 +851,7 @@
{
// Match found. Trigger notifier entry.
TRAPD( err, e.TriggerL( EEventNotifyRemove,
- eventIdArray ) );
+ eventIdArray, uriArray ) );
if( err != KErrNone )
{
e.TriggerError( err );
@@ -673,7 +860,7 @@
else
{
TRAP_IGNORE( e.CacheL( EEventNotifyRemove,
- eventIdArray ) );
+ eventIdArray, uriArray ) );
}
}
else if( ( e.iType & ERelationNotifyRemove )
@@ -685,7 +872,7 @@
{
// Match found. Trigger notifier entry.
TRAPD( err, e.TriggerL( ERelationNotifyRemove,
- relationIdArray ) );
+ relationIdArray, uriArray ) );
if( err != KErrNone )
{
e.TriggerError( err );
@@ -694,9 +881,10 @@
else
{
TRAP_IGNORE( e.CacheL( ERelationNotifyRemove,
- relationIdArray ) );
+ relationIdArray, uriArray ) );
}
}
+ CleanupStack::PopAndDestroy( &uriArray );
}
}
CleanupStack::PopAndDestroy( 3, &objectIdArray ); // relationIdArray, eventIdArray, objectIdArray
@@ -709,74 +897,112 @@
void CMdSNotifier::NotifyModifiedL(CMdCSerializationBuffer& aSerializedItems,
CMdCSerializationBuffer& aSerializedItemIds)
{
- const TInt count = iEntries.Count();
+ const TBool uriNotify = CheckForNotifier(EObjectNotifyModifyWithUri);
+ TBool allMatched( EFalse );
+ TBool allItemsFetched( EFalse );
+
+ RArray<TItemId> allItemsIdArray;
+ CleanupClosePushL( allItemsIdArray );
+ RPointerArray<HBufC> allItemsUriArray;
+ CleanupResetAndDestroyPushL( allItemsUriArray );
- for( TInt i = 0; i < count; ++i )
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
- if ( ! (e.iType & ( EObjectNotifyModify | ERelationNotifyModify ) ) )
+ if ( ! (e.iType & ( EObjectNotifyModify | ERelationNotifyModify | EObjectNotifyModifyWithUri ) ) )
{
continue;
}
RArray<TItemId> matchingObjectIdArray;
+ RPointerArray<HBufC> matchingItemUriArray;
CleanupClosePushL( matchingObjectIdArray );
+ CleanupResetAndDestroyPushL( matchingItemUriArray );
aSerializedItems.PositionL( KNoOffset );
aSerializedItemIds.PositionL( KNoOffset );
- const TBool someMatches = iComparator->MatchL( e.NamespaceDefId(),
- e.iType, e.Condition(), aSerializedItems, aSerializedItemIds,
- matchingObjectIdArray, e.AllowConfidential() );
+ const TBool someMatches = iComparator->MatchL( e.NamespaceDefId(), e.iType, e.Condition(),
+ aSerializedItems, aSerializedItemIds,
+ matchingObjectIdArray,
+ allItemsIdArray,
+ matchingItemUriArray,
+ allItemsUriArray,
+ e.AllowConfidential(),
+ uriNotify,
+ allMatched,
+ allItemsFetched );
if( someMatches ) // check if there is some matches
{
if( e.IsPending() )
{
- // match found. trigger notifier entry !
- TRAPD( err, e.TriggerL( EObjectNotifyModify | ERelationNotifyModify,
- matchingObjectIdArray ) );
- if( err != KErrNone )
- {
- e.TriggerError( err );
- }
+ TInt err( KErrNone );
+ // match found. trigger notifier entry !
+ if( allMatched )
+ {
+ TRAP( err, e.TriggerL( EObjectNotifyModify | ERelationNotifyModify | EObjectNotifyModifyWithUri,
+ allItemsIdArray, allItemsUriArray ) );
+ }
+ else
+ {
+ TRAP( err, e.TriggerL( EObjectNotifyModify | ERelationNotifyModify | EObjectNotifyModifyWithUri,
+ matchingObjectIdArray, matchingItemUriArray ) );
+ }
+ if( err != KErrNone )
+ {
+ e.TriggerError( err );
+ }
}
else
{
- TRAP_IGNORE( e.CacheL( EObjectNotifyModify | ERelationNotifyModify,
- matchingObjectIdArray ) );
- }
+ if( allMatched )
+ {
+ TRAP_IGNORE( e.CacheL( EObjectNotifyModify | ERelationNotifyModify | EObjectNotifyModifyWithUri,
+ allItemsIdArray, allItemsUriArray ) );
+ }
+ else
+ {
+ TRAP_IGNORE( e.CacheL( EObjectNotifyModify | ERelationNotifyModify | EObjectNotifyModifyWithUri,
+ matchingObjectIdArray, matchingItemUriArray ) );
+ }
+ }
}
-
- CleanupStack::PopAndDestroy( &matchingObjectIdArray );
+ CleanupStack::PopAndDestroy( 2, &matchingObjectIdArray ); // matchingItemIdArray, matchingItemUriArray
}
+ CleanupStack::PopAndDestroy( 2, &allItemsIdArray ); // allItemsIdArray, allItemsUriArray
}
// ------------------------------------------------
// NotifyModified
// ------------------------------------------------
//
-void CMdSNotifier::NotifyModifiedL(const RArray<TItemId>& aObjectIds)
+void CMdSNotifier::NotifyModifiedL(const RArray<TItemId>& aObjectIds,
+ CMdSManipulationEngine* aMEngine)
{
if (aObjectIds.Count() == 0)
{
return;
}
- const TInt count = iEntries.Count();
+ TBool allUrisFetched( EFalse );
+ RPointerArray<HBufC> allUrisArray;
+ CleanupResetAndDestroyPushL( allUrisArray );
- for( TInt i = 0; i < count; ++i )
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
- if( e.iType & EObjectNotifyModify )
+ if( e.iType & (EObjectNotifyModify | EObjectNotifyModifyWithUri) )
{
// collect matching object IDs
RArray<TItemId> matchingObjectIdArray;
CleanupClosePushL( matchingObjectIdArray );
+ RPointerArray<HBufC> uriArray;
+ CleanupResetAndDestroyPushL( uriArray );
- const TBool allMatches = iComparator->MatchObjectIdsL( e.Condition(),
+ const TBool allMatches = iComparator->MatchObjectIdsL( e.Condition(),
aObjectIds, matchingObjectIdArray );
// check is there any matches
@@ -790,15 +1016,36 @@
if( allMatches )
{
// all matches so send whole object ID array
- TRAP( err, e.TriggerL( EObjectNotifyModify,
- aObjectIds ) );
+ if( e.iType & EObjectNotifyModifyWithUri )
+ {
+ if( !allUrisFetched )
+ {
+ aMEngine->GetObjectUrisByIdsL( aObjectIds, allUrisArray );
+ allUrisFetched = ETrue;
+ }
+ TRAP( err, e.TriggerL( EObjectNotifyModifyWithUri,
+ aObjectIds, allUrisArray ) );
+ }
+ else
+ {
+ TRAP( err, e.TriggerL( EObjectNotifyModify,
+ aObjectIds, uriArray ) );
+ }
}
else
{
- TRAP( err, e.TriggerL( EObjectNotifyModify,
- matchingObjectIdArray ) );
+ if( e.iType & EObjectNotifyModifyWithUri )
+ {
+ aMEngine->GetObjectUrisByIdsL( matchingObjectIdArray, uriArray );
+ TRAP( err, e.TriggerL( EObjectNotifyModifyWithUri,
+ matchingObjectIdArray, uriArray ) );
+ }
+ else
+ {
+ TRAP( err, e.TriggerL( EObjectNotifyModify,
+ matchingObjectIdArray, uriArray ) );
+ }
}
-
if( err != KErrNone )
{
e.TriggerError( err );
@@ -808,39 +1055,72 @@
{
if( allMatches )
{
- // all matches so send whole object ID array
- TRAP_IGNORE( e.CacheL( EObjectNotifyModify,
- aObjectIds ) );
+ // all matches so send whole object ID array
+ if( e.iType & EObjectNotifyModifyWithUri )
+ {
+ if( !allUrisFetched )
+ {
+ aMEngine->GetObjectUrisByIdsL( aObjectIds, allUrisArray );
+ allUrisFetched = ETrue;
+ }
+ TRAP_IGNORE( e.CacheL( EObjectNotifyModifyWithUri,
+ aObjectIds, allUrisArray ) );
+ }
+ else
+ {
+ TRAP_IGNORE( e.CacheL( EObjectNotifyModify,
+ aObjectIds, uriArray ) );
+ }
}
else
{
- TRAP_IGNORE( e.CacheL( EObjectNotifyModify,
- matchingObjectIdArray ) );
+ if( e.iType & EObjectNotifyModifyWithUri )
+ {
+ aMEngine->GetObjectUrisByIdsL( matchingObjectIdArray, uriArray );
+ TRAP_IGNORE( e.CacheL( EObjectNotifyModifyWithUri,
+ matchingObjectIdArray, uriArray ) );
+ }
+ else
+ {
+ TRAP_IGNORE( e.CacheL( EObjectNotifyModify,
+ matchingObjectIdArray, uriArray ) );
+ }
}
}
}
-
- CleanupStack::PopAndDestroy( &matchingObjectIdArray );
+ CleanupStack::PopAndDestroy( 2, &matchingObjectIdArray ); // matchingObjectIdArray, uriArray
}
}
+ CleanupStack::PopAndDestroy( &allUrisArray );
}
// ------------------------------------------------
// NotifyRemoved
// ------------------------------------------------
//
-void CMdSNotifier::NotifyRemovedL(const RArray<TItemId>& aItemIdArray)
+void CMdSNotifier::NotifyRemovedL(const RArray<TItemId>& aItemIdArray,
+ CMdSManipulationEngine* aMEngine)
{
- const TInt entriesCount( iEntries.Count() );
- for( TInt i=0; i<entriesCount; ++i )
+ if (aItemIdArray.Count() == 0)
+ {
+ return;
+ }
+
+ RPointerArray<HBufC> uriArray;
+ CleanupResetAndDestroyPushL( uriArray );
+ TBool urisFetched( EFalse );
+
+ for( TInt i = iEntries.Count()- 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
if( e.iType & EObjectNotifyRemove )
{
+ RPointerArray<HBufC> nullArray; // For when uris are not needed
+ CleanupResetAndDestroyPushL( nullArray );
if( e.IsPending() )
{
- TRAPD( err, e.TriggerL( EObjectNotifyRemove, aItemIdArray ) );
+ TRAPD( err, e.TriggerL( EObjectNotifyRemove, aItemIdArray, nullArray ) );
if( err != KErrNone )
{
e.TriggerError( err );
@@ -848,10 +1128,32 @@
}
else
{
- TRAP_IGNORE( e.CacheL( EObjectNotifyRemove, aItemIdArray ) );
+ TRAP_IGNORE( e.CacheL( EObjectNotifyRemove, aItemIdArray, nullArray ) );
}
+ CleanupStack::PopAndDestroy( &nullArray );
}
+ else if( e.iType & EObjectNotifyRemoveWithUri )
+ {
+ if( !urisFetched && aMEngine )
+ {
+ aMEngine->GetObjectUrisByIdsL( aItemIdArray, uriArray );
+ urisFetched = ETrue;
+ }
+ if( e.IsPending() )
+ {
+ TRAPD( err, e.TriggerL( EObjectNotifyRemoveWithUri, aItemIdArray, uriArray ) );
+ if( err != KErrNone )
+ {
+ e.TriggerError( err );
+ }
+ }
+ else
+ {
+ TRAP_IGNORE( e.CacheL( EObjectNotifyRemoveWithUri, aItemIdArray, uriArray ) );
+ }
+ }
}
+ CleanupStack::PopAndDestroy( &uriArray );
}
// ------------------------------------------------
@@ -865,9 +1167,7 @@
return;
}
- const TInt count = iEntries.Count();
-
- for( TInt i = 0; i < count; ++i )
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
@@ -878,10 +1178,11 @@
const TMdSObserverNotificationType objectState =
aPresent ? EObjectNotifyPresent : EObjectNotifyNotPresent;
+ RPointerArray<HBufC> nullArray; // For when uris are not needed
if( e.IsPending() )
{
// match found. trigger notifier entry !
- TRAPD( err, e.TriggerL( objectState, aObjectIds ) );
+ TRAPD( err, e.TriggerL( objectState, aObjectIds, nullArray ) );
if( err != KErrNone )
{
e.TriggerError( err );
@@ -889,8 +1190,9 @@
}
else
{
- TRAP_IGNORE( e.CacheL( objectState, aObjectIds ) );
+ TRAP_IGNORE( e.CacheL( objectState, aObjectIds, nullArray ) );
}
+ nullArray.Close();
}
}
}
@@ -906,9 +1208,7 @@
return;
}
- const TInt count = iEntries.Count();
-
- for( TInt i = 0; i < count; ++i )
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
@@ -919,10 +1219,11 @@
const TMdSObserverNotificationType relationState =
aPresent ? ERelationNotifyPresent : ERelationNotifyNotPresent;
+ RPointerArray<HBufC> nullArray; // For when uris are not needed
if( e.IsPending() )
{
// match found. trigger notifier entry !
- TRAPD( err, e.TriggerL( relationState, aRelationIds ) );
+ TRAPD( err, e.TriggerL( relationState, aRelationIds, nullArray ) );
if( err != KErrNone )
{
e.TriggerError( err );
@@ -930,8 +1231,9 @@
}
else
{
- TRAP_IGNORE( e.CacheL( relationState, aRelationIds ) );
+ TRAP_IGNORE( e.CacheL( relationState, aRelationIds, nullArray ) );
}
+ nullArray.Close();
}
}
}
@@ -943,9 +1245,7 @@
//
void CMdSNotifier::NotifySchemaAddedL()
{
- const TInt count = iEntries.Count();
-
- for( TInt i = 0; i < count; ++i )
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
@@ -973,9 +1273,7 @@
//
TBool CMdSNotifier::CheckForNotifier( TUint32 aNotifyTypes )
{
- const TInt count = iEntries.Count();
-
- for( TInt i = 0; i < count; ++i )
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
if ( iEntries[i].iType & aNotifyTypes )
{
@@ -994,8 +1292,7 @@
if( items.iRelations.iPtr.iCount )
{
- const TInt entriesCount = iEntries.Count();
- for( TInt i = 0; i < entriesCount; ++i )
+ for( TInt i = iEntries.Count() - 1; i >=0; i-- )
{
TEntry& e = iEntries[i];
--- a/metadataengine/server/src/mdsnotifycomparator.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsnotifycomparator.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -62,7 +62,13 @@
CMdCSerializationBuffer& aSerializedItems,
CMdCSerializationBuffer& aSerializedItemIds,
RArray<TItemId>& aMatchingItemIdArray,
- TBool aAllowConfidential)
+ RArray<TItemId>& aAllItemsIdArray,
+ RPointerArray<HBufC>& aMatchingItemUriArray,
+ RPointerArray<HBufC>& aAllItemsUriArray,
+ TBool aAllowConfidential,
+ TBool uriNotify,
+ TBool& aAllMatched,
+ TBool& aAllItemsFetched )
{
const TMdCItems& items = TMdCItems::GetFromBufferL( aSerializedItems );
@@ -74,14 +80,17 @@
return EFalse;
}
+ aAllMatched = EFalse;
+
if( ( items.iObjects.iPtr.iCount > 0 ) &&
( itemIds.iObjectIds.iPtr.iCount > 0 ) &&
- ( aType & ( EObjectNotifyAdd | EObjectNotifyModify ) ) )
+ ( aType & ( EObjectNotifyAdd | EObjectNotifyModify | EObjectNotifyAddWithUri | EObjectNotifyModifyWithUri ) ) )
{
// object ID count and object item count should match
__ASSERT_DEBUG( items.iObjects.iPtr.iCount == itemIds.iObjectIds.iPtr.iCount, MMdCCommon::Panic( KErrCorrupt ) );
aSerializedItemIds.PositionL( itemIds.iObjectIds.iPtr.iOffset );
+ TBool allItemsFetched( aAllItemsFetched );
for( TUint32 i = 0; i < itemIds.iObjectIds.iPtr.iCount; i++ )
{
TItemId objectId;
@@ -140,13 +149,48 @@
if ( succeed )
{
+ if( uriNotify )
+ {
+ // set correct position to item buffer
+ aSerializedItems.PositionL( items.iObjects.iPtr.iOffset +
+ i * sizeof(TMdCObject) );
+
+ const TMdCObject& object = TMdCObject::GetFromBufferL( aSerializedItems );
+
+ aSerializedItems.PositionL( object.iUri.iPtr.iOffset );
+ HBufC* uriBuf = aSerializedItems.ReceiveDes16L();
+ aMatchingItemUriArray.AppendL( uriBuf );
+ }
aMatchingItemIdArray.AppendL( objectId );
}
}
else
{
- aMatchingItemIdArray.AppendL( objectId );
- }
+ aAllMatched = ETrue;
+ if( uriNotify && (!aAllItemsFetched || !allItemsFetched) )
+ {
+ // set correct position to item buffer
+ aSerializedItems.PositionL( items.iObjects.iPtr.iOffset +
+ i * sizeof(TMdCObject) );
+
+ const TMdCObject& object = TMdCObject::GetFromBufferL( aSerializedItems );
+
+ aSerializedItems.PositionL( object.iUri.iPtr.iOffset );
+ HBufC* uriBuf = aSerializedItems.ReceiveDes16L();
+ aAllItemsUriArray.AppendL( uriBuf );
+ aAllItemsIdArray.AppendL( objectId );
+ allItemsFetched = ETrue;
+ }
+ else if( !aAllItemsFetched || !allItemsFetched )
+ {
+ aAllItemsIdArray.AppendL( objectId );
+ allItemsFetched = ETrue;
+ }
+ }
+ }
+ if( allItemsFetched )
+ {
+ aAllItemsFetched = ETrue;
}
}
else if( ( items.iEvents.iPtr.iCount > 0 ) &&
@@ -215,7 +259,7 @@
}
}
- if( aMatchingItemIdArray.Count() > 0 )
+ if( aMatchingItemIdArray.Count() > 0 || ( aAllItemsIdArray.Count() > 0 && aAllMatched ))
{
return ETrue;
}
--- a/metadataengine/server/src/mdsschema.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsschema.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -203,7 +203,7 @@
void CMdsSchema::CreateObjectTablesL()
{
- _LIT( KBaseObjectDefinition, "CREATE TABLE IF NOT EXISTS %S%u(ObjectId INTEGER PRIMARY KEY AUTOINCREMENT,ObjectDefId INTEGER NOT NULL,Flags INTEGER,MediaId LARGEINT,UsageCount LARGEINT DEFAULT 0,GuidHigh LARGEINT,GuidLow LARGEINT,URI TEXT NOT NULL COLLATE NOCASE,Origin INTEGER,Size LARGEINT,TimeOffset INTEGER,CreationDate LARGEINT,LastModifiedDate LARGEINT,ItemType TEXT,Title TEXT,UNIQUE(GuidHigh,GuidLow),UNIQUE(MediaId,URI));" );
+ _LIT( KBaseObjectDefinition, "CREATE TABLE IF NOT EXISTS %S%u(ObjectId INTEGER PRIMARY KEY AUTOINCREMENT,ObjectDefId INTEGER NOT NULL,Flags INTEGER,MediaId LARGEINT,UsageCount LARGEINT DEFAULT 0,GuidHigh LARGEINT,GuidLow LARGEINT,URI TEXT NOT NULL COLLATE NOCASE,Origin INTEGER,Size LARGEINT,TimeOffset INTEGER,CreationDate LARGEINT,LastModifiedDate LARGEINT,ItemType TEXT,Title TEXT,UNIQUE(GuidHigh,GuidLow),UNIQUE(URI,MediaId));" );
_LIT( KCreateRelationsTable, "CREATE TABLE IF NOT EXISTS Relations%u(RelationId INTEGER PRIMARY KEY AUTOINCREMENT,Flags INTEGER,RelationDefId INTEGER NOT NULL,LeftObjectId INTEGER NOT NULL,RightObjectId INTEGER NOT NULL,Parameter INTEGER,GuidHigh LARGEINT,GuidLow LARGEINT,LastModifiedDate LARGEINT);" );
_LIT( KCreateEventsTable, "CREATE TABLE IF NOT EXISTS Event%u(EventId INTEGER PRIMARY KEY AUTOINCREMENT,ObjectId INTEGER NOT NULL, EventDefId INTEGER NOT NULL, Timestamp INTEGER NOT NULL, Source TEXT, Participant TEXT);" );
_LIT( KCreateTxtSrchTable, "CREATE TABLE IF NOT EXISTS TextSearch%u(WordId INTEGER NOT NULL,ObjectId INTEGER NOT NULL,Position INTEGER);" );
@@ -233,6 +233,9 @@
// ObjectTypeDefinition index
_LIT( KMdsIndexObjectDefId, "CREATE INDEX ObjectDefIndex%u ON Object%u(ObjectDefId);" );
+
+ // MediaId index
+ _LIT( KMdsIndexMediaId, "CREATE INDEX MediaIdIndex%u ON Object%u(MediaId);" );
// create tables
CMdsClauseBuffer* clause = CMdsClauseBuffer::NewLC( 1024 );
@@ -339,6 +342,11 @@
clauseTrigger->BufferL().Format( KMdsIndexObjectDefId, namespaceDefId, namespaceDefId );
connection.ExecuteL( clauseTrigger->ConstBufferL(), emptyRowData );
+ // add mediaidindex[number]
+ clauseTrigger->ReserveSpaceL( KMdsIndexMediaId().Size() + ( KMaxUintValueLength * 2 ) );
+ clauseTrigger->BufferL().Format( KMdsIndexMediaId, namespaceDefId, namespaceDefId );
+ connection.ExecuteL( clauseTrigger->ConstBufferL(), emptyRowData );
+
namespaceDef->SetTableStoredInDB();
}
--- a/metadataengine/server/src/mdsserver.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsserver.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -35,7 +35,6 @@
__DEFINE_LOGGER
const TInt64 KDiskSpaceGarbageCollectorThreshold = 1024*1024; // 1 MB
-const TInt64 KDiskFullThreshold = 1024*50; // 50 kB
_LIT( KSchema, "schema.mde" );
_LIT( KDefaultImportProfile, "defaultimportfile.mde" );
@@ -156,6 +155,36 @@
NULL //mdsElements
};
+// ======================= LOCAL FUNCTIONS ================================
+
+void CheckAndInitializeFileL( RFs& aFs, TBuf<KMaxFileName>& aFile, const TDesC16& aFilePath,
+ RFileReadStream& aTempFile, CFileMan* aFileMan )
+ {
+ __LOG1( ELogAlways, "CheckAndInitializeFileL() - handling file %S", &aFilePath );
+ const TInt err = aTempFile.Open( aFs, aFile, EFileRead | EFileShareAny );
+ __LOG1( ELogAlways, "CheckAndInitializeFileL() - open file error %d", err );
+ aTempFile.Close();
+ if ( err != KErrNone )
+ {
+ if ( err == KErrNotFound )
+ {
+ // Path found but not schema.mde, copy schema.m
+ const TInt error = aFileMan->Copy( aFilePath, aFile, CFileMan::EOverWrite );
+ __LOG1( ELogAlways, "CheckAndInitializeFileL() - copy file error %d", error );
+ }
+ else if ( err == KErrPathNotFound)
+ {
+ // Create private dir
+ User::LeaveIfError( aFs.CreatePrivatePath( EDriveC ) );
+
+ // Copy schema.mde
+ const TInt error = aFileMan->Copy( aFilePath, aFile, CFileMan::EOverWrite );
+ __LOG1( ELogAlways, "CheckAndInitializeFileL() - copy file error %d", error );
+ }
+ }
+ }
+
+// ======================= MEMBER FUNCTIONS ===============================
CPolicyServer::TCustomResult CMdSServer::CustomSecurityCheckL(
const RMessage2& aMsg, TInt& /*aAction*/, TSecurityInfo& /*aMissing*/ )
@@ -325,6 +354,10 @@
__INIT_LOGGER;
StartL( KMdSServerName );
__LOGLB( ELogAlways, "Server start" );
+
+ RProcess process;
+ process.SetPriority( EPriorityBackground );
+ process.Close();
CheckInitSriptL();
@@ -516,21 +549,23 @@
{
return iBackupOrRestoreRunning;
}
-
+
+TBool CMdSServer::ShutdownInProgress() const
+ {
+ return iShutdown;
+ }
+
// -----------------------------------------------------------------------------
// CMdSServer::ShutdownNotification
// -----------------------------------------------------------------------------
//
void CMdSServer::ShutdownNotification()
{
-
-
if (!iShutdown)
{
CActiveScheduler::Stop();
iShutdown = ETrue;
}
-
}
// -----------------------------------------------------------------------------
@@ -871,73 +906,13 @@
backupRegistration.Append( KBackupRegistration );
CFileMan* fileMan = CFileMan::NewL( fs );
- CleanupStack::PushL( fileMan);
+ CleanupStack::PushL( fileMan );
+
+ CheckAndInitializeFileL( fs, schema, KSchemaPath(), tmpFile, fileMan );
- TInt err = tmpFile.Open( fs, schema, EFileRead | EFileShareAny );
- __LOG1( ELogAlways, "open schema.mde %d", err );
- tmpFile.Close();
- if ( err != KErrNone )
- {
- if ( err == KErrNotFound )
- {
- // Path found but not schema.mde, copy schema.m
- const TInt error = fileMan->Copy( KSchemaPath, schema, CFileMan::EOverWrite );
- __LOG1( ELogAlways, "copy schema.mde %d", error );
- }
- else if ( err == KErrPathNotFound)
- {
- // Create private dir
- User::LeaveIfError( fs.CreatePrivatePath( EDriveC ) );
-
- // Copy schema.mde
- const TInt error = fileMan->Copy( KSchemaPath, schema, CFileMan::EOverWrite );
- __LOG1( ELogAlways, "copy schema.mde %d", error );
- }
- }
-
- err = tmpFile.Open( fs, defaultImportProfile, EFileRead | EFileShareAny );
- __LOG1( ELogAlways, "open defaultimportprofile.mde %d", err );
- tmpFile.Close();
- if ( err != KErrNone )
- {
- if ( err == KErrNotFound )
- {
- // Path found but not schema.mde, copy schema.m
- const TInt error1 = fileMan->Copy( KDefaultImportProfilePath, defaultImportProfile, CFileMan::EOverWrite );
- __LOG1( ELogAlways, "copy defaultimportprofile.mde %d", error1 );
- }
- else if ( err == KErrPathNotFound)
- {
- // Create private dir
- User::LeaveIfError( fs.CreatePrivatePath( EDriveC ) );
-
- // Copy schema.mde
- const TInt error1 = fileMan->Copy( KDefaultImportProfilePath, defaultImportProfile, CFileMan::EOverWrite );
- __LOG1( ELogAlways, "copy defaultimportprofile.mde %d", error1 );
- }
- }
+ CheckAndInitializeFileL( fs, defaultImportProfile, KDefaultImportProfilePath(), tmpFile, fileMan );
- err = tmpFile.Open( fs, backupRegistration, EFileRead | EFileShareAny );
- __LOG1( ELogAlways, "open backup_registration.xml %d", err );
- tmpFile.Close();
- if ( err != KErrNone )
- {
- if ( err == KErrNotFound )
- {
- // Path found but not schema.mde, copy schema.m
- const TInt error2 = fileMan->Copy( KBackupRegistrationPath, backupRegistration, CFileMan::EOverWrite );
- __LOG1( ELogAlways, "copy backup_registration.xml %d", error2 );
- }
- else if ( err == KErrPathNotFound)
- {
- // Create private dir
- User::LeaveIfError( fs.CreatePrivatePath( EDriveC ) );
-
- // Copy schema.mde
- const TInt error2 = fileMan->Copy( KBackupRegistrationPath, backupRegistration, CFileMan::EOverWrite );
- __LOG1( ELogAlways, "copy backup_registration.xml %d", error2 );
- }
- }
+ CheckAndInitializeFileL( fs, backupRegistration, KBackupRegistrationPath(), tmpFile, fileMan );
CleanupStack::PopAndDestroy( 2 ); //fileman, fs
}
--- a/metadataengine/server/src/mdsserversession.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdsserversession.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -115,6 +115,12 @@
return;
}
+ if( iServer.ShutdownInProgress() )
+ {
+ aMessage.Complete( KErrServerTerminated );
+ return;
+ }
+
TRAPD( err, ServiceFunctionL( aMessage ) );
if( err != KErrNone )
{
@@ -638,12 +644,10 @@
CMdSFindEngine* findEngine = NULL;
const TUint32 queryId = (TUint32)aMsg.Int0();
-
- const TInt count = iFindEngines.Count();
-
+
TInt feIndex = 0;
- for( TInt i = 0; i < count; i++ )
+ for( TInt i = iFindEngines.Count() - 1; i >=0; i-- )
{
if( queryId == iFindEngines[i]->QueryId() )
{
@@ -684,9 +688,7 @@
const TUint32 queryId = (TUint32)aMsg.Int0();
- const TInt count = iFindEngines.Count();
-
- for( TInt i = 0; i < count; i++ )
+ for( TInt i = iFindEngines.Count() - 1; i >=0; i-- )
{
CMdSFindEngine* findEngine = iFindEngines[i];
@@ -1195,10 +1197,8 @@
void CMdSServerSession::ShutdownL( const RMessage2& /*aMsg*/ )
{
__LOGLB( ELogServer, "-> Shutdown session" );
-
- const TInt count = iFindEngines.Count();
-
- for( TInt i = 0; i < count; i++ )
+
+ for( TInt i = iFindEngines.Count() - 1; i >=0; i-- )
{
CMdSFindEngine* fe = iFindEngines[i];
--- a/metadataengine/server/src/mdssqlfindoperation.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdssqlfindoperation.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -1405,9 +1405,7 @@
{
if( EQueryResultModeId != iResultMode )
{
- const TInt KRowCount = iResultRows.Count();
-
- for( TInt i = 0; i < KRowCount; i++ )
+ for( TInt i = iResultRows.Count() - 1; i >=0; i-- )
{
iResultRows[i]->Close();
}
--- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -39,11 +39,12 @@
#include "mdsgetimeiao.h"
#include <e32math.h>
+#include <mdeobject.h>
/** logging instance */
__USES_LOGGER
-const TInt KMaxBuffers = 3;
+const TInt KMaxBuffers = 5;
_LIT( KMemoryCard, "MC" );
@@ -181,6 +182,7 @@
iBuffers.Close();
delete iGenerator;
+ delete iUri;
}
CMdSSqlObjectManipulate::CMdSSqlObjectManipulate( const CMdsSchema& aSchema,
@@ -418,7 +420,7 @@
RRowData var;
CleanupClosePushL( var );
- var.ReserveL( 5 );
+ var.ReserveL( 6 );
var.AppendL( TColumn( EMdEObjectFlagRemoved ) );
var.AppendL( TColumn( EMdEObjectFlagNotPresent ) ); // not present flag
var.AppendL( TColumn( EMdEObjectFlagStartUpNotPresent ) ); // start up not present flag
@@ -507,6 +509,7 @@
clauseBuffer.BufferL().Format( KSetFileToPresent, KDefaultNamespaceDefId );
RRowData var;
+ var.ReserveL( 3 );
CleanupClosePushL( var );
// reset not present and start up not present flags
var.AppendL( TColumn( ~(EMdEObjectFlagNotPresent | EMdEObjectFlagStartUpNotPresent) ) );
@@ -531,29 +534,33 @@
void CMdSSqlObjectManipulate::SetRelationsToPresentL(TItemId aObjectId,
RArray<TItemId>& aIdArray)
{
- _LIT( KSearchNotPresentRelations, "SELECT RelationId FROM Relations%u WHERE NOT Flags&? AND Flags&? AND (LeftObjectId=? OR RightObjectId=?);" );
- _LIT( KSetRelationsToPresent, "UPDATE Relations%u SET Flags=Flags&? WHERE Flags&? AND (LeftObjectId=? OR RightObjectId=?);" );
-
- RClauseBuffer commonClauseOne(*this, KSearchNotPresentRelations.iTypeLength + KMaxUintValueLength);
+ _LIT( KSearchNotPresentRelations, "SELECT RelationId FROM Relations%u WHERE NOT Flags&? AND Flags&? AND LeftObjectId=? UNION SELECT RelationId FROM Relations%u WHERE NOT Flags&? AND Flags&? AND RightObjectId=?;" );
+ _LIT( KSetRelationsToPresent1, "UPDATE Relations%u SET Flags=Flags&? WHERE Flags&? AND LeftObjectId=?;" );
+ _LIT( KSetRelationsToPresent2, "UPDATE Relations%u SET Flags=Flags&? WHERE Flags&? AND RightObjectId=?;" );
+
+ RClauseBuffer commonClauseOne(*this, KSearchNotPresentRelations.iTypeLength + 2*KMaxUintValueLength);
CleanupClosePushL( commonClauseOne );
CMdsClauseBuffer& clauseBuffer = commonClauseOne.BufferL();
- clauseBuffer.BufferL().Format( KSearchNotPresentRelations, KDefaultNamespaceDefId );
+ clauseBuffer.BufferL().Format( KSearchNotPresentRelations, KDefaultNamespaceDefId, KDefaultNamespaceDefId );
CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
RRowData var;
CleanupClosePushL( var );
- var.ReserveL( 4 ); // reserve space for flags and object IDs
+ var.ReserveL( 6 ); // reserve space for flags and object IDs
var.AppendL( TColumn( EMdERelationFlagDeleted ) );
var.AppendL( TColumn( EMdERelationFlagNotPresent ) );
var.AppendL( TColumn( aObjectId ) );
+ var.AppendL( TColumn( EMdERelationFlagDeleted ) );
+ var.AppendL( TColumn( EMdERelationFlagNotPresent ) );
var.AppendL( TColumn( aObjectId ) );
RMdsStatement statement;
CleanupClosePushL( statement );
connection.ExecuteQueryL( clauseBuffer.ConstBufferL(), statement, var );
- var.Free(); var.Reset();
+ var.Free();
+ var.Reset();
TItemId relationId(0);
var.AppendL( TColumn( relationId ) );
while( connection.NextRowL( statement, var ) )
@@ -562,8 +569,21 @@
aIdArray.AppendL( relationId );
}
- clauseBuffer.ReserveSpaceL( KSetRelationsToPresent.iTypeLength + KMaxUintValueLength );
- clauseBuffer.BufferL().Format( KSetRelationsToPresent, KDefaultNamespaceDefId );
+ clauseBuffer.ReserveSpaceL( KSetRelationsToPresent1.iTypeLength + KMaxUintValueLength );
+ clauseBuffer.BufferL().Format( KSetRelationsToPresent1, KDefaultNamespaceDefId );
+
+ var.Free();
+ var.Reset();
+
+ var.ReserveL( 3 );
+ var.AppendL( TColumn( ~EMdERelationFlagNotPresent ) ); // reset not present flag
+ var.AppendL( TColumn( EMdERelationFlagNotPresent ) );
+ var.AppendL( TColumn( aObjectId ) );
+
+ connection.ExecuteL( clauseBuffer.ConstBufferL(), var );
+
+ clauseBuffer.ReserveSpaceL( KSetRelationsToPresent2.iTypeLength + KMaxUintValueLength );
+ clauseBuffer.BufferL().Format( KSetRelationsToPresent2, KDefaultNamespaceDefId );
var.Free();
var.Reset();
@@ -571,17 +591,15 @@
var.AppendL( TColumn( ~EMdERelationFlagNotPresent ) ); // reset not present flag
var.AppendL( TColumn( EMdERelationFlagNotPresent ) );
var.AppendL( TColumn( aObjectId ) );
- var.AppendL( TColumn( aObjectId ) );
connection.ExecuteL( clauseBuffer.ConstBufferL(), var );
-
+
CleanupStack::PopAndDestroy( 3, &commonClauseOne ); // statement, var, clauseBuffer
}
void CMdSSqlObjectManipulate::SetFilesToNotPresentL(TUint32 aMediaId, TBool aStartUp,
RArray<TItemId>& aObjectIds)
- {
-
+ {
_LIT( KSearchPresentFilesStartUpL, "SELECT ObjectId FROM Object%u WHERE NOT Flags&? AND MediaId=?;" );
_LIT( KSearchPresentFilesL, "SELECT ObjectId FROM Object%u WHERE NOT Flags&? AND NOT Flags&? AND MediaId=?;" );
@@ -657,21 +675,27 @@
void CMdSSqlObjectManipulate::SetRelationsToNotPresentL(
TUint32 aMediaId, RArray<TItemId>& aRelationIds)
{
- _LIT( KSearchPresentRelations, "SELECT DISTINCT A.RelationId FROM Relations%u AS A LEFT JOIN object%u AS B On A.LeftObjectId = B.ObjectId OR A.RightObjectId = B.ObjectId WHERE NOT A.Flags&%u AND NOT A.Flags&%u AND B.MediaId=%u" );
+ _LIT( KSearchPresentRelations, "SELECT A.RelationId FROM Relations%u AS A, Object%u AS B WHERE A.LeftObjectId = B.ObjectId AND B.MediaId=%u AND NOT A.Flags&%u AND NOT A.Flags&%u UNION SELECT A.RelationId FROM Relations%u AS A, Object%u AS B WHERE A.RightObjectId = B.ObjectId AND B.MediaId=%u AND NOT A.Flags&%u AND NOT A.Flags&%u" );
_LIT( KSetRelationsToPresent, "UPDATE Relations%u SET Flags=Flags|? WHERE NOT Flags&? AND RelationId IN (%S);" );
// RelationIDs query sql statement
RClauseBuffer commonClauseOne(*this,
KSearchPresentRelations.iTypeLength +
- KMaxUintValueLength );
+ 2*KMaxUintValueLength );
CleanupClosePushL( commonClauseOne );
CMdsClauseBuffer& clauseBufferOne = commonClauseOne.BufferL();
clauseBufferOne.BufferL().Format( KSearchPresentRelations,
KDefaultNamespaceDefId,
KDefaultNamespaceDefId,
+ aMediaId,
EMdERelationFlagDeleted,
EMdERelationFlagNotPresent,
- aMediaId );
+ KDefaultNamespaceDefId,
+ KDefaultNamespaceDefId,
+ aMediaId,
+ EMdERelationFlagDeleted,
+ EMdERelationFlagNotPresent
+ );
CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
@@ -733,6 +757,7 @@
RRowData var;
CleanupClosePushL( var );
+ var.ReserveL( 4 );
var.AppendL( TColumn( EMdEObjectFlagRemoved ) );
var.AppendL( TColumn( EMdEObjectFlagNotPresent ) );
var.AppendL( TColumn( EMdEObjectFlagStartUpNotPresent ) );
@@ -769,6 +794,7 @@
RRowData var;
CleanupClosePushL( var );
+ var.ReserveL( 5 );
var.AppendL( TColumn( EMdEObjectFlagRemoved ) );
var.AppendL( TColumn( EMdEObjectFlagRemoved ) );
var.AppendL( TColumn( EMdEObjectFlagNotPresent ) ); // not present flag
@@ -1415,8 +1441,6 @@
if(objName != iLastAddedObjName)
{
iLastAddedObjName = objName;
- aMdsBaseObjStatement.Close();
- aMdsBaseObjStatement = RMdsStatement();
aMdsObjStatement.Close();
aMdsObjStatement = RMdsStatement();
}
@@ -1729,6 +1753,7 @@
// do remove
RRowData varRemove;
CleanupClosePushL( varRemove );
+ varRemove.ReserveL( 3 );
varRemove.AppendL( TColumn( EMdEObjectFlagRemoved ) );
varRemove.AppendL( TColumn( aObjectId ) );
varRemove.AppendL( TColumn( aUri ) );
@@ -1822,7 +1847,8 @@
db.ExecuteQueryL( checkObjectClause.ConstBufferL(), query, rowData );
- rowData.Free(); rowData.Reset();
+ rowData.Free();
+ rowData.Reset();
rowData.ReserveL( 3 ); // space for SELECTs
TMdCObject object;
@@ -1996,11 +2022,14 @@
void CMdSSqlObjectManipulate::CollectRemovedItemsL( RArray<TItemId>& aRemoveIds, RArray<TItemId>& aObjectIds,
RArray<TItemId>& aRelationIds, RArray<TItemId>& /*aEventIds*/ )
{
- _LIT( KCollectGetDeleteId, "SELECT O.ObjectId, R.RelationId FROM Object%u AS O LEFT JOIN Relations%u AS R ON O.ObjectId=R.LeftObjectId OR O.ObjectId=R.RightObjectId WHERE NOT O.Flags&? AND ObjectId IN(?" );
+ _LIT( KCollectGetDeleteId1, "SELECT O.ObjectId, R.RelationId FROM Object%u AS O LEFT JOIN Relations%u AS R ON O.ObjectId=R.LeftObjectId WHERE NOT O.Flags&? AND ObjectId IN(?");
+ _LIT( KCollectGetDeleteId2, " UNION SELECT O.ObjectId, R.RelationId FROM Object%u AS O LEFT JOIN Relations%u AS R ON O.ObjectId=R.RightObjectId WHERE NOT O.Flags&? AND ObjectId IN(?");
+
_LIT( KCollectUpdateObjectBegin, "UPDATE Object%u SET Flags=Flags|? WHERE ObjectId IN(?" );
_LIT( KCollectUpdateRelationsBegin, "UPDATE Relations%u SET Flags=Flags|? WHERE RelationId IN(?" );
_LIT( KCollectMiddle, ",?" );
- _LIT( KCollectEnd, ");" );
+ _LIT( KCollectEnd1, ")" );
+ _LIT( KCollectEnd2, ");" );
const TInt removeIdsCount = aRemoveIds.Count();
if (removeIdsCount < 1)
@@ -2009,27 +2038,58 @@
}
CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
- RClauseBuffer commonClauseOne(*this, KCollectGetDeleteId().Length() + 2 * KMaxUintValueLength +
- (removeIdsCount-1) * KCollectMiddle().Length() +
- KCollectEnd().Length());
+
+ const TInt clauseSize( KCollectGetDeleteId1().Length() + KMaxUintValueLength +
+ (removeIdsCount-1) * KCollectMiddle().Length() +
+ KCollectEnd1().Length() +
+ KCollectGetDeleteId2().Length() + KMaxUintValueLength +
+ (removeIdsCount-1) * KCollectMiddle().Length() +
+ KCollectEnd2().Length() );
+
+ HBufC* clause = HBufC::NewLC( clauseSize );
+
+ TPtr clauseBuffer( clause->Des() );
+ clauseBuffer.Append( KCollectGetDeleteId1 );
+ for( TInt i = removeIdsCount - 2; i >=0; i-- )
+ {
+ clauseBuffer.Append( KCollectMiddle );
+ }
+ clauseBuffer.Append( KCollectEnd1 );
+
+ clauseBuffer.Append( KCollectGetDeleteId2 );
+ for( TInt i = removeIdsCount - 2; i >=0; i-- )
+ {
+ clauseBuffer.Append( KCollectMiddle );
+ }
+ clauseBuffer.Append( KCollectEnd2 );
+
+ RClauseBuffer commonClauseOne(*this, clauseSize );
CleanupClosePushL( commonClauseOne );
CMdsClauseBuffer& buffer = commonClauseOne.BufferL();
// getting removed object id and relation id
+ buffer.BufferL().Format( clauseBuffer,
+ iNamespaceDef->GetId(),
+ iNamespaceDef->GetId(),
+ iNamespaceDef->GetId(),
+ iNamespaceDef->GetId() );
+
RRowData dataRow;
CleanupClosePushL( dataRow );
- dataRow.ReserveL( removeIdsCount );
+ dataRow.ReserveL( removeIdsCount*2 + 2 );
dataRow.AppendL( TColumn( EMdEObjectFlagRemoved ) );
- buffer.BufferL().Format( KCollectGetDeleteId, iNamespaceDef->GetId(), iNamespaceDef->GetId() );
- for (TInt i = 0; i < removeIdsCount; ++i)
- {
- if(i>0)
- {
- buffer.AppendL( KCollectMiddle );
- }
- dataRow.AppendL( TColumn( aRemoveIds[i] ) );
- }
- buffer.AppendL( KCollectEnd );
+
+ for( TInt i = removeIdsCount - 1; i >=0; i-- )
+ {
+ dataRow.AppendL( TColumn( aRemoveIds[i] ) );
+ }
+
+ dataRow.AppendL( TColumn( EMdEObjectFlagRemoved ) );
+
+ for( TInt i = removeIdsCount - 1; i >=0; i-- )
+ {
+ dataRow.AppendL( TColumn( aRemoveIds[i] ) );
+ }
RMdsStatement objectQuery;
CleanupClosePushL( objectQuery );
@@ -2037,7 +2097,8 @@
__LOGQUERY_16( _L("Find objects to delete:"), buffer.ConstBufferL(), dataRow);
connection.ExecuteQueryL( buffer.ConstBufferL(), objectQuery, dataRow );
- dataRow.Free(); dataRow.Reset();
+ dataRow.Free();
+ dataRow.Reset();
TItemId objectId = KNoId;
TItemId prevId = objectId;
TItemId relationId = KNoId;
@@ -2073,7 +2134,7 @@
{
buffer.ReserveSpaceL( KCollectUpdateObjectBegin().Length() + KMaxUintValueLength +
(removeObjectCount-1) * KCollectMiddle().Length() +
- KCollectEnd().Length() );
+ KCollectEnd2().Length() );
buffer.BufferL().Format( KCollectUpdateObjectBegin, iNamespaceDef->GetId() );
@@ -2089,39 +2150,10 @@
}
dataRow.AppendL( TColumn( aObjectIds[i] ) );
}
- buffer.AppendL( KCollectEnd );
+ buffer.AppendL( KCollectEnd2 );
__LOGQUERY_16( _L("Remove objects:"), buffer.ConstBufferL(), dataRow);
connection.ExecuteL( buffer.ConstBufferL(), dataRow );
-
-#ifdef MDS_PLAYLIST_HARVESTING_ENABLED
- _LIT( KSetPlaylistItemsRemoved, "UPDATE Object%u SET Flags=Flags|? WHERE ObjectId IN (SELECT ObjectId FROM AudioPlaylistItem%u WHERE AudioObjectID IN(?" );
- _LIT( KPlaylistCollectEnd, "));" );
-
- buffer.ReserveSpaceL( KSetPlaylistItemsRemoved().Length() + KMaxUintValueLength +
- (removeObjectCount-1) * KCollectMiddle().Length() +
- KPlaylistCollectEnd().Length() );
-
- TDefId nameSpaceDefID = iNamespaceDef->GetId();
- buffer.BufferL().Format( KSetPlaylistItemsRemoved, nameSpaceDefID, nameSpaceDefID );
-
- dataRow.Free();
- dataRow.Reset();
- dataRow.AppendL( TColumn( EMdEObjectFlagRemoved ) );
-
- for (TInt i = 0; i < removeObjectCount; ++i)
- {
- if(i>0)
- {
- buffer.AppendL( KCollectMiddle );
- }
- dataRow.AppendL( TColumn( aObjectIds[i] ) );
- }
- buffer.AppendL( KPlaylistCollectEnd );
-
- __LOGQUERY_16( _L("Remove playlist items:"), buffer.ConstBufferL(), dataRow);
- connection.ExecuteL( buffer.ConstBufferL(), dataRow );
-#endif
}
// mark relations as removed
@@ -2131,7 +2163,7 @@
{
buffer.ReserveSpaceL( KCollectUpdateRelationsBegin().Length() + KMaxUintValueLength +
(removeRelationCount-1) * KCollectMiddle().Length() +
- KCollectEnd().Length() );
+ KCollectEnd2().Length() );
buffer.BufferL().Format( KCollectUpdateRelationsBegin, iNamespaceDef->GetId() );
@@ -2147,19 +2179,20 @@
}
dataRow.AppendL( TColumn( aRelationIds[i] ) );
}
- buffer.AppendL( KCollectEnd );
+ buffer.AppendL( KCollectEnd2 );
__LOGQUERY_16( _L("Remove relations:"), buffer.ConstBufferL(), dataRow);
connection.ExecuteL( buffer.ConstBufferL(), dataRow );
}
- CleanupStack::PopAndDestroy( 3, &commonClauseOne ); // objectQuery, dataRow, commonClauseOne
+ CleanupStack::PopAndDestroy( 4, clause ); // objectQuery, dataRow, commonClauseOne, clause
}
void CMdSSqlObjectManipulate::RemoveObjectsByIdL(
CMdCSerializationBuffer& aBuffer, TInt aCount, RArray<TItemId>& aIdArray,
- RArray<TItemId>& aRelationIds, RArray<TItemId>& aEventIds )
+ RArray<TItemId>& aRelationIds, RArray<TItemId>& aEventIds,
+ TBool aUrisRequired, RPointerArray<HBufC>& aRemovedItemUriArray )
{
if ( !iNamespaceDef )
{
@@ -2175,7 +2208,9 @@
for (TUint32 i = 0; i < aCount; ++i)
{
aBuffer.ReceiveL( objectId );
- if ( objectId != KNoId )
+ if ( objectId != KNoId &&
+ objectId != KSystemFavouritesAlbumId &&
+ objectId != KSystemCapturedAlbumId )
{
if ( iLockList.IsLocked( *iNamespaceDef, objectId ) )
{
@@ -2185,15 +2220,28 @@
objectIds.AppendL( objectId );
}
}
-
- CollectRemovedItemsL( objectIds, aIdArray, aRelationIds, aEventIds );
-
+
+ CollectRemovedItemsL( objectIds, aIdArray, aRelationIds, aEventIds );
+
+ if( aUrisRequired )
+ {
+ const TInt count( aIdArray.Count() );
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ TUint32 flags;
+ SearchObjectUriByIdL( aIdArray[i], flags );
+ aRemovedItemUriArray.AppendL( iUri );
+ iUri = NULL;
+ }
+ }
+
CleanupStack::PopAndDestroy( &objectIds );
}
void CMdSSqlObjectManipulate::RemoveObjectsByUriL(
CMdCSerializationBuffer& aBuffer, TInt aCount, RArray<TItemId>& aIdArray,
- RArray<TItemId>& aRelationIds, RArray<TItemId>& aEventIds )
+ RArray<TItemId>& aRelationIds, RArray<TItemId>& aEventIds,
+ TBool aUrisRequired, RPointerArray<HBufC>& aRemovedItemUriArray )
{
if ( !iNamespaceDef )
{
@@ -2210,7 +2258,9 @@
{
TPtrC16 uri = aBuffer.ReceivePtr16L();
objectId = SearchObjectByUriL( uri, flags );
- if ( objectId != KNoId )
+ if ( objectId != KNoId &&
+ objectId != KSystemFavouritesAlbumId &&
+ objectId != KSystemCapturedAlbumId )
{
// unlock object, so update is no possible anymore
if ( iLockList.IsLocked( *iNamespaceDef, objectId ) )
@@ -2219,6 +2269,13 @@
}
objectIds.AppendL( objectId );
+
+ if( aUrisRequired )
+ {
+ // Only objects have uris, so if the are removed by uri, it can be assumed
+ // that only objects are removed.
+ aRemovedItemUriArray.AppendL( uri.AllocL() );
+ }
}
}
@@ -2250,6 +2307,7 @@
RRowData varSearch;
CleanupClosePushL( varSearch );
+ varSearch.ReserveL( 3 );
varSearch.AppendL( TColumn( EMdEObjectFlagNotPresent ) );
varSearch.AppendL( TColumn( EMdEObjectFlagRemoved ) );
varSearch.AppendL( TColumn( aUri ) );
@@ -2277,6 +2335,58 @@
return objectId;
}
+HBufC*& CMdSSqlObjectManipulate::SearchObjectUriByIdL( const TItemId aId,
+ TUint32& aFlags )
+ {
+ _LIT( KMdsSearchObjectUribyId, "SELECT URI,Flags FROM Object%u WHERE NOT Flags&? AND ObjectId=? LIMIT 1;" );
+
+ if ( !iNamespaceDef )
+ {
+ User::Leave( KErrMdEUnknownNamespaceDef );
+ }
+
+ RClauseBuffer commonClauseOne(*this, KMdsSearchObjectUribyId.iTypeLength + KMaxUintValueLength );
+ CleanupClosePushL( commonClauseOne );
+ CMdsClauseBuffer& searchUriClause = commonClauseOne.BufferL();
+
+ searchUriClause.BufferL().Format( KMdsSearchObjectUribyId, iNamespaceDef->GetId() );
+
+ CMdSSqLiteConnection& connection = MMdSDbConnectionPool::GetDefaultDBL();
+
+ TPtrC16 uri;
+ aFlags = 0;
+
+ RRowData varSearch;
+ CleanupClosePushL( varSearch );
+ varSearch.ReserveL( 2 );
+ varSearch.AppendL( TColumn( EMdEObjectFlagNotPresent ) );
+ varSearch.AppendL( TColumn( aId ) );
+
+ RMdsStatement getQuery;
+ CleanupClosePushL( getQuery );
+
+ __LOGQUERY_16( _L("Search object URI by ID:"),
+ searchUriClause.ConstBufferL(), varSearch);
+ TRAPD( err, connection.ExecuteQueryL(
+ searchUriClause.ConstBufferL(), getQuery, varSearch ) );
+
+ varSearch.Free();
+ varSearch.Reset();
+ varSearch.AppendL( TColumn( uri ) );
+ varSearch.AppendL( TColumn( aFlags ) );
+ if ( err == KErrNone && connection.NextRowL( getQuery, varSearch ) )
+ {
+ varSearch.Column(0).Get( uri );
+ varSearch.Column(1).Get( aFlags );
+ iUri = uri.AllocL();
+ }
+
+ CleanupStack::PopAndDestroy( 2, &varSearch ); // getQuery, varSearch
+ CleanupStack::PopAndDestroy( &commonClauseOne );
+
+ return iUri;
+ }
+
TItemId CMdSSqlObjectManipulate::UpdateObjectL(
CMdSSqLiteConnection& aConnection, CMdCSerializationBuffer& aBuffer )
{
@@ -2484,10 +2594,8 @@
objectRow.AppendL( TColumn( object.iId ) );
}
- TInt queryResult = 0, err;
- RMdSTransaction transaction( aConnection );
- CleanupClosePushL( transaction );
- User::LeaveIfError( transaction.Error() );
+ TInt queryResult( 0 );
+ TInt err( KErrNone );
if ( KUpdateModObject || KBaseObjectPropertyMod )
{
@@ -2538,9 +2646,6 @@
}
}
- transaction.CommitL();
- CleanupStack::PopAndDestroy( &transaction );
-
CleanupStack::PopAndDestroy( uriBuf );
CleanupStack::PopAndDestroy( &commonClauseTwo );
CleanupStack::PopAndDestroy( &commonClauseOne );
@@ -2761,6 +2866,7 @@
RRowData varRemove;
CleanupClosePushL( varRemove );
+ varRemove.ReserveL( 3 );
varRemove.AppendL( TColumn(
EMdERelationFlagDeleted | EMdERelationFlagGarbageDeleted ) );
varRemove.AppendL( TColumn( relationId ) );
--- a/package_definition.xml Fri Mar 19 09:38:01 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
- <package id="mds" name="Metadata Services" levels="mgr eng server int">
- <collection id="clfwrapper" name="Content Listing Framework Wrapper" level="int">
- <component id="clfwrapper_build" filter="s60" name="CLF Wrapper Build" introduced="^2">
- <unit bldFile="clfwrapper/group"/>
- </component>
- </collection>
- <collection id="contextengine" name="Context Engine" level="eng">
- <component id="contextengine_plugins" filter="s60" name="Context Engine Plugins" class="plugin" introduced="^2">
- <unit bldFile="contextengine/plugins/group"/>
- </component>
- <component id="contextengine_build" filter="s60" name="Context Engine Build" introduced="^2">
- <unit bldFile="contextengine/group"/>
- </component>
- </collection>
- <collection id="harvester" name="Harvester" level="eng">
- <component id="blacklistclient" filter="s60" name="Blacklist Client" introduced="^2">
- <unit bldFile="harvester/blacklistclient/group"/>
- </component>
- <component id="blacklistserver" filter="s60" name="Blacklist Server" introduced="^2">
- <unit bldFile="harvester/blacklistserver/group"/>
- </component>
- <component id="harvester_common" filter="s60" name="Harvester Common" introduced="^2">
- <unit bldFile="harvester/common/group"/>
- </component>
- <component id="composerplugins" filter="s60" name="Composer Plugins" class="plugin" introduced="^2">
- <unit bldFile="harvester/composerplugins/group"/>
- </component>
- <component id="harvesterplugins" filter="s60" name="Harvester Plugins" class="plugin" introduced="^2">
- <!-- <unit bldFile="harvester/harvesterplugins/audioplaylistplugin/group"/> -->
- <unit bldFile="harvester/harvesterplugins/group"/>
- </component>
- <component id="monitorplugins" filter="s60" name="Monitor Plugins" class="plugin" introduced="^2">
- <unit bldFile="harvester/monitorplugins/group"/>
- </component>
- <component id="harvester_server" filter="s60" name="Harvester Server" introduced="^2">
- <unit bldFile="harvester/server/group"/>
- </component>
- <component id="harvester_client" filter="s60" name="Harvester Client" introduced="^2">
- <unit bldFile="harvester/client/group"/>
- </component>
- <component id="harvester_build" filter="s60" name="Harvester Build" introduced="^2">
- <unit bldFile="harvester/group"/>
- </component>
- </collection>
- <collection id="locationmanager" name="Location Manager" level="mgr">
- <component id="locationtrail" filter="s60" name="Location Trail" introduced="^2">
- <unit bldFile="locationmanager/locationtrail/group"/>
- </component>
- <component id="locationmanager_server" filter="s60" name="Location Manager Server" introduced="^2">
- <unit bldFile="locationmanager/server/group"/>
- </component>
- <component id="locationmanager_client" filter="s60" name="Location Manager Client" introduced="^2">
- <unit bldFile="locationmanager/client/group"/>
- </component>
- <component id="locationmanager_build" filter="s60" name="Location Manager Build" introduced="^2">
- <!--consider making this collection a single component -->
- <unit bldFile="locationmanager/group"/>
- </component>
- </collection>
- <collection id="metadataengine" name="Metadata Engine" level="eng">
- <component id="metadataengine_common" filter="s60" name="Metadata Engine Common" introduced="^2">
- <unit bldFile="metadataengine/common/group"/>
- </component>
- <component id="metadataengine_server" filter="s60" name="Metadata Engine Server" introduced="^2">
- <unit bldFile="metadataengine/server/group"/>
- </component>
- <component id="metadataengine_client" filter="s60" name="Metadata Engine Client" introduced="^2">
- <unit bldFile="metadataengine/client/group"/>
- </component>
- <component id="metadataengine_build" filter="s60" name="Metadata Engine Build" introduced="^2">
- <!--consider making this collection a single component -->
- <unit bldFile="metadataengine/group"/>
- </component>
- </collection>
- <collection id="watchdog" name="Watchdog" level="server">
- <component id="mdswatchdog" filter="s60" name="Metadata Watchdog" introduced="^2">
- <unit bldFile="watchdog/group"/>
- </component>
- </collection>
- <collection id="iadstoprestart" name="IAD Stop/Restart" level="server">
- <component id="iadstoprestart_build" filter="s60" name="IAD Stop Restart Build" introduced="^2">
- <!-- <unit bldFile="iadstoprestart/group"/> -->
- </component>
- </collection>
- <collection id="mds_info" name="Metadata Services Info" level="int">
- <component id="mds_pub" filter="s60" name="Metadata Services Public Interfaces" class="api" introduced="^2">
- <unit bldFile="mds_pub/group"/>
- </component>
- <component id="mds_plat" filter="s60" name="Metadata Services Platform Interfaces" class="api" introduced="^2">
- <unit bldFile="mds_plat/group"/>
- <!-- should #include the rets if they're needed -->
- <!-- <unit bldFile="mds_plat/content_listing_framework_collection_manager_api/tsrc/group"/> -->
- <!-- <unit bldFile="mds_plat/context_engine_plugin_api/tsrc/group"/> -->
- <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/composerplugintest/group"/> -->
- <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/group"/> -->
- <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/harvesterclienttest/group"/> -->
- <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/harvesterdatatest/group"/> -->
- <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/harvesterplugintest/group"/> -->
- <!-- <unit bldFile="mds_plat/harvester_framework_api/tsrc/monitorplugintest/group"/> -->
- <!-- <unit bldFile="mds_plat/location_manager_api/tsrc/group"/> -->
- <!-- <unit bldFile="mds_plat/metadata_engine_api/tsrc/group"/> -->
- </component>
- <component id="mds_build" filter="s60" name="Metadata Services Build" introduced="^2">
- <!-- consider distributiing this into the rest of the components in the package -->
- <unit bldFile="group"/>
- </component>
- </collection>
- </package>
-</SystemDefinition>
Binary file sis/mds/mds_stub.sis has changed
--- a/sis/mds/package.pkg Fri Mar 19 09:38:01 2010 +0200
+++ b/sis/mds/package.pkg Fri Apr 16 15:23:55 2010 +0300
@@ -17,7 +17,7 @@
&EN
;packet-header (name, uid, major, minor, build, type)
-#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 3, TYPE=SA, RU
+#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 5, TYPE=SA, RU
; Localised vendor name
%{"Nokia"}
--- a/sis/mds/package_separate.pkg Fri Mar 19 09:38:01 2010 +0200
+++ b/sis/mds/package_separate.pkg Fri Apr 16 15:23:55 2010 +0300
@@ -17,7 +17,7 @@
&EN
;packet-header (name, uid, major, minor, build, type)
-#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 3, TYPE=SA, RU
+#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 5, TYPE=SA, RU
; Localised vendor name
%{"Nokia"}
--- a/sis/mds/stub.pkg Fri Mar 19 09:38:01 2010 +0200
+++ b/sis/mds/stub.pkg Fri Apr 16 15:23:55 2010 +0300
@@ -17,7 +17,7 @@
&EN
; Header
-#{"Metadata System"}, (0x200009F5), 10, 10, 3, TYPE=SA
+#{"Metadata System"}, (0x200009F5), 10, 10, 5, TYPE=SA
; Localised Vendor name
%{"Nokia"}
--- a/watchdog/src/watchdog.cpp Fri Mar 19 09:38:01 2010 +0200
+++ b/watchdog/src/watchdog.cpp Fri Apr 16 15:23:55 2010 +0300
@@ -89,20 +89,46 @@
PRINT(_L("CWatchdog::ConstructL() - create observer"));
iShutdownObserver = CWDShutdownObserver::NewL( *this );
iSelfShutdownObserver = CWDSelfShutdownObserver::NewL( *this );
-
- RProcess process;
- process.SetPriority( EPriorityBackground );
- process.Close();
}
void CWatchdog::Start()
- {
-
+ {
PRINT(_L("CWatchdog::Start()"));
- // Create the server process
+ // Double check that harvester server is not already running
+ TFullName name;
TInt res( KErrNone );
+
+ // find really Harvester Server, using TFindServer to avoid logon a dead process
+ TFindServer findServer( KHarvesterServerProcess );
+ if ( findServer.Next(name) == KErrNone )
+ {
+ TFindProcess findProcess( KHarvesterServerProcess );
+ if ( findProcess.Next(name) == KErrNone )
+ {
+ PRINT(_L("CWatchdog::Start() - server already running, start listening"));
+
+ iProcess.Close();
+ res = iProcess.Open(name);
+ if ( res != KErrNone )
+ {
+ PRINT(_L("CWatchdog::Start() - error in starting listening "));
+ return;
+ }
+ iState = EWaitingRendezvous;
+ SetActive();
+ return;
+ }
+ }
+ // close the panic process
+ TFindProcess findProcess( KHarvesterServerProcess );
+ if ( findProcess.Next(name) == KErrNone )
+ {
+ iProcess.Close();
+ }
+
+ // Create the server process
// KNullDesC param causes server's E32Main() to be run
res = iProcess.Create( KHarvesterServerExe, KNullDesC );
if ( res != KErrNone )
@@ -189,8 +215,7 @@
}
default:
- break;
-
+ break;
}