diff -r ff2fb7658ff7 -r f759b6186ab5 imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp --- a/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Mon Jun 21 16:00:46 2010 +0300 +++ b/imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagdaemon.cpp Thu Jul 15 18:59:26 2010 +0300 @@ -80,7 +80,6 @@ #ifdef _DEBUG iAddCounter = 0; - iModCounter = 0; iDelCounter = 0; #endif @@ -137,9 +136,7 @@ if(iMdESession) { - TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) ); - TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) ); - TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) ); + TRAP_IGNORE( iMdESession->RemoveObjectObserverWithUriL( *this ) ); TRAP_IGNORE( iMdESession->RemoveObjectPresentObserverL( * this )); // connect to MDS @@ -149,6 +146,22 @@ iMdESession = CMdESession::NewL( *this ); iSessionError = EFalse; + + delete iImageObserver; + iImageObserver = NULL; + iImageObserver = CThumbAGImageObserver::NewL(iProcessor); + + delete iCameraObserver; + iCameraObserver = NULL; + iCameraObserver = CThumbAGCameraObserver::NewL(iProcessor); + + delete iAudioObserver; + iAudioObserver = NULL; + iAudioObserver = CThumbAGAudioObserver::NewL(iProcessor); + + delete iVideoObserver; + iVideoObserver = NULL; + iVideoObserver = CThumbAGVideoObserver::NewL(iProcessor); } else { @@ -166,7 +179,19 @@ { TN_DEBUG1( "CThumbAGDaemon::~CThumbAGDaemon() - begin" ); - iShutdown = ETrue; + iShutdown = ETrue; + + delete iImageObserver; + iImageObserver = NULL; + + delete iCameraObserver; + iCameraObserver = NULL; + + delete iVideoObserver; + iVideoObserver = NULL; + + delete iAudioObserver; + iAudioObserver = NULL; delete iMDSShutdownObserver; delete iShutdownObserver; @@ -187,9 +212,6 @@ if (iMdESession) { - // 2 observers - TRAP_IGNORE( iMdESession->RemoveObjectObserverL( *this ) ); - #ifdef MDS_URI_OBSERVER // remove observer with uri TRAP_IGNORE( iMdESession->RemoveObjectObserverWithUriL( *this ) ); @@ -262,9 +284,9 @@ if (aError == KErrNone) { - iProcessor->SetMdESession(iMdESession); + TRAPD(err, iProcessor->SetMdESessionL(iMdESession)); - TRAPD( err, AddObserversL() ); + TRAP( err, AddObserversL() ); if (err != KErrNone) { TN_DEBUG2( "CThumbAGDaemon::HandleSessionOpened, AddObserversL error == %d", err ); @@ -287,6 +309,18 @@ { iSessionError = ETrue; + delete iImageObserver; + iImageObserver = NULL; + + delete iCameraObserver; + iCameraObserver = NULL; + + delete iVideoObserver; + iVideoObserver = NULL; + + delete iAudioObserver; + iAudioObserver = NULL; + // kill processor right away, because it also has MdESession if(iProcessor) { @@ -328,8 +362,9 @@ { TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - removed"); TInt err(0); - TRAP(err, iProcessor->AddToQueueL(aType, aObjectIdArray, aObjectUriArray, EFalse)); + TRAP(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, aObjectUriArray, EFalse)); __ASSERT_DEBUG((err==KErrNone), User::Panic(_L("CThumbAGDaemon::HandleUriObjectNotification()"), err)); + err = KErrNone; } TN_DEBUG1( "CThumbAGDaemon::HandleUriObjectNotification() - end" ); @@ -353,37 +388,23 @@ } #ifdef _DEBUG - if (aType == ENotifyAdd) - { - TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyAdd %d", aObjectIdArray.Count() ); - iAddCounter = aObjectIdArray.Count(); - } - else if (aType == ENotifyModify) - { - TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyModify %d", aObjectIdArray.Count() ); - iModCounter = aObjectIdArray.Count(); - } - else if (aType == ENotifyRemove) + if (aType == ENotifyRemove) { TN_DEBUG2( "CThumbAGDaemon::HandleObjectNotification() - ENotifyRemove %d", aObjectIdArray.Count() ); iDelCounter = aObjectIdArray.Count(); } #endif - if ( (aType == ENotifyAdd || aType == ENotifyModify || aType == ENotifyRemove) && - (aObjectIdArray.Count() > 0) ) + if ( aType == ENotifyRemove && aObjectIdArray.Count() > 0 ) { TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - AddToQueueL" ); // If delete event, remove IDs from Modify and Add queues - if ( aType == ENotifyRemove ) - { - iProcessor->RemoveFromQueues( aObjectIdArray, EFalse); - } + iProcessor->RemoveFromQueues( aObjectIdArray, EFalse); // Add event to processing queue by type and enable force run RPointerArray dummyArray; - TRAPD(err, iProcessor->AddToQueueL(aType, aObjectIdArray, dummyArray, EFalse)); + TRAPD(err, iProcessor->AddToQueueL(aType, EGenerationItemTypeAny, aObjectIdArray, dummyArray, EFalse)); if (err != KErrNone) { TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - error adding to queue" ); @@ -395,12 +416,8 @@ } #ifdef _DEBUG - TN_DEBUG4( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Modify = %d Delete = %d", - iAddCounter, iModCounter, iDelCounter ); - iModCounter = 0; + TN_DEBUG2( "CThumbAGDaemon::IN-COUNTERS---------- Delete = %d", iDelCounter ); iDelCounter = 0; - iAddCounter = 0; - #endif TN_DEBUG1( "CThumbAGDaemon::HandleObjectNotification() - end" ); @@ -430,10 +447,9 @@ { // do not force run of these items RPointerArray dummyArray; - TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, aObjectIdArray, dummyArray, ETrue)); + TRAP(err, iProcessor->AddToQueueL(ENotifyAdd, EGenerationItemTypeUnknown, aObjectIdArray, dummyArray, ETrue)); - TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd %d", aObjectIdArray.Count() ); - + TN_DEBUG2( "CThumbAGDaemon::HandleObjectPresentNotification() - ENotifyAdd unknown items %d", aObjectIdArray.Count() ); #ifdef _DEBUG iAddCounter = aObjectIdArray.Count(); if (err != KErrNone) @@ -465,11 +481,9 @@ } #ifdef _DEBUG - TN_DEBUG4( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Modify = %d Delete = %d", - iAddCounter, iModCounter, iDelCounter ); - iModCounter = 0; + TN_DEBUG3( "CThumbAGDaemon::IN-COUNTERS---------- Add = %d Delete = %d", iAddCounter, iDelCounter ); iDelCounter = 0; - iAddCounter = 0; + iAddCounter = 0; #endif TN_DEBUG1( "CThumbAGDaemon::HandleObjectPresentNotification() - end" ); @@ -498,31 +512,6 @@ { TN_DEBUG1( "CThumbAGDaemon::AddObserversL() - begin" ); - CMdENamespaceDef& defaultNamespace = iMdESession->GetDefaultNamespaceDefL(); - CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); - CMdEObjectDef& videoDef = defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject ); - CMdEObjectDef& audioDef = defaultNamespace.GetObjectDefL( MdeConstants::Audio::KAudioObject ); - - // set observing conditions - CMdELogicCondition* addCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorOr ); - addCondition->AddObjectConditionL( imageDef ); - addCondition->AddObjectConditionL( videoDef ); - addCondition->AddObjectConditionL( audioDef ); - CleanupStack::Pop( addCondition ); - - CMdELogicCondition* modifyCondition = CMdELogicCondition::NewLC( ELogicConditionOperatorOr ); - modifyCondition->AddObjectConditionL( imageDef ); - modifyCondition->AddObjectConditionL( videoDef ); - modifyCondition->AddObjectConditionL( audioDef ); - CleanupStack::Pop( modifyCondition ); - - // add observer - iMdESession->AddObjectObserverL( *this, addCondition, ENotifyAdd ); - - // modify observer -#ifdef MDS_MODIFY_OBSERVER - iMdESession->AddObjectObserverL( *this, modifyCondition, ENotifyModify ); -#endif #ifdef MDS_URI_OBSERVER // remove observer with uri