searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp
changeset 12 993ab30e92fc
parent 11 773be20e0a25
child 17 7d8c8d8f5eab
--- a/searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp	Wed Jun 23 18:13:49 2010 +0300
+++ b/searchui/runtimeproviders/searchruntimeprovider/src/searchruntime.cpp	Tue Jul 06 14:17:22 2010 +0300
@@ -33,13 +33,14 @@
         "search.nokia.com/state/wizardprogressivestate";
 const char wizardSettingStateUri[] =
         "search.nokia.com/state/wizardsettingstate";
-
+const char wizardOnlineStateUri[] =
+        "search.nokia.com/state/wizardonlinestate";
 // ---------------------------------------------------------------------------
 // searchRuntime::SearchRuntime
 // ---------------------------------------------------------------------------
 //
 SearchRuntime::SearchRuntime(QObject* aParent) :
-QStateMachine(aParent),mWindow(0)
+    QStateMachine(aParent), mWindow(0)
     {
     createGuiServiceParts();
     createStates();
@@ -52,7 +53,7 @@
 SearchRuntime::~SearchRuntime()
     {
     delete mWindow;
-  //  delete mStateMachine;
+    //  delete mStateMachine;
     }
 
 // ---------------------------------------------------------------------------
@@ -61,7 +62,7 @@
 //
 void SearchRuntime::handleStateMachineStarted()
     {
-   // emit started();
+    // emit started();
     }
 
 // ---------------------------------------------------------------------------
@@ -91,7 +92,7 @@
     {
 
     SearchStateProvider stateProvider;
-    
+
     QFinalState* finalState = new QFinalState();
     this->addState(finalState);
 
@@ -105,32 +106,55 @@
 
     QState* searchRootState = new QState(guiRootState);
 
-
-    QState* wizardProgressiveState = stateProvider.createState(wizardProgressiveStateUri);
+    QState* wizardProgressiveState = stateProvider.createState(
+            wizardProgressiveStateUri);
     // set state specific data
     wizardProgressiveState->setParent(searchRootState);
     wizardProgressiveState->setObjectName(wizardProgressiveStateUri);
 
-
-    QState* wizardSettingState = stateProvider.createState(wizardSettingStateUri);
+    QState* wizardSettingState = stateProvider.createState(
+            wizardSettingStateUri);
     wizardSettingState->setParent(searchRootState);
     wizardSettingState->setObjectName(wizardSettingStateUri);
 
+    QState* wizardOnlineState = stateProvider.createState(
+            wizardOnlineStateUri);
+    wizardOnlineState->setParent(searchRootState);
+    wizardOnlineState->setObjectName(wizardOnlineStateUri);
+
+    // progressive to settings
     wizardProgressiveState->addTransition(wizardProgressiveState,
-            SIGNAL(settingsState()), wizardSettingState);
+            SIGNAL(switchProToSettingsState()), wizardSettingState);
 
-    // From activated back to menu
+    // settings to progressive 
     wizardSettingState->addTransition(wizardSettingState,
-            SIGNAL(backEventTriggered()), wizardProgressiveState);
-    
+            SIGNAL(switchToProState()), wizardProgressiveState);
+
+    // online to settings
+    wizardOnlineState->addTransition(wizardOnlineState,
+            SIGNAL(switchOnlineToSettingsState()), wizardSettingState);
+
+    // settings to online 
+    wizardSettingState->addTransition(wizardSettingState,
+            SIGNAL(switchToOnlineState()), wizardOnlineState);
+
     connect(wizardSettingState, SIGNAL(clickstatus(bool)),
-                wizardProgressiveState, SLOT(settingsaction(bool)));
+            wizardProgressiveState, SLOT(settingsaction(bool)));
 
     connect(wizardSettingState, SIGNAL(publishSelectedCategory(int,bool)),
             wizardProgressiveState, SLOT(getSettingCategory(int,bool)));
+    
+    connect(wizardSettingState, SIGNAL(publishISProviderIcon(int,HbIcon)),
+            wizardProgressiveState, SLOT(slotISProvidersIcon(int,HbIcon)));
 
-    connect(wizardSettingState, SIGNAL(customizeGoButton(bool)),
-            wizardProgressiveState, SLOT(_customizeGoButton(bool)));
+    connect(wizardProgressiveState, SIGNAL(inDeviceSearchQuery(QString)),
+            wizardOnlineState, SLOT(slotIndeviceQuery(QString)));
+    
+    connect(wizardProgressiveState, SIGNAL(launchLink(int,QString)),
+            wizardOnlineState, SLOT(slotlaunchLink(int,QString)));
+
+    connect(wizardOnlineState, SIGNAL(onlineSearchQuery(QString)),
+            wizardProgressiveState, SLOT(slotOnlineQuery(QString)));
 
     // set initial state for statemachine
     if (hbApp->activateReason() == Hb::ActivationReasonActivity)
@@ -146,27 +170,24 @@
         else if (var == "SearchDeviceQueryView")
             {
             searchRootState->setInitialState(wizardProgressiveState);
-           
+
             }
         else if (var == "SearchWebQueryView")
             {
-            //set initial state as internet
+            searchRootState->setInitialState(wizardOnlineState);
             }
         }
     else if (hbApp->activateReason() == Hb::ActivationReasonNormal)
         {
 
-        searchRootState->setInitialState(wizardProgressiveState);        
+        searchRootState->setInitialState(wizardProgressiveState);
 
         }
     guiRootState->setInitialState(searchRootState);
     this->setInitialState(parallel);
 
-    connect(this, SIGNAL(started()),
-            SLOT(handleStateMachineStarted()));
-    connect(this, SIGNAL(stopped()),
-            SLOT(handleStateMachineStopped()));
-    connect(this, SIGNAL(finished()),
-            SLOT(handleStateMachineStopped()));
+    connect(this, SIGNAL(started()), SLOT(handleStateMachineStarted()));
+    connect(this, SIGNAL(stopped()), SLOT(handleStateMachineStopped()));
+    connect(this, SIGNAL(finished()), SLOT(handleStateMachineStopped()));
 
     }