--- a/phonebookui/pbkcommonui/src/cntcontactcardheadingitem.cpp Fri May 14 15:42:23 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cntcontactcardheadingitem.cpp Thu May 27 12:45:19 2010 +0300
@@ -19,7 +19,6 @@
#include <qtcontacts.h>
#include <QGraphicsSceneMouseEvent>
-#include <QTapAndHoldGesture>
#include <hbiconitem.h>
#include <hbtextitem.h>
@@ -30,6 +29,7 @@
#include <hbtoucharea.h>
#include <hbaction.h>
#include <hbmainwindow.h>
+#include <hbtapgesture.h>
CntContactCardHeadingItem::CntContactCardHeadingItem(QGraphicsItem *parent) :
HbWidget(parent),
@@ -324,18 +324,6 @@
{
primaryText = hbTrId("txt_phob_list_unnamed");
}
-
- /*
- // prefix, first and middle
- QStringList firstNameList;
- firstNameList << name.prefix() << name.first() << name.middle();
- firstLineText = firstNameList.join(" ").trimmed();
-
- // last and suffix
- QStringList lastNameList;
- lastNameList << name.last() << name.suffix();
- mSecondLineText = lastNameList.join(" ").trimmed();
- */
}
// nick label
@@ -383,21 +371,48 @@
emit passLongPressed(point);
}
+void CntContactCardHeadingItem::processShortPress(const QPointF &point)
+{
+ emit passShortPressed(point);
+}
+
void CntContactCardHeadingItem::gestureEvent(QGestureEvent* event)
{
- QGesture *tapAndHold = event->gesture(Qt::TapAndHoldGesture);
- if (tapAndHold && tapAndHold->state() == Qt::GestureFinished) {
- processLongPress(static_cast<QTapAndHoldGesture *>(tapAndHold)->position());
+
+ if (HbTapGesture *tap = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture)))
+ {
+ switch (tap->state())
+ {
+ case Qt::GestureFinished:
+ if (tap->tapStyleHint() == HbTapGesture::Tap && mIcon->rect().contains(mapFromScene(tap->position())))
+ {
+ processShortPress(tap->position());
+ }
+ break;
+ case Qt::GestureUpdated:
+ if (tap->tapStyleHint() == HbTapGesture::TapAndHold && mIcon->rect().contains(mapFromScene(tap->position())))
+ {
+ processLongPress(tap->position());
+ }
+ break;
+ default:
+ break;
+ }
+ event->accept();
+ }
+ else
+ {
+ event->ignore();
}
}
void CntContactCardHeadingItem::initGesture()
{
- grabGesture(Qt::TapAndHoldGesture);
+ grabGesture(Qt::TapGesture);
}
QVariant CntContactCardHeadingItem::itemChange(GraphicsItemChange change, const QVariant &value)
-{
+{
if (change == QGraphicsItem::ItemSceneHasChanged)
{
HbMainWindow *window = mainWindow();