31
|
1 |
/*
|
|
2 |
* Copyright (c) 2007 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: Object for a message item in history.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __MSG_ITEM_H__
|
|
19 |
#define __MSG_ITEM_H__
|
|
20 |
|
|
21 |
#include "msghistorydefines.h"
|
|
22 |
|
|
23 |
#include <QDateTime>
|
|
24 |
#include <QString>
|
|
25 |
|
|
26 |
/**
|
|
27 |
* Message Item in history.
|
|
28 |
*/
|
|
29 |
class MSG_HISTORY_EXPORT MsgItem
|
|
30 |
{
|
|
31 |
public:
|
|
32 |
/**
|
|
33 |
* Message direction
|
|
34 |
*/
|
|
35 |
enum MsgDirection {
|
|
36 |
MsgDirectionIncoming = 0,
|
|
37 |
MsgDirectionOutgoing,
|
|
38 |
ECsDirectionMissed,
|
|
39 |
ECsDirectionUnknown
|
|
40 |
};
|
|
41 |
|
|
42 |
/**
|
|
43 |
* Message type
|
|
44 |
*/
|
|
45 |
enum MsgType {
|
|
46 |
MsgTypeSMS = 0,
|
|
47 |
MsgTypeMMS,
|
|
48 |
MsgTypeMmsNotification,
|
|
49 |
MsgTypeAudio,
|
|
50 |
MsgTypeBioMsg,
|
|
51 |
MsgTypeBlueTooth,
|
|
52 |
MsgTypeRingingTone,
|
|
53 |
MsgTypeProvisioning,
|
|
54 |
MsgTypeUnknown
|
|
55 |
};
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Message state
|
|
59 |
*/
|
|
60 |
enum MsgState {
|
|
61 |
MsgStateUnknown = 0,
|
|
62 |
MsgStateUponRequest,
|
|
63 |
MsgStateWaiting,
|
|
64 |
MsgStateSending,
|
|
65 |
MsgStateScheduled,
|
|
66 |
MsgStateResend,
|
|
67 |
MsgStateSuspended,
|
|
68 |
MsgStateFailed,
|
|
69 |
MsgStateSent,
|
|
70 |
MsgStateNotApplicable
|
|
71 |
};
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Message attribute
|
|
75 |
*/
|
|
76 |
enum MsgAttribute {
|
|
77 |
MsgAttributeNone = 0x0000, // None
|
|
78 |
MsgAttributeNew = 0x0001, // New message
|
|
79 |
MsgAttributeDraft = 0x0002, // Draft message
|
|
80 |
MsgAttributeAttachment = 0x0004, // Attachment present
|
|
81 |
MsgAttributeHighPriority = 0x0008, // Priority high
|
|
82 |
MsgAttributeLowPriority = 0x0010, // Low high
|
|
83 |
MsgAttributeUnread = 0x0020, // Unread
|
|
84 |
MsgAttributeSent = 0x0040 // Sent message
|
|
85 |
};
|
|
86 |
|
|
87 |
public: // member functions
|
|
88 |
/*
|
|
89 |
* Constructor
|
|
90 |
*/
|
|
91 |
MsgItem();
|
|
92 |
|
|
93 |
/*
|
|
94 |
* Destructor
|
|
95 |
*/
|
|
96 |
virtual ~MsgItem();
|
|
97 |
|
|
98 |
/*
|
|
99 |
* get messgae id
|
|
100 |
* @return message id.
|
|
101 |
*/
|
|
102 |
int id() const;
|
|
103 |
|
|
104 |
/*
|
|
105 |
* phoneNumber
|
|
106 |
* @return phone number.
|
|
107 |
*/
|
|
108 |
QString phoneNumber() const;
|
|
109 |
|
|
110 |
/*
|
|
111 |
* body
|
|
112 |
* @return message body text.
|
|
113 |
*/
|
|
114 |
QString body() const;
|
|
115 |
|
|
116 |
/*
|
|
117 |
* timeStamp
|
|
118 |
*@return QDateTime
|
|
119 |
*/
|
|
120 |
QDateTime timeStamp() const;
|
|
121 |
|
|
122 |
/*
|
|
123 |
* direction
|
|
124 |
* @return MsgDirection
|
|
125 |
*/
|
|
126 |
MsgDirection direction() const;
|
|
127 |
|
|
128 |
/*
|
|
129 |
* type
|
|
130 |
* @return MsgType
|
|
131 |
*/
|
|
132 |
MsgType type() const;
|
|
133 |
|
|
134 |
/*
|
|
135 |
* state
|
|
136 |
* @return MsgState
|
|
137 |
*/
|
|
138 |
MsgState state() const;
|
|
139 |
|
|
140 |
/*
|
|
141 |
* isAttributeSet
|
|
142 |
* @return true, if set
|
|
143 |
*/
|
|
144 |
bool isAttributeSet(MsgAttribute attribute) const;
|
|
145 |
|
|
146 |
/*
|
|
147 |
* setId
|
|
148 |
* @param id, message id
|
|
149 |
*/
|
|
150 |
void setId(int id);
|
|
151 |
|
|
152 |
/*
|
|
153 |
* setPhoneNumber
|
|
154 |
* @param number, QString
|
|
155 |
*/
|
|
156 |
void setPhoneNumber(const QString& number);
|
|
157 |
|
|
158 |
/*
|
|
159 |
* setBody
|
|
160 |
* @param body, QString
|
|
161 |
*/
|
|
162 |
void setBody(const QString& body);
|
|
163 |
|
|
164 |
/*
|
|
165 |
* setTimeStamp
|
|
166 |
* @param sec, time in secs
|
|
167 |
*/
|
|
168 |
void setTimeStamp(uint sec);
|
|
169 |
|
|
170 |
/*
|
|
171 |
* setDirection
|
|
172 |
* @param direction, MsgDirection
|
|
173 |
*/
|
|
174 |
void setDirection(MsgDirection direction);
|
|
175 |
|
|
176 |
/*
|
|
177 |
* setType
|
|
178 |
* @param, MsgType
|
|
179 |
*/
|
|
180 |
void setType(MsgType type);
|
|
181 |
|
|
182 |
/*
|
|
183 |
* setState
|
|
184 |
* @param state ,MsgState
|
|
185 |
*/
|
|
186 |
void setState(MsgState state);
|
|
187 |
|
|
188 |
/*
|
|
189 |
* changeAttributes
|
|
190 |
* @param setAttributes, attribute to be set
|
|
191 |
* @param clearAttributes, attribute to be reset
|
|
192 |
*/
|
|
193 |
void changeAttributes
|
|
194 |
(quint16 setAttributes, quint16 clearAttributes = MsgAttributeNone);
|
|
195 |
|
|
196 |
private: // data members
|
|
197 |
|
|
198 |
/*
|
|
199 |
* message time stamp
|
|
200 |
*/
|
|
201 |
QDateTime mTime;
|
|
202 |
|
|
203 |
/*
|
|
204 |
* phone number
|
|
205 |
*/
|
|
206 |
QString mPhoneNumber;
|
|
207 |
|
|
208 |
/*
|
|
209 |
* message body
|
|
210 |
*/
|
|
211 |
QString mBody;
|
|
212 |
|
|
213 |
/*
|
|
214 |
* Msg direction
|
|
215 |
*/
|
|
216 |
MsgDirection mDirection;
|
|
217 |
|
|
218 |
/*
|
|
219 |
* mesage type
|
|
220 |
*/
|
|
221 |
MsgType mType;
|
|
222 |
|
|
223 |
/*
|
|
224 |
* message state
|
|
225 |
*/
|
|
226 |
MsgState mState;
|
|
227 |
|
|
228 |
/*
|
|
229 |
* message attributes
|
|
230 |
*/
|
|
231 |
MsgAttribute mAttributes;
|
|
232 |
|
|
233 |
/*
|
|
234 |
* message id
|
|
235 |
*/
|
|
236 |
int mId;
|
|
237 |
};
|
|
238 |
|
|
239 |
#endif // __MSG_ITEM_H__
|