imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp
branchRCL_3
changeset 7 2eb74cf6572e
parent 5 82749d516180
child 9 dea39715fc05
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp	Fri Feb 19 23:07:36 2010 +0200
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp	Fri Mar 12 15:43:57 2010 +0200
@@ -87,88 +87,32 @@
             
             TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() - URI = %S", &object->Uri() );
                             
-            if( iUpdateToDb)
-                {
-                //update IDs to database by Path
-                if (ClientThreadAlive(EFalse))
-                    {               
-                    TInt err = iMessage.Read( 0, iRequestParams );
-                    if( err == KErrNone)
-                        {
-                        TThumbnailRequestParams& params = iRequestParams();
-                        TRAP_IGNORE(iServer.UpdateIDL(object->Uri(), params.iThumbnailId));
-                        }                   
-                    }
-                }
-    
-            // return path to client side            
-            ReturnPath(object->Uri());
-            }
-        else if (iQueryType == EId )
-            {
-            const CMdEObject* object = &iQuery->Result(0);
-            
-            TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() - Id = %d",  object->Id());
-            
-            if( object->Id() != KNoId)
+            // return path to client side       
+            if( iDelete )
                 {
-                if( iUpdateToDb)
-                    {
-                    TRAP_IGNORE(iServer.UpdateIDL(object->Uri(), object->Id() ));
-                    }
-                else
-                    {
-                    // add Id to message
-                    if (ClientThreadAlive(EFalse))
-                        {
-                        TInt ret = iMessage.Read( 0, iRequestParams );
-                        if( ret == KErrNone)
-                            {
-                            TThumbnailRequestParams& params = iRequestParams();
-                            params.iThumbnailId = object->Id();
-                            ret = iMessage.Write( 0, iRequestParams );
-                            }
-                        }
-                    }
+                TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() delete %S", &iUri );
+                TRAP_IGNORE( iServer.DeleteThumbnailsL( iUri ) );
                 }
-            
-            // complete the message with a code from which client side
-            // knows to make a new request using the path
-            if (ClientThreadAlive(EFalse))
-                {  
-                Complete( KThumbnailErrThumbnailNotFound );
-                ResetMessageData();
+            else
+                {
+                ReturnPath(object->Uri());
                 }
             }
         else
             {
-            TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - Don't ever come here" );
+            TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - Don't ever come here!" );
             if (ClientThreadAlive(EFalse))
                 {  
                 Complete( KErrNotFound );
                 ResetMessageData();
                 }
+            __ASSERT_DEBUG((EFalse), User::Panic(_L("CThumbnailMDSQueryTask::HandleQueryCompleted()"), KErrNotSupported));
             }
         }
     else
         {
         TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - No results." );
-        
-        if( iQueryType == EId )
-            {
-            if( iUpdateToDb)
-                {
-                TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() delete %S", &iUri );
-                TRAP_IGNORE( iServer.DeleteThumbnailsL( iUri ) );
-                }
-               
-            if (ClientThreadAlive(EFalse))
-                {     
-                Complete( KThumbnailErrThumbnailNotFound );
-                ResetMessageData();
-                }
-            }
-        else 
+        if(!iDelete)
             {
             if (ClientThreadAlive(EFalse))
                 {  
@@ -230,10 +174,11 @@
 // CThumbnailMDSQueryTask::QueryPathByIdL()
 // ---------------------------------------------------------------------------
 //
-void CThumbnailMDSQueryTask::QueryPathByIdL(TThumbnailId aId)
+void CThumbnailMDSQueryTask::QueryPathByIdL(TThumbnailId aId, TBool aDelete)
     {
     TN_DEBUG1( "CThumbnailMDSQueryTask()::QueryPathByIdL()");
     iQueryType = EURI;
+    iDelete = aDelete;
     CMdENamespaceDef* defNamespace = &iMdESession->GetDefaultNamespaceDefL();
     CMdEObjectDef& objDef = defNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
     
@@ -272,27 +217,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CThumbnailMDSQueryTask::QueryIdByPathL()
-// ---------------------------------------------------------------------------
-//
-void CThumbnailMDSQueryTask::QueryIdByPathL(const TDesC& aUri)
-    {
-    TN_DEBUG1( "CThumbnailMDSQueryTask()::QueryIdByPathL()");
-    iQueryType = EId;
-    iUri = aUri;
-    CMdENamespaceDef* defNamespace = &iMdESession->GetDefaultNamespaceDefL();
-    CMdEObjectDef& objDef = defNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
-    
-    iQuery = iMdESession->NewObjectQueryL( *defNamespace, objDef, this );
-    iQuery->SetResultMode( EQueryResultModeItem );
-
-    CMdELogicCondition& rootCondition = iQuery->Conditions();
-    rootCondition.SetOperator( ELogicConditionOperatorOr );
-    
-    rootCondition.AddObjectConditionL(EObjectConditionCompareUri, aUri);
-    }
-
-// ---------------------------------------------------------------------------
 // CThumbnailMDSQueryTask::SetUpdateToDb()
 // ---------------------------------------------------------------------------
 //