--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Fri Feb 19 23:07:36 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailserversession.cpp Fri Mar 12 15:43:57 2010 +0200
@@ -102,11 +102,6 @@
err = ChangePriority( aMessage );
break;
}
- case ECreateThumbnails:
- {
- CreateThumbnailsL( aMessage );
- break;
- }
case EDeleteThumbnails:
{
DeleteThumbnailsL( aMessage );
@@ -243,17 +238,24 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
- TBool finished = Server()->UpdateThumbnailsL( params.iThumbnailId, params.iFileName, params.iOrientation, params.iModified );
+ TBool finished = Server()->UpdateThumbnailsL( params.iFileName, params.iOrientation, params.iModified );
RArray < TThumbnailPersistentSize >* missingSizes = NULL;
+ TBool gridSizeOnly(EFalse);
+
+ if ( params.iQualityPreference == CThumbnailManager
+ ::EOptimizeForQualityWithPreview )
+ {
+ gridSizeOnly = ETrue;
+ }
+
if (finished)
{
// source type
TDataType mimeType;
TInt sourceType = 0;
TInt err = Server()->MimeTypeFromFileExt( params.iFileName, mimeType );
- TBool missingIDs(EFalse);
// get missing sizes
if ( err == KErrNone && ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
@@ -263,7 +265,7 @@
missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
CleanupClosePushL( *missingSizes );
- Server()->GetMissingSizesAndIDsL( params.iFileName, sourceType, *missingSizes, missingIDs);
+ Server()->GetMissingSizesL( params.iFileName, sourceType, *missingSizes, gridSizeOnly );
if ( missingSizes->Count() == 0)
{
@@ -276,7 +278,7 @@
if(!missingSizes)
{
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished" );
+ TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished part 1" );
aMessage.Complete( KErrNone );
}
else
@@ -285,7 +287,7 @@
}
}
- if(missingSizes || !finished)
+ if (missingSizes || !finished)
{
TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - need to create (some) thumbs" );
@@ -306,7 +308,7 @@
}
else
{
- TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished" );
+ TN_DEBUG1( "CThumbnailServerSession::UpdateThumbnailsL() - finished part 2" );
}
iMessage = RMessage2();
@@ -334,54 +336,14 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
- TRAPD( err, Server()->FetchThumbnailL( params.iThumbnailId, iBitmap, iBuffer,
- params.iThumbnailSize, iOriginalSize ));
- if ( !err && iBitmap )
- {
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByIdAsyncL() - found existing thumbnail- bitmap" );
-
- ProcessBitmapL();
- }
- else if ( !err && iBuffer)
- {
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByIdAsyncL() - found existing thumbnail- jpeg" );
-
- CThumbnailDecodeTask* task = new( ELeave )CThumbnailDecodeTask( Server()
- ->Processor(), * Server(), iBuffer, params.iPriority, params.iDisplayMode );
-
- CleanupStack::PushL( task );
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ), iMessage );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
-
- // Decode task is now responsible for completing the message
- iMessage = RMessage2();
-
- //CThumbnailDecodeTask is responsible freeing
- iBuffer = NULL;
- }
- else if( err == KErrCompletion )
- {
- // If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
- TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByIdAsyncL() - thumbnail blacklisted" );
- aMessage.Complete( err );
- iMessage = RMessage2();
- }
- else
- {
- TN_DEBUG2(
- "CThumbnailServerSession::RequestThumbByIdAsyncL() - thumbnail not found ( query path from MDS ), err=%d ", err );
-
+
#ifdef RD_MDS_2_5
// try to query path from MDS
CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask(
Server()->Processor(), params.iPriority + 1, Server()->GetMdESession(), *Server());
CleanupStack::PushL( task );
- task->QueryPathByIdL(params.iThumbnailId);
+ task->QueryPathByIdL(params.iThumbnailId, EFalse);
task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ), iMessage );
Server()->QueueTaskL( task );
CleanupStack::Pop( task ); // owned by processor now
@@ -389,14 +351,13 @@
// query task is now responsible for completing the message
iMessage = RMessage2();
#else
- User::Leave(KThumbnailErrThumbnailNotFound);
+ User::Leave(KErrNotSupported);
#endif // RD_MDS_2_5
- }
#ifdef _DEBUG
aStop.UniversalTime();
- TN_DEBUG2( "CThumbnailStore::RequestThumbByIdAsyncL() request took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000 );
+ TN_DEBUG2( "CThumbnailServerSession::RequestThumbByIdAsyncL() request took %d ms", (TInt)aStop.MicroSecondsFrom(aStart).Int64()/1000 );
#endif
TN_DEBUG1("CThumbnailServerSession::RequestThumbByIdAsyncL() - end" );
@@ -437,6 +398,7 @@
// CreateThumbnails
if (params.iControlFlags == EThumbnailGeneratePersistentSizesOnly)
{
+ TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - EThumbnailGeneratePersistentSizesOnly" );
CleanupClosePushL( file );
CreateGenerateTaskFromFileHandleL( &file );
CleanupStack::Pop( &file );
@@ -467,6 +429,7 @@
else if ( (err == KErrNotFound || err == KErrAccessDenied) &&
!(params.iFlags& CThumbnailManager::EDoNotCreate) )
{
+ TN_DEBUG1( "CThumbnailServerSession::RequestThumbByFileHandleAsyncL() - KErrNotFound & !EDoNotCreate" );
CreateGenerateTaskFromFileHandleL( &file);
}
else if (!err && iBuffer)
@@ -569,7 +532,7 @@
{
// If thumbnail of requested size is blacklisted, fetching is left with KErrCompletion
TN_DEBUG1(
- "CThumbnailServerSession::RequestThumbByIdAsyncL() - thumbnail blacklisted" );
+ "CThumbnailServerSession::RequestThumbByPathAsyncL() - thumbnail blacklisted" );
aMessage.Complete( err );
iMessage = RMessage2();
}
@@ -595,24 +558,7 @@
User::Leave( KErrDiskFull );
}
-#ifdef RD_MDS_2_5
- // try to query ID from MDS
- CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask(
- Server()->Processor(), params.iPriority + 1, Server()->GetMdESession(), *Server());
-
- CleanupStack::PushL( task );
- task->SetUpdateToDb( EFalse );
- task->QueryIdByPathL( params.iFileName );
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ), iMessage );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
-
- // query task is now responsible for completing the message
- iMessage = RMessage2();
-#else
User::Leave(err);
-#endif // RD_MDS_2_5
-
}
}
@@ -690,7 +636,6 @@
TDataType mimeType;
TInt sourceType = 0;
TInt err = Server()->MimeTypeFromFileExt( params.iTargetUri, mimeType );
- TBool missingIDs(EFalse);
// get missing sizes
if ( err == KErrNone && ( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly ) != 0 )
@@ -700,7 +645,7 @@
missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
CleanupClosePushL( *missingSizes );
- Server()->GetMissingSizesAndIDsL( params.iTargetUri, sourceType, *missingSizes, missingIDs);
+ Server()->GetMissingSizesL( params.iTargetUri, sourceType, *missingSizes, EFalse);
if ( missingSizes->Count() == 0)
{
@@ -731,11 +676,9 @@
CThumbnailScaleTask* scaleTask = CThumbnailScaleTask::NewL( Server()->Processor(),
*Server(), params.iTargetUri, bitmap, bitmapSize,
(*missingSizes)[i].iSize, (*missingSizes)[i].iCrop, params.iDisplayMode,
- KMaxPriority, KNullDesC, (*missingSizes)[i].iType, params.iThumbnailId, EFalse, EFalse );
+ KMaxPriority, KNullDesC, (*missingSizes)[i].iType, params.iModified, EFalse, EFalse );
CleanupStack::PushL( scaleTask );
scaleTask->SetDoStore( ETrue );
- //increase priority, scale needs to run before ID update below
- scaleTask->SetPriority( params.iPriority + 1 );
Server()->Processor().AddTaskL( scaleTask );
CleanupStack::Pop( scaleTask );
@@ -746,8 +689,6 @@
iMessage = RMessage2();
}
}
-
- TN_DEBUG3("CThumbnailServerSession::RequestSetThumbnailByBitmapL() ID = %d, missingIDs = %d", params.iThumbnailId, missingIDs);
}
else
{
@@ -767,23 +708,6 @@
iBitmapHandle = 0;
bitmap = NULL;
}
-
-// -----------------------------------------------------------------------------
-// CThumbnailServerSession::CreateThumbnailsL()
-// Create thumbnails for given object file
-// -----------------------------------------------------------------------------
-//
-void CThumbnailServerSession::CreateThumbnailsL( const RMessage2& aMessage )
- {
- RFile64 file;
- CleanupClosePushL( file );
- User::LeaveIfError( file.AdoptFromClient( aMessage, 1, 2 ));
-
- CreateGenerateTaskFromFileHandleL( &file);
-
- CleanupStack::Pop( &file );
- }
-
// -----------------------------------------------------------------------------
// CThumbnailServerSession::CreateGenerateTaskL()
@@ -801,8 +725,6 @@
{
User::Leave( KErrDiskFull );
}
-
- TBool missingIDs = EFalse;
RArray < TThumbnailPersistentSize >* missingSizes = NULL;
@@ -813,35 +735,17 @@
sourceType = Server()->SourceTypeFromMimeType( params.iMimeType );
missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
CleanupClosePushL( *missingSizes );
-
- Server()->GetMissingSizesAndIDsL( params.iFileName, sourceType, *missingSizes, missingIDs );
-#ifdef RD_MDS_2_5
- if( missingIDs )
- {
- TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() some IDs missing");
+
+
+ TBool gridSizeOnly(EFalse);
- if( params.iThumbnailId == KNoId)
- {
- TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() query fro MDS");
- // try to query ID from MDS
- CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask(
- Server()->Processor(), params.iPriority + 1, Server()->GetMdESession(), *Server());
-
- CleanupStack::PushL( task );
- task->QueryIdByPathL( params.iFileName );
-
- task->SetMessageData( TThumbnailServerRequestId( this, params.iRequestId ) );
- Server()->QueueTaskL( task );
- CleanupStack::Pop( task ); // owned by processor now
- TN_DEBUG1("CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() query from MDS queued" );
- }
- else
- {
- TN_DEBUG2("CThumbnailServerSession::CreateGenerateTaskFromFileHandleL() got ID %d from params", params.iThumbnailId);
- TRAP_IGNORE( Server()->UpdateIDL(params.iFileName, params.iThumbnailId ) );
- }
- }
-#endif // RD_MDS_2_5
+ if ( params.iQualityPreference == CThumbnailManager
+ ::EOptimizeForQualityWithPreview )
+ {
+ gridSizeOnly = ETrue;
+ }
+
+ Server()->GetMissingSizesL( params.iFileName, sourceType, *missingSizes, gridSizeOnly);
if ( missingSizes->Count() == 0)
{
@@ -873,7 +777,7 @@
CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
->Processor(), * Server(), aFile, NULL, ¶ms.iMimeType, params.iFlags,
params.iSize, params.iDisplayMode, priority, missingSizes, params.iTargetUri,
- params.iThumbnailSize, params.iThumbnailId, params.iQualityPreference );
+ params.iThumbnailSize, params.iModified, params.iQualityPreference );
// do not store bitmaps to server pool when generating only
if( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly )
@@ -950,8 +854,7 @@
missingSizes = new (ELeave) RArray < TThumbnailPersistentSize >;
CleanupClosePushL( *missingSizes );
- TBool missingIDs;
- Server()->GetMissingSizesAndIDsL( params.iTargetUri, sourceType, *missingSizes, missingIDs );
+ Server()->GetMissingSizesL( params.iTargetUri, sourceType, *missingSizes, EFalse );
if ( missingSizes->Count() == 0)
{
@@ -984,7 +887,7 @@
CThumbnailGenerateTask* task = new( ELeave )CThumbnailGenerateTask( Server()
->Processor(), * Server(), NULL, aBuffer, ¶ms.iMimeType, params.iFlags,
params.iSize, params.iDisplayMode, priority, missingSizes, params.iTargetUri,
- params.iThumbnailSize, params.iThumbnailId, params.iQualityPreference );
+ params.iThumbnailSize, params.iModified, params.iQualityPreference );
// do not store bitmaps to server pool when generating only
if( params.iControlFlags & EThumbnailGeneratePersistentSizesOnly )
@@ -1030,15 +933,13 @@
if( params.iFileName != KNullDesC )
{
- TN_DEBUG4( "CThumbnailServerSession::FetchThumbnailL( TNId==%d ThumbnailSize=%d ( Path=%S ))",
- params.iThumbnailId, params.iThumbnailSize, ¶ms.iFileName );
+ TN_DEBUG3( "CThumbnailServerSession::FetchThumbnailL( ThumbnailSize=%d ( Path=%S ))",
+ params.iThumbnailSize, ¶ms.iFileName );
Server()->FetchThumbnailL( params.iFileName, iBitmap, iBuffer, params.iThumbnailSize, iOriginalSize);
}
else
{
- TN_DEBUG3( "CThumbnailServerSession::FetchThumbnailL(Path=%S ThumbnailSize=%d)",
- ¶ms.iFileName, params.iThumbnailSize );
- Server()->FetchThumbnailL( params.iThumbnailId, iBitmap, iBuffer, params.iThumbnailSize, iOriginalSize );
+ User::Leave( KErrNotSupported );
}
#ifdef _DEBUG
if( iBitmap)
@@ -1064,7 +965,7 @@
{
Server()->StoreThumbnailL( params.iTargetUri, iBitmap, iOriginalSize,
params.iFlags& CThumbnailManager::ECropToAspectRatio,
- params.iThumbnailSize, params.iThumbnailId,
+ params.iThumbnailSize, params.iModified,
EFalse, EFalse);
}
@@ -1191,9 +1092,17 @@
aMessage.ReadL( 0, iRequestParams );
const TThumbnailRequestParams& params = iRequestParams();
- TThumbnailId id = params.iThumbnailId;
- Server()->DeleteThumbnailsByIdL( id );
+
+#ifdef RD_MDS_2_5
+ // try to query path from MDS
+ CThumbnailMDSQueryTask* task = new( ELeave )CThumbnailMDSQueryTask(
+ Server()->Processor(), params.iPriority + 1, Server()->GetMdESession(), *Server());
+ CleanupStack::PushL( task );
+ task->QueryPathByIdL(params.iThumbnailId, ETrue);
+ Server()->QueueTaskL( task );
+ CleanupStack::Pop( task ); // owned by processor now
+#endif // RD_MDS_2_5
aMessage.Complete( KErrNone );
iMessage = RMessage2();
}
@@ -1328,6 +1237,7 @@
//
TInt CThumbnailServerSession::ConvertSqlErrToE32Err( TInt aReason )
{
+ TN_DEBUG2("CThumbnailServerSession::ConvertSqlErrToE32Err(%d)", aReason);
TInt e32Err;
if ( aReason >= - 144 )
// magic: [-1..-144] is E32 error range