wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp
changeset 60 822a45792fdd
parent 53 bdc64aa9b954
--- a/wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp	Mon Aug 23 13:30:09 2010 +0300
+++ b/wlanutilities/wlanwizard/src/wlanwizardpagescanning.cpp	Fri Sep 03 09:37:37 2010 +0300
@@ -16,19 +16,23 @@
 */
 
 // System includes
+
 #include <HbParameterLengthLimiter>
 #include <HbMainWindow>
 #include <HbDocumentLoader>
 #include <HbWidget>
 #include <HbLabel>
 #include <HbProgressBar>
+
 #include <cmmanagerdefines_shim.h>
 #include <wlanqtutils.h>
 #include <wlanqtutilsap.h>
 
 // User includes
+
 #include "wlanwizard_p.h"
 #include "wlanwizardpagescanning.h"
+
 #include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "wlanwizardpagescanningTraces.h"
@@ -49,7 +53,8 @@
     mScanResultsAvailable(false),
     mScanStatus(WlanQtUtils::ScanStatusOk)
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY);
+    
     WlanQtUtils* utils = mWizard->wlanQtUtils();
 
     // Connect normal scan completion signal from wlanQtUtils to result
@@ -60,9 +65,9 @@
         SIGNAL(wlanScanApReady(int)),
         this,
         SLOT(wlanScanResultPreCheck(int)));
+    Q_ASSERT(ok);
     
-    Q_ASSERT(ok);
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT );
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT);
 }
 
 /*!
@@ -71,9 +76,11 @@
  */
 WlanWizardPageScanning::~WlanWizardPageScanning()
 {
-    OstTraceFunctionEntry0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY );
+    OstTraceFunctionEntry0(DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_ENTRY);
+    
     delete mLoader;
-    OstTraceFunctionExit0( DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT );
+    
+    OstTraceFunctionExit0(DUP1_WLANWIZARDPAGESCANNING_WLANWIZARDPAGESCANNING_EXIT);
 }
 
 /*!
@@ -83,7 +90,8 @@
  */
 HbWidget* WlanWizardPageScanning::initializePage()
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_INITIALIZEPAGE_ENTRY);
+    
     OstTrace0(
         TRACE_NORMAL,
         WLANWIZARDPAGESCANNING_INITIALIZEPAGE,
@@ -136,7 +144,7 @@
         "txt_occ_dialog_searching").arg(mWizard->configuration(
             WlanWizardPrivate::ConfSsid).toString()));
 
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_INITIALIZEPAGE_EXIT );
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_INITIALIZEPAGE_EXIT);
     return mWidget;
 }
 
@@ -148,10 +156,11 @@
  */
 int WlanWizardPageScanning::nextId(bool &removeFromStack) const
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_NEXTID_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_NEXTID_ENTRY);
+    
     removeFromStack = true;
 
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_NEXTID_EXIT );
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_NEXTID_EXIT);
     return mNextPageId;
 }
 
@@ -165,12 +174,22 @@
  */
 int WlanWizardPageScanning::previousTriggered()
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_ENTRY );
-    disconnect(this, SLOT(wlanScanDirectReady(int)));
-    disconnect(this, SLOT(wlanScanResultPreCheck(int)));
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_ENTRY);
     
     WlanQtUtils* utils = mWizard->wlanQtUtils();
     
+    disconnect(
+        utils,
+        SIGNAL(wlanScanApReady(int)),
+        this,
+        SLOT(wlanScanResultPreCheck(int)));
+    
+    disconnect(
+        utils,
+        SIGNAL(wlanScanDirectReady(int)),
+        this,
+        SLOT(wlanScanDirectReady(int)));
+    
     utils->stopWlanScan();
 
     bool ok = connect(
@@ -187,7 +206,7 @@
         SLOT(wlanScanDirectReady(int)));
     Q_ASSERT(ok);
     
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_EXIT );
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_PREVIOUSTRIGGERED_EXIT);
     return OneStepBackwards;
     
 }
@@ -202,9 +221,11 @@
  */
 bool WlanWizardPageScanning::showPage()
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SHOWPAGE_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_SHOWPAGE_ENTRY);
+
     mWizard->setConfiguration(WlanWizardHelper::ConfProcessSettings, false);
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SHOWPAGE_EXIT );
+
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_SHOWPAGE_EXIT);
     return false;
 }
 
@@ -216,8 +237,8 @@
  */
 bool WlanWizardPageScanning::requiresStartOperation()
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY );
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_ENTRY);
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_REQUIRESSTARTOPERATION_EXIT);
     return true;
 }
 
@@ -227,16 +248,20 @@
  */
 void WlanWizardPageScanning::startOperation()
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY );
-    OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_STARTOPERATION,
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_STARTOPERATION_ENTRY);
+    
+    OstTrace0(
+        TRACE_NORMAL,
+        WLANWIZARDPAGESCANNING_STARTOPERATION,
         "WlanWizardPageScanning::startOperation - start AP scan if results"
-        " are available." );
+        " are available.");
 
     if (mScanResultsAvailable) {
         mScanResultsAvailable = false;
         wlanScanApReady();
     }
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT );
+    
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_STARTOPERATION_EXIT);
 }
 
 /*!
@@ -247,10 +272,13 @@
  */
 void WlanWizardPageScanning::loadDocmlSection(Qt::Orientation orientation)
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY );
-    OstTrace1( TRACE_NORMAL, WLANWIZARDPAGESCANNING_LOADDOCML,
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_ENTRY);
+    
+    OstTrace1(
+        TRACE_NORMAL,
+        WLANWIZARDPAGESCANNING_LOADDOCML,
         "WlanWizardPageScanning::loadDocml - orientation ;orientation=%x",
-        ( TUint )( orientation ) );
+        (TUint)orientation);
 
     WlanWizardPageInternal::loadDocmlSection(
         mLoader,
@@ -258,7 +286,8 @@
         ":/docml/occ_add_wlan_06.docml", 
         "portrait_section",
         "landscape_section");
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT );
+    
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_LOADDOCMLSECTION_EXIT);
 }
 
 /*!
@@ -269,32 +298,38 @@
  */
 void WlanWizardPageScanning::wlanScanResultPreCheck(int scanStatus)
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_ENTRY);
+    
     mScanStatus = scanStatus;
     
     if (!mWidget) {
-        OstTrace1( TRACE_BORDER, WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
+        OstTrace1(
+            TRACE_BORDER,
+            WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
             "WlanWizardPageScanning::wlanScanResultPreCheck no widget;this=%x",
-            this );
+            this);
 
         mScanResultsAvailable = true;
     } else {
         if (mWizard->isCurrentPage(mWidget)) {
-            OstTrace0( TRACE_BORDER,
+            OstTrace0(
+                TRACE_BORDER,
                 DUP1_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
                 "WlanWizardPageScanning::wlanScanResultPreCheck go to results");
 
             wlanScanApReady();
         } else {
-            OstTrace0( TRACE_BORDER,
+            OstTrace0(
+                TRACE_BORDER,
                 DUP2_WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK,
                 "WlanWizardPageScanning::wlanScanResultPreCheck"
-                " not current widget" );
+                " not current widget");
 
             mScanResultsAvailable = true;
         }
     }
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT );
+    
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANSCANRESULTPRECHECK_EXIT);
 }
 
 /*!
@@ -304,9 +339,12 @@
  */
 void WlanWizardPageScanning::wlanScanDirectReady(int scanStatus)
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY );
-    OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY,
-        "WlanWizardPageScanning::wlanScanDirectReady" );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_ENTRY);
+    
+    OstTrace0(
+        TRACE_NORMAL,
+        WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY,
+        "WlanWizardPageScanning::wlanScanDirectReady");
 
     WlanQtUtils* utils = mWizard->wlanQtUtils();
 
@@ -315,7 +353,7 @@
     QList<WlanScanResult> filteredResults;
 
     if (scanStatus == WlanQtUtils::ScanStatusOk) {
-        QList<QSharedPointer<WlanQtUtilsAp> > directScanResults;
+        QList< QSharedPointer<WlanQtUtilsAp> > directScanResults;
         // Read the directed scan results from Qt Utils
         utils->availableWlanAps(directScanResults);
 
@@ -326,7 +364,8 @@
     // Process the scan results. If scan status is not ok, feed an empty
     // result table to the selection function.
     selectNextPageActions(filteredResults);
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT );
+    
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANSCANDIRECTREADY_EXIT);
 }
 
 /*!
@@ -337,9 +376,12 @@
  */
 void WlanWizardPageScanning::wlanScanApReady()
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY );
-    OstTrace0( TRACE_NORMAL, WLANWIZARDPAGESCANNING_WLANSCANAPREADY,
-        "WlanWizardPageScanning::wlanScanApReady" );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_WLANSCANAPREADY_ENTRY);
+    
+    OstTrace0(
+        TRACE_NORMAL,
+        WLANWIZARDPAGESCANNING_WLANSCANAPREADY,
+        "WlanWizardPageScanning::wlanScanApReady");
 
     if (mScanStatus == WlanQtUtils::ScanStatusOk) {
         WlanQtUtils* utils = mWizard->wlanQtUtils();
@@ -365,7 +407,8 @@
         mNextPageId = WlanWizardPageInternal::PageNetworkMode;
         mWizard->nextPage();
     }
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_WLANSCANAPREADY_EXIT );
+    
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_WLANSCANAPREADY_EXIT);
 }
 
 /*!
@@ -378,7 +421,8 @@
     QString ssid,
     const QList<QSharedPointer<WlanQtUtilsAp> > &matchList)
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_ENTRY);
+    
     mWlanApList.clear();
     QSharedPointer<WlanQtUtilsAp> item;
 
@@ -388,7 +432,8 @@
             mWlanApList.append(item);
         }
     }
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_EXIT );
+    
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_GETSSIDMATCHLIST_EXIT);
 }
 
 /*
@@ -403,7 +448,8 @@
     const QList<QSharedPointer<WlanQtUtilsAp> > &openScanResults,
     QList<WlanScanResult> &finalResults)
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_ENTRY);
+    
     finalResults.clear();
 
     // The key assumption of this algorithm is that both direct and public scan
@@ -430,7 +476,8 @@
 
         finalResults.append(resultItem);
     }
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_EXIT );
+    
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_GETFINALSCANRESULTS_EXIT);
 }
 
 /*!
@@ -442,7 +489,8 @@
 int WlanWizardPageScanning::processMultipleScanResults(
     const QList<WlanScanResult> &finalResults)
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_ENTRY);
+    
     WlanWizardScanList networkOptions;
     int nextPage;
 
@@ -473,7 +521,7 @@
         nextPage = WlanWizardPageInternal::PageNetworkSecurity;
     }
     
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT );
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_PROCESSMULTIPLESCANRESULTS_EXIT);
     return nextPage;
 }
 
@@ -484,9 +532,10 @@
 void WlanWizardPageScanning::selectNextPageActions(
     const QList<WlanScanResult> &finalResults)
 {
-    OstTraceFunctionEntry0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY );
+    OstTraceFunctionEntry0(WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_ENTRY);
+
     mWizard->clearConfiguration(WlanWizardHelper::ConfAvailableNetworkOptions);
-    
+
     if (finalResults.isEmpty()) {
         // In case of no results at all were found.
         mNextPageId = WlanWizardPageInternal::PageNetworkMode;
@@ -494,7 +543,8 @@
         // In case there is only a single result.
         WlanScanResult item = finalResults.first();
         mNextPageId = mWizard->getNextPageId(
-            item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toString(),
+            item.scanResult->value(WlanQtUtilsAp::ConfIdName).toString(),
+            item.scanResult->value(WlanQtUtilsAp::ConfIdSsid).toByteArray(),
             item.scanResult->value(WlanQtUtilsAp::ConfIdConnectionMode).toInt(),
             item.scanResult->value(WlanQtUtilsAp::ConfIdSecurityMode).toInt(),
             item.scanResult->value(WlanQtUtilsAp::ConfIdWpaPskUse).toBool(),
@@ -507,5 +557,6 @@
     }
 
     mWizard->nextPage();
-    OstTraceFunctionExit0( WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_EXIT );
+
+    OstTraceFunctionExit0(WLANWIZARDPAGESCANNING_SELECTNEXTPAGEACTIONS_EXIT);
 }