imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailmdsquerytask.cpp
branchRCL_3
changeset 40 6257223ede8a
parent 38 2b4b06654caa
child 41 9d4d3445ce6e
equal deleted inserted replaced
38:2b4b06654caa 40:6257223ede8a
    23 
    23 
    24 #include "thumbnailmdsquerytask.h"
    24 #include "thumbnailmdsquerytask.h"
    25 #include "thumbnailmanagerconstants.h"
    25 #include "thumbnailmanagerconstants.h"
    26 #include "thumbnaillog.h"
    26 #include "thumbnaillog.h"
    27 #include "thumbnailserver.h"
    27 #include "thumbnailserver.h"
       
    28 #include "OstTraceDefinitions.h"
       
    29 #ifdef OST_TRACE_COMPILER_IN_USE
       
    30 #include "thumbnailmdsquerytaskTraces.h"
       
    31 #endif
    28 
    32 
    29 
    33 
    30 // ======== MEMBER FUNCTIONS ========
    34 // ======== MEMBER FUNCTIONS ========
    31 
    35 
    32 // ---------------------------------------------------------------------------
    36 // ---------------------------------------------------------------------------
    34 // C++ default constructor can NOT contain any code, that might leave.
    38 // C++ default constructor can NOT contain any code, that might leave.
    35 // ---------------------------------------------------------------------------
    39 // ---------------------------------------------------------------------------
    36 //
    40 //
    37 CThumbnailMDSQueryTask::CThumbnailMDSQueryTask(
    41 CThumbnailMDSQueryTask::CThumbnailMDSQueryTask(
    38         CThumbnailTaskProcessor& aProcessor, TInt aPriority, CMdESession* aMdESession, CThumbnailServer& aServer): 
    42         CThumbnailTaskProcessor& aProcessor, TInt aPriority, CMdESession* aMdESession, CThumbnailServer& aServer): 
    39         CThumbnailTask( aProcessor, aPriority ), iMdESession( aMdESession ), iQuery(NULL), iServer(aServer), iUpdateToDb(ETrue)
    43         CThumbnailTask( aProcessor, aPriority ), iMdESession( aMdESession ), iQuery(NULL), 
       
    44 		iServer(aServer), iUpdateToDb(ETrue)
    40     {
    45     {
    41     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::CThumbnailMDSQueryTask()", this );
    46     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::CThumbnailMDSQueryTask()", this );
       
    47     OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_CTHUMBNAILMDSQUERYTASK, "CThumbnailMDSQueryTask::CThumbnailMDSQueryTask;this=%o", this );
    42     }
    48     }
    43 
    49 
    44 
    50 
    45 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    46 // CThumbnailMDSQueryTask::~CThumbnailMDSQueryTask()
    52 // CThumbnailMDSQueryTask::~CThumbnailMDSQueryTask()
    48 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    49 //
    55 //
    50 CThumbnailMDSQueryTask::~CThumbnailMDSQueryTask()
    56 CThumbnailMDSQueryTask::~CThumbnailMDSQueryTask()
    51     {
    57     {
    52     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::~CThumbnailMDSQueryTask()", this);
    58     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::~CThumbnailMDSQueryTask()", this);
       
    59     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMDSQUERYTASK_CTHUMBNAILMDSQUERYTASK, "CThumbnailMDSQueryTask::~CThumbnailMDSQueryTask;this=%o", this );
    53            
    60            
    54     if (iQuery)
    61     if (iQuery)
    55         {
    62         {
    56         iQuery->Cancel();
    63         iQuery->Cancel();
    57         delete iQuery;
    64         delete iQuery;
    76 // -----------------------------------------------------------------------------
    83 // -----------------------------------------------------------------------------
    77 //
    84 //
    78 void CThumbnailMDSQueryTask::HandleQueryCompleted( CMdEQuery& /*aQuery*/, const TInt aError )
    85 void CThumbnailMDSQueryTask::HandleQueryCompleted( CMdEQuery& /*aQuery*/, const TInt aError )
    79     {
    86     {
    80     TN_DEBUG3( "CThumbnailMDSQueryTask::HandleQueryCompleted(0x%08x), aError == %d", this, aError );
    87     TN_DEBUG3( "CThumbnailMDSQueryTask::HandleQueryCompleted(0x%08x), aError == %d", this, aError );
       
    88     OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted;this=%o", this );
       
    89     OstTrace1( TRACE_NORMAL, DUP1_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted;aError=%d", aError );
       
    90     
    81     
    91     
    82     // if no errors in query
    92     // if no errors in query
    83     if (aError == KErrNone && iQuery && iQuery->Count() > 0)
    93     if (aError == KErrNone && iQuery && iQuery->Count() > 0)
    84         {
    94         {
    85         if( iQueryType == EURI )
    95         if( iQueryType == EURI )
    86             {
    96             {
    87             const CMdEObject* object = &iQuery->Result(0);
    97             const CMdEObject* object = &iQuery->Result(0);
    88             
    98             
    89             TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() - URI = %S", &object->Uri() );
    99             TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() - URI = %S", &object->Uri() );
       
   100             OstTraceExt1( TRACE_NORMAL, DUP2_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted;object->Uri()=%S", object->Uri() );
    90                             
   101                             
    91             // return path to client side       
   102             // return path to client side       
    92             if( iDelete )
   103             if( iDelete )
    93                 {
   104                 {
    94                 TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() delete %S", &iUri );
   105                 TN_DEBUG2( "CThumbnailMDSQueryTask::HandleQueryCompleted() delete %S", &iUri );
       
   106                 OstTraceExt1( TRACE_NORMAL, DUP3_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted - delete;iUri()=%S", iUri );
    95                 TRAP_IGNORE( iServer.DeleteThumbnailsL( iUri ) );
   107                 TRAP_IGNORE( iServer.DeleteThumbnailsL( iUri ) );
    96                 }
   108                 }
    97             else
   109             else
    98                 {
   110                 {
    99                 ReturnPath(object->Uri());
   111                 ReturnPath(object->Uri());
   100                 }
   112                 }
   101             }
   113             }
   102         else
   114         else
   103             {
   115             {
   104             TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - Don't ever come here!" );
   116             TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - Don't ever come here!" );
       
   117             OstTrace0( TRACE_NORMAL, DUP4_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted - Don't ever come here!" );
   105             if (ClientThreadAlive())
   118             if (ClientThreadAlive())
   106                 {  
   119                 {  
   107                 Complete( KErrNotFound );
   120                 Complete( KErrNotFound );
   108                 ResetMessageData();
   121                 ResetMessageData();
   109                 }
   122                 }
   111             }
   124             }
   112         }
   125         }
   113     else
   126     else
   114         {
   127         {
   115         TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - No results." );
   128         TN_DEBUG1( "CThumbnailMDSQueryTask::HandleQueryCompleted() - No results." );
       
   129         OstTrace0( TRACE_NORMAL, DUP5_CTHUMBNAILMDSQUERYTASK_HANDLEQUERYCOMPLETED, "CThumbnailMDSQueryTask::HandleQueryCompleted - No results." );
   116         if(!iDelete)
   130         if(!iDelete)
   117             {
   131             {
   118             if (ClientThreadAlive())
   132             if (ClientThreadAlive())
   119                 {  
   133                 {  
   120                 Complete( KErrNotFound );
   134                 Complete( KErrNotFound );
   130 // ---------------------------------------------------------------------------
   144 // ---------------------------------------------------------------------------
   131 //
   145 //
   132 void CThumbnailMDSQueryTask::StartL()
   146 void CThumbnailMDSQueryTask::StartL()
   133     {
   147     {
   134     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::StartL()", this );
   148     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::StartL()", this );
       
   149     OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_STARTL, "CThumbnailMDSQueryTask::StartL;this=%o", this );
   135 
   150 
   136     CThumbnailTask::StartL();
   151     CThumbnailTask::StartL();
   137     
   152     
   138     if (iMessage.Handle())
   153     if (iMessage.Handle())
   139         {
   154         {
   155 //
   170 //
   156 void CThumbnailMDSQueryTask::RunL()
   171 void CThumbnailMDSQueryTask::RunL()
   157     {
   172     {
   158     // No implementation required
   173     // No implementation required
   159     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::RunL()", this );
   174     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::RunL()", this );
       
   175     OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_RUNL, "CThumbnailMDSQueryTask::RunL;this=%o", this );
   160     }
   176     }
   161 
   177 
   162 
   178 
   163 // ---------------------------------------------------------------------------
   179 // ---------------------------------------------------------------------------
   164 // CThumbnailMDSQueryTask::DoCancel()
   180 // CThumbnailMDSQueryTask::DoCancel()
   165 // ---------------------------------------------------------------------------
   181 // ---------------------------------------------------------------------------
   166 //
   182 //
   167 void CThumbnailMDSQueryTask::DoCancel()
   183 void CThumbnailMDSQueryTask::DoCancel()
   168     {
   184     {
   169     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::DoCancel()", this );
   185     TN_DEBUG2( "CThumbnailMDSQueryTask(0x%08x)::DoCancel()", this );
       
   186     OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_DOCANCEL, "CThumbnailMDSQueryTask::DoCancel;this=%o", this );
   170     
   187     
   171     iQuery->Cancel();
   188     iQuery->Cancel();
   172     }
   189     }
   173 
   190 
   174 // ---------------------------------------------------------------------------
   191 // ---------------------------------------------------------------------------
   176 // ---------------------------------------------------------------------------
   193 // ---------------------------------------------------------------------------
   177 //
   194 //
   178 void CThumbnailMDSQueryTask::QueryPathByIdL(TThumbnailId aId, TBool aDelete)
   195 void CThumbnailMDSQueryTask::QueryPathByIdL(TThumbnailId aId, TBool aDelete)
   179     {
   196     {
   180     TN_DEBUG1( "CThumbnailMDSQueryTask()::QueryPathByIdL()");
   197     TN_DEBUG1( "CThumbnailMDSQueryTask()::QueryPathByIdL()");
       
   198     OstTrace0( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_QUERYPATHBYIDL, "CThumbnailMDSQueryTask::QueryPathByIdL" );
   181     iQueryType = EURI;
   199     iQueryType = EURI;
   182     iDelete = aDelete;
   200     iDelete = aDelete;
   183     CMdENamespaceDef* defNamespace = &iMdESession->GetDefaultNamespaceDefL();
   201     CMdENamespaceDef* defNamespace = &iMdESession->GetDefaultNamespaceDefL();
   184     CMdEObjectDef& objDef = defNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
   202     CMdEObjectDef& objDef = defNamespace->GetObjectDefL( MdeConstants::Object::KBaseObject );
   185     
   203     
   229 // ---------------------------------------------------------------------------
   247 // ---------------------------------------------------------------------------
   230 //
   248 //
   231 void CThumbnailMDSQueryTask::SetUpdateToDb(const TBool& aUpdateToDb )
   249 void CThumbnailMDSQueryTask::SetUpdateToDb(const TBool& aUpdateToDb )
   232     {
   250     {
   233     TN_DEBUG2( "CThumbnailMDSQueryTask()::SetCompleteTask() aUpdateToDb == %d", aUpdateToDb);
   251     TN_DEBUG2( "CThumbnailMDSQueryTask()::SetCompleteTask() aUpdateToDb == %d", aUpdateToDb);
       
   252     OstTrace1( TRACE_NORMAL, CTHUMBNAILMDSQUERYTASK_SETUPDATETODB, "CThumbnailMDSQueryTask::SetUpdateToDb;aUpdateToDb=%u", aUpdateToDb );
   234     iUpdateToDb = aUpdateToDb;
   253     iUpdateToDb = aUpdateToDb;
   235     }
   254     }