messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 51 3507212d340e
equal deleted inserted replaced
25:84d9eb65b26f 37:518b245aa84c
    23 
    23 
    24 // FORWORD DECLARATIONS
    24 // FORWORD DECLARATIONS
    25 class HbIconItem;
    25 class HbIconItem;
    26 class HbTextItem;
    26 class HbTextItem;
    27 class HbIcon;
    27 class HbIcon;
    28 class QGraphicsSceneMouseEvent;
    28 class ThumbnailManager;
    29 class HbGestureSceneFilter;
       
    30 
    29 
    31 #include "convergedmessageaddress.h"
    30 #include "convergedmessageaddress.h"
    32 
    31 
    33 /**
    32 /**
    34  * This class is a custom layout widget for Contact Card layout.
    33  * @class MsgContactCardWidget
       
    34  * @brief This class is a custom layout widget for Contact Card layout.
    35  */
    35  */
    36 class MsgContactCardWidget : public HbWidget
    36 class MsgContactCardWidget: public HbWidget
    37 {
    37 {
    38 Q_OBJECT
    38 Q_OBJECT
    39 
    39 
    40 public:
    40 public:
    41 
    41 
    76 
    76 
    77     /**
    77     /**
    78      * Refreshes all the Contact card fields.
    78      * Refreshes all the Contact card fields.
    79      */
    79      */
    80     void updateContents();
    80     void updateContents();
    81     
       
    82 
    81 
    83     /**
    82     /**
    84      * Clears  all the Contact card fields.
    83      * Clears  all the Contact card fields.
    85      */
    84      */
    86     void clearContent();
    85     void clearContent();
    87     
    86 
    88     /**
    87 signals:
    89      * for tactile feed back.
    88 
    90      */
    89     /**
    91     HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const;
    90      *
    92     
    91      */
    93     /**
    92     void conversationIdChanged(qint64 convId);
    94      * To connect/disconnect clicked signal
    93 
    95      */
       
    96     void connectSignals(bool yes);
       
    97     
       
    98 protected:
    94 protected:
    99     /**
    95 
   100      * reimplemented from base class.
    96     /**
   101      */
    97      * Event handler for gesture events.
   102     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
    98      * Reimplemented from HbWidgetBase.
   103     
    99      * @see HbWidgetBase
   104     /**
   100      */
   105      * reimplemented from base class.
   101     virtual void gestureEvent(QGestureEvent *event);
   106      */
       
   107     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
       
   108 
   102 
   109 private:
   103 private:
   110 
   104 
   111     /**
   105     /**
   112      * Initialization function.
   106      * Initialization function.
   113      */
   107      */
   114     void init();
   108     void init();
   115     
   109 
   116     /** Helper method to get contact id against phone number.
   110     /** Helper method to get contact id against phone number.
   117      * @param value phone number.
   111      * @param value phone number.
   118      */
   112      */
   119     int resolveContactId(const QString& value);
   113     int resolveContactId(const QString& value);
       
   114 
       
   115     /**
       
   116      * Handles pressed state.
       
   117      */
       
   118     void setPressed(bool pressed);
       
   119 
       
   120 private slots:
       
   121 
       
   122     /**
       
   123      * show longp tap.
       
   124      */
       
   125     void handleLongTap(const QPointF &position);
   120     
   126     
   121     /**
   127     /**
   122      * Helper method to set back ground.
   128      * handles short tap.
   123      */
   129      */
   124     void setBackGround(const QString& bg);
   130     void handleShortTap(const QPointF &position);
   125     
   131 
   126 private slots:
       
   127     /**
       
   128      * show longpress menu for attachment object
       
   129      */
       
   130     void handleLongPress(QPointF position);
       
   131     
       
   132     /**
       
   133      * Helper method to initialize gesture.
       
   134      */
       
   135     void initGesture();
       
   136 	
       
   137     /**
   132     /**
   138      * Slot for handling valid returns from the framework.
   133      * Slot for handling valid returns from the framework.
   139      * Updates the display name in the contact card widget.
   134      * Updates the display name in the contact card widget.
   140      * @param result const QVariant&
   135      * @param result const QVariant&
   141      */
   136      */
   142     void handleOk(const QVariant& result);
   137     void handleOk(const QVariant& result);
   143     
   138 
   144     /**
   139     /**
   145      * Slot for handling errors. Error ids are provided as 
   140      * Slot for handling errors. Error ids are provided as 
   146      * 32-bit integers.
   141      * 32-bit integers.
   147      * @param errorCode qint32
   142      * @param errorCode qint32
   148      */
   143      */
   149     void handleError(int errorCode, const QString& errorMessage);
   144     void handleError(int errorCode, const QString& errorMessage);
   150 	    
   145 
   151     /**
   146     /**
   152      * Called when clicked() signal is emitted
   147      * Called when clicked() signal is emitted
   153      * Launches phonebook to view an existing contact 
   148      * Launches phonebook to view an existing contact 
   154      * or to add a new contact
   149      * or to add a new contact
   155      */
   150      */
   156     void openContactInfo();
   151     void openContactInfo();
       
   152 
       
   153     /**
       
   154      * Launches Dialer Service 
       
   155      */
       
   156     void call();
       
   157 
       
   158     /**
       
   159      * Adds unknown number to phonebook
       
   160      */
       
   161     void addToContacts();
       
   162 
       
   163     /**
       
   164      * Called after service request is completed.
       
   165      */
       
   166     void onServiceRequestCompleted();
       
   167 
       
   168     /**
       
   169      * Slot hit when the thumbnail is ready.
       
   170      */
       
   171     void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
       
   172 
       
   173     /**
       
   174      * Ignore gesture events.
       
   175      */
       
   176     void ignoreSignals(bool yes);
   157     
   177     
   158     /**
   178     /**
   159      * Launches Dialer Service 
   179      * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
   160      */
   180      * events back to back.  
   161     void call();
   181      */
   162     
   182     void regrabGesture();
   163     /**
       
   164      * Adds unknown number to phonebook
       
   165      */
       
   166     void addToContacts();
       
   167     
       
   168     /**
       
   169      * Called after service request is completed.
       
   170      */
       
   171     void onServiceRequestCompleted();
       
   172     
       
   173 signals:
       
   174    /**
       
   175 	* Emitted when contact card is short tapped.
       
   176 	*/
       
   177     void clicked();
       
   178     
       
   179 
   183 
   180 private:
   184 private:
   181     // Data
   185 
   182 
   186     /**
   183 
   187      * Bool variable on which gesture events are accepted/ignored.
   184     /**
   188      */
   185      * To supress short tap if long tap triggered.
   189     bool mIgnoreEvents;
   186      */
   190 
   187     bool mMenuShown;  
   191     /**
   188 	
       
   189 	/**
       
   190      * Contact Number for the conversation
   192      * Contact Number for the conversation
   191      */
   193      */
   192     QString mContactNumber;
   194     QString mContactNumber;
   193 	
   195 
   194     /**
   196     /**
   195      * Address string.
   197      * Address string.
   196      */
   198      */
   197     QString mAddress;
   199     QString mAddress;
   198 
   200 
   211     /**
   213     /**
   212      * Address text item.
   214      * Address text item.
   213      * Own.
   215      * Own.
   214      */
   216      */
   215     HbTextItem *mAddressTextItem;
   217     HbTextItem *mAddressTextItem;
   216 	   
   218 
   217     /**
   219     /**
   218      * gesture filter for long press.
   220      * ThumbnailManager
   219      */    
   221      * Own.
   220     HbGestureSceneFilter* mGestureFilter;
   222      */
   221 	
   223     ThumbnailManager *mThumbnailManager;
   222 
       
   223     
       
   224   
       
   225 };
   224 };
   226 
   225 
   227 #endif // MSGCONTACTCARDWIDGET_H
   226 #endif // MSGCONTACTCARDWIDGET_H
   228 // EOF
   227 // EOF