wlanutilities/wlanwizard/src/wlanwizardpagekeyquery.cpp
changeset 39 7b3e49e4608a
parent 31 e8f4211554fb
child 43 72ebcbb64834
child 50 d4198dcb9983
equal deleted inserted replaced
36:682dd021f9be 39:7b3e49e4608a
    21 #include <HbMainWindow>
    21 #include <HbMainWindow>
    22 #include <HbWidget>
    22 #include <HbWidget>
    23 #include <HbLabel>
    23 #include <HbLabel>
    24 #include <HbLineEdit>
    24 #include <HbLineEdit>
    25 #include <HbEditorInterface>
    25 #include <HbEditorInterface>
       
    26 #include <HbParameterLengthLimiter>
    26 
    27 
    27 // User includes
    28 // User includes
    28 #include "wlanwizard.h"
    29 #include "wlanwizard.h"
    29 #include "wlanwizard_p.h"
    30 #include "wlanwizard_p.h"
    30 #include "wlanwizardpagekeyquery.h"
    31 #include "wlanwizardpagekeyquery.h"
   123     } else {
   124     } else {
   124         mLineEdit->setMaxLength(WlanWizardUtils::WpaMaxLength);
   125         mLineEdit->setMaxLength(WlanWizardUtils::WpaMaxLength);
   125     }
   126     }
   126     
   127     
   127     mLabelTitle->setPlainText(
   128     mLabelTitle->setPlainText(
   128         hbTrId("txt_occ_dialog_enter_key_for_1").arg(mWizard->configuration(
   129         HbParameterLengthLimiter(
   129             WlanWizardPrivate::ConfSsid).toString()));
   130             hbTrId("txt_occ_dialog_enter_key_for_1")).arg(
       
   131                 mWizard->configuration(WlanWizardPrivate::ConfSsid).toString()));
   130     
   132     
   131     return mWidget;
   133     return mWidget;
   132 }
   134 }
   133 
   135 
   134 /*!
   136 /*!
   137    
   139    
   138    @param [in] orientation to be loaded.
   140    @param [in] orientation to be loaded.
   139  */
   141  */
   140 void WlanWizardPageKeyQuery::loadDocmlSection(Qt::Orientation orientation)
   142 void WlanWizardPageKeyQuery::loadDocmlSection(Qt::Orientation orientation)
   141 {
   143 {
   142     bool ok = false;
   144     WlanWizardPageInternal::loadDocmlSection(
   143     
   145         mDocLoader,
   144     // Load the orientation specific section
   146         orientation,
   145     if (orientation == Qt::Horizontal) {
   147         ":/docml/occ_add_wlan_01_04.docml", 
   146         mDocLoader->load(
   148         "portrait_section",
   147             ":/docml/occ_add_wlan_01_04.docml", "landscape_section", &ok);
   149         "landscape_section");
   148         Q_ASSERT(ok);
       
   149     } else {
       
   150         Q_ASSERT(orientation == Qt::Vertical);
       
   151         mDocLoader->load(
       
   152             ":/docml/occ_add_wlan_01_04.docml", "portrait_section", &ok);
       
   153         Q_ASSERT(ok);
       
   154     }
       
   155 }
   150 }
   156 
   151 
   157 /*!
   152 /*!
   158    See WlanWizardPage::nextId()
   153    See WlanWizardPage::nextId()
   159    
   154    
   167    
   162    
   168  */
   163  */
   169 int WlanWizardPageKeyQuery::nextId(bool &removeFromStack) const
   164 int WlanWizardPageKeyQuery::nextId(bool &removeFromStack) const
   170 {
   165 {
   171     WlanWizardUtils::KeyStatus status(WlanWizardUtils::KeyStatusOk);
   166     WlanWizardUtils::KeyStatus status(WlanWizardUtils::KeyStatusOk);
   172     int pageId = WlanWizardPage::PageNone;
   167     int pageId = WlanWizardPage::nextId(removeFromStack);
   173     int secMode = mWizard->configuration(
   168     int secMode = mWizard->configuration(
   174         WlanWizardPrivate::ConfSecurityMode).toInt();
   169         WlanWizardPrivate::ConfSecurityMode).toInt();
   175     
   170     
   176     if (secMode == CMManagerShim::WlanSecModeWep) {
   171     if (secMode == CMManagerShim::WlanSecModeWep) {
   177         status = WlanWizardUtils::validateWepKey(mLineEdit->text());   
   172         status = WlanWizardUtils::validateWepKey(mLineEdit->text());   
   250     case WlanWizardUtils::KeyStatusIllegalCharacters:
   245     case WlanWizardUtils::KeyStatusIllegalCharacters:
   251         errorString = hbTrId("txt_occ_dialog_illegal_characters_in_key_please_c");
   246         errorString = hbTrId("txt_occ_dialog_illegal_characters_in_key_please_c");
   252         break;
   247         break;
   253 
   248 
   254     case WlanWizardUtils::KeyStatusWpaTooShort:
   249     case WlanWizardUtils::KeyStatusWpaTooShort:
   255     case WlanWizardUtils::KeyStatusWpaTooLong:
       
   256         errorString = hbTrId("txt_occ_dialog_preshared_key_too_short_at_least");
   250         errorString = hbTrId("txt_occ_dialog_preshared_key_too_short_at_least");
   257         break;
   251         break;
   258 
   252 
   259     case WlanWizardUtils::KeyStatusWepInvalidLength:
   253     case WlanWizardUtils::KeyStatusWepInvalidLength:
   260         errorString = hbTrId("txt_occ_dialog_key_is_of_incorrect_length_please");
   254         errorString = hbTrId("txt_occ_dialog_key_is_of_incorrect_length_please");
   261         break;
   255         break;
   262 
   256 
   263     case WlanWizardUtils::KeyStatusOk:
       
   264     default:
   257     default:
   265         Q_ASSERT(WlanWizardUtils::KeyStatusOk == status);
   258         Q_ASSERT(WlanWizardUtils::KeyStatusOk == status);
   266         // nothing to do here.
   259         // nothing to do here.
   267         break;
   260         break;
   268     }
   261     }