stateproviders/ftustateprovider/src/ftuwizardactivatedstate.cpp
changeset 2 66c26770985f
parent 0 c464cd7e2753
child 3 0de9fa4800b7
--- a/stateproviders/ftustateprovider/src/ftuwizardactivatedstate.cpp	Mon Apr 19 14:01:47 2010 +0300
+++ b/stateproviders/ftustateprovider/src/ftuwizardactivatedstate.cpp	Mon May 03 12:24:41 2010 +0300
@@ -34,6 +34,7 @@
 #include <QDebug>
 #include <QGraphicsWidget>
 #include <QDir>
+#include <hbmenu.h>
 
 const int gridRowCount = 1;
 
@@ -144,7 +145,7 @@
 void FtuWizardActivatedState::onExit(QEvent *event)
 {
     QState::onExit(event);
-    
+    mMainWindow->currentView()->takeMenu();
     disconnect(mBackAction, SIGNAL(triggered()),
                this, SLOT(handleBackEvent()));
     
@@ -160,6 +161,10 @@
 
     disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
             this, SLOT(updateInfoText(FtuWizard *, QString)));
+    
+    //disconnect from the existing existing wizard's updateMainMenu signal
+    disconnect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )),
+            this,SLOT(updateMainMenu(FtuWizard *, HbMenu * )));
 }
 
 // ---------------------------------------------------------------------------
@@ -181,7 +186,11 @@
 
     disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
             this, SLOT(updateInfoText(FtuWizard *, QString)));
-
+    
+    //disconnect from the existing existing wizard's updateMainMenu signal
+    disconnect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )),
+            this,SLOT(updateMainMenu(FtuWizard *, HbMenu * )));
+    
     // then connect new ones to active wizard
     connect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, QGraphicsWidget* )),
             this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*)));
@@ -194,6 +203,10 @@
     
     connect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
             this, SLOT(updateInfoText(FtuWizard *, QString)));
+    
+    // connect to the updateMainMenu wizard signal
+    connect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )),
+            this,SLOT(updateMainMenu(FtuWizard *, HbMenu * )));
 }
 
 // ---------------------------------------------------------------------------
@@ -218,6 +231,22 @@
     }    
 }
 
+
+// ---------------------------------------------------------------------------
+// FtuWizardActivatedState::updateMainMenu
+// ---------------------------------------------------------------------------
+//
+void FtuWizardActivatedState::updateMainMenu(FtuWizard * caller, HbMenu * menu)
+{
+    //check if only current wizard has emmited this signal
+    if(caller==mActiveWizard)
+        {
+            mMainWindow->currentView()->takeMenu();
+            if(menu)
+                mMainWindow->currentView()->setMenu(menu);
+        }
+}
+
 // ---------------------------------------------------------------------------
 // FtuWizardActivatedState::changeWizardView
 // ---------------------------------------------------------------------------
@@ -365,6 +394,7 @@
         // check if other wizard than current is activated
         if (mActiveWizard != content()->wizard(wizardIndex))
         {
+            mMainWindow->currentView()->takeMenu();
             // first deactivate current active wizard
 		    if(mActiveWizard)
 		    {