wlanutilities/wlanwizard/src/wlanwizard_p.cpp
changeset 60 822a45792fdd
parent 53 bdc64aa9b954
child 61 e1d68407ed06
equal deleted inserted replaced
53:bdc64aa9b954 60:822a45792fdd
   180     // parent of the objects.
   180     // parent of the objects.
   181     mPages.clear();
   181     mPages.clear();
   182     
   182     
   183     // timer is cancelled/deleted automatically when the parent (this) is deleted 
   183     // timer is cancelled/deleted automatically when the parent (this) is deleted 
   184     
   184     
   185     // TODO: See TSW Error: MTAA-854DK8 and loadDocml()
       
   186     HbStyleLoader::unregisterFilePath(":/css/custom.css");
   185     HbStyleLoader::unregisterFilePath(":/css/custom.css");
   187     
   186     
   188     mDialog->setAttribute( Qt::WA_DeleteOnClose, true );
   187     mDialog->setAttribute( Qt::WA_DeleteOnClose, true );
   189     mDialog->close();
   188     mDialog->close();
   190     // Remove the pointer from QScopedPointer to prevent double deallocation
   189     // Remove the pointer from QScopedPointer to prevent double deallocation
   201 
   200 
   202 /*!
   201 /*!
   203    See WlanWizard::setParameters().
   202    See WlanWizard::setParameters().
   204  */
   203  */
   205 void WlanWizardPrivate::setParameters(
   204 void WlanWizardPrivate::setParameters(
   206     const QString &ssid,
   205     const QString &name, 
       
   206     const QByteArray &ssid, 
   207     int networkMode,
   207     int networkMode,
   208     int securityMode, 
   208     int securityMode, 
   209     bool usePsk,
   209     bool usePsk,
   210     bool wps)
   210     bool wps)
   211 {
   211 {
   216         WLANWIZARDPRIVATE_SETPARAMETERS, 
   216         WLANWIZARDPRIVATE_SETPARAMETERS, 
   217         "WlanWizardPrivate::setParameters;this=%x", 
   217         "WlanWizardPrivate::setParameters;this=%x", 
   218         this);
   218         this);
   219     
   219     
   220     mFirstPageId = getNextPageId(
   220     mFirstPageId = getNextPageId(
       
   221         name,
   221         ssid,
   222         ssid,
   222         networkMode,
   223         networkMode,
   223         securityMode,
   224         securityMode,
   224         usePsk,
   225         usePsk,
   225         false,
   226         false,
   267    Based on the provided parameters next page id is returned.
   268    Based on the provided parameters next page id is returned.
   268    
   269    
   269    @return next page id based on provided configurations.
   270    @return next page id based on provided configurations.
   270  */
   271  */
   271 int WlanWizardPrivate::getNextPageId(
   272 int WlanWizardPrivate::getNextPageId(
   272     const QString &ssid, 
   273     const QString &name,
       
   274     const QByteArray &ssid,
   273     int networkMode, 
   275     int networkMode, 
   274     int securityMode, 
   276     int securityMode, 
   275     bool usePsk,
   277     bool usePsk,
   276     bool hidden, 
   278     bool hidden,
   277     bool wps)
   279     bool wps)
   278 {
   280 {
   279     OstTraceFunctionEntry0(WLANWIZARDPRIVATE_GETNEXTPAGEID_ENTRY);
   281     OstTraceFunctionEntry0(WLANWIZARDPRIVATE_GETNEXTPAGEID_ENTRY);
   280     
   282     
   281     setConfiguration(ConfProcessSettings, true);
   283     setConfiguration(ConfName, name);
   282     setConfiguration(ConfSsid, ssid);
   284     setConfiguration(ConfSsid, ssid);
   283     setConfiguration(ConfNetworkMode, networkMode);
   285     setConfiguration(ConfNetworkMode, networkMode);
   284     setConfiguration(ConfSecurityMode, securityMode);
   286     setConfiguration(ConfSecurityMode, securityMode);
   285     setConfiguration(ConfUsePsk, usePsk);
   287     setConfiguration(ConfUsePsk, usePsk);
   286     setConfiguration(ConfWlanScanSSID, hidden);
   288     setConfiguration(ConfWlanScanSSID, hidden);
       
   289     setConfiguration(ConfProcessSettings, true);
   287 
   290 
   288     OstTrace1(
   291     OstTrace1(
   289         TRACE_NORMAL,
   292         TRACE_NORMAL,
   290         WLANWIZARDPRIVATE_GETNEXTPAGEID, 
   293         WLANWIZARDPRIVATE_GETNEXTPAGEID, 
   291         "WlanWizardPrivate::getNextPageId;wps=%u", 
   294         "WlanWizardPrivate::getNextPageId;wps=%u", 
   372    @return false in case IAP creation/update failed.
   375    @return false in case IAP creation/update failed.
   373  */
   376  */
   374 bool WlanWizardPrivate::handleIap()
   377 bool WlanWizardPrivate::handleIap()
   375 {
   378 {
   376     OstTraceFunctionEntry0(WLANWIZARDPRIVATE_HANDLEIAP_ENTRY);
   379     OstTraceFunctionEntry0(WLANWIZARDPRIVATE_HANDLEIAP_ENTRY);
   377     
   380 
   378     OstTrace0(
   381     OstTrace0(
   379         TRACE_FLOW,
   382         TRACE_FLOW,
   380         WLANWIZARDPRIVATE_HANDLEIAP,
   383         WLANWIZARDPRIVATE_HANDLEIAP,
   381         "WlanWizardPrivate::handleIap");
   384         "WlanWizardPrivate::handleIap");
   382     
   385 
   383     bool ret = true;
   386     bool ret = true;
   384     bool usePsk = true;
   387     bool usePsk = true;
   385     int securityMode = configuration(ConfSecurityMode).toInt();
   388     int securityMode = configuration(ConfSecurityMode).toInt();
   386     WlanQtUtilsAp wlanAp;
   389     WlanQtUtilsAp wlanAp;
   387    
   390 
   388     // Set default values
   391     // Set default values
   389     wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString());
   392     wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPsk, QString());
   390     wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true );
   393     wlanAp.setValue(WlanQtUtilsAp::ConfIdWpaPskUse, true );
   391     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 );
   394     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepDefaultIndex, CMManagerShim::WepKeyIndex1 );
   392     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString());
   395     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey1, QString());
   393     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString());
   396     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey2, QString());
   394     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString());
   397     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey3, QString());
   395     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString());
   398     wlanAp.setValue(WlanQtUtilsAp::ConfIdWepKey4, QString());
   396     
   399 
   397     // Set configuration
   400     // Set configuration
       
   401     wlanAp.setValue(WlanQtUtilsAp::ConfIdName, configuration(ConfName));
   398     wlanAp.setValue(WlanQtUtilsAp::ConfIdSsid, configuration(ConfSsid));
   402     wlanAp.setValue(WlanQtUtilsAp::ConfIdSsid, configuration(ConfSsid));
   399     wlanAp.setValue(
   403     wlanAp.setValue(
   400         WlanQtUtilsAp::ConfIdConnectionMode, 
   404         WlanQtUtilsAp::ConfIdConnectionMode, 
   401         configuration(ConfNetworkMode));
   405         configuration(ConfNetworkMode));
   402     wlanAp.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode);
   406     wlanAp.setValue(WlanQtUtilsAp::ConfIdSecurityMode, securityMode);
   428             securityMode == CMManagerShim::WlanSecMode802_1x);
   432             securityMode == CMManagerShim::WlanSecMode802_1x);
   429         // No WLAN Specific configuration
   433         // No WLAN Specific configuration
   430         break;
   434         break;
   431     }
   435     }
   432     
   436     
   433     // Create IAP if does not exists or update the existing IAP
   437     // Create an IAP if it does not exist or update the existing IAP
   434     int referenceId = configuration(ConfIapId).toInt();
   438     int referenceId = configuration(ConfIapId).toInt();
   435     if (referenceId == WlanQtUtils::IapIdNone) {
   439     if (referenceId == WlanQtUtils::IapIdNone) {
   436         OstTrace0(
   440         OstTrace0(
   437             TRACE_FLOW,
   441             TRACE_FLOW,
   438             WLANWIZARDPRIVATE_HANDLEIAP_CREATE, 
   442             WLANWIZARDPRIVATE_HANDLEIAP_CREATE, 
   996     //  PageProcessSettings is shown only when WLAN AP is found in scanning
  1000     //  PageProcessSettings is shown only when WLAN AP is found in scanning
   997     // 1/ when client calls setParameters()
  1001     // 1/ when client calls setParameters()
   998     // 2/ scanning page has found match with given SSID
  1002     // 2/ scanning page has found match with given SSID
   999     if (pageId == WlanWizardPage::PageProcessSettings) {
  1003     if (pageId == WlanWizardPage::PageProcessSettings) {
  1000         if (configuration(ConfProcessSettings).toBool() == false) {
  1004         if (configuration(ConfProcessSettings).toBool() == false) {
  1001             if (handleIap()){
  1005             if (handleIap()) {
       
  1006                 // Manually added IAP is by default an Internet IAP if
       
  1007                 // we can not run the internet connectivity test.
       
  1008                 mWlanQtUtils->moveIapToInternetSnap(configuration(ConfIapId).toInt());
  1002                 pageId = WlanWizardPageInternal::PageSummary;
  1009                 pageId = WlanWizardPageInternal::PageSummary;
  1003             } else {
  1010             } else {
  1004                 pageId = WlanWizardPage::PageGenericError;
  1011                 pageId = WlanWizardPage::PageGenericError;
  1005                 setConfiguration(
  1012                 setConfiguration(
  1006                     ConfGenericErrorString, 
  1013                     ConfGenericErrorString, 
  1216     mDialog->addAction(mActionPrevious);
  1223     mDialog->addAction(mActionPrevious);
  1217     mDialog->addAction(mActionCancel);
  1224     mDialog->addAction(mActionCancel);
  1218     mDialog->addAction(mActionNext);
  1225     mDialog->addAction(mActionNext);
  1219     mDialog->addAction(mActionFinish);
  1226     mDialog->addAction(mActionFinish);
  1220     
  1227     
  1221     // TODO: workaround to prevent action to close the dialog
       
  1222     disconnect(mActionPrevious, SIGNAL(triggered()), mDialog.data(), SLOT(close()));
       
  1223     disconnect(mActionCancel, SIGNAL(triggered()), mDialog.data(), SLOT(close()));
       
  1224     disconnect(mActionNext, SIGNAL(triggered()), mDialog.data(), SLOT(close()));
       
  1225     disconnect(mActionFinish, SIGNAL(triggered()), mDialog.data(), SLOT(close()));
       
  1226 
       
  1227     ok = true;
       
  1228     ok = connect(mPageTimer, SIGNAL(timeout()), this, SLOT(onTimeOut()));
  1228     ok = connect(mPageTimer, SIGNAL(timeout()), this, SLOT(onTimeOut()));
  1229     Q_ASSERT(ok);
  1229     Q_ASSERT(ok);
  1230     
  1230     
  1231     ok = connect(
  1231     ok = connect(
  1232         mActionNext,
  1232         mActionNext,
  1254         SIGNAL(triggered()), 
  1254         SIGNAL(triggered()), 
  1255         this,
  1255         this,
  1256         SLOT(cancelTriggered()));
  1256         SLOT(cancelTriggered()));
  1257     Q_ASSERT(ok);
  1257     Q_ASSERT(ok);
  1258 
  1258 
  1259     // TODO: workaround for full screen dialog, with docml it is possible to
       
  1260     // define fullscreen dialog, mut resize is not done correctly when orientation
       
  1261     // is changed. See TSW Error: MTAA-854DK8
       
  1262     ok = HbStyleLoader::registerFilePath(":/css/custom.css");
  1259     ok = HbStyleLoader::registerFilePath(":/css/custom.css");
  1263     Q_ASSERT(ok);
  1260     Q_ASSERT(ok);
  1264     
  1261 
  1265     OstTraceFunctionExit0(WLANWIZARDPRIVATE_LOADDOCML_EXIT);
  1262     OstTraceFunctionExit0(WLANWIZARDPRIVATE_LOADDOCML_EXIT);
  1266 }
  1263 }
  1267 
  1264 
  1268 /*!
  1265 /*!
  1269    Disconnect receiving triggered() signal from any toolbar action.
  1266    Disconnect receiving triggered() signal from any toolbar action.