messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator.h
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 47 5b14749788d7
child 62 fdbe8253b596
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
    17 
    17 
    18 #ifndef MSGINDICATOR_H
    18 #ifndef MSGINDICATOR_H
    19 #define MSGINDICATOR_H
    19 #define MSGINDICATOR_H
    20 
    20 
    21 #include <QObject>
    21 #include <QObject>
    22 
    22 #include <QRunnable>
    23 #include <hbindicatorinterface.h>
    23 #include <hbindicatorinterface.h>
    24 
    24 
       
    25 #include "msginfodefs.h"
    25 class MsgIndicatorPrivate;
    26 class MsgIndicatorPrivate;
    26 
    27 
    27 /**
    28 class ServiceRequestSenderTask : public QRunnable
    28  * Utility class used pass indication data 
    29 {
    29  * from private to Qt- class.
       
    30  */
       
    31 class IndicatorData
       
    32     {
       
    33 public:
    30 public:
    34     /**
    31     /**
    35      * Constructor
    32      * Constructor
    36      */
    33      */
    37     IndicatorData():mFromSingle(false),
    34     ServiceRequestSenderTask(qint64 conversationId);
    38     mConversationId(-1),
       
    39     mUnreadMsgCount(0){};
       
    40     
    35     
    41     /**
    36     /**
    42      * Message from single contact or many
    37      * Destructor
    43      */
    38      */
    44     bool mFromSingle; 
    39     ~ServiceRequestSenderTask();
    45     
    40      
    46     /**
    41     /**
    47      * Conversation id
    42      * create and send service request
    48      */
    43      */
    49     int mConversationId; 
    44      void run();
    50     
    45 
    51     /**
    46 private: 
    52      * Unread message count
    47      qint64 mConvId;
    53      */
    48 };
    54     int mUnreadMsgCount;
       
    55     
       
    56     /**
       
    57      * First name
       
    58      */
       
    59     QString mFirstName; 
       
    60     
       
    61     /**
       
    62      * Last name
       
    63      */
       
    64     QString mLastName; 
       
    65     
       
    66     /**
       
    67      * Nick name
       
    68      */
       
    69     QString mNickName; 
       
    70     
       
    71     /**
       
    72      * Phone number
       
    73      */
       
    74     QString mContactNum; 
       
    75     
       
    76     /**
       
    77      * Description
       
    78      */
       
    79     QString mDescription;
       
    80     };
       
    81 
    49 
    82 /**
    50 /**
    83  * Message indicator class. 
    51  * Message indicator class. 
    84  * Handles client request and showing the indications. 
    52  * Handles client request and showing the indications. 
    85  */
    53  */
   103     
    71     
   104     /**
    72     /**
   105      * @see HbIndicatorInterface
    73      * @see HbIndicatorInterface
   106      */
    74      */
   107     QVariant indicatorData(int role) const;
    75     QVariant indicatorData(int role) const;
       
    76 
   108     
    77     
   109 protected:
    78 protected:
   110     /**
    79     /**
   111      * @see HbIndicatorInterface
    80      * @see HbIndicatorInterface
   112      */
    81      */
   115 private: 
    84 private: 
   116     /**
    85     /**
   117      * Prepares the display name from stream.
    86      * Prepares the display name from stream.
   118      * @param IindicatorData inidcator data.
    87      * @param IindicatorData inidcator data.
   119      */
    88      */
   120     QString prepareDisplayName(IndicatorData& indicatorData) const;
    89     QString prepareDisplayName(MsgInfo& indicatorData) const;
   121     
    90     
       
    91     /**
       
    92      * Gets the primary text for an indicator type
       
    93      * @param data MsgInfo the message information.
       
    94      * @return QString the primary text
       
    95      */
       
    96     QString getPrimaryText(MsgInfo& data);
       
    97 
       
    98     /**
       
    99      * Gets the primary text for unread messages
       
   100      * @param data MsgInfo the message information.
       
   101      */
       
   102     QString getUnreadPrimaryText(MsgInfo& data);
       
   103     
       
   104     /**
       
   105      * Get the secondary Text for messages.
       
   106      * @param type The type of the indicator
       
   107      * @return QString the secondary text
       
   108      */
       
   109     QString getSecondaryText(MsgInfo& info);
       
   110 
   122 private:
   111 private:
   123     
   112     
   124     /**
   113     /**
   125      * Body text
   114      * Body text
   126      */
   115      */
   130      * Conversation id
   119      * Conversation id
   131      */
   120      */
   132     mutable qint64 mConversationId;
   121     mutable qint64 mConversationId;
   133     
   122     
   134     /**
   123     /**
       
   124      * Message type
       
   125      */
       
   126     mutable int mMessageType;
       
   127 
       
   128     /**
   135      * Message from single or multiple contact
   129      * Message from single or multiple contact
   136      */
   130      */
   137     mutable bool mConversationFromSingleContact;
   131     mutable bool mConversationFromSingleContact;
   138     
   132     
   139     /**
   133     /**
   140      * Private implementaion object.
   134      * Private implementaion object.
   141      * Owned.
   135      * Owned.
   142      */
   136      */
   143     MsgIndicatorPrivate* d_ptr;
   137     MsgIndicatorPrivate* d_ptr;
       
   138    
       
   139     /**
       
   140      * Primary Text
       
   141      * 
       
   142      */
       
   143     QString mPrimaryText;
       
   144     
       
   145     /**
       
   146      * Secondary Text
       
   147      */
       
   148     QString mSecondaryText;
       
   149     
       
   150     /**
       
   151      * Number of messages
       
   152      */    
       
   153     int mCount;
       
   154     
       
   155     /**
       
   156      * Indicator type
       
   157      */
       
   158     int mIndicatorType;
   144 };
   159 };
   145 
   160 
   146 #endif // MSGINDICATOR_H
   161 #endif // MSGINDICATOR_H
   147 
   162