messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicator.h
changeset 23 238255e8b033
child 25 84d9eb65b26f
equal deleted inserted replaced
5:4697dfb2d7ad 23:238255e8b033
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: Message Indicator class
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef MSGINDICATOR_H
       
    19 #define MSGINDICATOR_H
       
    20 
       
    21 #include <QObject>
       
    22 
       
    23 #include <hbindicatorinterface.h>
       
    24 
       
    25 class MsgIndicatorPrivate;
       
    26 
       
    27 /**
       
    28  * Utility class used pass indication data 
       
    29  * from private to Qt- class.
       
    30  */
       
    31 class IndicatorData
       
    32     {
       
    33 public:
       
    34     /**
       
    35      * Constructor
       
    36      */
       
    37     IndicatorData():mFromSingle(false),
       
    38     mConversationId(-1),
       
    39     mUnreadMsgCount(0){};
       
    40     
       
    41     /**
       
    42      * Message from single contact or many
       
    43      */
       
    44     bool mFromSingle; 
       
    45     
       
    46     /**
       
    47      * Conversation id
       
    48      */
       
    49     int mConversationId; 
       
    50     
       
    51     /**
       
    52      * Unread message count
       
    53      */
       
    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 
       
    82 /**
       
    83  * Message indicator class. 
       
    84  * Handles client request and showing the indications. 
       
    85  */
       
    86 class MsgIndicator : public HbIndicatorInterface
       
    87 {
       
    88 public:
       
    89     /**
       
    90      * Constructor
       
    91      */
       
    92     MsgIndicator(const QString &indicatorType);
       
    93     
       
    94     /**
       
    95      * Destructor
       
    96      */
       
    97     ~MsgIndicator();
       
    98     
       
    99     /**
       
   100      * @see HbIndicatorInterface
       
   101      */
       
   102     bool handleInteraction(InteractionType type);
       
   103     
       
   104     /**
       
   105      * @see HbIndicatorInterface
       
   106      */
       
   107     QVariant indicatorData(int role) const;
       
   108     
       
   109 protected:
       
   110     /**
       
   111      * @see HbIndicatorInterface
       
   112      */
       
   113     bool handleClientRequest(RequestType type, const QVariant &parameter);
       
   114     
       
   115 private: 
       
   116     /**
       
   117      * Prepares the display name from stream.
       
   118      * @param IindicatorData inidcator data.
       
   119      */
       
   120     QString prepareDisplayName(IndicatorData& indicatorData) const;
       
   121     
       
   122 private:
       
   123     
       
   124     /**
       
   125      * Body text
       
   126      */
       
   127     mutable QString mBodyText;
       
   128     
       
   129     /**
       
   130      * Conversation id
       
   131      */
       
   132     mutable qint64 mConversationId;
       
   133     
       
   134     /**
       
   135      * Message from single or multiple contact
       
   136      */
       
   137     mutable bool mConversationFromSingleContact;
       
   138     
       
   139     /**
       
   140      * Private implementaion object.
       
   141      * Owned.
       
   142      */
       
   143     MsgIndicatorPrivate* d_ptr;
       
   144 };
       
   145 
       
   146 #endif // MSGINDICATOR_H
       
   147