ipsservices/ipssosplugin/src/ipsplgsearchop.cpp
changeset 23 2dc6caa42ec3
parent 18 578830873419
child 74 6c59112cfd31
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
    20 #include "emailtrace.h"
    20 #include "emailtrace.h"
    21 #include "ipsplgheaders.h"
    21 #include "ipsplgheaders.h"
    22 
    22 
    23 /** Snippet length, for HTML tags. */
    23 /** Snippet length, for HTML tags. */
    24 const TInt KIpsPlgSnippetLen = 300;
    24 const TInt KIpsPlgSnippetLen = 300;
       
    25 
       
    26 // changed to one mail per one RunL - for cycle in RunL was removed
    25 // Defines the number of mails handled in one scheduler round
    27 // Defines the number of mails handled in one scheduler round
    26 const TInt KIpsPlgSearchMailsInRound = 10;
    28 // const TInt KIpsPlgSearchMailsInRound = 10;
    27 
    29 
    28 // ======== CONSTRUCTORS & DESTRUCTOR ========
    30 // ======== CONSTRUCTORS & DESTRUCTOR ========
    29 
    31 
    30 // ---------------------------------------------------------------------------
    32 // ---------------------------------------------------------------------------
    31 // CIpsPlgSearchOp::NewL()
    33 // CIpsPlgSearchOp::NewL()
    83     CActive( EPriorityStandard ),
    85     CActive( EPriorityStandard ),
    84     iObserver( aObserver ),
    86     iObserver( aObserver ),
    85     iMessage( NULL )
    87     iMessage( NULL )
    86     {
    88     {
    87     FUNC_LOG;
    89     FUNC_LOG;
       
    90     iRequiredPriority = Priority(); // priority changes are enabled
    88     CActiveScheduler::Add( this );
    91     CActiveScheduler::Add( this );
    89     }
    92     }
    90 
    93 
    91 // ---------------------------------------------------------------------------
    94 // ---------------------------------------------------------------------------
    92 // CIpsPlgSearchOp::ConstructL()
    95 // CIpsPlgSearchOp::ConstructL()
   135             {
   138             {
   136             // Collect all message id's in the mailbox and sort them.
   139             // Collect all message id's in the mailbox and sort them.
   137             iObserver.CollectMessagesL();
   140             iObserver.CollectMessagesL();
   138             iObserver.Sort();
   141             iObserver.Sort();
   139             iState = ERunning;
   142             iState = ERunning;
       
   143             iRequiredPriority = EPriorityStandard; // priority changes may be decreased
   140             ActivateAndComplete();
   144             ActivateAndComplete();
   141             break;
   145             break;
   142             }
   146             }
   143         case ERunning:
   147         case ERunning:
   144             {
   148             {
   145             for ( TInt i(0); i < KIpsPlgSearchMailsInRound; i++ )
       
   146                 {
       
   147                 if ( NextMailL() )
   149                 if ( NextMailL() )
   148                     {
   150                     {
   149                     // Mail found, read the content and search for the string.
   151                     // Mail found, read the content and search for the string.
   150                     // It must be made sure, that the search string contains valid 
   152                     // It must be made sure, that the search string contains valid 
   151                     // data to search the body, i.e. character set must match.
   153                     // data to search the body, i.e. character set must match.
   156                 else
   158                 else
   157                     {
   159                     {
   158                     FinalizeL();
   160                     FinalizeL();
   159                     return;
   161                     return;
   160                     }
   162                     }
   161                 }
       
   162 
       
   163             iState = ERunning;
   163             iState = ERunning;
       
   164 // When client wants call to contact the priority must be decreased 
       
   165 // to enable search for contact which uses idle priority
       
   166             TInt clientRequiredPriority(iRequiredPriority);
       
   167             iObserver.ClientRequiredSearchPriority( &clientRequiredPriority );
       
   168             iRequiredPriority = ((clientRequiredPriority > EPriorityIdle) ? EPriorityStandard : EPriorityIdle-1);
       
   169 
   164             ActivateAndComplete();
   170             ActivateAndComplete();
   165             break;
   171             break;
   166             }
   172             }
   167         default:
   173         default:
   168             {
   174             {
   361 //
   367 //
   362 void CIpsPlgSearchOp::ActivateAndComplete( )
   368 void CIpsPlgSearchOp::ActivateAndComplete( )
   363     {
   369     {
   364     FUNC_LOG;
   370     FUNC_LOG;
   365     iStatus = KRequestPending; 
   371     iStatus = KRequestPending; 
       
   372 // When client wants call to contact the priority must be decreased 
       
   373 // to enable search for contact made with idle priority
       
   374     if ( Priority() != iRequiredPriority ) // <cmail>
       
   375     	SetPriority(iRequiredPriority);
       
   376 
   366     SetActive();    
   377     SetActive();    
   367     TRequestStatus* status = &iStatus;
   378     TRequestStatus* status = &iStatus;
   368     User::RequestComplete( status, KErrNone );    
   379     User::RequestComplete( status, KErrNone );    
   369     }
   380     }
   370     
   381