ipsservices/ipssosplugin/src/ipsplgsearchop.cpp
changeset 23 2dc6caa42ec3
parent 18 578830873419
child 74 6c59112cfd31
--- a/ipsservices/ipssosplugin/src/ipsplgsearchop.cpp	Mon May 03 12:23:15 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgsearchop.cpp	Fri May 14 15:41:10 2010 +0300
@@ -22,8 +22,10 @@
 
 /** Snippet length, for HTML tags. */
 const TInt KIpsPlgSnippetLen = 300;
+
+// changed to one mail per one RunL - for cycle in RunL was removed
 // Defines the number of mails handled in one scheduler round
-const TInt KIpsPlgSearchMailsInRound = 10;
+// const TInt KIpsPlgSearchMailsInRound = 10;
 
 // ======== CONSTRUCTORS & DESTRUCTOR ========
 
@@ -85,6 +87,7 @@
     iMessage( NULL )
     {
     FUNC_LOG;
+    iRequiredPriority = Priority(); // priority changes are enabled
     CActiveScheduler::Add( this );
     }
 
@@ -137,13 +140,12 @@
             iObserver.CollectMessagesL();
             iObserver.Sort();
             iState = ERunning;
+            iRequiredPriority = EPriorityStandard; // priority changes may be decreased
             ActivateAndComplete();
             break;
             }
         case ERunning:
             {
-            for ( TInt i(0); i < KIpsPlgSearchMailsInRound; i++ )
-                {
                 if ( NextMailL() )
                     {
                     // Mail found, read the content and search for the string.
@@ -158,9 +160,13 @@
                     FinalizeL();
                     return;
                     }
-                }
+            iState = ERunning;
+// When client wants call to contact the priority must be decreased 
+// to enable search for contact which uses idle priority
+            TInt clientRequiredPriority(iRequiredPriority);
+            iObserver.ClientRequiredSearchPriority( &clientRequiredPriority );
+            iRequiredPriority = ((clientRequiredPriority > EPriorityIdle) ? EPriorityStandard : EPriorityIdle-1);
 
-            iState = ERunning;
             ActivateAndComplete();
             break;
             }
@@ -363,6 +369,11 @@
     {
     FUNC_LOG;
     iStatus = KRequestPending; 
+// When client wants call to contact the priority must be decreased 
+// to enable search for contact made with idle priority
+    if ( Priority() != iRequiredPriority ) // <cmail>
+    	SetPriority(iRequiredPriority);
+
     SetActive();    
     TRequestStatus* status = &iStatus;
     User::RequestComplete( status, KErrNone );