|
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 // System includes |
|
19 #include <qdebug> |
|
20 #include <QVariant> |
|
21 |
|
22 #include <hbdataformmodelitem.h> |
|
23 #include <cpitemdatahelper.h> |
|
24 #include "customedit.h" |
|
25 |
|
26 // User includes |
|
27 #include "actioncustomitem.h" |
|
28 #include "loggerutil.h" |
|
29 |
|
30 /*! |
|
31 Constructor |
|
32 */ |
|
33 ActionCustomItem::ActionCustomItem(QGraphicsItem *parent) |
|
34 : HbDataFormViewItem(parent) |
|
35 { |
|
36 _DBGLOG("ActionCustomItem::ActionCustomItem()") |
|
37 } |
|
38 |
|
39 /*! |
|
40 Destructor |
|
41 */ |
|
42 ActionCustomItem::~ActionCustomItem() |
|
43 { |
|
44 _DBGLOG("VmbxCpPlugin::~ActionCustomItem()") |
|
45 } |
|
46 |
|
47 /*! |
|
48 From base class HbDataFormViewItem |
|
49 */ |
|
50 HbAbstractViewItem* ActionCustomItem::createItem() |
|
51 { |
|
52 _DBGLOG("ActionCustomItem::createItem <>") |
|
53 return new ActionCustomItem(*this); |
|
54 } |
|
55 |
|
56 /*! |
|
57 From base class HbDataFormViewItem |
|
58 */ |
|
59 HbWidget* ActionCustomItem::createCustomWidget() |
|
60 { |
|
61 _DBGLOG("ActionCustomItem::createCustomWidget >") |
|
62 int type = modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt(); |
|
63 |
|
64 CustomEdit *edit = 0; |
|
65 if (type == VmbxEditItem) { |
|
66 edit = new CustomEdit(this); |
|
67 edit->setEchoMode(HbLineEdit::Normal ); |
|
68 edit->setReadOnly(true); |
|
69 _DBGLOG("ActionCustomItem::createCustomWidget customItem editor") |
|
70 } |
|
71 _DBGLOG("ActionCustomItem::createCustomWidget default<") |
|
72 return edit; |
|
73 } |
|
74 |
|
75 bool ActionCustomItem::canSetModelIndex(const QModelIndex &index) const |
|
76 { |
|
77 _DBGLOG("ActionCustomItem::canSetModelIndex >") |
|
78 int type = index.data(HbDataFormModelItem::ItemTypeRole).toInt(); |
|
79 return type == VmbxEditItem; |
|
80 } |
|
81 |
|
82 |
|
83 //End of file |