--- a/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp Fri Jun 04 10:25:39 2010 +0100
+++ b/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp Fri Jun 11 13:35:48 2010 +0300
@@ -21,16 +21,15 @@
#include "msgcontacthandler.h"
#include <QRegExp>
-#include <QGraphicsSceneMouseEvent>
#include <QApplication>
#include <QClipboard>
#include <QTextBlock>
+#include <HbTapGesture>
#include <HbMenu>
#include <HbAction>
-#include <HbFrameItem>
#include <cntservicescontact.h>
-#include <XQServiceRequest.h>
+#include <xqservicerequest.h>
#include <xqaiwrequest.h>
#include <xqappmgr.h>
@@ -67,10 +66,11 @@
{
this->setReadOnly(true);
this->setScrollable(false);
+ this->setSmileysEnabled(true);
this->setCursorVisibility(Hb::TextCursorHidden);
+ this->setFlag(QGraphicsItem::ItemIsFocusable,false);
this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- HbFrameItem *noBackground = new HbFrameItem(this);
- this->setBackgroundItem(noBackground);
+ this->setBackgroundItem(0);
//inserting rules and patterns to map.
mRules.insert(NUMBER_RULE,NUMBER_PATTERN);
@@ -117,6 +117,7 @@
QString ruleName = i.key();
QString rule = i.value();
QRegExp ruleExp(rule);
+ ruleExp.setCaseSensitivity(Qt::CaseInsensitive);
QTextCursor cursor = this->document()->find(ruleExp);
@@ -177,30 +178,65 @@
}
-
-void UniViewerTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void UniViewerTextItem::gestureEvent(QGestureEvent* event)
{
- HbTextEdit::mouseReleaseEvent(event);
-
- highlightText(false);
-
- QString anchor = this->anchorAt(event->pos());
-
- if(!anchor.isEmpty() && !this->textCursor().hasSelection())
+ //handle gesture to highlight and dehighlight find item.
+
+ if(HbTapGesture *tap = qobject_cast<HbTapGesture*>(event->gesture(Qt::TapGesture)))
{
- shortTapAction(anchor);
+ //capturing gesture position, and map to local co-ordinates.
+ QPointF pos = mapFromScene(tap->scenePosition());
+
+ switch (tap->state())
+ {
+ case Qt::GestureStarted:
+ {
+ //highlight find item.
+ QTextDocument* doc = this->document();
+ mCursorPos = doc->documentLayout()->hitTest(pos, Qt::ExactHit);
+ highlightText(true);
+ break;
+ }
+
+ case Qt::GestureFinished:
+ {
+ if (HbTapGesture::Tap == tap->tapStyleHint())
+ {
+ //gesture is finshed dehighlight text.
+ highlightText(false);
+
+ QString anchor = this->anchorAt(pos);
+
+ //do short tap action.
+ if (!anchor.isEmpty() && !this->textCursor().hasSelection())
+ {
+ shortTapAction(anchor);
+ }
+ }
+ break;
+ }
+
+ case Qt::GestureCanceled:
+ {
+ //gesture is canceled due to pan or swipe, dehighlight text.
+ if (HbTapGesture::Tap == tap->tapStyleHint())
+ {
+ highlightText(false);
+ break;
+ }
+ }
+ default:
+ break;
+ }
+ event->accept();
}
-}
-
-void UniViewerTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
- HbTextEdit::mousePressEvent(event);
-
- QTextDocument* doc = this->document();
-
- mCursorPos = doc->documentLayout()->hitTest(event->pos(), Qt::ExactHit);
-
- highlightText(true);
+ else
+ {
+ event->ignore();
+ }
+
+ //passing gesture event to base class.
+ HbTextEdit::gestureEvent(event);
}
void UniViewerTextItem::addNumberMenu(HbMenu* contextMenu,const QString& data)
@@ -308,7 +344,7 @@
phoneNumber.remove(NUMBER_RULE);
//invoke dialer service and pass phoneNumber.
- QString serviceName("com.nokia.services.telephony");
+ QString serviceName("com.nokia.symbian.ICallDial");
QString operation("dial(QString)");
XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName,operation,false);
@@ -348,11 +384,10 @@
emailId.remove(EMAIL_RULE);
// Launch email editor
- QString serviceName("com.nokia.services.commonemail");
- QString interfaceName("imessage.send");
+ QString interfaceName("com.nokia.symbian.IEmailMessageSend");
QString operation("send(QVariant)");
XQApplicationManager appManager;
- XQAiwRequest* request = appManager.create(serviceName, interfaceName,
+ XQAiwRequest* request = appManager.create(interfaceName,
operation, true);
if ( request == NULL )
{