securitysettings/cpwlansecurityuiplugins/cpwepui/src/cpwepui.cpp
branchGCC_SURGE
changeset 40 60f08993dad0
parent 39 fe6b6762fccd
child 47 712b4ffd76bb
equal deleted inserted replaced
29:77618ad58aba 40:60f08993dad0
     1 /*
     1 /*
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3  * All rights reserved.
     4  * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5  * under the terms of the License "Eclipse Public License v1.0"
     5  * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8  *
     8  *
     9  * Initial Contributors:
     9  * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    15  *    Control Panel QT UI for WEP configuration
    15  *    Control Panel QT UI for WEP configuration
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 /*
    19 /*
    20  * %version: 16 %
    20  * %version: tr1cfwln#24 %
    21  */
    21  */
    22 
    22 
    23 //User Includes
    23 //User Includes
    24 #include "cpwepui.h"
    24 #include "cpwepui.h"
       
    25 #include "wepkeyvalidator.h"
       
    26 
    25 
    27 
    26 // System includes
    28 // System includes
    27 #include <QStringList>
    29 #include <QStringList>
    28 #include <cpsettingformentryitemdata.h>
       
    29 #include <cpitemdatahelper.h>
    30 #include <cpitemdatahelper.h>
    30 #include <HbDataForm> 
       
    31 #include <HbDeviceNotificationDialog> 
       
    32 #include <QLocale>
       
    33 #include <QCoreApplication>
       
    34 #include <cmconnectionmethod_shim.h>
    31 #include <cmconnectionmethod_shim.h>
    35 #include <cmpluginwlandef.h>
       
    36 #include <cmmanagerdefines_shim.h>
    32 #include <cmmanagerdefines_shim.h>
    37 
    33 #include <HbLineEdit>
       
    34 #include <HbTranslator>
       
    35 #include <HbEditorInterface>
       
    36 
       
    37 //Trace Definition
    38 #include "OstTraceDefinitions.h"
    38 #include "OstTraceDefinitions.h"
    39 #ifdef OST_TRACE_COMPILER_IN_USE
    39 #ifdef OST_TRACE_COMPILER_IN_USE
    40 #include "cpwepuiTraces.h"
    40 #include "cpwepuiTraces.h"
    41 #endif
    41 #endif
    42 
    42 
    43 // Constants
    43 // Constants
    44 //The order in which WEP only mode appears in the list of available 
    44 //The order in which WEP only mode appears in the list of available 
    45 //security mode
    45 //security mode
    46 static const int UI_ORDER_WEP = 10;
    46 static const int UI_ORDER_WEP = 10;
    47 
    47 
       
    48 //! Index of first WEP key
       
    49 static const int KFirstKey = 0;
       
    50 
       
    51 //! Index of second WEP key
       
    52 static const int KSecondKey = 1;
       
    53 
       
    54 //! Index of third WEP key
       
    55 static const int KThirdKey = 2;
       
    56 
       
    57 //! Index of fourth WEP key
       
    58 static const int KFourthKey = 3;
       
    59 
       
    60 //!Maximum allowed length for WEP keys, in hex mode
       
    61 static const int KMaxKeyLength  = 26;
       
    62 
       
    63 
       
    64 
    48 /*!
    65 /*!
    49  \class CpWepUi
    66  \class CpWepUi
    50  \brief CpWepUi implements the WEP Security Settings Control Panel Plugin
    67  \brief CpWepUi implements the WEP Security Settings Control Panel Plugin
    51  which will allow viewing/editing of WEP Security Settings.
    68  which will allow viewing/editing of WEP Security Settings.
    52  */
    69  */
    53 //Contructs WEP object
    70 //Contructs WEP object
    54 CpWepUi::CpWepUi() :
    71 CpWepUi::CpWepUi() :
    55     mUi(NULL), mNewKeySelected(0), mTranslator(NULL), mCmCM(NULL), mCmId(0)
    72     mUi(NULL),
    56 {
    73     mNewKeySelected(0), 
    57     mTranslator = new QTranslator(this);
    74     mTranslator(new HbTranslator("cpwlansecsettingsplugin")),
    58     mTranslator->load(":/loc/wlan_en_GB.qm");
    75     mCmCM(NULL), 
    59     qApp->installTranslator(mTranslator);
    76     mCmId(0)    
    60 
    77 {
    61     /* Install localization
    78     //Initialize array members
    62      mTranslator = QSharedPointer<HbTranslator> (
    79     for(int index=0;index<KMaxNumberofKeys;index++)
    63      new HbTranslator("wlan_en_GB"));*/
    80     {
       
    81         mWepKey[index] = NULL;
       
    82         mWepKeyText[index] = NULL;   
       
    83         mkeyFormat[index] = EFormatHex;
       
    84     }
       
    85       
    64 }
    86 }
    65 
    87 
    66 //Deletes all objects WEP owns
    88 //Deletes all objects WEP owns
    67 CpWepUi::~CpWepUi()
    89 CpWepUi::~CpWepUi()
    68 {
    90 {
    69     OstTraceFunctionEntry1(CPWEPUI_CPWEPUI_ENTRY,this);
    91     OstTraceFunctionEntry1(CPWEPUI_CPWEPUI_ENTRY,this);
    70     //Elements like mUi and components that belong to it
    92     //Elements like mUi and components that belong to it
    71     //, are taken care by the parent
    93     //, are taken care by the parent
       
    94     delete mTranslator;
    72     OstTraceFunctionExit1(CPWEPUI_CPWEPUI_EXIT,this);
    95     OstTraceFunctionExit1(CPWEPUI_CPWEPUI_EXIT,this);
    73 }
    96 }
    74 
    97 
    75 // ======== MEMBER FUNCTIONS ========
    98 // ======== MEMBER FUNCTIONS ========
    76 
    99 
    80 
   103 
    81  \return Security mode identifier
   104  \return Security mode identifier
    82  */
   105  */
    83 CMManagerShim::WlanSecMode CpWepUi::securityMode() const
   106 CMManagerShim::WlanSecMode CpWepUi::securityMode() const
    84 {
   107 {
    85     OstTraceFunctionEntry1(CPWEPUI_MODE_ENTRY,this);
   108     OstTraceFunctionEntry1(CPWEPUI_SECURITYMODE_ENTRY,this);
    86     OstTraceFunctionExit1(CPWEPUI_MODE_EXIT,this);
   109     OstTraceFunctionExit1(CPWEPUI_SECURITYMODE_EXIT,this);
    87     //return security mode
   110     //return security mode
    88     return CMManagerShim::WlanSecModeWep;
   111     return CMManagerShim::WlanSecModeWep;
    89 }
   112 }
    90 
   113 
    91 /*!
   114 /*!
    95  
   118  
    96  \return Localization text ID
   119  \return Localization text ID
    97  */
   120  */
    98 QString CpWepUi::securityModeTextId() const
   121 QString CpWepUi::securityModeTextId() const
    99 {
   122 {
   100     OstTraceFunctionEntry1(CPWEPUI_LOCALIZATION_ID_ENTRY,this);
   123     OstTraceFunctionEntry1( CPWEPUI_SECURITYMODETEXTID_ENTRY, this );
   101     OstTraceFunctionExit1(CPWEPUI_LOCALIZATION_ID_EXIT,this);
   124     OstTraceFunctionExit1( CPWEPUI_SECURITYMODETEXTID_EXIT, this );
   102     return "txt_occ_setlabel_wlan_security_mode_val_wep";
   125     return "txt_occ_setlabel_wlan_security_mode_val_wep";
   103 }
   126 }
   104 
   127 
   105 /*! 
   128 /*! 
   106  Sets the database reference (WLAN Service Table ID).
   129  Sets the database reference Iap id.
   107 
   130 
   108  \param id Database reference
   131  \param id Database reference
   109  */
   132  */
   110 void CpWepUi::setReference(CmConnectionMethodShim *cmCm, uint id)
   133 void CpWepUi::setReference(CmConnectionMethodShim *cmCm, uint id)
   111 {
   134 {
   112     OstTraceFunctionEntry1(CPWEPUI_SETREFERENCE_ENTRY,this);
   135     OstTraceFunctionEntry1(CPWEPUI_SETREFERENCE_ENTRY,this);
   113 
       
   114     // Assuming that id is the connection method Id/IAP Id.
       
   115     //mCmId - Not used currently
       
   116     mCmId = id;
   136     mCmId = id;
   117 
   137 
   118     //mCmCM is not deleted assuming CmManager owns it.
   138     //mCmCM is not deleted assuming CmManager owns it.
   119     mCmCM = cmCm;
   139     mCmCM = cmCm;
   120     OstTraceFunctionExit1(CPWEPUI_SETREFERENCE_EXIT,this);
   140     OstTraceFunctionExit1(CPWEPUI_SETREFERENCE_EXIT,this);
   134 }
   154 }
   135 
   155 
   136 /*!
   156 /*!
   137  * Returns the fully constructed Ui Group , for WEP security plugin
   157  * Returns the fully constructed Ui Group , for WEP security plugin
   138  * 
   158  * 
   139  * \param \param dataHelper to add Connections
   159  * \param dataHelper to add Connections
   140  * 
   160  * 
   141  * \return The WEP UI
   161  * \return The WEP UI
   142  */
   162  */
   143 CpSettingFormItemData* CpWepUi::uiInstance(CpItemDataHelper &dataHelpper)
   163 CpSettingFormItemData* CpWepUi::uiInstance(CpItemDataHelper &dataHelpper)
   144 {
   164 {
   148     //Read values From CommsDatbase
   168     //Read values From CommsDatbase
   149     QT_TRYCATCH_ERROR(err, loadFieldsFromDataBase());
   169     QT_TRYCATCH_ERROR(err, loadFieldsFromDataBase());
   150     if (err != KErrNone) {
   170     if (err != KErrNone) {
   151         OstTrace1( TRACE_ERROR, CPWEPUI_UIINSTANCE, "LoadFromDataBase returned %d", err );
   171         OstTrace1( TRACE_ERROR, CPWEPUI_UIINSTANCE, "LoadFromDataBase returned %d", err );
   152     }
   172     }
       
   173     
       
   174     //Store the address of the Data Helper
       
   175     mItemDataHelper = &dataHelpper;
   153 
   176 
   154     mUi = new CpSettingFormItemData(HbDataFormModelItem::GroupItem, hbTrId(
   177     mUi = new CpSettingFormItemData(HbDataFormModelItem::GroupItem, hbTrId(
   155             "txt_occ_subhead_security_settings"));
   178             "txt_occ_subhead_security_settings"));
   156 
   179 
   157     CpSettingFormItemData *wepKeyInUse = new CpSettingFormItemData(
   180     CpSettingFormItemData *wepKeyInUse = new CpSettingFormItemData(
   167     wepKeyInUse->setContentWidgetData("currentIndex", mNewKeySelected);
   190     wepKeyInUse->setContentWidgetData("currentIndex", mNewKeySelected);
   168     dataHelpper.addConnection(wepKeyInUse, SIGNAL(currentIndexChanged(int)),
   191     dataHelpper.addConnection(wepKeyInUse, SIGNAL(currentIndexChanged(int)),
   169             this, SLOT(wepKeyInUseChanged(int)));
   192             this, SLOT(wepKeyInUseChanged(int)));
   170     mUi->appendChild(wepKeyInUse);
   193     mUi->appendChild(wepKeyInUse);
   171 
   194 
   172     createWEPKeyOneGroup(dataHelpper);
   195     //Create Ui for all 4 WEP keys
   173 
   196     createWEPKeyGroup(KFirstKey);
   174     createWEPKeyTwoGroup(dataHelpper);
   197 
   175 
   198     createWEPKeyGroup(KSecondKey);
   176     createWEPKeyThreeGroup(dataHelpper);
   199 
   177 
   200     createWEPKeyGroup(KThirdKey);
   178     createWEPKeyFourGroup(dataHelpper);
   201 
       
   202     createWEPKeyGroup(KFourthKey);
       
   203     
       
   204     //Add Connections(signals)
       
   205     addConnections(dataHelpper);
   179 
   206 
   180     OstTraceFunctionExit1(CPWEPUI_UIINSTANCE_EXIT,this);
   207     OstTraceFunctionExit1(CPWEPUI_UIINSTANCE_EXIT,this);
   181     return mUi;
   208     return mUi;
   182 }
   209 }
   183 
   210 
   184 /*!
   211 
   185  * Create Ui element with text edit for WEP KEY One
   212 /*!
   186  * 
   213    Validates current security settings. This function is called whenever
   187  * \param dataHelper to add Connections
   214    user tries to exit from the settings view. If the plugin determines
   188  */
   215    that some settings need editing before considered valid, it shall
   189 void CpWepUi::createWEPKeyOneGroup(CpItemDataHelper &dataHelpper)
   216    return false. A dialog will be shown to the user indicating that
       
   217    settings are still incomplete and asking if he/she wishes to exit
       
   218    anyway.
       
   219 
       
   220    \return True if security settings for WEP are valid, false if not.
       
   221 */
       
   222 bool CpWepUi::validateSettings()
       
   223 {
       
   224     bool ret(false);
       
   225     //Check the latest string entered for the WEP key in the text box
       
   226     QVariant keyValue = mWepKeyText[mNewKeySelected]->contentWidgetData("text");
       
   227     QString keyString = keyValue.toString();
       
   228     
       
   229     WepKeyValidator::KeyStatus keystatus = WepKeyValidator::validateWepKey(keyString);
       
   230     
       
   231     //Check if key is  valid and not of zero length 
       
   232     if(keystatus==WepKeyValidator::KeyStatusOk) {
       
   233         ret = true;
       
   234     }
       
   235     return ret;
       
   236 }
       
   237 
       
   238 /*!
       
   239  * Create Ui element with text edit for WEP KEYS
       
   240  * 
       
   241  * \param index of the WEP key
       
   242  * */
       
   243 void CpWepUi::createWEPKeyGroup(int index)
   190     {
   244     {
   191     OstTraceFunctionEntry1(CPWEPUI_CREATEWEPKEYONEGROUP_ENTRY,this);
   245     OstTraceFunctionEntry1(CPWEPUI_CREATEWEPKEYGROUP_ENTRY,this);
   192     mWepKeyText[KFirstKey] = new CpSettingFormItemData(
   246     QString textId;
       
   247     
       
   248     switch(index)
       
   249         {
       
   250         case KFirstKey:
       
   251             textId  = hbTrId("txt_occ_setlabel_wep_key_1");
       
   252             break;
       
   253             
       
   254         case KSecondKey:
       
   255             textId  = hbTrId("txt_occ_setlabel_wep_key_2");
       
   256             break;
       
   257             
       
   258         case KThirdKey:
       
   259             textId  = hbTrId("txt_occ_setlabel_wep_key_3");
       
   260             break;
       
   261             
       
   262         case KFourthKey:
       
   263             textId  = hbTrId("txt_occ_setlabel_wep_key_4");
       
   264             break;
       
   265         }
       
   266         
       
   267     mWepKeyText[index] = new CpSettingFormItemData(
   193             HbDataFormModelItem::TextItem,
   268             HbDataFormModelItem::TextItem,
   194             hbTrId("txt_occ_subhead_wep_key_1"), mUi);
   269             textId, mUi);
   195 
   270 
   196     if (mKeyData[KFirstKey].length() != 0) {
   271     if (mKeyData[index].length() != 0) {
   197         mWepKeyText[KFirstKey]->setContentWidgetData("text",
   272         mWepKeyText[index]->setContentWidgetData("text",
   198                 mKeyData[KFirstKey]);
   273                 mKeyData[index]);
   199     }
   274     }
   200     mWepKeyText[KFirstKey]->setContentWidgetData("echoMode", 2);
   275     mWepKeyText[index]->setContentWidgetData("echoMode",HbLineEdit::PasswordEchoOnEdit);
   201     mWepKeyText[KFirstKey]->setContentWidgetData("smileysEnabled", "false");
   276     mWepKeyText[index]->setContentWidgetData("smileysEnabled", "false");
   202 
   277 
       
   278     
       
   279     mUi->appendChild(mWepKeyText[index]);
       
   280     OstTraceFunctionExit1(CPWEPUI_CREATEWEPKEYGROUP_EXIT,this);
       
   281     }
       
   282 
       
   283 
       
   284 /*!
       
   285  * Add signals to all the text Edit of WEP key groups.
       
   286  *  
       
   287  *  \param dataHelper ; to add Connections
       
   288  */
       
   289 void CpWepUi::addConnections(CpItemDataHelper &dataHelpper)
       
   290     {
       
   291     OstTraceFunctionEntry1( CPWEPUI_ADDCONNECTIONS_ENTRY, this );
       
   292     
   203     dataHelpper.addConnection(mWepKeyText[KFirstKey],
   293     dataHelpper.addConnection(mWepKeyText[KFirstKey],
   204             SIGNAL( editingFinished ()), this, SLOT(wepKeyOneChanged() ));
   294                 SIGNAL( editingFinished ()), this, SLOT(wepKeyOneChanged() ));
   205 
   295     
   206     mUi->appendChild(mWepKeyText[KFirstKey]);
       
   207     OstTraceFunctionExit1(CPWEPUI_CREATEWEPKEYONEGROUP_EXIT,this);
       
   208     }
       
   209 
       
   210 /*!
       
   211  * Create Ui element with text edit for WEP KEY Two
       
   212  * \param dataHelper to add Connections
       
   213  */
       
   214 void CpWepUi::createWEPKeyTwoGroup(CpItemDataHelper &dataHelpper)
       
   215 {
       
   216     OstTraceFunctionEntry1(CPWEPUI_CREATEWEPKEYTWOGROUP_ENTRY,this);
       
   217     mWepKeyText[KSecondKey] = new CpSettingFormItemData(
       
   218             HbDataFormModelItem::TextItem,
       
   219             hbTrId("txt_occ_subhead_wep_key_2"), mUi);
       
   220 
       
   221     if (mKeyData[KSecondKey].length() != 0) {
       
   222         mWepKeyText[KSecondKey]->setContentWidgetData("text",
       
   223                 mKeyData[KSecondKey]);
       
   224     }
       
   225     mWepKeyText[KSecondKey]->setContentWidgetData("echoMode", 2);
       
   226     mWepKeyText[KSecondKey]->setContentWidgetData("smileysEnabled", "false");
       
   227     dataHelpper.addConnection(mWepKeyText[KSecondKey],
   296     dataHelpper.addConnection(mWepKeyText[KSecondKey],
   228             SIGNAL( editingFinished ()), this, SLOT(wepKeyTwoChanged() ));
   297                SIGNAL( editingFinished ()), this, SLOT(wepKeyTwoChanged() ));
   229 
   298     
   230     mUi->appendChild(mWepKeyText[KSecondKey]);
       
   231     OstTraceFunctionExit1(CPWEPUI_CREATEWEPKEYTWOGROUP_EXIT,this);
       
   232 }
       
   233 
       
   234 /*!
       
   235  * Create Ui element with text edit for WEP KEY Three
       
   236  * \param dataHelper to add Connections
       
   237  */
       
   238 void CpWepUi::createWEPKeyThreeGroup(CpItemDataHelper &dataHelpper)
       
   239 {
       
   240     OstTraceFunctionEntry1(CPWEPUI_CREATEWEPKEYTHREEGROUP_ENTRY,this);
       
   241     mWepKeyText[KThirdKey] = new CpSettingFormItemData(
       
   242             HbDataFormModelItem::TextItem,
       
   243             hbTrId("txt_occ_subhead_wep_key_3"), mUi);
       
   244 
       
   245     if (mKeyData[KThirdKey].length() != 0) {
       
   246         mWepKeyText[KThirdKey]->setContentWidgetData("text",
       
   247                 mKeyData[KThirdKey]);
       
   248     }
       
   249     mWepKeyText[KThirdKey]->setContentWidgetData("echoMode", 2);
       
   250     mWepKeyText[KThirdKey]->setContentWidgetData("smileysEnabled", "false");
       
   251     dataHelpper.addConnection(mWepKeyText[KThirdKey],
   299     dataHelpper.addConnection(mWepKeyText[KThirdKey],
   252             SIGNAL( editingFinished ()), this, SLOT(wepKeyThreeChanged() ));
   300                SIGNAL( editingFinished ()), this, SLOT(wepKeyThreeChanged() ));
   253 
   301     
   254     mUi->appendChild(mWepKeyText[KThirdKey]);
       
   255     OstTraceFunctionExit1(CPWEPUI_CREATEWEPKEYTHREEGROUP_EXIT,this);
       
   256 }
       
   257 
       
   258 /*!
       
   259  * Create Ui element with text edit for WEP KEY  Four
       
   260  * \param dataHelper to add Connections
       
   261  */
       
   262 void CpWepUi::createWEPKeyFourGroup(CpItemDataHelper &dataHelpper)
       
   263 {
       
   264     OstTraceFunctionEntry1(CPWEPUI_CREATEWEPKEYFOURGROUP_ENTRY,this);
       
   265     mWepKeyText[KFourthKey] = new CpSettingFormItemData(
       
   266             HbDataFormModelItem::TextItem,
       
   267             hbTrId("txt_occ_subhead_wep_key_4"), mUi);
       
   268 
       
   269     if (mKeyData[KFourthKey].length() != 0) {
       
   270         mWepKeyText[KFourthKey]->setContentWidgetData("text",
       
   271                 mKeyData[KFourthKey]);
       
   272     }
       
   273     mWepKeyText[KFourthKey]->setContentWidgetData("echoMode", 2);
       
   274     mWepKeyText[KFourthKey]->setContentWidgetData("smileysEnabled", "false");
       
   275     dataHelpper.addConnection(mWepKeyText[KFourthKey],
   302     dataHelpper.addConnection(mWepKeyText[KFourthKey],
   276             SIGNAL( editingFinished ()), this, SLOT(wepKeyFourChanged() ));
   303                 SIGNAL( editingFinished ()), this, SLOT(wepKeyFourChanged() ));
   277 
   304     
   278     mUi->appendChild(mWepKeyText[KFourthKey]);
   305     dataHelpper.connectToForm(SIGNAL(itemShown (const QModelIndex &) ), 
   279     OstTraceFunctionExit1(CPWEPUI_CREATEWEPKEYFOURGROUP_EXIT,this);
   306             this, SLOT(setEditorPreferences(const QModelIndex &)));
   280 }
   307  
       
   308     OstTraceFunctionExit1( CPWEPUI_ADDCONNECTIONS_EXIT, this );
       
   309     }
       
   310 
   281 
   311 
   282 /*!
   312 /*!
   283  * Slot to handle , if a different wep key (index) 
   313  * Slot to handle , if a different wep key (index) 
   284  * is made active
   314  * is made active
   285  * \param wepKeyInUse index of the chosen wep key
   315  * \param wepKeyInUse index of the chosen wep key
   293     QT_TRYCATCH_ERROR(err, mCmCM->setIntAttribute(CMManagerShim::WlanWepKeyIndex, wepKeyInUse));
   323     QT_TRYCATCH_ERROR(err, mCmCM->setIntAttribute(CMManagerShim::WlanWepKeyIndex, wepKeyInUse));
   294     if (err != KErrNone) {
   324     if (err != KErrNone) {
   295         OstTrace1( TRACE_ERROR, CPWEPUI_WEPKEYINUSECHANGED, "Error wepKeyInUse returned %d", err );
   325         OstTrace1( TRACE_ERROR, CPWEPUI_WEPKEYINUSECHANGED, "Error wepKeyInUse returned %d", err );
   296     }
   326     }
   297     tryUpdate();
   327     tryUpdate();
       
   328     
       
   329     //Store the wep key in use
       
   330     mNewKeySelected = wepKeyInUse;
   298     OstTraceFunctionExit1(CPWEPUI_WEPKEYINUSECHANGED_EXIT,this);
   331     OstTraceFunctionExit1(CPWEPUI_WEPKEYINUSECHANGED_EXIT,this);
   299 }
   332 }
   300 
   333 
   301 /*!
   334 /*!
   302  * Slot to handle ,when the  
   335  * Slot to handle ,when the  
   373 void CpWepUi::wepKeyTextChanged(int index)
   406 void CpWepUi::wepKeyTextChanged(int index)
   374 {
   407 {
   375     OstTraceFunctionEntry1(CPWEPUI_WEPKEYTEXTCHANGED_ENTRY,this);
   408     OstTraceFunctionEntry1(CPWEPUI_WEPKEYTEXTCHANGED_ENTRY,this);
   376 
   409 
   377     QVariant value = mWepKeyText[index]->contentWidgetData("text");
   410     QVariant value = mWepKeyText[index]->contentWidgetData("text");
   378 
   411     QString key = value.toString();
   379     WepKeyValidator::KeyStatus keystatus = WepKeyValidator::validateWepKey(
   412 
   380             value.toString());
   413     WepKeyValidator::KeyStatus keystatus = WepKeyValidator::validateWepKey(key);
   381 
   414 
   382     if (keystatus == WepKeyValidator::KeyStatusOk) {
   415     // allow storing an empty key to enable clearing WEP keys
   383         QString key = value.toString();
   416     if (keystatus == WepKeyValidator::KeyStatusOk || key.length() == 0) {
   384 
   417 
   385         //If key is valid set the format of the key
   418         //If key is valid set the format of the key
   386         setKeyFormat(key, index);
   419         setKeyFormat(key, index);
   387 
   420 
   388         //Get the right field to store
   421         //Get the right field to store
   398          * Commit All 4 WEP keys , anyways
   431          * Commit All 4 WEP keys , anyways
   399          */
   432          */
   400         commitWEPkeys(index);
   433         commitWEPkeys(index);
   401     }
   434     }
   402     else {
   435     else {
       
   436         OstTrace0( TRACE_ERROR, CPWEPUI_WEPKEYTEXTCHANGED_ERROR, "CpWepUi::wepKeyTextChanged Invalid WEP Key Input" );        
   403         showMessageBox(HbMessageBox::MessageTypeWarning, hbTrId(
   437         showMessageBox(HbMessageBox::MessageTypeWarning, hbTrId(
   404                 "txt_occ_info_invalid_input"));
   438                 "txt_occ_info_invalid_input"));
   405     }
   439     }
   406     OstTraceFunctionExit1(CPWEPUI_WEPKEYTEXTCHANGED_EXIT,this);
   440     OstTraceFunctionExit1(CPWEPUI_WEPKEYTEXTCHANGED_EXIT,this);
   407 }
   441 }
       
   442 
       
   443 /*!
       
   444  * Slot that configures the editor settings for all WEP key fields.
       
   445  * This slot is invoked whenever a new item(s) are shown in the current view 
       
   446  * 
       
   447  * \param modelIndex Index of the current item in the  model
       
   448  */
       
   449 void CpWepUi::setEditorPreferences(const QModelIndex &modelIndex)
       
   450 {
       
   451     
       
   452     HbDataFormModelItem *item = mItemDataHelper->modelItemFromModelIndex(modelIndex);
       
   453 
       
   454     HbSmileyTheme smiley;
       
   455     /* Configure settings only for text fields*/
       
   456     if(item->type() == HbDataFormModelItem::TextItem) {
       
   457         HbLineEdit *edit = qobject_cast<HbLineEdit*>(mItemDataHelper->widgetFromModelIndex(modelIndex));           
       
   458         HbEditorInterface editInterface(edit);    
       
   459         editInterface.setInputConstraints(HbEditorConstraintLatinAlphabetOnly);
       
   460         edit->setInputMethodHints(Qt::ImhNoPredictiveText);    
       
   461         edit->setMaxLength(KMaxKeyLength);
       
   462         }
       
   463 }
       
   464 
   408 
   465 
   409 /*!
   466 /*!
   410  * Store the WEP key in Comms
   467  * Store the WEP key in Comms
   411  * \enumValue the right field represented by the enum value
   468  * \enumValue the right field represented by the enum value
   412  * \key the WEP key String to store
   469  * \key the WEP key String to store
   506 
   563 
   507     //All data fetched in Hex Format
   564     //All data fetched in Hex Format
   508     mKeyData.insert(KFirstKey, mCmCM->getString8Attribute(
   565     mKeyData.insert(KFirstKey, mCmCM->getString8Attribute(
   509             CMManagerShim::WlanWepKey1InHex));
   566             CMManagerShim::WlanWepKey1InHex));
   510 
   567 
   511     mKeyData.insert(KSecondKey, mCmCM->getString8Attribute(
   568     mKeyData.insert(KSecondKey,mCmCM->getString8Attribute(
   512             CMManagerShim::WlanWepKey2InHex));
   569             CMManagerShim::WlanWepKey2InHex));
   513 
   570 
   514     mKeyData.insert(KThirdKey, mCmCM->getString8Attribute(
   571     mKeyData.insert(KThirdKey, mCmCM->getString8Attribute(
   515             CMManagerShim::WlanWepKey3InHex));
   572             CMManagerShim::WlanWepKey3InHex));
   516 
   573