stateproviders/ftustateprovider/src/ftuwizardactivatedstate.cpp
changeset 2 66c26770985f
parent 0 c464cd7e2753
child 3 0de9fa4800b7
equal deleted inserted replaced
0:c464cd7e2753 2:66c26770985f
    32 #include <hbgridview.h>
    32 #include <hbgridview.h>
    33 #include <QStandardItemModel>
    33 #include <QStandardItemModel>
    34 #include <QDebug>
    34 #include <QDebug>
    35 #include <QGraphicsWidget>
    35 #include <QGraphicsWidget>
    36 #include <QDir>
    36 #include <QDir>
       
    37 #include <hbmenu.h>
    37 
    38 
    38 const int gridRowCount = 1;
    39 const int gridRowCount = 1;
    39 
    40 
    40 const char *FTUSTATEPROVIDER_DOCML2 = ":/xml/ftustateprovider.docml";
    41 const char *FTUSTATEPROVIDER_DOCML2 = ":/xml/ftustateprovider.docml";
    41 const char *WIZARD_VIEW = "wizardView";
    42 const char *WIZARD_VIEW = "wizardView";
   142 // ---------------------------------------------------------------------------
   143 // ---------------------------------------------------------------------------
   143 //
   144 //
   144 void FtuWizardActivatedState::onExit(QEvent *event)
   145 void FtuWizardActivatedState::onExit(QEvent *event)
   145 {
   146 {
   146     QState::onExit(event);
   147     QState::onExit(event);
   147     
   148     mMainWindow->currentView()->takeMenu();
   148     disconnect(mBackAction, SIGNAL(triggered()),
   149     disconnect(mBackAction, SIGNAL(triggered()),
   149                this, SLOT(handleBackEvent()));
   150                this, SLOT(handleBackEvent()));
   150     
   151     
   151     disconnect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, 
   152     disconnect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, 
   152                                                  QGraphicsWidget* )),
   153                                                  QGraphicsWidget* )),
   158     disconnect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )),
   159     disconnect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )),
   159                this, SLOT(enablePartialScreenMode(FtuWizard*)));
   160                this, SLOT(enablePartialScreenMode(FtuWizard*)));
   160 
   161 
   161     disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
   162     disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
   162             this, SLOT(updateInfoText(FtuWizard *, QString)));
   163             this, SLOT(updateInfoText(FtuWizard *, QString)));
       
   164     
       
   165     //disconnect from the existing existing wizard's updateMainMenu signal
       
   166     disconnect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )),
       
   167             this,SLOT(updateMainMenu(FtuWizard *, HbMenu * )));
   163 }
   168 }
   164 
   169 
   165 // ---------------------------------------------------------------------------
   170 // ---------------------------------------------------------------------------
   166 // FtuWizardActivatedState::setActiveWizardConnections
   171 // FtuWizardActivatedState::setActiveWizardConnections
   167 // ---------------------------------------------------------------------------
   172 // ---------------------------------------------------------------------------
   179     disconnect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )),
   184     disconnect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )),
   180                this, SLOT(enablePartialScreenMode(FtuWizard*)));
   185                this, SLOT(enablePartialScreenMode(FtuWizard*)));
   181 
   186 
   182     disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
   187     disconnect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
   183             this, SLOT(updateInfoText(FtuWizard *, QString)));
   188             this, SLOT(updateInfoText(FtuWizard *, QString)));
   184 
   189     
       
   190     //disconnect from the existing existing wizard's updateMainMenu signal
       
   191     disconnect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )),
       
   192             this,SLOT(updateMainMenu(FtuWizard *, HbMenu * )));
       
   193     
   185     // then connect new ones to active wizard
   194     // then connect new ones to active wizard
   186     connect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, QGraphicsWidget* )),
   195     connect(mActiveWizard, SIGNAL(viewChanged(FtuWizard *, QGraphicsWidget* )),
   187             this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*)));
   196             this, SLOT(changeWizardView(FtuWizard*, QGraphicsWidget*)));
   188     
   197     
   189     connect(mActiveWizard, SIGNAL(fullScreenModeRequested(FtuWizard *)),
   198     connect(mActiveWizard, SIGNAL(fullScreenModeRequested(FtuWizard *)),
   192     connect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )),
   201     connect(mActiveWizard, SIGNAL(partialScreenModeRequested(FtuWizard * )),
   193             this, SLOT(enablePartialScreenMode(FtuWizard*)));
   202             this, SLOT(enablePartialScreenMode(FtuWizard*)));
   194     
   203     
   195     connect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
   204     connect(mActiveWizard, SIGNAL(infoTextUpdated(FtuWizard *, QString )),
   196             this, SLOT(updateInfoText(FtuWizard *, QString)));
   205             this, SLOT(updateInfoText(FtuWizard *, QString)));
       
   206     
       
   207     // connect to the updateMainMenu wizard signal
       
   208     connect(mActiveWizard,SIGNAL(updateMainMenu(FtuWizard *, HbMenu * )),
       
   209             this,SLOT(updateMainMenu(FtuWizard *, HbMenu * )));
   197 }
   210 }
   198 
   211 
   199 // ---------------------------------------------------------------------------
   212 // ---------------------------------------------------------------------------
   200 // FtuWizardActivatedState::content
   213 // FtuWizardActivatedState::content
   201 // ---------------------------------------------------------------------------
   214 // ---------------------------------------------------------------------------
   214 {
   227 {
   215     if(!mActiveWizard->handleBackEvent())
   228     if(!mActiveWizard->handleBackEvent())
   216     {
   229     {
   217         emit backEventTriggered();
   230         emit backEventTriggered();
   218     }    
   231     }    
       
   232 }
       
   233 
       
   234 
       
   235 // ---------------------------------------------------------------------------
       
   236 // FtuWizardActivatedState::updateMainMenu
       
   237 // ---------------------------------------------------------------------------
       
   238 //
       
   239 void FtuWizardActivatedState::updateMainMenu(FtuWizard * caller, HbMenu * menu)
       
   240 {
       
   241     //check if only current wizard has emmited this signal
       
   242     if(caller==mActiveWizard)
       
   243         {
       
   244             mMainWindow->currentView()->takeMenu();
       
   245             if(menu)
       
   246                 mMainWindow->currentView()->setMenu(menu);
       
   247         }
   219 }
   248 }
   220 
   249 
   221 // ---------------------------------------------------------------------------
   250 // ---------------------------------------------------------------------------
   222 // FtuWizardActivatedState::changeWizardView
   251 // FtuWizardActivatedState::changeWizardView
   223 // ---------------------------------------------------------------------------
   252 // ---------------------------------------------------------------------------
   363     if (wizardIndex != -1)
   392     if (wizardIndex != -1)
   364     {
   393     {
   365         // check if other wizard than current is activated
   394         // check if other wizard than current is activated
   366         if (mActiveWizard != content()->wizard(wizardIndex))
   395         if (mActiveWizard != content()->wizard(wizardIndex))
   367         {
   396         {
       
   397             mMainWindow->currentView()->takeMenu();
   368             // first deactivate current active wizard
   398             // first deactivate current active wizard
   369 		    if(mActiveWizard)
   399 		    if(mActiveWizard)
   370 		    {
   400 		    {
   371 			    mActiveWizard->deactivateWizard();
   401 			    mActiveWizard->deactivateWizard();
   372 		    }
   402 		    }