messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
--- a/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h	Fri Apr 16 14:56:15 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h	Mon May 03 12:29:07 2010 +0300
@@ -19,21 +19,21 @@
 #define MSGCONTACTCARDWIDGET_H
 
 // SYSTEM INCLUDES
-#include <HbAbstractButton>
+#include <HbWidget>
 
 // FORWORD DECLARATIONS
 class HbIconItem;
 class HbTextItem;
 class HbIcon;
-class HbPushButton;
 class QGraphicsSceneMouseEvent;
+class HbGestureSceneFilter;
 
 #include "convergedmessageaddress.h"
 
 /**
  * This class is a custom layout widget for Contact Card layout.
  */
-class MsgContactCardWidget : public HbAbstractButton
+class MsgContactCardWidget : public HbWidget
 {
 Q_OBJECT
 
@@ -84,13 +84,27 @@
      * Clears  all the Contact card fields.
      */
     void clearContent();
-
-signals:
-
+    
+    /**
+     * for tactile feed back.
+     */
+    HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const;
+    
     /**
-     * Signal emitted when widget is clicked.
+     * To connect/disconnect clicked signal
      */
-    void clicked();
+    void connectSignals(bool yes);
+    
+protected:
+    /**
+     * reimplemented from base class.
+     */
+    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    
+    /**
+     * reimplemented from base class.
+     */
+    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
 private:
 
@@ -98,10 +112,85 @@
      * Initialization function.
      */
     void init();
+    
+    /** Helper method to get contact id against phone number.
+     * @param value phone number.
+     */
+    int resolveContactId(const QString& value);
+    
+    /**
+     * Helper method to set back ground.
+     */
+    void setBackGround(const QString& bg);
+    
+private slots:
+    /**
+     * show longpress menu for attachment object
+     */
+    void handleLongPress(QPointF position);
+    
+    /**
+     * Helper method to initialize gesture.
+     */
+    void initGesture();
+	
+    /**
+     * Slot for handling valid returns from the framework.
+     * Updates the display name in the contact card widget.
+     * @param result const QVariant&
+     */
+    void handleOk(const QVariant& result);
+    
+    /**
+     * Slot for handling errors. Error ids are provided as 
+     * 32-bit integers.
+     * @param errorCode qint32
+     */
+    void handleError(int errorCode, const QString& errorMessage);
+	    
+    /**
+     * Called when clicked() signal is emitted
+     * Launches phonebook to view an existing contact 
+     * or to add a new contact
+     */
+    void openContactInfo();
+    
+    /**
+     * Launches Dialer Service 
+     */
+    void call();
+    
+    /**
+     * Adds unknown number to phonebook
+     */
+    void addToContacts();
+    
+    /**
+     * Called after service request is completed.
+     */
+    void onServiceRequestCompleted();
+    
+signals:
+   /**
+	* Emitted when contact card is short tapped.
+	*/
+    void clicked();
+    
 
 private:
     // Data
 
+
+    /**
+     * To supress short tap if long tap triggered.
+     */
+    bool mMenuShown;  
+	
+	/**
+     * Contact Number for the conversation
+     */
+    QString mContactNumber;
+	
     /**
      * Address string.
      */
@@ -124,12 +213,15 @@
      * Own.
      */
     HbTextItem *mAddressTextItem;
-
+	   
     /**
-     * Background frame item.
-     * Own.
-     */
-    HbPushButton *mBackgroundItem;
+     * gesture filter for long press.
+     */    
+    HbGestureSceneFilter* mGestureFilter;
+	
+
+    
+  
 };
 
 #endif // MSGCONTACTCARDWIDGET_H