imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp
changeset 22 a67f74060682
parent 19 b790c5b3d11f
child 25 cb86b71cae0a
equal deleted inserted replaced
19:b790c5b3d11f 22:a67f74060682
    64 void CThumbAGProcessor::ConstructL()
    64 void CThumbAGProcessor::ConstructL()
    65     {
    65     {
    66     TN_DEBUG1( "CThumbAGProcessor::ConstructL() - begin" );
    66     TN_DEBUG1( "CThumbAGProcessor::ConstructL() - begin" );
    67     
    67     
    68     iTMSession = CThumbnailManager::NewL( *this );
    68     iTMSession = CThumbnailManager::NewL( *this );
       
    69     iTMSession->SetRequestObserver(*this);
       
    70     
    69     iQueryAllItems = NULL;
    71     iQueryAllItems = NULL;
    70     iQueryPlaceholders = NULL;
    72     iQueryPlaceholders = NULL;
    71     iQuery = NULL;
    73     iQuery = NULL;
    72     iQueryActive = EFalse;
    74     iQueryActive = EFalse;
    73     iModify = EFalse;
    75     iModify = EFalse;
   114 //
   116 //
   115 CThumbAGProcessor::~CThumbAGProcessor()
   117 CThumbAGProcessor::~CThumbAGProcessor()
   116     {
   118     {
   117     TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - begin" );
   119     TN_DEBUG1( "CThumbAGProcessor::~CThumbAGProcessor() - begin" );
   118     
   120     
   119     if(iForegroundGenerationObserver)
   121     Cancel();
   120       {
   122     
   121       delete iForegroundGenerationObserver;
   123     if(iPeriodicTimer)
   122       iForegroundGenerationObserver = NULL;
   124         {
   123       }
   125         iPeriodicTimer->Cancel();
       
   126         delete iPeriodicTimer;
       
   127         }
   124     
   128     
   125     if(iActivityManager)
   129     if(iActivityManager)
   126         {
   130         {
   127         delete iActivityManager;
   131         delete iActivityManager;
   128         iActivityManager = NULL;
   132         iActivityManager = NULL;
   129         }
   133         }
   130     
   134     
   131     if (iInactivityTimer)
   135     if (iQuery)
   132         {
   136         {
   133         iInactivityTimer->Cancel();
   137         iQuery->Cancel();
   134         delete iInactivityTimer;
   138         delete iQuery;
   135         iInactivityTimer = NULL;
   139         iQuery = NULL;
   136         }
   140         }
   137     
       
   138     if(iPeriodicTimer)
       
   139         {
       
   140         iPeriodicTimer->Cancel();
       
   141         delete iPeriodicTimer;
       
   142         }
       
   143     
       
   144     if (!iInit)
       
   145         {
       
   146 #ifdef MDS_MODIFY_OBSERVER
       
   147         iHarvesterClient.RemoveHarvesterEventObserver(*this);
       
   148         iHarvesterClient.Close();
       
   149 #endif
       
   150         }
       
   151     
       
   152     if ( iCollectionUtility )
       
   153         {
       
   154         iCollectionUtility->Close();
       
   155         iCollectionUtility = NULL;
       
   156         }
       
   157 
       
   158     Cancel();
       
   159     
   141     
   160     if(iQueryPlaceholders)
   142     if(iQueryPlaceholders)
   161         {
   143         {
   162         iQueryPlaceholders->Cancel();
   144         iQueryPlaceholders->Cancel();
   163         delete iQueryPlaceholders;
   145         delete iQueryPlaceholders;
   164         iQueryPlaceholders = NULL;
   146         iQueryPlaceholders = NULL;
   165         }
       
   166     
       
   167     if (iQuery)
       
   168         {
       
   169         iQuery->Cancel();
       
   170         delete iQuery;
       
   171         iQuery = NULL;
       
   172         }
   147         }
   173     
   148     
   174     if (iQueryAllItems)
   149     if (iQueryAllItems)
   175        {
   150        {
   176        iQueryAllItems->Cancel();
   151        iQueryAllItems->Cancel();
   177        delete iQueryAllItems;
   152        delete iQueryAllItems;
   178        iQueryAllItems = NULL;
   153        iQueryAllItems = NULL;
   179        }
   154        }
       
   155     
       
   156     if (!iInit)
       
   157         {
       
   158 #ifdef MDS_MODIFY_OBSERVER
       
   159         iHarvesterClient.RemoveHarvesterEventObserver(*this);
       
   160         iHarvesterClient.Close();
       
   161 #endif
       
   162         }
       
   163     
       
   164     if(iForegroundGenerationObserver)
       
   165         {
       
   166         delete iForegroundGenerationObserver;
       
   167         iForegroundGenerationObserver = NULL;
       
   168         }
       
   169     
       
   170     if ( iCollectionUtility )
       
   171         {
       
   172         iCollectionUtility->Close();
       
   173         iCollectionUtility = NULL;
       
   174         }
   180 
   175 
   181     iAddQueue.Close();
   176     iAddQueue.Close();
   182     iModifyQueue.Close();
   177     iModifyQueue.Close();
   183     iRemoveQueue.ResetAndDestroy();
   178     iRemoveQueue.ResetAndDestroy();
   184     iQueryQueue.Close();
   179     iQueryQueue.Close();
   186 	  
   181 	  
   187     i2ndRoundGenerateQueue.Close();
   182     i2ndRoundGenerateQueue.Close();
   188     
   183     
   189     if (iTMSession)
   184     if (iTMSession)
   190         {
   185         {
       
   186         iTMSession->RemoveRequestObserver();
   191         delete iTMSession;
   187         delete iTMSession;
   192         iTMSession = NULL;
   188         iTMSession = NULL;
   193         }
   189         }
   194     
   190     
   195     delete iFormatObserver;
   191     delete iFormatObserver;
   433     ActivateAO();
   429     ActivateAO();
   434 	
   430 	
   435     TN_DEBUG1( "CThumbAGProcessor::ThumbnailReady() - end" );
   431     TN_DEBUG1( "CThumbAGProcessor::ThumbnailReady() - end" );
   436     }
   432     }
   437 
   433 
       
   434 // -----------------------------------------------------------------------------
       
   435 // CThumbAGProcessor::ThumbnailRequestReady()
       
   436 // -----------------------------------------------------------------------------
       
   437 //
       
   438 void CThumbAGProcessor::ThumbnailRequestReady( TInt /*aError*/, TThumbnailRequestType aRequestType,
       
   439                                                TThumbnailRequestId /*aId*/ )
       
   440     {	
       
   441     if (aRequestType == ERequestDeleteThumbnails)
       
   442         {
       
   443         TN_DEBUG1( "CThumbAGProcessor::ThumbnailRequestReady() - delete" );
       
   444     
       
   445         iActiveCount--;
       
   446         
       
   447         if(iActiveCount <= 0)
       
   448             {
       
   449             iActiveCount = 0;
       
   450             iActive = EFalse;
       
   451             }
       
   452     
       
   453         ActivateAO();
       
   454         }
       
   455     }
       
   456 
   438 // ---------------------------------------------------------------------------
   457 // ---------------------------------------------------------------------------
   439 // CThumbAGProcessor::SetMdESession()
   458 // CThumbAGProcessor::SetMdESession()
   440 // ---------------------------------------------------------------------------
   459 // ---------------------------------------------------------------------------
   441 //
   460 //
   442 void CThumbAGProcessor::SetMdESession( CMdESession* aMdESession )
   461 void CThumbAGProcessor::SetMdESession( CMdESession* aMdESession )
   663                     // ignore if fails
   682                     // ignore if fails
   664                     i2ndRoundGenerateQueue.InsertInOrder(aObject->Id(), Compare);
   683                     i2ndRoundGenerateQueue.InsertInOrder(aObject->Id(), Compare);
   665                     }
   684                     }
   666                 }
   685                 }
   667             
   686             
   668 		   // 10.1 specific
   687 		   // Symbian^4 specific
   669            if( imageObjectDef.Id() != aObject->Def().Id()  )
   688            if( imageObjectDef.Id() != aObject->Def().Id()  )
   670                 {
   689                 {
   671                 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round not image");
   690                 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round not image");
   672                 ActivateAO();
   691                 ActivateAO();
   673                 return;
   692                 return;
   933             ActivateAO();
   952             ActivateAO();
   934             TN_DEBUG2( "CThumbAGProcessor::RunL() - Session restart failed, error == %d", err );
   953             TN_DEBUG2( "CThumbAGProcessor::RunL() - Session restart failed, error == %d", err );
   935             }        
   954             }        
   936         else 
   955         else 
   937             {
   956             {
       
   957             iTMSession->SetRequestObserver(*this);
   938             iSessionDied = EFalse;
   958             iSessionDied = EFalse;
   939             }
   959             }
   940         }    
   960         }    
   941    
   961    
   942     // do not run if request is already issued to TNM server even if forced
   962     // do not run if request is already issued to TNM server even if forced
  1108                 iTMSession->DeleteThumbnails( *source );
  1128                 iTMSession->DeleteThumbnails( *source );
  1109                 }
  1129                 }
  1110             iRemoveQueue.Remove( 0 );
  1130             iRemoveQueue.Remove( 0 );
  1111             delete source;
  1131             delete source;
  1112             delete uri;
  1132             delete uri;
  1113             }
  1133             
  1114             
  1134             iActiveCount++;
  1115         ActivateAO();
  1135             iActive = ETrue;
       
  1136             }
  1116         }
  1137         }
  1117     else if( i2ndRoundGenerateQueue.Count() > 0)
  1138     else if( i2ndRoundGenerateQueue.Count() > 0)
  1118         {
  1139         {
  1119         TN_DEBUG1( "void CThumbAGProcessor::RunL() update 2nd round thumbnails");
  1140         TN_DEBUG1( "void CThumbAGProcessor::RunL() update 2nd round thumbnails");
  1120             
  1141             
  1131 // CThumbAGProcessor::DeleteAndCancelQuery()
  1152 // CThumbAGProcessor::DeleteAndCancelQuery()
  1132 // ---------------------------------------------------------------------------
  1153 // ---------------------------------------------------------------------------
  1133 //
  1154 //
  1134 void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems)
  1155 void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems)
  1135     {
  1156     {
  1136     TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" );
  1157     TN_DEBUG2( "CThumbAGProcessor::DeleteAndCancelQuery(aRestoreItems = %d) in", aRestoreItems );
  1137     
  1158     
  1138     if(iQuery)
  1159     if(iQuery)
  1139         {
  1160         {
  1140         TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() - deleting query" );
  1161         TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() - deleting query" );
  1141         iQuery->Cancel();
  1162         iQuery->Cancel();
  1726         }
  1747         }
  1727     else
  1748     else
  1728         {
  1749         {
  1729         iIdle = ETrue; 
  1750         iIdle = ETrue; 
  1730         
  1751         
  1731         if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 )
  1752         if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() + 
       
  1753            iQueryQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 )
  1732             {
  1754             {
  1733             ActivateAO();
  1755             ActivateAO();
  1734             }
  1756             }
  1735         }
  1757         }
  1736     }
  1758     }