securitysettings/cpwlansecurityuiplugins/cpwepui/inc/cpwepui.h
changeset 22 093cf0757204
child 26 9abfd4f00d37
equal deleted inserted replaced
20:8b3129ac4c0f 22:093cf0757204
       
     1 /*
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *    Control Panel QT UI for WEP configuration
       
    16  *
       
    17  */
       
    18 
       
    19 /*
       
    20  * %version: 13 %
       
    21  */
       
    22 
       
    23 #ifndef CPWEPUI_H
       
    24 #define CPWEPUI_H
       
    25 
       
    26 // System includes
       
    27 #include <cpsettingformitemdata.h>
       
    28 #include <QStringList>
       
    29 #include <HbMessageBox>
       
    30 //#include <HbTranslator>
       
    31 //#include <QSharedPointer>
       
    32 #include <QTranslator>
       
    33 
       
    34 //User Includes
       
    35 #include "cpwlansecurityplugininterface.h"
       
    36 #include "wlansecuritycontrolpanelwepdefs.h"
       
    37 #include "wepkeyvalidator.h"
       
    38 
       
    39 // Forward declarations
       
    40 class QTranslator;
       
    41 class CmConnectionMethodShim;
       
    42 class CpWepKeyValidation;
       
    43 /*!
       
    44  * @addtogroup group_wlan_security_ui_plugin_wep
       
    45  * @{
       
    46  */
       
    47 
       
    48 /*! 
       
    49  * Implements WEP plugin for Wlan security control panel  
       
    50  */
       
    51 
       
    52 // Class declaration
       
    53 class CpWepUi : public QObject, public CpWlanSecurityPluginInterface
       
    54 {
       
    55     Q_OBJECT
       
    56     Q_INTERFACES(CpWlanSecurityPluginInterface)
       
    57 
       
    58 public:
       
    59     CpWepUi();
       
    60     ~CpWepUi();
       
    61 
       
    62 public:
       
    63     // from CpWlanSecurityPluginInterface 
       
    64 
       
    65     CMManagerShim::WlanSecMode securityMode() const;
       
    66 
       
    67     QString securityModeTextId() const;
       
    68     
       
    69     void setReference(CmConnectionMethodShim *cmCm, uint id);
       
    70     
       
    71     int orderNumber() const;
       
    72     
       
    73     CpSettingFormItemData* uiInstance(CpItemDataHelper &dataHelper);
       
    74 
       
    75 public:
       
    76 
       
    77     enum WEPKeyFormat
       
    78         {
       
    79         EFormatHex, EFormatAscii,
       
    80         };
       
    81 
       
    82 private:
       
    83 
       
    84     void loadFieldsFromDataBase();
       
    85 
       
    86     void wepKeyTextChanged(int index);
       
    87 
       
    88     bool tryUpdate();
       
    89 
       
    90     void handleUpdateError();
       
    91 
       
    92     void showMessageBox(HbMessageBox::MessageBoxType type,
       
    93             const QString &text);
       
    94 
       
    95     void updateWepSettings();
       
    96 
       
    97     void commitWEPkeys(int index);
       
    98     
       
    99     void createWEPKeyOneGroup(CpItemDataHelper &dataHelpper);
       
   100     
       
   101     void createWEPKeyTwoGroup(CpItemDataHelper &dataHelpper);
       
   102     
       
   103     void createWEPKeyThreeGroup(CpItemDataHelper &dataHelpper);
       
   104     
       
   105     void createWEPKeyFourGroup(CpItemDataHelper &dataHelpper); 
       
   106     
       
   107     void storeWEPKey(CMManagerShim::ConnectionMethodAttribute enumValue,QString& key);
       
   108     
       
   109     void setKeyFormat(QString& key,int index);
       
   110         
       
   111     CMManagerShim::ConnectionMethodAttribute getWEPKeyEnum(int index);
       
   112     
       
   113 private slots:
       
   114 
       
   115     void wepKeyInUseChanged(int index);
       
   116 
       
   117     void wepKeyOneChanged();
       
   118 
       
   119     void wepKeyTwoChanged();
       
   120 
       
   121     void wepKeyThreeChanged();
       
   122 
       
   123     void wepKeyFourChanged();
       
   124 
       
   125 private:
       
   126 
       
   127     Q_DISABLE_COPY(CpWepUi)
       
   128 
       
   129     //!WEP security group item
       
   130     CpSettingFormItemData* mUi;
       
   131 
       
   132     //! Store strings of WEP keys
       
   133     QStringList mKeyData;
       
   134 
       
   135     //! WEP keys item
       
   136     CpSettingFormItemData *mWepKey[KMaxNumberofKeys];
       
   137 
       
   138     //! WEP keys text item
       
   139     CpSettingFormItemData *mWepKeyText[KMaxNumberofKeys];
       
   140 
       
   141     //!Store the index of the current key in use   
       
   142     int mNewKeySelected;
       
   143 
       
   144     //QSharedPointer<HbTranslator> mTranslator;
       
   145     QTranslator* mTranslator;
       
   146 
       
   147     //! Connection Settings Shim connection method pointer
       
   148     CmConnectionMethodShim *mCmCM;
       
   149 
       
   150     //! Connection method Id
       
   151     int mCmId;
       
   152 
       
   153     //! Message box for info notes
       
   154     QSharedPointer<HbMessageBox> mMessageBox;
       
   155 
       
   156     //! Store Formats of WEP keys
       
   157     WEPKeyFormat mkeyFormat[KMaxNumberofKeys];
       
   158     
       
   159     
       
   160 
       
   161 };
       
   162 
       
   163 /*! @} */
       
   164 
       
   165 #endif //CPWEPUI_H