searchui/searchapplication/src/searchapplication.cpp
changeset 21 708468d5143e
parent 10 d05738f02936
child 27 7a8855317cbd
--- a/searchui/searchapplication/src/searchapplication.cpp	Tue Aug 31 17:25:42 2010 +0530
+++ b/searchui/searchapplication/src/searchapplication.cpp	Mon Sep 06 09:21:19 2010 +0530
@@ -19,26 +19,16 @@
 #include <qstatemachine.h>
 #include <searchruntimeprovider.h>
 #include <searchruntime.h>
+#include <hbapplication.h>
 
 // ---------------------------------------------------------------------------
 // SearchApplication::SearchApplication
 // ---------------------------------------------------------------------------
 //
-SearchApplication::SearchApplication(QObject* aParent) :
-    QObject(aParent), mRuntime(NULL)
+SearchApplication::SearchApplication(int argc, char *argv[]) :
+    HbApplication(argc, argv), mRuntime(NULL)
     {
-    SEARCH_FUNC_ENTRY("SEARCH::SearchApplication::SearchApplication");
-
-    SearchRuntimeProvider *interface = new SearchRuntimeProvider();
-    mRuntime = interface->createPlugin();
-    if (mRuntime)
-        {
-        mRuntime->setParent(this);
-        connect(mRuntime, SIGNAL(started()),this, SLOT(handleRuntimeStarted()));
-        connect(mRuntime, SIGNAL(stopped()),this, SLOT(handleRuntimeStopped()));
-        connect(mRuntime, SIGNAL(faulted()),this, SLOT(handleRuntimeFaulted()));
-        } 
-		SEARCH_FUNC_EXIT("SEARCH::SearchApplication::SearchApplication");
+    SEARCH_FUNC_ENTRY("SEARCH::SearchApplication::SearchApplication"); SEARCH_FUNC_EXIT("SEARCH::SearchApplication::SearchApplication");
     }
 
 // ---------------------------------------------------------------------------
@@ -49,6 +39,10 @@
     {
     if (mRuntime)
         {
+        mRuntime->stop();
+        }
+    if (mRuntime)
+        {
         disconnect(mRuntime, SIGNAL(started()), this,
                 SLOT(handleRuntimeStarted()));
         disconnect(mRuntime, SIGNAL(stopped()), this,
@@ -59,7 +53,6 @@
         delete mRuntime;
         }
     }
-
 // ---------------------------------------------------------------------------
 // SearchApplication::start()
 // ---------------------------------------------------------------------------
@@ -67,7 +60,20 @@
 void SearchApplication::start()
     {
     SEARCH_FUNC_ENTRY("SEARCH::Search::start");
-
+    SearchRuntimeProvider *interface = new SearchRuntimeProvider();
+    mRuntime = interface->createPlugin();
+    if (mRuntime)
+        {
+        mRuntime->setParent(this);
+        connect(mRuntime, SIGNAL(started()), this,
+                SLOT(handleRuntimeStarted()));
+        connect(mRuntime, SIGNAL(stopped()), this,
+                SLOT(handleRuntimeStopped()));
+        connect(mRuntime, SIGNAL(faulted()), this,
+                SLOT(handleRuntimeFaulted()));
+        connect(mRuntime, SIGNAL(sentMattiEventSignal()), this,
+                SLOT(sentMattiEventSlot()));
+        }
     if (mRuntime)
         {
         mRuntime->start();
@@ -75,9 +81,7 @@
     else
         {
         emit exit();
-        }
-
-    SEARCH_FUNC_EXIT("SEARCH::Search::start");
+        } SEARCH_FUNC_EXIT("SEARCH::Search::start");
     }
 
 // ---------------------------------------------------------------------------
@@ -120,3 +124,8 @@
     {
     emit exit();
     }
+
+void SearchApplication::sentMattiEventSlot()
+    {
+    emit applicationReady();
+    }