|
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 #include "cppincodepluginview.h" |
|
18 #include <hbdataform.h> |
|
19 #include <hbdataformmodel.h> |
|
20 #include <hbdataformmodelitem.h> |
|
21 #include <hblineedit.h> |
|
22 #include <seccodeeditdataformviewitem.h> |
|
23 #include <seccodesettings.h> |
|
24 |
|
25 CpPinCodePluginView::CpPinCodePluginView(QGraphicsItem *parent /*= 0*/) |
|
26 : CpBaseSettingView(0,parent), mSecCodeSettings(new SecCodeSettings()) |
|
27 { |
|
28 if (HbDataForm *form = settingForm()) { |
|
29 |
|
30 QList<HbAbstractViewItem *> protoTypeList = form->itemPrototypes(); |
|
31 protoTypeList.append(new SecCodeEditDataFormViewItem()); |
|
32 form->setItemPrototypes(protoTypeList); |
|
33 |
|
34 form->setHeading(tr("PIN code")); |
|
35 |
|
36 HbDataFormModel *formModel = new HbDataFormModel(); |
|
37 |
|
38 HbDataFormModelItem *pinCodeRequestItem = new HbDataFormModelItem( |
|
39 HbDataFormModelItem::ToggleValueItem,tr("PIN code requests")); |
|
40 |
|
41 pinCodeRequestItem->setContentWidgetData("text",tr("On")); |
|
42 pinCodeRequestItem->setContentWidgetData("additionalText",tr("Off")); |
|
43 |
|
44 formModel->appendDataFormItem(pinCodeRequestItem); |
|
45 |
|
46 HbDataFormModelItem *pinCodeItem = new HbDataFormModelItem( |
|
47 static_cast<HbDataFormModelItem::DataItemType>(SecCodeEditDataFormViewItem::SecCodeEditItem), |
|
48 tr("PIN code")); |
|
49 pinCodeItem->setContentWidgetData("echoMode",HbLineEdit::Password); |
|
50 pinCodeItem->setContentWidgetData("text","1111"); |
|
51 pinCodeItem->setContentWidgetData("readOnly",true); |
|
52 form->addConnection(pinCodeItem,SIGNAL(clicked()),this,SLOT(onPinCodeClicked())); |
|
53 |
|
54 formModel->appendDataFormItem(pinCodeItem); |
|
55 |
|
56 HbDataFormModelItem *pin2CodeItem = new HbDataFormModelItem( |
|
57 static_cast<HbDataFormModelItem::DataItemType>(SecCodeEditDataFormViewItem::SecCodeEditItem), |
|
58 tr("PIN2 code")); |
|
59 pin2CodeItem->setContentWidgetData("echoMode",HbLineEdit::Password); |
|
60 pin2CodeItem->setContentWidgetData("text","1111"); |
|
61 pin2CodeItem->setContentWidgetData("readOnly",true); |
|
62 form->addConnection(pin2CodeItem,SIGNAL(clicked()),this,SLOT(onPin2CodeClicked())); |
|
63 |
|
64 formModel->appendDataFormItem(pin2CodeItem); |
|
65 |
|
66 form->setModel(formModel); |
|
67 } |
|
68 } |
|
69 |
|
70 CpPinCodePluginView::~CpPinCodePluginView() |
|
71 { |
|
72 delete mSecCodeSettings; |
|
73 } |
|
74 |
|
75 void CpPinCodePluginView::onPinCodeClicked() |
|
76 { |
|
77 mSecCodeSettings->changePinCode(); |
|
78 } |
|
79 |
|
80 void CpPinCodePluginView::onPin2CodeClicked() |
|
81 { |
|
82 mSecCodeSettings->changePin2Code(); |
|
83 } |