searchui/indevicehandler/src/indevicehandler.cpp
changeset 16 e918432ddd92
parent 15 df6898e696c6
child 26 367228f82b66
--- a/searchui/indevicehandler/src/indevicehandler.cpp	Mon Jul 26 12:45:04 2010 +0530
+++ b/searchui/indevicehandler/src/indevicehandler.cpp	Mon Aug 09 12:23:41 2010 +0530
@@ -34,11 +34,17 @@
     {
     if (mSearchInterface)
         {
+        disconnect(mSearchInterface, SIGNAL(handleSearchResults(int,int)),
+                this, SLOT(getSearchResult(int,int)));
+        disconnect(mSearchInterface,
+                SIGNAL(handleDocument(int,CpixDocument*)), this,
+                SLOT(getDocumentAsync(int,CpixDocument*)));
+        disconnect(mSearchInterface,
+                SIGNAL(handleDocument(int,CpixDocument*)), this,
+                SLOT(getDocumentAsync(int,CpixDocument*)));
         delete mSearchInterface;
-
         }
     }
-
 // ---------------------------------------------------------------------------
 // InDeviceHandler::getSearchResult(int aError, int estimatedResultCount)
 // aError: error code
@@ -47,7 +53,6 @@
 //
 void InDeviceHandler::getSearchResult(int aError, int estimatedResultCount)
     {
-    qDebug() << aError << estimatedResultCount;
     mSearchResultCount = estimatedResultCount;
     emit handleAsyncSearchResult(aError, estimatedResultCount);
     }
@@ -62,6 +67,17 @@
     emit handleDocument(aError, aDocument);
     }
 // ---------------------------------------------------------------------------
+// InDeviceHandler::getBatchDocumentAsync(int aError, CpixDocument* aDocument)
+// aError: error code
+// aDocument: holding the result item
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::getBatchDocumentAsync(int aError, int aCount,
+        CpixDocument** aDocument)
+    {
+    emit handleBatchDocument(aError, aCount, aDocument);
+    }
+// ---------------------------------------------------------------------------
 // InDeviceHandler::getDocumentAtIndex(int aIndex)
 // aIndex: item index to be found
 // ---------------------------------------------------------------------------
@@ -85,7 +101,6 @@
     return doc;
     }
 
-
 // ---------------------------------------------------------------------------
 // InDeviceHandler::getSearchResultCount()
 // gets the number of hits
@@ -114,7 +129,27 @@
             return;
             }
         }
-
+    }
+// ---------------------------------------------------------------------------
+// InDeviceHandler::getBatchDocumentAsyncAtIndex
+// aIndex :  index of item to be found async
+// aCount :  number of result items
+// ---------------------------------------------------------------------------
+//
+void InDeviceHandler::getBatchDocumentAsyncAtIndex(int aIndex, int aCount)
+    {
+    if (mSearchInterface)
+        {
+        try
+            {
+            mSearchInterface->batchdocumentAsync(aIndex, aCount);
+            }
+        catch (...)
+            {
+            // handle the exception
+            return;
+            }
+        }
     }
 // ---------------------------------------------------------------------------
 // InDeviceHandler::searchAsync
@@ -148,7 +183,6 @@
 void InDeviceHandler::cancelLastSearch()
     {
     if (mSearchInterface)
-
         {
         try
             {
@@ -183,31 +217,17 @@
     else
         {
         mSearchInterface = CpixSearcher::newInstance("root",
-        DEFAULT_SEARCH_FIELD);
+                DEFAULT_SEARCH_FIELD);
         }
     if (mSearchInterface)
         {
-        try
-            {
-            mSearchInterface->connect(mSearchInterface,
-                    SIGNAL(handleSearchResults(int,int)), this,
-                    SLOT(getSearchResult(int,int)));
-            }
-        catch (...)
-            {
-            // handle the exception
-            }
-
-        try
-            {
-            mSearchInterface->connect(mSearchInterface,
-                    SIGNAL(handleDocument(int,CpixDocument*)), this,
-                    SLOT(getDocumentAsync(int,CpixDocument*)));
-            }
-        catch (...)
-            {
-            // handle the exception
-            }
+        connect(mSearchInterface, SIGNAL(handleSearchResults(int,int)), this,
+                SLOT(getSearchResult(int,int)));
+        connect(mSearchInterface, SIGNAL(handleDocument(int,CpixDocument*)),
+                this, SLOT(getDocumentAsync(int,CpixDocument*)));
+        connect(mSearchInterface,
+                SIGNAL(handleBatchDocuments(int,int,CpixDocument**)), this,
+                SLOT(getBatchDocumentAsync(int,int,CpixDocument**)));
         }
     }
 
@@ -222,7 +242,5 @@
         {
         return true;
         }
-
     return false;
-
     }