void HsViewAppSettingsState::onExit(QEvent *event)
{
    
    QState::onExit(event);
    // Remove mView from main window and restore previous view.
    HbMainWindow *hbMainWindow = mainWindow();
    hbMainWindow->setCurrentView(mPreviousView);
    hbMainWindow->removeView(mView);

    
    delete mActionConfirm;
    mActionConfirm = NULL;
    delete mView;
    mView = NULL;
}
// ---------------------------------------------------------------------------
// PosSettingsForm::closeAdvancedView
// ---------------------------------------------------------------------------
//
void PosSettingsForm::closeAdvancedView()
{
    qDebug() << "+ PosSettingsForm::closeAdvancedView()";
    disconnect(mBackAction, SIGNAL(triggered()), this, SLOT(closeAdvancedView()));

    HbMainWindow* mainWindow = hbInstance->allMainWindows().at(0);
    mainWindow->removeView(mAdvancedView);

    mAdvancedView->setParent(NULL);

    delete mAdvancedView;
    mAdvancedView = NULL;

    // refresh first view
    setPosTypeState( PosTypeIndexGps);
    setPosTypeState( PosTypeIndexWireless);
    setPosTypeState( PosTypeIndexBackground);
    validatePosTypeVisibility(PosTypeIndexBackground);
    qDebug() << "- PosSettingsForm::closeAdvancedView()";
}