diff -r 682dd021f9be -r 7b3e49e4608a wlanutilities/testwizard/src/FirstView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wlanutilities/testwizard/src/FirstView.cpp Thu Jun 24 10:49:51 2010 +0300 @@ -0,0 +1,130 @@ +/* + * 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: + * Test application for wizards. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "firstview.h" +#include "wlanwizard.h" + +FirstView::FirstView() : + mWizard(NULL) +{ + qDebug("FirstView::FirstView()"); + bool ok = false; + HbDocumentLoader loader; + loader.load(":/docml/mainview.docml", &ok); + Q_ASSERT_X(ok, "EAP Wizard EXE", "Invalid docml file"); + + QGraphicsWidget *widget = loader.findWidget("view"); + Q_ASSERT_X(widget != 0, "TestEapWizard", "View not found"); + + HbPushButton *action = qobject_cast (loader.findObject("startWizard")); + Q_ASSERT_X(action != 0, "TestEapWizard", "startWizard not found"); + connect(action, SIGNAL(clicked(bool)), this, SLOT(start(bool))); + + mUseConf = qobject_cast (loader.findWidget("useConf")); + Q_ASSERT_X(mUseConf != 0, "TestEapWizard", "useConf not found"); + + mSsid = qobject_cast (loader.findWidget("ssid")); + Q_ASSERT_X(mSsid != 0, "TestEapWizard", "ssid not found"); + + mNetworkMode = qobject_cast (loader.findWidget("networkMode")); + Q_ASSERT_X(mNetworkMode != 0, "TestEapWizard", "networkMode not found"); + + mSecurityMode = qobject_cast (loader.findWidget("securityMode")); + Q_ASSERT_X(mSecurityMode != 0, "TestEapWizard", "securityMode not found"); + + mHidden = qobject_cast (loader.findWidget("isHidden")); + Q_ASSERT_X(mHidden != 0, "TestEapWizard", "isHidden not found"); + + mUseWpaPsk = qobject_cast (loader.findWidget("useWpaPsk")); + Q_ASSERT_X(mUseWpaPsk != 0, "TestEapWizard", "useWpaPsk not found"); + + mUseWps = qobject_cast (loader.findWidget("useWps")); + Q_ASSERT_X(mUseConf != 0, "TestEapWizard", "useWps not found"); + + mStatus = qobject_cast (loader.findWidget("labelWizardStatus")); + Q_ASSERT_X(mStatus != 0, "TestEapWizard", "labelWizardStatus not found"); + + setWidget(widget); + qDebug("FirstView::FirstView() - done %d", action); +} + +FirstView::~FirstView() +{ + delete mWizard; +} + +void FirstView::start(bool) +{ + qDebug("FirstView::Start"); + if (!mWizard) { + mWizard = new WlanWizard(mainWindow()); + + connect(mWizard, SIGNAL(finished(int, bool)), this, SLOT(finished(int, bool))); + connect(mWizard, SIGNAL(cancelled()), this, SLOT(cancelled())); + } + + if (mUseConf->isChecked()) { + mWizard->setParameters( + mSsid->text(), + mNetworkMode->currentIndex(), + 1 << mSecurityMode->currentIndex(), + mUseWpaPsk->isChecked(), + mHidden->isChecked(), + mUseWps->isChecked()); + } + + mWizard->show(); +} + +void FirstView::deleteWizard() +{ + qDebug("FirstView::deleteWizard"); + + Q_ASSERT(mWizard); + mWizard->deleteLater(); + mWizard = NULL; + +} + +void FirstView::finished(int iapId, bool connected) +{ + qDebug("FirstView::complete(), iap id: %d, connected: %d", iapId, connected); + QString text; + text.setNum(iapId); + text.prepend("Finished, IAP ID: "); + mStatus->setPlainText(text); + deleteWizard(); +} + +void FirstView::cancelled() +{ + qDebug("FirstView::cancelled()"); + mStatus->setPlainText("Cancelled"); + deleteWizard(); +} +