31
|
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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <msgitem.h>
|
|
19 |
|
|
20 |
// ---------------------------------------------------------------------------
|
|
21 |
// Constructor.
|
|
22 |
// ---------------------------------------------------------------------------
|
|
23 |
MsgItem::MsgItem()
|
|
24 |
{
|
|
25 |
mAttributes = MsgAttributeNone;
|
|
26 |
}
|
|
27 |
|
|
28 |
// ---------------------------------------------------------------------------
|
|
29 |
// Destructor.
|
|
30 |
// ---------------------------------------------------------------------------
|
|
31 |
MsgItem::~MsgItem()
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
// ---------------------------------------------------------------------------
|
|
36 |
// MsgItem::id
|
|
37 |
//@ see header
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
int MsgItem::id() const
|
|
40 |
{
|
|
41 |
return mId;
|
|
42 |
}
|
|
43 |
|
|
44 |
// ---------------------------------------------------------------------------
|
|
45 |
// MsgItem::phoneNumber
|
|
46 |
//@ see header
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
QString MsgItem::phoneNumber() const
|
|
49 |
{
|
|
50 |
return mPhoneNumber;
|
|
51 |
}
|
|
52 |
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
// MsgItem::body
|
|
56 |
//@ see header
|
|
57 |
// ---------------------------------------------------------------------------
|
|
58 |
QString MsgItem::body() const
|
|
59 |
{
|
|
60 |
return mBody;
|
|
61 |
}
|
|
62 |
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
// MsgItem::timeStamp
|
|
65 |
//@ see header
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
QDateTime MsgItem::timeStamp() const
|
|
68 |
{
|
|
69 |
return mTime;
|
|
70 |
}
|
|
71 |
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
// MsgItem::type
|
|
74 |
//@ see header
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
MsgItem::MsgType MsgItem::type() const
|
|
77 |
{
|
|
78 |
return mType;
|
|
79 |
}
|
|
80 |
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
// MsgItem::direction
|
|
83 |
//@ see header
|
|
84 |
// ---------------------------------------------------------------------------
|
|
85 |
MsgItem::MsgDirection MsgItem::direction() const
|
|
86 |
{
|
|
87 |
return mDirection;
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// MsgItem::state
|
|
92 |
//@ see header
|
|
93 |
// ---------------------------------------------------------------------------
|
|
94 |
MsgItem::MsgState MsgItem::state() const
|
|
95 |
{
|
|
96 |
return mState;
|
|
97 |
}
|
|
98 |
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
// MsgItem::isAttributeSet
|
|
101 |
//@ see header
|
|
102 |
// ---------------------------------------------------------------------------
|
|
103 |
bool MsgItem::isAttributeSet
|
|
104 |
(MsgItem::MsgAttribute attribute) const
|
|
105 |
{
|
|
106 |
return (mAttributes & attribute );
|
|
107 |
}
|
|
108 |
|
|
109 |
// ---------------------------------------------------------------------------
|
|
110 |
// MsgItem::setId
|
|
111 |
//@ see header
|
|
112 |
// ---------------------------------------------------------------------------
|
|
113 |
void MsgItem::setId(int id)
|
|
114 |
{
|
|
115 |
mId = id;
|
|
116 |
}
|
|
117 |
|
|
118 |
// ---------------------------------------------------------------------------
|
|
119 |
// MsgItem::setPhoneNumber
|
|
120 |
//@ see header
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
void MsgItem::setPhoneNumber(const QString& number)
|
|
123 |
{
|
|
124 |
mPhoneNumber = number;
|
|
125 |
}
|
|
126 |
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
// MsgItem::setBody
|
|
129 |
//@ see header
|
|
130 |
// ---------------------------------------------------------------------------
|
|
131 |
void MsgItem::setBody(const QString& body)
|
|
132 |
{
|
|
133 |
mBody = body;
|
|
134 |
}
|
|
135 |
|
|
136 |
// ---------------------------------------------------------------------------
|
|
137 |
// MsgItem::setTimeStamp
|
|
138 |
//@ see header
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
void MsgItem::setTimeStamp(uint sec)
|
|
141 |
{
|
|
142 |
mTime.setTime_t(sec);
|
|
143 |
}
|
|
144 |
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
// MsgItem::setDirection
|
|
147 |
//@ see header
|
|
148 |
// ---------------------------------------------------------------------------
|
|
149 |
void MsgItem::setDirection(MsgItem::MsgDirection direction)
|
|
150 |
{
|
|
151 |
mDirection = direction;
|
|
152 |
}
|
|
153 |
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
// MsgItem::setType
|
|
156 |
//@ see header
|
|
157 |
// ---------------------------------------------------------------------------
|
|
158 |
void MsgItem::setType(MsgItem::MsgType type)
|
|
159 |
{
|
|
160 |
mType = type;
|
|
161 |
}
|
|
162 |
|
|
163 |
// ---------------------------------------------------------------------------
|
|
164 |
// MsgItem::setState
|
|
165 |
//@ see header
|
|
166 |
// ---------------------------------------------------------------------------
|
|
167 |
void MsgItem::setState(MsgItem::MsgState state)
|
|
168 |
{
|
|
169 |
mState = state;
|
|
170 |
}
|
|
171 |
|
|
172 |
// ---------------------------------------------------------------------------
|
|
173 |
// MsgItem::changeAttributes
|
|
174 |
//@ see header
|
|
175 |
// ---------------------------------------------------------------------------
|
|
176 |
void MsgItem::changeAttributes(quint16 setAttributes,
|
|
177 |
quint16 clearAttributes)
|
|
178 |
{
|
|
179 |
quint16 attribute = mAttributes;
|
|
180 |
attribute |= setAttributes;
|
|
181 |
attribute &= ~clearAttributes;
|
|
182 |
mAttributes = (MsgItem::MsgAttribute)attribute;
|
|
183 |
}
|