ipsservices/ipssosplugin/src/ipsplgsearchop.cpp
changeset 2 5253a20d2a1e
parent 0 8466d47a6819
child 18 578830873419
--- a/ipsservices/ipssosplugin/src/ipsplgsearchop.cpp	Thu Jan 07 12:38:38 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgsearchop.cpp	Mon Jan 18 20:08:26 2010 +0200
@@ -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 );