controlpanelui/src/cpplugins/devicelockplugin/src/cpdevicelockpluginview.cpp
changeset 19 36aa4756ee82
parent 12 624337f114fe
child 20 22d3abee08da
equal deleted inserted replaced
12:624337f114fe 19:36aa4756ee82
     1 /*
       
     2  * Copyright (c) 2009 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 #include "cpdevicelockpluginview.h"
       
    19 #include <QStringList>
       
    20 #include <hblineedit.h>
       
    21 #include <hbdataform.h>
       
    22 #include <hbdataformmodel.h>
       
    23 #include <hbdataformmodelitem.h>
       
    24 #include "cpremotelockdataformviewitem.h"
       
    25 
       
    26 CpDeviceLockPluginView::CpDeviceLockPluginView(QGraphicsItem *parent /*= 0*/)
       
    27 : CpBaseSettingView(0,parent)
       
    28 {
       
    29 	if (HbDataForm *form = settingForm()) {
       
    30 
       
    31 		QList<HbAbstractViewItem *> protoTypeList = form->itemPrototypes();
       
    32 		protoTypeList.append(new CpRemoteLockDataFormViewItem());
       
    33         form->setItemPrototypes(protoTypeList);
       
    34 
       
    35 		HbDataFormModel *formModel = new HbDataFormModel();
       
    36 
       
    37 		form->setHeading(tr("Device lock"));
       
    38 
       
    39 		HbDataFormModelItem *deviceLockItem = new HbDataFormModelItem(
       
    40 			HbDataFormModelItem::ToggleValueItem,tr("Device lock"));
       
    41     
       
    42 		deviceLockItem->setContentWidgetData("text",tr("On"));
       
    43 		deviceLockItem->setContentWidgetData("additionalText",tr("Off"));
       
    44 
       
    45 		formModel->appendDataFormItem(deviceLockItem);
       
    46 
       
    47 		HbDataFormModelItem *lockCodeItem = new HbDataFormModelItem(
       
    48 			HbDataFormModelItem::TextItem,tr("Lock code"));
       
    49 		lockCodeItem->setContentWidgetData("echoMode",HbLineEdit::Password);
       
    50 		lockCodeItem->setContentWidgetData("text","1111");
       
    51 		lockCodeItem->setContentWidgetData("readOnly",true);
       
    52 
       
    53 		formModel->appendDataFormItem(lockCodeItem);
       
    54 
       
    55 		HbDataFormModelItem *deviceLockAfterItem = new HbDataFormModelItem(
       
    56 			HbDataFormModelItem::RadioButtonListItem,tr("Device will be locked automatically after:"));
       
    57 
       
    58 		QStringList items;
       
    59 		items << tr("15 minutes") << tr("30 minutes") << tr("1 hour") << tr("4 hours") ;
       
    60 		deviceLockAfterItem->setContentWidgetData("items",items);
       
    61 		deviceLockAfterItem->setContentWidgetData("selected",0);
       
    62 
       
    63 		formModel->appendDataFormItem(deviceLockAfterItem);
       
    64 
       
    65 		HbDataFormModelItem *remoteLockItem = new HbDataFormModelItem(
       
    66 			static_cast<HbDataFormModelItem::DataItemType>(CpRemoteLockDataFormViewItem::CpRemoteLockItem),
       
    67 			tr("Remote locking"));
       
    68 		remoteLockItem->setContentWidgetData("plainText",
       
    69 			tr("Device can be locked remotely by sending lock code to the device as SMS."));
       
    70 		remoteLockItem->setContentWidgetData("TextWrapping",Hb::TextWordWrap);
       
    71 
       
    72 		formModel->appendDataFormItem(remoteLockItem);
       
    73 
       
    74 		form->setModel(formModel);
       
    75 	}
       
    76 }
       
    77 
       
    78 CpDeviceLockPluginView::~CpDeviceLockPluginView()
       
    79 {
       
    80 }
       
    81 
       
    82