wlanutilities/wlanwizard/src/wlanwizardpageprocessingsettings.cpp
changeset 39 7b3e49e4608a
parent 31 e8f4211554fb
child 43 72ebcbb64834
child 50 d4198dcb9983
equal deleted inserted replaced
36:682dd021f9be 39:7b3e49e4608a
    19 #include <HbMainWindow>
    19 #include <HbMainWindow>
    20 #include <HbDocumentLoader>
    20 #include <HbDocumentLoader>
    21 #include <HbWidget>
    21 #include <HbWidget>
    22 #include <HbLabel>
    22 #include <HbLabel>
    23 #include <HbProgressBar>
    23 #include <HbProgressBar>
       
    24 #include <HbParameterLengthLimiter>
    24 #include <wlanerrorcodes.h>
    25 #include <wlanerrorcodes.h>
    25 
    26 
    26 // User includes
    27 // User includes
    27 #include "wlanwizardplugin.h"
    28 #include "wlanwizardplugin.h"
    28 #include "wlanqtutils.h"
    29 #include "wlanqtutils.h"
    67 {
    68 {
    68     WlanQtUtils* utils = mWizard->wlanQtUtils();
    69     WlanQtUtils* utils = mWizard->wlanQtUtils();
    69 
    70 
    70     bool ok;
    71     bool ok;
    71     ok = connect(
    72     ok = connect(
    72         utils, SIGNAL(wlanNetworkOpened(int)), 
    73         utils,
    73         this, SLOT(wlanNetworkOpened(int)));
    74         SIGNAL(wlanNetworkOpened(int)), 
       
    75         this,
       
    76         SLOT(wlanNetworkOpened(int)));
    74     Q_ASSERT(ok);
    77     Q_ASSERT(ok);
    75     
    78     
    76     ok = connect(
    79     ok = connect(
    77         utils, SIGNAL(wlanNetworkClosed(int,int)), 
    80         utils,
    78         this, SLOT(wlanNetworkClosed(int,int)));
    81         SIGNAL(wlanNetworkClosed(int,int)), 
       
    82         this,
       
    83         SLOT(wlanNetworkClosed(int,int)));
    79     Q_ASSERT(ok);
    84     Q_ASSERT(ok);
    80     
    85     
    81 #ifdef ICT_RESULT_ENUM
       
    82     ok = connect(
    86     ok = connect(
    83         utils, SIGNAL(ictResult(int,WlanLoginIctsResultType)), 
    87         utils,
    84         this, SLOT(ictResult(int,WlanLoginIctsResultType)));
    88         SIGNAL(ictResult(int,int)), 
    85 #else
    89         this,
    86     ok &= connect(
    90         SLOT(ictResult(int,int)));
    87         utils, SIGNAL(ictResult(int,bool)), 
    91     Q_ASSERT(ok);
    88         this, SLOT(ictResult(int,bool)));
    92 
    89 #endif
       
    90     Q_UNUSED(ok);
    93     Q_UNUSED(ok);
    91     Q_ASSERT(ok);
    94     Q_ASSERT(ok);
    92 }
    95 }
    93 
    96 
    94 /*!
    97 /*!
   125             mWizard->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
   128             mWizard->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
   126             this, SLOT(loadDocmlSection(Qt::Orientation)));
   129             this, SLOT(loadDocmlSection(Qt::Orientation)));
   127         Q_ASSERT(ok);
   130         Q_ASSERT(ok);
   128     }
   131     }
   129     
   132     
   130     mLabel->setPlainText(hbTrId("txt_occ_dialog_checking_connection_to_1").arg(
   133     mLabel->setPlainText(
   131         mWizard->configuration(WlanWizardPrivate::ConfSsid).toString()));
   134         HbParameterLengthLimiter(
       
   135             hbTrId("txt_occ_dialog_checking_connection_to_1")).arg(
       
   136                 mWizard->configuration(WlanWizardPrivate::ConfSsid).toString()));
   132 
   137 
   133     return mWidget;
   138     return mWidget;
   134 }
   139 }
   135 
   140 
   136 /*!
   141 /*!
   163    
   168    
   164    @param [in] orientation to be loaded.
   169    @param [in] orientation to be loaded.
   165  */
   170  */
   166 void WlanWizardPageProcessingSettings::loadDocmlSection(Qt::Orientation orientation)
   171 void WlanWizardPageProcessingSettings::loadDocmlSection(Qt::Orientation orientation)
   167 {
   172 {
   168     bool ok;
   173     WlanWizardPageInternal::loadDocmlSection(
   169     // Load the orientation specific section   
   174         mDocLoader,
   170     if (orientation == Qt::Horizontal) {
   175         orientation,
   171         mDocLoader->load(":/docml/occ_add_wlan_06.docml", "landscape_section", &ok);
   176         ":/docml/occ_add_wlan_06.docml", 
   172         Q_ASSERT(ok);
   177         "portrait_section",
   173     }
   178         "landscape_section");
   174     else {
       
   175         Q_ASSERT(orientation == Qt::Vertical);
       
   176         mDocLoader->load(":/docml/occ_add_wlan_06.docml", "portrait_section", &ok);
       
   177         Q_ASSERT(ok);
       
   178     }
       
   179 }
   179 }
   180 
   180 
   181 /*!
   181 /*!
   182    This method is connected to WlanQtUtils::wlanNetworkClosed(int, int) signal.
   182    This method is connected to WlanQtUtils::wlanNetworkClosed(int, int) signal.
   183    to get disconnected status events of currently established connection.
   183    to get disconnected status events of currently established connection.
   220             break;
   220             break;
   221             
   221             
   222         case KErrWlanSharedKeyAuthFailed:
   222         case KErrWlanSharedKeyAuthFailed:
   223             errorText = hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the");
   223             errorText = hbTrId("txt_occ_dialog_incorrect_wep_key_please_check_the");
   224             break;
   224             break;
   225         
   225 
   226         case KErrNone:
       
   227             // Do nothing, when connection is dropped we don't get any error code
       
   228         default:
   226         default:
       
   227             // Handles also KErrNone
   229             // Get plugin specific localized error text if any
   228             // Get plugin specific localized error text if any
   230             WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin();
   229             WlanWizardPlugin *plugin = mWizard->wlanWizardPlugin();
   231             
   230             
   232             if (plugin){
   231             if (plugin){
   233                 errorText = plugin->errorString(reason);
   232                 errorText = plugin->errorString(reason);
   238             break;
   237             break;
   239         }
   238         }
   240         mNextPageId = WlanWizardPageInternal::PageGenericError;
   239         mNextPageId = WlanWizardPageInternal::PageGenericError;
   241         mWizard->setConfiguration(
   240         mWizard->setConfiguration(
   242             WlanWizardHelper::ConfGenericErrorString, errorText);
   241             WlanWizardHelper::ConfGenericErrorString, errorText);
       
   242         
       
   243         mWizard->setConfiguration(
       
   244             WlanWizardHelper::ConfGenericErrorPageStepsBackwards, 
       
   245             WlanWizardPage::OneStepBackwards);
       
   246         
   243         mWizard->nextPage();
   247         mWizard->nextPage();
   244     }
   248     }
   245     
   249     
   246     OstTrace0( 
   250     OstTrace0( 
   247         TRACE_BORDER, WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_DONE,
   251         TRACE_BORDER, WLANWIZARDPAGEPROCESSINGSETTINGS_WLANNETWORKCLOSED_DONE,
   253    WlanWizardHelper::nextPage() to trigger movement to next page.
   257    WlanWizardHelper::nextPage() to trigger movement to next page.
   254    
   258    
   255    @param [in] iapId IAP ID
   259    @param [in] iapId IAP ID
   256    @param [in] reason ICT result, Symbian error code
   260    @param [in] reason ICT result, Symbian error code
   257  */
   261  */
   258 #ifdef ICT_RESULT_ENUM
   262 void WlanWizardPageProcessingSettings::ictResult(int iapId, int reason)
   259 void WlanWizardPageProcessingSettings::ictResult(int iapId, WlanLoginIctsResultType reason)
       
   260 {
   263 {
   261     OstTraceExt2( 
   264     OstTraceExt2( 
   262         TRACE_BORDER, 
   265         TRACE_BORDER, 
   263         WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT, 
   266         WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT, 
   264         "WlanWizardPageProcessingSettings::ictResult;iapId=%d;result=%d", 
   267         "WlanWizardPageProcessingSettings::ictResult;iapId=%d;result=%d", 
   265         iapId, reason );
   268         iapId, reason );
   266     
   269     
   267     if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) {
   270     if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) {
   268         Q_ASSERT(false);
       
   269         return;
   271         return;
   270     }
   272     }
   271     mWizard->setConfiguration(WlanWizardPrivate::ConfConnected, true);
   273     
   272     mWizard->setConfiguration(WlanWizardPrivate::ConfIctStatus, reason);
   274     // Cast of result .
   273     if(reason == IctsCanceled) {
   275     WlanQtUtils::IctStatus status = 
   274         QString errorText;
   276         static_cast<WlanQtUtils::IctStatus>(reason);
   275         // TODO: What error string should be loaded?
   277 
   276         mNextPageId = WlanWizardPageInternal::PageGenericError;
   278     if(status == WlanQtUtils::IctCancelled) {
   277         mWizard->setConfiguration(
   279         
   278             WlanWizardHelper::ConfGenericErrorString, errorText);
   280         mNextPageId = WlanWizardPageInternal::PageNone;
   279     }
   281         mWizard->cancelTriggered();
       
   282     }
       
   283     else {
       
   284         mWizard->setConfiguration(WlanWizardPrivate::ConfConnected, true);
       
   285     }
       
   286     mWizard->setConfiguration(WlanWizardPrivate::ConfIctStatus, status);
       
   287         
   280     mWizard->nextPage();
   288     mWizard->nextPage();
   281     
   289     
   282     OstTrace0( TRACE_BORDER, WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_DONE, 
   290     OstTrace0( TRACE_BORDER, WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_DONE, 
   283         "WlanWizardPageProcessingSettings::ictResult - Done" );
   291         "WlanWizardPageProcessingSettings::ictResult - Done" );
   284 }
   292 }
   285 #else
       
   286 void WlanWizardPageProcessingSettings::ictResult(int iapId, bool reason)
       
   287 {
       
   288     OstTraceExt2( 
       
   289         TRACE_BORDER, 
       
   290         WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_1, 
       
   291         "WlanWizardPageProcessingSettings::ictResult;iapId=%d;result=%d", 
       
   292         iapId, reason );
       
   293     
       
   294     if (iapId != mWizard->configuration(WlanWizardHelper::ConfIapId).toInt()) {
       
   295         Q_ASSERT(false);
       
   296         return;
       
   297     }
       
   298     mWizard->setConfiguration(WlanWizardPrivate::ConfConnected, true);
       
   299     mWizard->setConfiguration(WlanWizardPrivate::ConfIctStatus, reason);
       
   300     mWizard->nextPage();
       
   301     
       
   302     OstTrace0( TRACE_BORDER, WLANWIZARDPAGEPROCESSINGSETTINGS_ICTRESULT_DONE_1, 
       
   303         "WlanWizardPageProcessingSettings::ictResult - Done" );
       
   304 }
       
   305 #endif
       
   306 
   293 
   307 /*!
   294 /*!
   308    Handles wlanNetworkOpened(int) signal from WlanQtUtils.
   295    Handles wlanNetworkOpened(int) signal from WlanQtUtils.
   309    
   296    
   310    @param [in] iapId IAP ID
   297    @param [in] iapId IAP ID
   352     } else {
   339     } else {
   353         mNextPageId = WlanWizardPageInternal::PageGenericError;
   340         mNextPageId = WlanWizardPageInternal::PageGenericError;
   354         mWizard->setConfiguration(
   341         mWizard->setConfiguration(
   355             WlanWizardHelper::ConfGenericErrorString, 
   342             WlanWizardHelper::ConfGenericErrorString, 
   356             hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret"));
   343             hbTrId("txt_occ_dialog_unable_to_save_settings_please_ret"));
       
   344         
       
   345         mWizard->setConfiguration(
       
   346             WlanWizardHelper::ConfGenericErrorPageStepsBackwards, 
       
   347             WlanWizardPage::OneStepBackwards);
   357         mWizard->nextPage();
   348         mWizard->nextPage();
   358     }
   349     }
   359 }
   350 }