diff -r 30a5f517c615 -r b3d8f88532b7 wlanutilities/wpswizard/src/wpswizardsteptwo.cpp --- a/wlanutilities/wpswizard/src/wpswizardsteptwo.cpp Fri Jun 11 16:27:29 2010 +0100 +++ b/wlanutilities/wpswizard/src/wpswizardsteptwo.cpp Thu Jul 22 16:44:32 2010 +0100 @@ -2,7 +2,7 @@ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available - * under the terms of the License "Eclipse Public License v1.0" + * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -17,11 +17,11 @@ */ // System includes -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // User includes #include "wpswizardsteptwo.h" @@ -30,155 +30,198 @@ // Trace includes #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE -#include "wpspagesteptwoTraces.h" +#include "wpswizardsteptwoTraces.h" #endif +// External function prototypes + +// Local constants /*! - * Constructor for WPS page two - * - * \param WpsWizardPrivate* Pointer to the WPS wizard private implementation + \class WpsPageStepTwo + \brief Implementation of wps wizard page for step two. + */ + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor for WPS page two + + @param [in] parent Pointer to the WPS wizard private implementation */ WpsPageStepTwo::WpsPageStepTwo(WpsWizardPrivate* parent) : - WpsWizardPage(parent), mWidget(NULL), mRadio(NULL), mValid(false) - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this) + WpsWizardPage(parent), + mWidget(NULL), + mRadio(NULL), + mHeading(NULL), + mValid(false), + mItemSelected(0), + mLoader(NULL) +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this); - } +} /*! - * Destructor + Destructor */ WpsPageStepTwo::~WpsPageStepTwo() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_ENTRY, this) - - delete mWidget; - OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_EXIT, this) - - } +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_DESTRUCTOR_ENTRY, this); + delete mLoader; + OstTraceFunctionExit1(WPSPAGESTEPTWO_WPSPAGESTEPTWO_DESTRUCTOR_EXIT, this); +} /*! - * Loads the page with all the widgets - * - * \return HbWidget* Returns the view widget + Loads the page with all the widgets + + @return HbWidget* Returns the view widget */ HbWidget* WpsPageStepTwo::initializePage() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_INITIALIZEPAGE_ENTRY, this) +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_INITIALIZEPAGE_ENTRY, this); - if (!mWidget) - { + if (!mWidget) { bool ok; - HbDocumentLoader loader; - loader.load(":/docml/occ_wps_P1.docml", &ok); - Q_ASSERT_X(ok, "WPS Wizard", "Invalid docml file"); + mLoader = new HbDocumentLoader(mWizard->mainWindow()); + + mLoader->load(":/docml/occ_wps_01_05.docml", &ok); + Q_ASSERT(ok); + + // Initialize orientation + loadDocmlSection(mWizard->mainWindow()->orientation()); - mWidget = qobject_cast (loader.findWidget("occ_wps_P1")); - Q_ASSERT_X(mWidget != 0, "WPS Wizard", "View not found"); + mWidget = qobject_cast (mLoader->findWidget("occ_wps_P1")); + Q_ASSERT(mWidget); + + mHeading = qobject_cast (mLoader->findWidget("label")); + Q_ASSERT(mHeading); + mHeading->setPlainText(hbTrId("txt_occ_dialog_selected_network_supports_wifi_pro")); - mHeading - = qobject_cast (loader.findWidget("label_heading")); - Q_ASSERT_X(mTitle != 0, "WPS wizard", "Header not found"); - - mRadio = qobject_cast (loader.findWidget( - "radioButtonList")); - Q_ASSERT_X(mRadio != 0, "WPS Wizard", "List not found"); + mRadio = qobject_cast (mLoader->findWidget("radioButtonList")); + Q_ASSERT(mRadio); + + //Set Options + QStringList list; + list << hbTrId("txt_occ_list_use_pushbutton") + << hbTrId("txt_occ_list_use_pin_code") + << hbTrId("txt_occ_list_configure_manually"); + mRadio->setItems(list); - connect(mRadio, SIGNAL(itemSelected(int)), this, - SLOT(itemSelected(int))); + bool connectOk = connect( + mRadio, + SIGNAL(itemSelected(int)), + this, + SLOT(itemSelected(int))); + Q_ASSERT(connectOk); - } - OstTraceFunctionExit1(WPSPAGESTEPTWO_INITIALIZEPAGE_EXIT, this) - + connectOk = connect( + mWizard->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(connectOk); + } + + OstTraceFunctionExit1(WPSPAGESTEPTWO_INITIALIZEPAGE_EXIT, this); return mWidget; - } - +} /*! - * Funtion to determine the next page to be displayed in the wizard process - * - * \param bool& RemoveFromStack indicating whether the current page should be - * removed from the stack - * - * \return int Page Id of the next page to be displayed. + Funtion to determine the next page to be displayed in the wizard process + + @param [out] removeFromStack bool indicating whether the current page should be + removed from the stack + + @return int Page Id of the next page to be displayed. */ int WpsPageStepTwo::nextId(bool &removeFromStack) const - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_NEXTID_ENTRY, this) +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_NEXTID_ENTRY, this); int id = WpsWizardPage::PageWpsWizardStep3_Button; removeFromStack = false; - if (mItemSelected == 0) + + if (mItemSelected == WpsPushButtonMode) { id = WpsWizardPage::PageWpsWizardStep3_Button; - else + + } else if (mItemSelected == WpsPinCodeMode) { id = WpsWizardPage::PageWpsWizardStep3_Number; - OstTraceFunctionExit1(WPSPAGESTEPTWO_NEXTID_EXIT, this) - - + + } else { + id = mWizard->nextPageId(false); + } + + OstTraceFunctionExit1(WPSPAGESTEPTWO_NEXTID_EXIT, this); return id; - } +} /*! - * Determines the Number of steps to move backwards when 'Prev' Button - * is clicked - * - * \return int Number of pages to move backwards + Determines the Number of steps to move backwards when 'Prev' Button + is clicked + + @return int Number of pages to move backwards */ -int WpsPageStepTwo::stepsBackwards() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_STEPSBACKWARDS_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_STEPBACKWARDS_EXIT, this) - +int WpsPageStepTwo::previousTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_EXIT, this); return 1; - } +} /*! - * Callback when the previous button is clicked -*/ -void WpsPageStepTwo::previousTriggered() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_PREVIOUSTRIGGERED_EXIT, this) - - } + CallBack when the cancel button is clicked + */ +void WpsPageStepTwo::cancelTriggered() +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_CANCELTRIGGERED_ENTRY, this); + OstTraceFunctionExit1(WPSPAGESTEPTWO_CANCELTRIGGERED_EXIT, this); +} /*! - * CallBack when the cancel button is clicked + Determines whether the Next action button should be enabled or not + + @return bool Indicating whether next button is enabled or not. */ -void WpsPageStepTwo::cancelTriggered() - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_CANCELTRIGGERED_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_CANCELTRIGGERED_EXIT, this) - - } +bool WpsPageStepTwo::showPage() +{ + return mValid; +} /*! - * Validates the content of the pages - * - * \return bool Indicating the result of the operation + Call back when an item is selected from the list on the UI + + @param [in] index Indcating the relative position in the list */ -bool WpsPageStepTwo::validate() const - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_VALIDATE_ENTRY, this) - OstTraceFunctionExit1(WPSPAGESTEPTWO_VALIDATE_EXIT, this) - - return mValid; - } +void WpsPageStepTwo::itemSelected(int index) +{ + OstTraceFunctionEntry1(WPSPAGESTEPTWO_ITEMSELECTED_ENTRY, this); + mValid = true; + mWizard->enableNextButton(mValid); + mItemSelected = index; + OstTraceFunctionExit1(WPSPAGESTEPTWO_ITEMSELECTED_EXIT, this); +} /*! - * Call back when an item is selected from the list on the UI - * - * \param int index Indcating the relative position in the list + Loads docml at initialization phase and when HbMainWindow sends + orientation() signal. + + @param [in] orientation orientation to be loaded. */ -void WpsPageStepTwo::itemSelected(int index) - { - OstTraceFunctionEntry1(WPSPAGESTEPTWO_ITEMSELECTED_ENTRY, this) +void WpsPageStepTwo::loadDocmlSection(Qt::Orientation orientation) +{ + bool ok = false; + + // Load the orientation specific section + if (orientation == Qt::Horizontal) { + mLoader->load(":/docml/occ_wps_01_05.docml", "landscape", &ok); + Q_ASSERT(ok); + } else { + Q_ASSERT(orientation == Qt::Vertical); + mLoader->load(":/docml/occ_wps_01_05.docml", "portrait", &ok); + Q_ASSERT(ok); + } +} - mValid = true; - mWizard->enableNextButton(mValid); - mItemSelected = index; - OstTraceFunctionExit1(WPSPAGESTEPTWO_ITEMSELECTED_EXIT, this) - - } -