cpsecplugins/simpincodeplugin/src/seccodeeditdataformviewitem.cpp
branchRCL_3
changeset 21 09b1ac925e3f
equal deleted inserted replaced
20:63339781d179 21:09b1ac925e3f
       
     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  *
       
    16  */
       
    17 
       
    18 // User includes
       
    19 #include "seccodeeditdataformviewitem.h"
       
    20 #include "seccodeedit.h"
       
    21 #include <../../inc/cpsecplugins.h>
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 /*!
       
    26     Constructor
       
    27 */
       
    28 SecCodeEditDataFormViewItem::SecCodeEditDataFormViewItem(
       
    29     QGraphicsItem *parent): HbDataFormViewItem(parent)
       
    30 {
       
    31 	RDEBUG("0", 0);
       
    32 }
       
    33 
       
    34 /*!
       
    35     Destructor
       
    36 */
       
    37 SecCodeEditDataFormViewItem::~SecCodeEditDataFormViewItem()
       
    38 {
       
    39 }
       
    40 
       
    41 /*!
       
    42     Create Item
       
    43 */
       
    44 HbAbstractViewItem *SecCodeEditDataFormViewItem::createItem()
       
    45 {
       
    46 		RDEBUG("0", 0);
       
    47     return new SecCodeEditDataFormViewItem( *this);
       
    48 }
       
    49    
       
    50 /*!
       
    51     Create Item
       
    52 */
       
    53 bool SecCodeEditDataFormViewItem::canSetModelIndex(
       
    54     const QModelIndex &index) const
       
    55 {
       
    56     int type = index.data(HbDataFormModelItem::ItemTypeRole).toInt();
       
    57     RDEBUG("type", type);
       
    58     return type == SecCodeEditItem;
       
    59 }
       
    60 
       
    61 /*!
       
    62     Create Custom Widget
       
    63 */
       
    64 HbWidget *SecCodeEditDataFormViewItem::createCustomWidget()
       
    65 {
       
    66     int type = modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt();
       
    67     RDEBUG("type", type);
       
    68 
       
    69     if (type == SecCodeEditItem) {
       
    70         SecCodeEdit *edit = new SecCodeEdit("1234");
       
    71         edit->setEchoMode(HbLineEdit::Password);
       
    72         RDEBUG("edit->setReadOnly", 1);
       
    73         edit->setReadOnly(true);
       
    74         return edit;
       
    75     }
       
    76 		RDEBUG("0", 0);
       
    77     return 0;
       
    78 }