phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp
branchRCL_3
changeset 23 5586b4d2ec3e
parent 0 e686773b3f54
child 26 0d28c1c5b6dd
--- a/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp	Wed Mar 31 21:13:53 2010 +0300
+++ b/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp	Wed Apr 14 15:45:35 2010 +0300
@@ -55,6 +55,8 @@
 #include "cpbkxrclvcardsender.h"
 #include "cpbkxrclactionservicewrapper.h"
 
+#include <e32base.h>
+
 // list box field formats
 _LIT( KFieldFormat, "\t%S %S" );
 _LIT( KFieldFormatWithIcon, "\t%S %S\t%d" );
@@ -137,6 +139,10 @@
 
     // add foreground observer
     CCoeEnv::Static()->AddForegroundObserverL( *this );
+    
+    // Idle object for scheduling showing of the 
+    // "more than 50 results..." note
+    iIdleNote = CIdle::NewL(CActive::EPriorityIdle);
     }
 
 // ---------------------------------------------------------------------------
@@ -165,10 +171,29 @@
      	delete iActionMenu;
     	iActionMenu = NULL;
     	}    
+    
+    delete iIdleNote;
     }
 
+// ---------------------------------------------------------------------------
+// CPbkxRclSearchResultDlg::SetMoreThanMaxResults
+// ---------------------------------------------------------------------------
+//
+void CPbkxRclSearchResultDlg::SetMoreThanMaxResults(TBool aMoreThanMax)
+    {
+    iMoreThanMaxResults = aMoreThanMax;
+    }
 
 // ---------------------------------------------------------------------------
+// CPbkxRclSearchResultDlg::MoreThanMaxResults
+// ---------------------------------------------------------------------------
+//
+TBool CPbkxRclSearchResultDlg::MoreThanMaxResults()
+    {
+    return iMoreThanMaxResults;
+    }
+   
+// ---------------------------------------------------------------------------
 // CPbkxRclSearchResultDlg::DisplayTooManyResultsInfoNoteL
 // ---------------------------------------------------------------------------
 //
@@ -176,12 +201,14 @@
     {
     FUNC_LOG;
     // For making sure the note is not shown again set the flag off.  
-    iMoreThanMaxResults = EFalse; 
+    SetMoreThanMaxResults(EFalse); 
        
     HBufC* text = StringLoader::LoadLC( 
             R_QTN_RCL_TOO_MANY_RESULTS_NOTE, 
             KMaxMatches );               
-           
+    
+    // Note is non blocking and is displayed above the search results until
+    // the note expires and closes itself.
     CAknInformationNote* informationNote = new (ELeave) CAknInformationNote; 
     informationNote->SetTimeout(CAknNoteDialog::ELongTimeout);
     informationNote->ExecuteLD(*text);
@@ -200,7 +227,6 @@
     PrepareLC( R_RCL_SEARCH_RESULT_DIALOG );
 
     UpdateGraphics();
-    UpdateColors();
 
     HBufC* noItemText = StringLoader::LoadLC( R_QTN_RCL_NO_RESULTS );
     ListBox()->View()->SetListEmptyTextL( *noItemText );
@@ -216,17 +242,31 @@
       ConstructMenuBarL( R_RCL_OPTIONS_BACK_CONTEXTMENU );
       }
 
-    // If there was more than max number of results show an info note to user.
-    // Note is non blocking and is displayed above the search results until
-    // the note expires and closes by itself.
-    if (iMoreThanMaxResults)
-        {    
-        DisplayTooManyResultsInfoNoteL();
+    if ( MoreThanMaxResults() )
+        { 
+        // If there was more than max number of results found 
+        // show a "more than 50 results..." info note to user.  
+        iIdleNote->Cancel();  
+        // For smooth display of the note, request
+        // an idle callback for launching the note later.
+        iIdleNote->Start( TCallBack(
+                ( &CPbkxRclSearchResultDlg::TooManyResultsIdleCallbackL ),this ) );
         }  
       
     CAknSelectionListDialog::RunLD();
     }
 
+// --------------------------------------------------------------------------
+// CPbkxRclSearchResultDlg::TooManyResultsIdleCallbackL
+// --------------------------------------------------------------------------
+//
+TInt CPbkxRclSearchResultDlg::TooManyResultsIdleCallbackL( TAny* aSelf )
+    {
+    CPbkxRclSearchResultDlg* self = static_cast<CPbkxRclSearchResultDlg*>( aSelf );
+    self->DisplayTooManyResultsInfoNoteL();
+    return 0;
+    }
+
 // ---------------------------------------------------------------------------
 // CPbkxRclSearchResultDlg::CurrentItemIndex
 // ---------------------------------------------------------------------------
@@ -289,6 +329,17 @@
         {
         ConstructMenuBarL( R_RCL_OPTIONS_BACK_OPEN );
         }
+   
+    if ( MoreThanMaxResults() )
+        { 
+        // If there was more than max number of results found 
+        // show a "more than 50 results..." info note to user.  
+        iIdleNote->Cancel();  
+        // For smooth display of the note, request
+        // an idle callback for launching the note later.
+        iIdleNote->Start( TCallBack(
+                ( &CPbkxRclSearchResultDlg::TooManyResultsIdleCallbackL ),this ) );
+        }  
     }
 
 // ---------------------------------------------------------------------------