imagehandlingutilities/thumbnailmanager/thumbagdaemon/src/thumbagprocessor.cpp
branchRCL_3
changeset 21 ad31f4183ddc
parent 20 ffb2d5dd62e9
child 24 f0aa341a25bf
equal deleted inserted replaced
20:ffb2d5dd62e9 21:ad31f4183ddc
    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 		   // 9.2 specific
   687             /*CMdEProperty* inDefaultFolder = NULL;
   669            if( !(imageObjectDef.Id() == aObject->Def().Id() || videoObjectDef.Id() == aObject->Def().Id()) )
   688             TBool inDefaultFolderVal(ETrue);
   670                 {
   689             TInt inDefaultFolderErr = aObject->Property( baseObjDef.GetPropertyDefL( MdeConstants::Object::KInDefaultFolder ), inDefaultFolder, 0 );
   671                 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round and not image or video, skip");
   690             
       
   691             if(inDefaultFolder &&  inDefaultFolderErr >= 0 )
       
   692                 {
       
   693                 inDefaultFolderVal = inDefaultFolder->BoolValueL();
       
   694                 }*/
       
   695             
       
   696 		   // Symbian^3 specific
       
   697            if( !(( imageObjectDef.Id() == aObject->Def().Id() || videoObjectDef.Id() == aObject->Def().Id()) 
       
   698                    /*&& inDefaultFolderVal*/ ) )
       
   699                 {
       
   700                 TN_DEBUG1( "CThumbAGProcessor::CreateThumbnailsL() 1st round; not image or video in default folder, skip");
   672                 ActivateAO();
   701                 ActivateAO();
   673                 return;
   702                 return;
   674                 }
   703                 }
   675             }
   704             }
   676 
   705 
   933             ActivateAO();
   962             ActivateAO();
   934             TN_DEBUG2( "CThumbAGProcessor::RunL() - Session restart failed, error == %d", err );
   963             TN_DEBUG2( "CThumbAGProcessor::RunL() - Session restart failed, error == %d", err );
   935             }        
   964             }        
   936         else 
   965         else 
   937             {
   966             {
       
   967             iTMSession->SetRequestObserver(*this);
   938             iSessionDied = EFalse;
   968             iSessionDied = EFalse;
   939             }
   969             }
   940         }    
   970         }    
   941    
   971    
   942     // do not run if request is already issued to TNM server even if forced
   972     // do not run if request is already issued to TNM server even if forced
  1108                 iTMSession->DeleteThumbnails( *source );
  1138                 iTMSession->DeleteThumbnails( *source );
  1109                 }
  1139                 }
  1110             iRemoveQueue.Remove( 0 );
  1140             iRemoveQueue.Remove( 0 );
  1111             delete source;
  1141             delete source;
  1112             delete uri;
  1142             delete uri;
  1113             }
  1143             
  1114             
  1144             iActiveCount++;
  1115         ActivateAO();
  1145             iActive = ETrue;
       
  1146             }
  1116         }
  1147         }
  1117     else if( i2ndRoundGenerateQueue.Count() > 0)
  1148     else if( i2ndRoundGenerateQueue.Count() > 0)
  1118         {
  1149         {
  1119         TN_DEBUG1( "void CThumbAGProcessor::RunL() update 2nd round thumbnails");
  1150         TN_DEBUG1( "void CThumbAGProcessor::RunL() update 2nd round thumbnails");
  1120             
  1151             
  1131 // CThumbAGProcessor::DeleteAndCancelQuery()
  1162 // CThumbAGProcessor::DeleteAndCancelQuery()
  1132 // ---------------------------------------------------------------------------
  1163 // ---------------------------------------------------------------------------
  1133 //
  1164 //
  1134 void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems)
  1165 void CThumbAGProcessor::DeleteAndCancelQuery(TBool aRestoreItems)
  1135     {
  1166     {
  1136     TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() in" );
  1167     TN_DEBUG2( "CThumbAGProcessor::DeleteAndCancelQuery(aRestoreItems = %d) in", aRestoreItems );
  1137     
  1168     
  1138     if(iQuery)
  1169     if(iQuery)
  1139         {
  1170         {
  1140         TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() - deleting query" );
  1171         TN_DEBUG1( "CThumbAGProcessor::DeleteAndCancelQuery() - deleting query" );
  1141         iQuery->Cancel();
  1172         iQuery->Cancel();
  1726         }
  1757         }
  1727     else
  1758     else
  1728         {
  1759         {
  1729         iIdle = ETrue; 
  1760         iIdle = ETrue; 
  1730         
  1761         
  1731         if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 )
  1762         if(iAddQueue.Count() + iModifyQueue.Count() + iRemoveQueue.Count() + 
       
  1763            iQueryQueue.Count() + i2ndRoundGenerateQueue.Count() > 0 )
  1732             {
  1764             {
  1733             ActivateAO();
  1765             ActivateAO();
  1734             }
  1766             }
  1735         }
  1767         }
  1736     }
  1768     }