--- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Fri Mar 12 15:43:57 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp Mon Mar 15 12:41:55 2010 +0200
@@ -143,9 +143,10 @@
if (!iInit)
{
- /*
+#ifdef MDS_MODIFY_OBSERVER
iHarvesterClient.RemoveHarvesterEventObserver(*this);
- iHarvesterClient.Close();*/
+ iHarvesterClient.Close();
+#endif
}
if ( iCollectionUtility )
@@ -247,6 +248,12 @@
}
delete iQueryPlaceholders;
iQueryPlaceholders = NULL;
+
+ if(iDoQueryAllItems)
+ {
+ iDoQueryAllItems = EFalse;
+ TRAP_IGNORE(QueryAllItemsL());
+ }
}
else if(&aQuery == iQueryAllItems)
{
@@ -291,6 +298,52 @@
{
iProcessingCount = iQuery->Count();
+ if(iProcessingCount != iQueryQueue.Count())
+ {
+ TN_DEBUG1( "CThumbAGProcessor::HandleQueryCompleted() some result items missing");
+
+ RArray<TItemId> iQueryQueueDelta;
+
+ TInt itemIndex(KErrNotFound);
+
+ //search delta items
+ for(TInt queryItem =0; queryItem < iQueryQueue.Count();queryItem++)
+ {
+ TBool found(EFalse);
+ for(TInt queryResult = 0; queryResult < iQuery->Count(); queryResult++)
+ {
+ const CMdEObject* object = &iQuery->Result(queryResult);
+
+ if( iQueryQueue[queryItem] == object->Id())
+ {
+ found = ETrue;
+ break;
+ }
+ }
+
+ if(!found)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing from results item %d", iQueryQueue[queryItem] );
+ iQueryQueueDelta.Append( iQueryQueue[queryItem] );
+ }
+ }
+
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() missing items total count %d", iQueryQueueDelta.Count());
+ //cleanup from previous queue it item is not found from MDS
+ while(iQueryQueueDelta.Count())
+ {
+ itemIndex = iLastQueue->Find(iQueryQueueDelta[0]);
+ if(itemIndex >= 0)
+ {
+ TN_DEBUG2( "CThumbAGProcessor::HandleQueryCompleted() remove items %d", iQueryQueue[0]);
+ iLastQueue->Remove( itemIndex );
+ }
+ iQueryQueueDelta.Remove(0);
+ }
+ iQueryQueueDelta.Close();
+ }
+
+ // no results, reset query
if( !iProcessingCount)
{
delete iQuery;
@@ -818,6 +871,8 @@
iPlaceholderQueue.Reset();
TRAP_IGNORE(QueryPlaceholdersL());
+ //query all items after PH query
+ iDoQueryAllItems = ETrue;
TN_DEBUG1( "CThumbAGProcessor::RunL() - Initialisation 1 done" );
ActivateAO();
return;
@@ -829,9 +884,10 @@
iInit2 = EFalse;
TInt err(KErrNone);
- /*
+
+#ifdef MDS_MODIFY_OBSERVER
TN_DEBUG1( "CThumbAGProcessor::RunL() do iHarvesterClient connect");
- TInt err = iHarvesterClient.Connect();
+ err = iHarvesterClient.Connect();
TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient connect err = %d", err);
__ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
@@ -842,7 +898,8 @@
err = iHarvesterClient.AddHarvesterEventObserver( *this, EHEObserverTypeOverall | EHEObserverTypePlaceholder, KMaxTInt );
TN_DEBUG2( "CThumbAGProcessor::RunL() iHarvesterClient observer err = %d", err);
__ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGProcessor::RunL(), !iHarvesterClient "), err));
- }*/
+ }
+#endif
TN_DEBUG1( "CThumbAGProcessor::RunL() MMPXCollectionUtility");
TRAP( err, iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeIsolated ));
@@ -855,8 +912,6 @@
iActivityManager->Start();
}
- TRAP_IGNORE(QueryAllItemsL());
-
TN_DEBUG1( "CThumbAGProcessor::RunL() - Initialisation 2 done" );
return;
}
@@ -908,7 +963,7 @@
}
#endif
- if( /*iForceRun || */iForegroundRun )
+ if( iForceRun || iForegroundRun )
{
TN_DEBUG1( "void CThumbAGProcessor::RunL() skip idle detection!");
CancelTimeout();
@@ -931,15 +986,12 @@
TInt serveIdle(KErrNotFound);
TInt ret = RProperty::Get(KServerIdle, KIdle, serveIdle);
- if(ret == KErrNone )
+ if(ret != KErrNone || !serveIdle )
{
- if(!serveIdle)
- {
//start inactivity timer and retry on after callback
TN_DEBUG1( "void CThumbAGProcessor::RunL() server not idle");
StartTimeout();
return;
- }
}
TN_DEBUG1( "void CThumbAGProcessor::RunL() device and server idle, process");
}
@@ -1010,23 +1062,9 @@
TN_DEBUG1( "CThumbAGProcessor::RunL() - iQueryReady FINISH" );
iQueryReady = EFalse;
iQueryActive = EFalse;
- iModify = EFalse;
+ }
- //check if forced run needs to continue
- if (iModifyQueue.Count())
- {
- SetForceRun( ETrue );
- }
- else
- {
- SetForceRun( EFalse );
- }
- }
- //keep going if processing Remove items or if Add item fails
- else if( iModify || err )
- {
- ActivateAO();
- }
+ ActivateAO();
}
//waiting for MDS query to complete
else if( iQueryActive )
@@ -1317,6 +1355,17 @@
TRequestStatus* statusPtr = &iStatus;
User::RequestComplete( statusPtr, KErrNone );
}
+
+ //check if forced run needs to continue
+ if (iModifyQueue.Count())
+ {
+ SetForceRun( ETrue );
+ }
+ else
+ {
+ iModify = EFalse;
+ SetForceRun( EFalse );
+ }
UpdatePSValues();
}
@@ -1477,10 +1526,7 @@
TN_DEBUG2( "CThumbAGProcessor::SetForceRun(%d) - end", aForceRun );
// enable forced run
- if (aForceRun)
- {
- iForceRun = aForceRun;
- }
+ iForceRun = aForceRun;
}
// ---------------------------------------------------------------------------
@@ -1550,18 +1596,18 @@
return;
}
- TN_DEBUG1( "CThumbAGProcessor::HandleCollectionMessage" );
-
TMPXMessageId generalId( *aMessage->Value<TMPXMessageId>( KMPXMessageGeneralId ) );
+
+ TN_DEBUG2( "CThumbAGProcessor::HandleCollectionMessage KMPXMessageGeneralId=%d", generalId);
//we are interestead of only general system events
if ( generalId == KMPXMessageGeneral )
{
TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) );
+ TInt op( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
+ TN_DEBUG3( "CThumbAGProcessor::HandleCollectionMessage KMPXMessageGeneralEvent=%d", event, op);
if ( event == TMPXCollectionMessage::EBroadcastEvent )
{
- TInt op( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
-
switch( op )
{
//when MTP sync or music collection is started then pause processing