wlanutilities/wlanwizard/src/wlanwizardpagesecuritymode.cpp
changeset 61 e1d68407ed06
parent 53 bdc64aa9b954
equal deleted inserted replaced
60:822a45792fdd 61:e1d68407ed06
    45     WlanWizardPrivate* parent) :
    45     WlanWizardPrivate* parent) :
    46     WlanWizardPageInternal(parent), 
    46     WlanWizardPageInternal(parent), 
    47     mWidget(NULL),
    47     mWidget(NULL),
    48     mList(NULL),
    48     mList(NULL),
    49     mLabel(NULL),
    49     mLabel(NULL),
    50     mLoader(NULL),
    50     mLoader(NULL)
    51     mValid(false)
       
    52 {
    51 {
    53     OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY);
    52     OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_ENTRY);
    54     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT);
    53     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_WLANWIZARDPAGESECURITYMODE_EXIT);
    55 }
    54 }
    56 
    55 
   117                  this, SLOT(itemSelected())); 
   116                  this, SLOT(itemSelected())); 
   118         Q_ASSERT(ok);
   117         Q_ASSERT(ok);
   119     }
   118     }
   120     
   119     
   121     // Create contents to the security mode radio button list.
   120     // Create contents to the security mode radio button list.
   122     populateSecModeList();
   121     QStringList items;    
   123 
   122     populateSecModeList(items);
       
   123 
       
   124     // Do not override the list, if it didn't change, because setItems()
       
   125     // clears the possible selected item.
       
   126     if (items != mList->items()) {
       
   127         mList->setItems(items);
       
   128     }
       
   129     
   124     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_EXIT);
   130     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_INITIALIZEPAGE_EXIT);
   125     return mWidget;
   131     return mWidget;
   126 }
   132 }
   127 
   133 
   128 /*!
   134 /*!
   129  * Validates the Sequrity more selection and sets the configuration in
   135  * Validates the Security more selection and sets the configuration in
   130  * the wlanwizard.
   136  * the wlanwizard.
   131  * @param [out] removeFromStack returns false.
   137  * @param [out] removeFromStack returns false.
   132  * @return depending on the sequrity mode, returns the appropriate view
   138  * @return depending on the security mode, returns the appropriate view
   133  * identifier.
   139  * identifier.
   134  */
   140  */
   135 int WlanWizardPageSecurityMode::nextId(bool &removeFromStack) const
   141 int WlanWizardPageSecurityMode::nextId(bool &removeFromStack) const
   136 {
   142 {
   137     OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_NEXTID_ENTRY);
   143     OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_NEXTID_ENTRY);
   149     mWizard->setConfiguration(
   155     mWizard->setConfiguration(
   150         WlanWizardPrivate::ConfUsePsk,
   156         WlanWizardPrivate::ConfUsePsk,
   151         mUsePsk.at(mList->selected()));
   157         mUsePsk.at(mList->selected()));
   152     
   158     
   153     OstTraceFunctionExit0(LANWIZARDPAGESECURITYMODE_NEXTID_EXIT);
   159     OstTraceFunctionExit0(LANWIZARDPAGESECURITYMODE_NEXTID_EXIT);
   154     return mPageIds.at( mList->selected() );
   160     return mPageIds.at(mList->selected());
   155 }
   161 }
   156 
   162 
   157 /*!
   163 /*!
   158  * This method is overrides the default implementation from WlanWizardPage.
   164  * This method is overrides the default implementation from WlanWizardPage.
   159  * It indicates whether the Next-button should be enabled or not.
   165  * @return Should the Next-button be enabled or not.
   160  * @return true, if a mode has been selected.
       
   161  */
   166  */
   162 bool WlanWizardPageSecurityMode::showPage()
   167 bool WlanWizardPageSecurityMode::showPage()
   163 {
   168 {
   164     OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_ENTRY);
   169     OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_ENTRY);
   165     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_EXIT);
   170     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_SHOWPAGE_EXIT);
   166     return mValid;
   171     // Next-button is enabled whenever the radio button list has some value
       
   172     // selected.
       
   173     return mList->selected() != -1;
   167 }
   174 }
   168 
   175 
   169 /*!
   176 /*!
   170  * Is invoked when user selects a mode from the radio button list.
   177  * Is invoked when user selects a mode from the radio button list.
   171  * (HbRadioButtonList's itemSelected-signal)
   178  * (HbRadioButtonList's itemSelected-signal)
   176     
   183     
   177     OstTrace0(
   184     OstTrace0(
   178         TRACE_BORDER,
   185         TRACE_BORDER,
   179         WLANWIZARDPAGESECURITYMODE_ITEMSELECTED,
   186         WLANWIZARDPAGESECURITYMODE_ITEMSELECTED,
   180         "WlanWizardPageSecurityMode::itemSelected");
   187         "WlanWizardPageSecurityMode::itemSelected");
   181     
   188 
   182     mValid = true;
   189     mWizard->enableNextButton(true);
   183     mWizard->enableNextButton(mValid);
       
   184     
   190     
   185     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_EXIT);
   191     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_ITEMSELECTED_EXIT);
   186 }
   192 }
   187 
   193 
   188 /*!
   194 /*!
   211     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_EXIT);
   217     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_LOADDOCMLSECTION_EXIT);
   212 }
   218 }
   213 
   219 
   214 /*!
   220 /*!
   215  * Support function that creates the contents of the security mode list. 
   221  * Support function that creates the contents of the security mode list. 
   216  */
   222  * @param [out] list is the list of captions used for the radio buttons.
   217 void WlanWizardPageSecurityMode::populateSecModeList()
   223  */
       
   224 void WlanWizardPageSecurityMode::populateSecModeList(QStringList &list)
   218 {
   225 {
   219     OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_ENTRY);
   226     OstTraceFunctionEntry0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_ENTRY);
   220     
       
   221     QStringList items;
       
   222     
   227     
   223     mSecModes.clear();
   228     mSecModes.clear();
   224     mPageIds.clear();
   229     mPageIds.clear();
   225     mUsePsk.clear();
   230     mUsePsk.clear();
   226     
   231     
   227     // A list is created. Since there is no practical way of knowing whether
       
   228     // the new contents are different from the previous contents (if there
       
   229     // even were any in the first place) the validity is always reset.
       
   230     mValid = false;
       
   231 
       
   232     // Create the radio button list to correspond to correct security mode
   232     // Create the radio button list to correspond to correct security mode
   233     // identifiers and page identifiers.
   233     // identifiers and page identifiers.
   234     // Populate the list according to network mode selection.
   234     // Populate the list according to network mode selection.
   235     addToList(
   235     addToList(
   236         items,
   236         list,
   237         hbTrId("txt_occ_list_open"), 
   237         hbTrId("txt_occ_list_open"), 
   238         CMManagerShim::WlanSecModeOpen,
   238         CMManagerShim::WlanSecModeOpen,
   239         WlanWizardPage::PageProcessSettings,
   239         WlanWizardPage::PageProcessSettings,
   240         false);
   240         false);
   241 
   241 
   242     addToList(
   242     addToList(
   243         items,
   243         list,
   244         hbTrId("txt_occ_list_wep_1"),
   244         hbTrId("txt_occ_list_wep_1"),
   245         CMManagerShim::WlanSecModeWep,
   245         CMManagerShim::WlanSecModeWep,
   246         WlanWizardPageInternal::PageKeyQuery,
   246         WlanWizardPageInternal::PageKeyQuery,
   247         true);
   247         true);
   248 
   248 
   249     // In case of Ad-hoc network, exclude wpa, eap and 802.1X modes.
   249     // In case of Ad-hoc network, exclude wpa, eap and 802.1X modes.
   250     if (mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt()
   250     if (mWizard->configuration(WlanWizardPrivate::ConfNetworkMode).toInt()
   251         != CMManagerShim::Adhoc) {
   251         != CMManagerShim::Adhoc) {
   252 
   252 
   253         addToList(
   253         addToList(
   254             items,
   254             list,
   255             hbTrId("txt_occ_list_wpa_with_password"),
   255             hbTrId("txt_occ_list_wpa_with_password"),
   256             CMManagerShim::WlanSecModeWpa,
   256             CMManagerShim::WlanSecModeWpa,
   257             WlanWizardPageInternal::PageKeyQuery,
   257             WlanWizardPageInternal::PageKeyQuery,
   258             true);
   258             true);
   259 
   259 
   260         addToList(
   260         addToList(
   261             items,
   261             list,
   262             hbTrId("txt_occ_list_wpa_with_eap"),
   262             hbTrId("txt_occ_list_wpa_with_eap"),
   263             CMManagerShim::WlanSecModeWpa,
   263             CMManagerShim::WlanSecModeWpa,
   264             WlanWizardPage::PageEapStart,
   264             WlanWizardPage::PageEapStart,
   265             false);
   265             false);
   266 
   266 
   267         addToList(
   267         addToList(
   268             items,
   268             list,
   269             hbTrId("txt_occ_list_8021x_1"),
   269             hbTrId("txt_occ_list_8021x_1"),
   270             CMManagerShim::WlanSecMode802_1x,
   270             CMManagerShim::WlanSecMode802_1x,
   271             WlanWizardPage::PageEapStart,
   271             WlanWizardPage::PageEapStart,
   272             false);
   272             false);
   273     }
   273     }
   274 
   274 
   275     mList->setItems(items);
       
   276     
       
   277     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_EXIT);
   275     OstTraceFunctionExit0(WLANWIZARDPAGESECURITYMODE_POPULATESECMODELIST_EXIT);
   278 }
   276 }
   279 
   277 
   280 /*!
   278 /*!
   281  * A support function to map the radio button list to a generic network
   279  * A support function to map the radio button list to a generic network