securitysettings/cpeapuiplugins/cpeapciphersuiteui/src/cpeapciphersuiteui_p.cpp
branchRCL_3
changeset 46 c74b3d9f6b9e
parent 45 bad0cc58d154
child 55 9c2aa05919d9
equal deleted inserted replaced
45:bad0cc58d154 46: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 TLS ciphersuite configiration in EAP methods
       
    16 *
       
    17 */
       
    18 
       
    19 /*
       
    20 * %version: 4 %
       
    21 */
       
    22 
       
    23 // System includes
       
    24 #include <cpsettingformitemdata.h>
       
    25 #include <eapqtconfig.h>
       
    26 
       
    27 // User includes
       
    28 #include "cpeapciphersuiteui_p.h"
       
    29 
       
    30 /*!
       
    31  * \class CpEapCiphersuiteUiPrivate
       
    32  * \brief Control Panel QT UI for TLS ciphersuite configiration in EAP methods. 
       
    33  */
       
    34 
       
    35 // External function prototypes
       
    36 
       
    37 // Local constants
       
    38 
       
    39 // ======== LOCAL FUNCTIONS ========
       
    40 
       
    41 // ======== MEMBER FUNCTIONS ========
       
    42 
       
    43 /*!
       
    44  * Constructor.
       
    45  */ 
       
    46 CpEapCiphersuiteUiPrivate::CpEapCiphersuiteUiPrivate()
       
    47 {
       
    48 
       
    49 }
       
    50 
       
    51 /*!
       
    52  * Destructor.
       
    53  */
       
    54 CpEapCiphersuiteUiPrivate::~CpEapCiphersuiteUiPrivate()
       
    55 {
       
    56 
       
    57 }
       
    58 
       
    59 /*!
       
    60  * Tells the caller is requested cipher suite selected
       
    61  * 
       
    62  * @param suites List of selected cipher suites
       
    63  * @param id Index of requested cipher suite
       
    64  * 
       
    65  * @return Qt::Checked if requested cipher suite is found from the list
       
    66  *         Qt::Unchecked otherwise
       
    67  */
       
    68 int CpEapCiphersuiteUiPrivate::ciphersuiteSelected(QVariant suites, int id)
       
    69 {
       
    70     QList<QVariant> suiteList(suites.toList());
       
    71     int ret = Qt::Unchecked;
       
    72     for (int i = 0; i < suiteList.count(); ++i) {
       
    73         
       
    74         if (suiteList.at(i).toInt() == id) {
       
    75             ret = Qt::Checked;
       
    76             break;
       
    77         }
       
    78     } 
       
    79     
       
    80     return ret;
       
    81 }
       
    82 
       
    83 /*!
       
    84  * Creates Cipher suite group item
       
    85  * 
       
    86  * @param suites List of selected cipher suites
       
    87  * @param name Localisation string of the cipher suite
       
    88  * @param id Index of the cipher suite
       
    89  * 
       
    90  * @return CpSettingFormItemData: Cipher suite check box
       
    91  */
       
    92 CpSettingFormItemData* CpEapCiphersuiteUiPrivate::createGroupItem(
       
    93     QVariant &suites, QString name, int id)
       
    94 {
       
    95     qDebug("CpEapCiphersuiteUiPrivate::createGroupItem - id: 0x%04x", id);
       
    96     QScopedPointer<CpSettingFormItemData> mItem;
       
    97     mItem.reset(new CpSettingFormItemData(
       
    98         HbDataFormModelItem::CheckBoxItem, QString("")));
       
    99     mItem->setContentWidgetData("text", name);
       
   100     mItem->setContentWidgetData("checkState", ciphersuiteSelected(
       
   101         suites, id));
       
   102     mSuiteMapper[mItem.data()] = id;
       
   103     
       
   104     CpSettingFormItemData* tmp = mItem.data();
       
   105     mItem.take();
       
   106     return tmp;
       
   107 }