|
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 #include <QRunnable> |
|
23 #include <hbindicatorinterface.h> |
|
24 |
|
25 #include "msginfodefs.h" |
|
26 class MsgIndicatorPrivate; |
|
27 |
|
28 class ServiceRequestSenderTask : public QRunnable |
|
29 { |
|
30 public: |
|
31 /** |
|
32 * Constructor |
|
33 */ |
|
34 ServiceRequestSenderTask(qint64 conversationId); |
|
35 |
|
36 /** |
|
37 * Destructor |
|
38 */ |
|
39 ~ServiceRequestSenderTask(); |
|
40 |
|
41 /** |
|
42 * create and send service request |
|
43 */ |
|
44 void run(); |
|
45 |
|
46 private: |
|
47 qint64 mConvId; |
|
48 }; |
|
49 |
|
50 /** |
|
51 * Message indicator class. |
|
52 * Handles client request and showing the indications. |
|
53 */ |
|
54 class MsgIndicator : public HbIndicatorInterface |
|
55 { |
|
56 public: |
|
57 /** |
|
58 * Constructor |
|
59 */ |
|
60 MsgIndicator(const QString &indicatorType); |
|
61 |
|
62 /** |
|
63 * Destructor |
|
64 */ |
|
65 ~MsgIndicator(); |
|
66 |
|
67 /** |
|
68 * @see HbIndicatorInterface |
|
69 */ |
|
70 bool handleInteraction(InteractionType type); |
|
71 |
|
72 /** |
|
73 * @see HbIndicatorInterface |
|
74 */ |
|
75 QVariant indicatorData(int role) const; |
|
76 |
|
77 |
|
78 protected: |
|
79 /** |
|
80 * @see HbIndicatorInterface |
|
81 */ |
|
82 bool handleClientRequest(RequestType type, const QVariant ¶meter); |
|
83 |
|
84 private: |
|
85 /** |
|
86 * Prepares the display name from stream. |
|
87 * @param IindicatorData inidcator data. |
|
88 */ |
|
89 QString prepareDisplayName(MsgInfo& indicatorData) const; |
|
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 |
|
111 private: |
|
112 |
|
113 /** |
|
114 * Body text |
|
115 */ |
|
116 mutable QString mBodyText; |
|
117 |
|
118 /** |
|
119 * Conversation id |
|
120 */ |
|
121 mutable qint64 mConversationId; |
|
122 |
|
123 /** |
|
124 * Message type |
|
125 */ |
|
126 mutable int mMessageType; |
|
127 |
|
128 /** |
|
129 * Message from single or multiple contact |
|
130 */ |
|
131 mutable bool mConversationFromSingleContact; |
|
132 |
|
133 /** |
|
134 * Private implementaion object. |
|
135 * Owned. |
|
136 */ |
|
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; |
|
159 }; |
|
160 |
|
161 #endif // MSGINDICATOR_H |
|
162 |