messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 51 3507212d340e
--- a/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -25,15 +25,15 @@
 class HbIconItem;
 class HbTextItem;
 class HbIcon;
-class QGraphicsSceneMouseEvent;
-class HbGestureSceneFilter;
+class ThumbnailManager;
 
 #include "convergedmessageaddress.h"
 
 /**
- * This class is a custom layout widget for Contact Card layout.
+ * @class MsgContactCardWidget
+ * @brief This class is a custom layout widget for Contact Card layout.
  */
-class MsgContactCardWidget : public HbWidget
+class MsgContactCardWidget: public HbWidget
 {
 Q_OBJECT
 
@@ -78,33 +78,27 @@
      * Refreshes all the Contact card fields.
      */
     void updateContents();
-    
 
     /**
      * Clears  all the Contact card fields.
      */
     void clearContent();
-    
+
+signals:
+
     /**
-     * for tactile feed back.
-     */
-    HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const;
-    
-    /**
-     * To connect/disconnect clicked signal
+     *
      */
-    void connectSignals(bool yes);
-    
+    void conversationIdChanged(qint64 convId);
+
 protected:
+
     /**
-     * reimplemented from base class.
+     * Event handler for gesture events.
+     * Reimplemented from HbWidgetBase.
+     * @see HbWidgetBase
      */
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
-    
-    /**
-     * reimplemented from base class.
-     */
-    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+    virtual void gestureEvent(QGestureEvent *event);
 
 private:
 
@@ -112,85 +106,93 @@
      * Initialization function.
      */
     void init();
-    
+
     /** Helper method to get contact id against phone number.
      * @param value phone number.
      */
     int resolveContactId(const QString& value);
+
+    /**
+     * Handles pressed state.
+     */
+    void setPressed(bool pressed);
+
+private slots:
+
+    /**
+     * show longp tap.
+     */
+    void handleLongTap(const QPointF &position);
     
     /**
-     * Helper method to set back ground.
-     */
-    void setBackGround(const QString& bg);
-    
-private slots:
-    /**
-     * show longpress menu for attachment object
+     * handles short tap.
      */
-    void handleLongPress(QPointF position);
-    
-    /**
-     * Helper method to initialize gesture.
-     */
-    void initGesture();
-	
+    void handleShortTap(const QPointF &position);
+
     /**
      * 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();
+
+    /**
+     * Slot hit when the thumbnail is ready.
+     */
+    void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
+
+    /**
+     * Ignore gesture events.
+     */
+    void ignoreSignals(bool yes);
     
-signals:
-   /**
-	* Emitted when contact card is short tapped.
-	*/
-    void clicked();
-    
+    /**
+     * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
+     * events back to back.  
+     */
+    void regrabGesture();
 
 private:
-    // Data
-
 
     /**
-     * To supress short tap if long tap triggered.
+     * Bool variable on which gesture events are accepted/ignored.
      */
-    bool mMenuShown;  
-	
-	/**
+    bool mIgnoreEvents;
+
+    /**
      * Contact Number for the conversation
      */
     QString mContactNumber;
-	
+
     /**
      * Address string.
      */
@@ -213,15 +215,12 @@
      * Own.
      */
     HbTextItem *mAddressTextItem;
-	   
+
     /**
-     * gesture filter for long press.
-     */    
-    HbGestureSceneFilter* mGestureFilter;
-	
-
-    
-  
+     * ThumbnailManager
+     * Own.
+     */
+    ThumbnailManager *mThumbnailManager;
 };
 
 #endif // MSGCONTACTCARDWIDGET_H