diff -r 682dd021f9be -r 7b3e49e4608a wlanutilities/eapwizard/src/eapwizardpagenewpacstore.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/eapwizard/src/eapwizardpagenewpacstore.cpp Thu Jun 24 10:49:51 2010 +0300 @@ -0,0 +1,187 @@ +/* + * 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 "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * EAP Wizard Page: New PAC store password + * + */ + +// System includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// User includes +#include "wlanwizardhelper.h" +#include "eapwizardpagenewpacstore.h" +#include "eapwizard_p.h" + +/*! + \class EapWizardPageNewPacStore + \brief Implements EAP wizard page: New PAC store password + */ + +// External function prototypes + +// Local constants + +// ======== LOCAL FUNCTIONS ======== + +// ======== MEMBER FUNCTIONS ======== + + +/*! + Constructor. + + @param [in] parent Pointer to EAP Wizard private implementation. + */ +EapWizardPageNewPacStore::EapWizardPageNewPacStore( + EapWizardPrivate* parent) : + EapWizardPage(parent), + mDocumentLoader(NULL), + mValidator(NULL), + mWidget(NULL), + mEditPasswordNew(NULL), + mEditPasswordConfirm(NULL), + mTitlePasswordNew(NULL), + mTitlePasswordConfirm(NULL) +{ +} + +/*! + Destructor. + */ +EapWizardPageNewPacStore::~EapWizardPageNewPacStore() +{ +} + +/*! + See WlanWizardPage. + */ +HbWidget* EapWizardPageNewPacStore::initializePage() +{ + if (!mWidget) { + bool ok; + mDocumentLoader.reset( + new HbDocumentLoader(mWizard->wizardHelper()->mainWindow())); + mDocumentLoader->load(":/docml/occ_eap_wizard_05_07.docml", &ok); + Q_ASSERT(ok); + + loadDocmlSection(mWizard->wizardHelper()->mainWindow()->orientation()); + + mWidget = qobject_cast (mDocumentLoader->findWidget("view")); + Q_ASSERT(mWidget); + + mTitlePasswordNew = qobject_cast (mDocumentLoader->findWidget("setlabel_55")); + Q_ASSERT(mTitlePasswordNew); + + mTitlePasswordConfirm = qobject_cast (mDocumentLoader->findWidget("setlabel_56")); + Q_ASSERT(mTitlePasswordConfirm); + + mEditPasswordNew = qobject_cast (mDocumentLoader->findWidget("lineEditUsername")); + Q_ASSERT(mEditPasswordNew); + + mEditPasswordConfirm = qobject_cast (mDocumentLoader->findWidget("lineEditPassword")); + Q_ASSERT(mEditPasswordConfirm); + + mValidator.reset( + mWizard->eapConfigurationInterface()->validatorPacStore( + EapQtPacStoreConfig::PacStorePassword)); + Q_ASSERT(mValidator.data()); + + mTitlePasswordNew->setPlainText(hbTrId("txt_occ_setlabel_new_pac_store_password")); + mTitlePasswordConfirm->setPlainText(hbTrId("txt_occ_setlabel_confirm_password")); + + // Configure editors properties + mValidator->updateEditor(mEditPasswordNew); + mValidator->updateEditor(mEditPasswordConfirm); + + ok = connect( + mWizard->wizardHelper()->mainWindow(), + SIGNAL(orientationChanged(Qt::Orientation)), + this, + SLOT(loadDocmlSection(Qt::Orientation))); + Q_ASSERT(ok); + + ok = connect( + mEditPasswordNew, SIGNAL(textChanged(const QString &)), + this, SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + + ok = connect( + mEditPasswordConfirm, SIGNAL(textChanged(const QString &)), + this, SLOT(textChanged(const QString &))); + Q_ASSERT(ok); + } + return mWidget; +} + +/*! + Loads the required orientation of docml. + + @param [in] orientation Orientation to be loaded. + */ +void EapWizardPageNewPacStore::loadDocmlSection(Qt::Orientation orientation) +{ + EapWizardPage::loadDocmlSection( + mDocumentLoader.data(), + orientation, + ":/docml/occ_eap_wizard_05_07.docml", + "portrait_section", + "landscape_section"); +} + +/*! + See WlanWizardPage. + + Validates the content of the page. + + @return true if content is valid. + */ +bool EapWizardPageNewPacStore::showPage() +{ + bool valid = false; + if (mValidator->validate(mEditPasswordNew->text()) == EapQtValidator::StatusOk && + mEditPasswordNew->text() == mEditPasswordConfirm->text()) { + valid = true; + } + return valid; +} + +/*! + See WlanWizardPage. + + @return next wizard page: EapWizardPage::PageUsernamePassword + */ +int EapWizardPageNewPacStore::nextId() const +{ + mWizard->setConfigurations(EapWizardPrivate::PacStorePassword, mEditPasswordNew->text()); + return EapWizardPage::PageUsernamePassword; +} + +/*! + Slot for textChanged() signal from HbLineEdit. + + @param [in] text NOT USED. + */ +void EapWizardPageNewPacStore::textChanged(const QString &text) +{ + Q_UNUSED(text); + mWizard->wizardHelper()->enableNextButton(showPage()); +}