14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <QGraphicsLayout> |
18 #include <QGraphicsLayout> |
19 #include <QDebug> |
19 #include "cntdebug.h" |
20 |
20 |
21 #include "cntcontactcarddetailitem.h" |
21 #include "cntcontactcarddetailitem.h" |
22 #include "cntcontactcarddataitem.h" |
22 #include "cntcontactcarddataitem.h" |
23 #include <hbiconitem.h> |
23 #include <hbiconitem.h> |
24 #include <hbtextitem.h> |
24 #include <hbtextitem.h> |
31 #include <hbinstantfeedback.h> |
31 #include <hbinstantfeedback.h> |
32 #include <hbcolorscheme.h> |
32 #include <hbcolorscheme.h> |
33 #include <QGestureEvent> |
33 #include <QGestureEvent> |
34 #include <hbtapgesture.h> |
34 #include <hbtapgesture.h> |
35 |
35 |
36 const int CNT_CONTACTCARD_TEXT_MAX_ROWCOUNT = 1; |
|
37 const int CNT_CONTACTCARD_Z_FRAME = -1; |
36 const int CNT_CONTACTCARD_Z_FRAME = -1; |
38 const int CNT_CONTACTCARD_Z_FOCUS = -2; |
37 const int CNT_CONTACTCARD_Z_FOCUS = -2; |
39 |
38 |
40 CntContactCardDetailItem::CntContactCardDetailItem(int index, QGraphicsItem *parent, bool isFocusable) : |
39 CntContactCardDetailItem::CntContactCardDetailItem(int index, QGraphicsItem *parent, bool isFocusable) : |
41 HbWidget(parent), |
40 HbWidget(parent), |
91 mSecondaryIcon = new HbIconItem(this); |
90 mSecondaryIcon = new HbIconItem(this); |
92 mSecondaryIcon->setFlags(HbIcon::Colorized); |
91 mSecondaryIcon->setFlags(HbIcon::Colorized); |
93 style()->setItemName(mSecondaryIcon, "secondaryIcon"); |
92 style()->setItemName(mSecondaryIcon, "secondaryIcon"); |
94 } |
93 } |
95 mSecondaryIcon->setIcon(secondaryIcon); |
94 mSecondaryIcon->setIcon(secondaryIcon); |
96 mSecondaryIcon->setColor(HbColorScheme::color("foreground")); |
95 mSecondaryIcon->setColor(HbColorScheme::color("qtc_view_normal")); |
97 |
96 |
98 |
97 |
99 if (!mFirstLineText) |
98 if (!mFirstLineText) |
100 { |
99 { |
101 mFirstLineText = new HbTextItem(this); |
100 mFirstLineText = new HbTextItem(this); |
152 grabGesture(Qt::TapGesture); |
151 grabGesture(Qt::TapGesture); |
153 } |
152 } |
154 |
153 |
155 void CntContactCardDetailItem::gestureEvent(QGestureEvent* event) |
154 void CntContactCardDetailItem::gestureEvent(QGestureEvent* event) |
156 { |
155 { |
157 qDebug() << "CntContactCardDetailItem::gestureEvent - IN"; |
156 CNT_ENTRY |
|
157 |
158 if (HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) |
158 if (HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) |
159 { |
159 { |
160 switch(tap->state()) |
160 switch(tap->state()) |
161 { |
161 { |
162 case Qt::GestureStarted: // |
162 case Qt::GestureStarted: // |
224 void CntContactCardDetailItem::setDetails(CntContactCardDataItem* aDataItem) |
225 void CntContactCardDetailItem::setDetails(CntContactCardDataItem* aDataItem) |
225 { |
226 { |
226 mValueTextElideMode = aDataItem->elideMode(); |
227 mValueTextElideMode = aDataItem->elideMode(); |
227 |
228 |
228 if (aDataItem->icon() != icon) |
229 if (aDataItem->icon() != icon) |
229 { |
230 { |
230 icon.clear(); |
231 icon.clear(); |
231 icon = aDataItem->icon(); |
232 icon = aDataItem->icon(); |
232 } |
233 } |
233 if (aDataItem->secondaryIcon() != secondaryIcon) |
234 if (aDataItem->secondaryIcon() != secondaryIcon) |
234 { |
235 { |
235 secondaryIcon.clear(); |
236 secondaryIcon.clear(); |
236 secondaryIcon = aDataItem->secondaryIcon(); |
237 secondaryIcon = aDataItem->secondaryIcon(); |
237 } |
238 } |
238 |
239 |
239 text.clear(); |
240 text.clear(); |
240 text = aDataItem->titleText(); |
241 text = aDataItem->titleText(); |
241 |
242 |
242 valueText.clear(); |
243 valueText.clear(); |
243 valueText = aDataItem->valueText(); |
244 valueText = aDataItem->valueText(); |
244 |
245 |
245 recreatePrimitives(); |
246 recreatePrimitives(); |
246 } |
247 } |
247 |
248 |
|
249 //To update the secondary icon item |
|
250 void CntContactCardDetailItem::setSecondaryIconItem( HbIcon aIcon ) |
|
251 { |
|
252 secondaryIcon.clear(); |
|
253 secondaryIcon = aIcon; |
|
254 if ( !mSecondaryIcon ) |
|
255 { |
|
256 mSecondaryIcon = new HbIconItem(this); |
|
257 mSecondaryIcon->setFlags(HbIcon::Colorized); |
|
258 style()->setItemName(mSecondaryIcon, "secondaryIcon"); |
|
259 } |
|
260 mSecondaryIcon->setIcon(secondaryIcon); |
|
261 mSecondaryIcon->setColor(HbColorScheme::color("foreground")); |
|
262 } |
|
263 |
248 int CntContactCardDetailItem::index() |
264 int CntContactCardDetailItem::index() |
249 { |
265 { |
250 return mIndex; |
266 return mIndex; |
251 } |
267 } |
252 |
268 |