messagingapp/msgui/conversationview/inc/msgconversationwidget.h
changeset 27 e4592d119491
parent 25 84d9eb65b26f
child 47 5b14749788d7
equal deleted inserted replaced
25:84d9eb65b26f 27:e4592d119491
    28 
    28 
    29 /**
    29 /**
    30  * This class represents the custom layouted widget to show
    30  * This class represents the custom layouted widget to show
    31  * the conversation inside a bubble shape in the conversation view.
    31  * the conversation inside a bubble shape in the conversation view.
    32  */
    32  */
    33 class MsgConversationWidget : public HbWidget
    33 class MsgConversationWidget: public HbWidget
    34 {
    34 {
    35 Q_OBJECT
    35 Q_OBJECT
    36 
    36 
    37     Q_PROPERTY(int priority READ priority WRITE setPriority)
    37 Q_ENUMS(SendingState)
    38     Q_PROPERTY(bool hasAttachment READ hasAttachment WRITE setAttachment)
    38 Q_PROPERTY(int priority READ priority WRITE setPriority)
    39     Q_PROPERTY(bool hasImage READ hasImage WRITE setImage)
    39 Q_PROPERTY(bool hasAttachment READ hasAttachment WRITE setAttachment)
    40     Q_PROPERTY(bool hasAudio READ hasAudio WRITE setAudio)
    40 Q_PROPERTY(bool hasImage READ hasImage WRITE setImage)
    41     Q_PROPERTY(bool hasVideo READ hasVideo WRITE setVideo)
    41 Q_PROPERTY(bool hasAudio READ hasAudio WRITE setAudio)
    42     Q_PROPERTY(bool isPlayable READ isPlayable WRITE setPlayable)
    42 Q_PROPERTY(bool hasVideo READ hasVideo WRITE setVideo)
    43     Q_PROPERTY(bool isIncoming READ isIncoming WRITE setIncoming)
    43 Q_PROPERTY(bool isPlayable READ isPlayable WRITE setPlayable)
    44     Q_PROPERTY(bool isMMS READ isMMS WRITE setMMS)
    44 Q_PROPERTY(bool isIncoming READ isIncoming WRITE setIncoming)
    45     Q_PROPERTY(bool isMMSNotification READ isMMSNotification WRITE setMMSNotification)
    45 Q_PROPERTY(bool isMMS READ isMMS WRITE setMMS)
    46     Q_PROPERTY(bool isUnread READ isUnread WRITE setUnread)
    46 Q_PROPERTY(bool isMMSNotification READ isMMSNotification WRITE setMMSNotification)
    47     Q_PROPERTY(int sendingState READ sendingState WRITE setSendingState)
    47 Q_PROPERTY(bool isUnread READ isUnread WRITE setUnread)
    48     Q_PROPERTY(int notificationState READ notificationState WRITE setNotificationState)
    48 Q_PROPERTY(SendingState sendingState READ sendingState WRITE setSendingState)
    49 
    49 Q_PROPERTY(int notificationState READ notificationState WRITE setNotificationState)
    50     Q_ENUMS(MessageState)
       
    51 
    50 
    52 public:
    51 public:
    53 
    52 
    54     /**
    53     /**
    55      * Constructor
    54      * Constructor
    64     virtual ~MsgConversationWidget();
    63     virtual ~MsgConversationWidget();
    65 
    64 
    66 public:
    65 public:
    67 
    66 
    68     /**
    67     /**
       
    68      * Enum defining Message Sending State
       
    69      * @attention This enum can have values from 0 to 255 only.
       
    70      */
       
    71     enum SendingState
       
    72     {
       
    73         Unknown = 0x00, Sent = 0x01, Sending = 0x02, Pending = 0x03, Failed = 0x04
       
    74     };
       
    75 
       
    76     /**
    69      * Set subject for this widget
    77      * Set subject for this widget
    70      * @param QString
    78      * @param QString
    71      */
    79      */
    72     void setSubject(const QString &subject);
    80     void setSubject(const QString &subject);
    73 
    81 
    79 
    87 
    80     /**
    88     /**
    81      * Set preview icon path for this widget
    89      * Set preview icon path for this widget
    82      * @param QString
    90      * @param QString
    83      */
    91      */
    84     void setPreviewIconPath(const QString &previewPath);
    92     void setPreviewIconPath(const QString& filePath,int msgId);
    85 
    93 
    86     /**
    94     /**
    87      * Set priority property
    95      * Set priority property
    88      * @param priority Set high/low/normal priority
    96      * @param priority Set high/low/normal priority
    89      * @attention Pass high/low/normal priority to this function.
    97      * @attention Pass high/low/normal priority to this function.
   208     /**
   216     /**
   209      * Get to find if this widget is of type MMS Notification
   217      * Get to find if this widget is of type MMS Notification
   210      * @return bool
   218      * @return bool
   211      */
   219      */
   212     bool isMMSNotification();
   220     bool isMMSNotification();
   213     
   221 
   214     /**
   222     /**
   215      * Set the sending state.
   223      * Set the sending state.
   216      * Maps ConvergedMessage::SendingState to MessageState.
   224      * Maps ConvergedMessage::SendingState to MessageState.
   217      * @see ConvergedMessage::SendingState
   225      * @see ConvergedMessage::SendingState
   218      */
   226      */
   220 
   228 
   221     /**
   229     /**
   222      * Returns the sending state.
   230      * Returns the sending state.
   223      * @return Returns one of the states from enum SendingState.
   231      * @return Returns one of the states from enum SendingState.
   224      */
   232      */
   225     int sendingState();
   233     SendingState sendingState();
   226 
   234 
   227     /**
   235     /**
   228      * Set the notification state.
   236      * Set the notification state.
   229      * Maps ConvergedMessage::NotificationState to MessageState.
   237      * Maps ConvergedMessage::NotificationState to MessageState.
   230      * @see ConvergedMessage::NotificationState
   238      * @see ConvergedMessage::NotificationState
   234     /**
   242     /**
   235      * Returns the notification state.
   243      * Returns the notification state.
   236      * @return Returns one of the states from enum NotificationState.
   244      * @return Returns one of the states from enum NotificationState.
   237      */
   245      */
   238     int notificationState();
   246     int notificationState();
   239     
   247 
   240     /**
   248     /**
   241      * Sets the Timestamp.
   249      * Sets the Timestamp.
   242      * @param timeStamp Timestamp to be set.
   250      * @param timeStamp Timestamp to be set.
   243      */
   251      */
   244     void setTimeStamp(const QString &timeStamp);
   252     void setTimeStamp(const QString &timeStamp);
   262      * Function to receive item pressed events.
   270      * Function to receive item pressed events.
   263      * @see MsgConversationViewItem::pressStateChanged
   271      * @see MsgConversationViewItem::pressStateChanged
   264      */
   272      */
   265     void pressStateChanged(bool pressed, bool animate);
   273     void pressStateChanged(bool pressed, bool animate);
   266 
   274 
       
   275 	/**
       
   276      * Function to reset widget items.
       
   277      */
       
   278     void resetProperties();
       
   279 
       
   280 	/**
       
   281      * Function to repolish the widget
       
   282      */
       
   283     void repolishWidget();
       
   284 
   267 private:
   285 private:
   268 
   286 
   269     /**
   287     /**
   270      * Initialize the widget.
   288      * Initialize the widget.
   271      */
   289      */
   272     void init();
   290     void init();
   273 
   291 
   274 public:
   292 public:
   275 
   293 
   276     /**
       
   277      * Enum defining Message Sending State
       
   278      * @attention This enum can have values from 0 to 255 only.
       
   279      */
       
   280     enum MessageState
       
   281     {
       
   282         Unknown = 0x00,
       
   283         Sent = 0x01,
       
   284         Sending = 0x02,
       
   285         Pending = 0x03,
       
   286         Failed = 0x04
       
   287     };
       
   288     
       
   289     /**
   294     /**
   290      * Enum defining MMS Notification's Msg State
   295      * Enum defining MMS Notification's Msg State
   291      * These are added here so that notification state 
   296      * These are added here so that notification state 
   292      * can be used inside css in future
   297      * can be used inside css in future
   293      * @attention This enum can have values from 0 to 255 only
   298      * @attention This enum can have values from 0 to 255 only
   294      * Add any new states only at the bottom of this enum
   299      * Add any new states only at the bottom of this enum
   295      */
   300      */
   296     enum NotificationState
   301     enum NotificationState
   297         {
   302     {
   298         NotifUnknown = 0x00,
   303         NotifUnknown = 0x00,
   299         NotifReadyForFetching = 0x01,
   304         NotifReadyForFetching = 0x01,
   300         NotifRetrieving = 0x02,
   305         NotifRetrieving = 0x02,
   301         NotifExpired = 0x03,
   306         NotifExpired = 0x03,
   302         NotifFailed = 0x04, 
   307         NotifFailed = 0x04,
   303         };
   308     };
   304 
   309 
   305 private:
   310 private:
   306 
   311 
   307     /**
   312     /**
   308      * Info if message has attachment.
   313      * Info if message has attachment.
   353 
   358 
   354     /**
   359     /**
   355      * Holds info if this widget is MMS Notification
   360      * Holds info if this widget is MMS Notification
   356      */
   361      */
   357     bool mIsMMSNotification;
   362     bool mIsMMSNotification;
   358     
   363 
   359     /**
   364     /**
   360      * Info about message priority.
   365      * Info about message priority.
   361      * @attention Stores high/low/normal priority.
   366      * @attention Stores high/low/normal priority.
   362      * @see ConvergedMessage::Priority
   367      * @see ConvergedMessage::Priority
   363      */
   368      */
   364     int mPriority;
   369     int mPriority;
   365 
   370 
   366     /**
   371     /**
   367      * Holds sending state information.
   372      * Holds sending state information.
   368      */
   373      */
   369     int mSendingState;
   374     MsgConversationWidget::SendingState mSendingState;
   370 
   375 
   371     /**
   376     /**
   372      * Holds Notification state information.
   377      * Holds Notification state information.
   373      */
   378      */
   374     int mNotificationState;
   379     int mNotificationState;
   375     
   380 
   376     /**
   381     /**
   377      * Graphics Item to hold new message icon.
   382      * Graphics Item to hold new message icon.
   378      * Owned
   383      * Owned
   379      */
   384      */
   380     HbFrameItem *mNewFrameItem;
   385     HbFrameItem *mNewFrameItem;