securitysettings/cpwlansecurityuiplugins/cp802dot1xui/src/cp802dot1xui.cpp
branchRCL_3
changeset 19 c74b3d9f6b9e
parent 18 bad0cc58d154
equal deleted inserted replaced
18:bad0cc58d154 19:c74b3d9f6b9e
     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 "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 802_Dot_1x configuration
       
    16  *
       
    17  */
       
    18 
       
    19 /*
       
    20  * %version: tr1cfwln#8 %
       
    21  */
       
    22 
       
    23 //User Includes
       
    24 #include "cp802dot1xui.h"
       
    25 #include "cpwpacmnui.h"
       
    26 #include "cpwpacmnui_global.h"
       
    27 
       
    28 //System Includes
       
    29 #include <cmmanagerdefines_shim.h>
       
    30 #include <cmconnectionmethod_shim.h>
       
    31 #include <eapqtconfiginterface.h>
       
    32 #include <QStringList>
       
    33 #include <HbTranslator>
       
    34 
       
    35 //Trace Definition
       
    36 #include "OstTraceDefinitions.h"
       
    37 #ifdef OST_TRACE_COMPILER_IN_USE
       
    38 #include "cp802dot1xuiTraces.h"
       
    39 #endif
       
    40 
       
    41 /*!
       
    42  \class Cp802Dot1xUi
       
    43  \brief Cp802Dot1xUi implements the common Ui for 802.1x only 
       
    44  Security Settings Control Panel Plugins,
       
    45  which will allow viewing/editing of 802.1x Security Settings.
       
    46  */
       
    47 //The order in which 802_Dot_1x only mode appears in the list of available 
       
    48 //security modes
       
    49 const int UI_ORDER_802_Dot_1x = 40;
       
    50 
       
    51 /*!
       
    52  * Constructor
       
    53  */
       
    54 
       
    55 Cp802Dot1xUi::Cp802Dot1xUi() :
       
    56     mUi(NULL), 
       
    57     mTranslator(new HbTranslator("cpwlansecsettingsplugin")),
       
    58     mCmCM(NULL),
       
    59     mEapQtConfigInterface(NULL),
       
    60     m802Ui(NULL)
       
    61 {
       
    62    
       
    63 }
       
    64 
       
    65 // Destructor
       
    66 Cp802Dot1xUi::~Cp802Dot1xUi()
       
    67 {
       
    68     OstTraceFunctionEntry1(CP802DOT1XUI_CP802DOT1XUI_ENTRY,this);
       
    69     delete mEapQtConfigInterface;
       
    70     delete mTranslator;
       
    71     OstTraceFunctionExit1(CP802DOT1XUI_CP802DOT1XUI_EXIT,this);
       
    72 }
       
    73 
       
    74 /*!
       
    75  Getter for security mode.
       
    76 
       
    77  \return Security mode identifier
       
    78  */
       
    79 CMManagerShim::WlanSecMode Cp802Dot1xUi::securityMode() const
       
    80 {
       
    81     OstTraceFunctionEntry1(CP802DOT1XUI_SECURITYMODE_ENTRY,this);
       
    82     OstTraceFunctionExit1(CP802DOT1XUI_SECURITYMODE_EXIT,this);
       
    83     //return security mode 
       
    84     return CMManagerShim::WlanSecMode802_1x;
       
    85 }
       
    86 
       
    87 /*!
       
    88  Getter for localization text identifier for the security mode,
       
    89  f.ex. "txt_occ_setlabel_wlan_security_mode_val_8021x". This localized
       
    90  text will be shown in the UI.
       
    91  
       
    92  \return Localization text ID
       
    93  */
       
    94 QString Cp802Dot1xUi::securityModeTextId() const
       
    95 {
       
    96     OstTraceFunctionEntry1( CP802DOT1XUI_SECURITYMODETEXTID_ENTRY, this );
       
    97     OstTraceFunctionExit1( CP802DOT1XUI_SECURITYMODETEXTID_EXIT, this );
       
    98     return "txt_occ_setlabel_wlan_security_mode_val_8021x";
       
    99 }
       
   100 
       
   101 /*! 
       
   102  Sets the database reference IAP id.
       
   103 
       
   104  \param id Database reference
       
   105  */
       
   106 void Cp802Dot1xUi::setReference(CmConnectionMethodShim *cmCm,uint id)
       
   107 {
       
   108     OstTraceFunctionEntry1(CP802DOT1XUI_SETREFERENCE_ENTRY,this);    
       
   109     if (!mEapQtConfigInterface) {
       
   110            mEapQtConfigInterface = new EapQtConfigInterface(
       
   111                EapQtConfigInterface::EapBearerTypeWlan, id);
       
   112     } 
       
   113     else {
       
   114            mEapQtConfigInterface->setConfigurationReference(id);     
       
   115     }
       
   116     
       
   117     //mCmCM is not deleted assuming mCmManager owns it.
       
   118      mCmCM = cmCm;
       
   119     
       
   120     OstTraceFunctionExit1(CP802DOT1XUI_SETREFERENCE_EXIT,this);
       
   121 }
       
   122 
       
   123 /*!
       
   124  Getter for order number. This order number is used by the client of
       
   125  this interface to put the security modes in correct order in the list.
       
   126 
       
   127  \return An order number
       
   128  */
       
   129 int Cp802Dot1xUi::orderNumber() const
       
   130 {
       
   131     OstTraceFunctionEntry1(CP802DOT1XUI_ORDERNUMBER_ENTRY,this);
       
   132     OstTraceFunctionExit1(CP802DOT1XUI_ORDERNUMBER_EXIT,this);
       
   133     return UI_ORDER_802_Dot_1x;
       
   134 }
       
   135 
       
   136 /*!
       
   137  Creates an UI instance. Caller owns the object.
       
   138  
       
   139  \param dataHelper Item data helper
       
   140  \return Pointer to an UI object
       
   141  */
       
   142 CpSettingFormItemData* Cp802Dot1xUi::uiInstance(CpItemDataHelper &dataHelpper)
       
   143 {
       
   144     OstTraceFunctionEntry1(CP802DOT1XUI_UIINSTANCE_ENTRY,this);
       
   145 
       
   146     //reset Common Ui ptr
       
   147     m802Ui.reset(new CpWpaCmnUi(CMManagerShim::WlanSecMode802_1x, dataHelpper));
       
   148         
       
   149     mUi = m802Ui->createUi(mEapQtConfigInterface, mCmCM);
       
   150       
       
   151     OstTraceFunctionExit1(CP802DOT1XUI_UIINSTANCE_EXIT,this);
       
   152     return mUi;
       
   153 }
       
   154 
       
   155 
       
   156 /*!
       
   157    Validates current security settings. This function is called whenever
       
   158    user tries to exit from the settings view. If the plugin determines
       
   159    that some settings need editing before considered valid, it shall
       
   160    return false. A dialog will be shown to the user indicating that
       
   161    settings are still incomplete and asking if he/she wishes to exit
       
   162    anyway.
       
   163 
       
   164    \return True if security settings for 802.1x only are valid, false if not.
       
   165 */
       
   166 bool Cp802Dot1xUi::validateSettings()
       
   167     {    
       
   168     return true;
       
   169     }
       
   170 
       
   171 
       
   172 Q_EXPORT_PLUGIN2(Cp802Dot1xUi, Cp802Dot1xUi)
       
   173 ;