|
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 FILES |
|
19 #include "logseventdata.h" |
|
20 #include "logsevent.h" |
|
21 #include "logseventdataparser.h" |
|
22 |
|
23 #include <QRegExp> |
|
24 #include <QRegExpValidator> |
|
25 |
|
26 // ---------------------------------------------------------------------------- |
|
27 // LogsEventData::LogsEventData |
|
28 // ---------------------------------------------------------------------------- |
|
29 // |
|
30 LogsEventData::LogsEventData() : |
|
31 mIsCNAP( false ), |
|
32 mIsVT( false ), |
|
33 mIsPoC( false ), |
|
34 mIsVoIP( false ), |
|
35 mIsEmerg( false ), |
|
36 mDataSent( 0 ), |
|
37 mDataReceived( 0 ), |
|
38 mMsgPartsNumber( 0 ), |
|
39 mServiceId( 0 ), |
|
40 mContactLocalId( 0 ), |
|
41 mRemoteUrl(), |
|
42 mLocalUrl() |
|
43 { |
|
44 } |
|
45 |
|
46 // ---------------------------------------------------------------------------- |
|
47 // LogsEventData::LogsEventData |
|
48 // ---------------------------------------------------------------------------- |
|
49 // |
|
50 LogsEventData::LogsEventData( const LogsEventData& data ) |
|
51 { |
|
52 mIsCNAP = data.mIsCNAP; |
|
53 mIsVT = data.mIsVT; |
|
54 mIsPoC = data.mIsPoC; |
|
55 mIsVoIP = data.mIsVoIP; |
|
56 mIsEmerg = data.mIsEmerg; |
|
57 mDataSent = data.mDataSent; |
|
58 mDataReceived = data.mDataReceived; |
|
59 mMsgPartsNumber = data.mMsgPartsNumber; |
|
60 mServiceId = data.mServiceId; |
|
61 mContactLocalId = data.mContactLocalId; |
|
62 mRemoteUrl = data.mRemoteUrl; |
|
63 mLocalUrl = data.mLocalUrl; |
|
64 } |
|
65 |
|
66 // ---------------------------------------------------------------------------- |
|
67 // LogsEventData::~LogsEventData |
|
68 // ---------------------------------------------------------------------------- |
|
69 // |
|
70 LogsEventData::~LogsEventData() |
|
71 { |
|
72 } |
|
73 |
|
74 // ---------------------------------------------------------------------------- |
|
75 // LogsEventData::parse |
|
76 // ---------------------------------------------------------------------------- |
|
77 // |
|
78 int LogsEventData::parse( const CLogEvent& source ) |
|
79 { |
|
80 return LogsEventDataParser::parse(source, *this); |
|
81 } |
|
82 |
|
83 // ---------------------------------------------------------------------------- |
|
84 // LogsEventData::isCNAP |
|
85 // ---------------------------------------------------------------------------- |
|
86 // |
|
87 bool LogsEventData::isCNAP() const |
|
88 { |
|
89 return mIsCNAP; |
|
90 } |
|
91 |
|
92 // ---------------------------------------------------------------------------- |
|
93 // LogsEventData::isVT |
|
94 // ---------------------------------------------------------------------------- |
|
95 // |
|
96 bool LogsEventData::isVT() const |
|
97 { |
|
98 return mIsVT; |
|
99 } |
|
100 |
|
101 // ---------------------------------------------------------------------------- |
|
102 // LogsEventData::isPoC |
|
103 // ---------------------------------------------------------------------------- |
|
104 // |
|
105 bool LogsEventData::isPoC() const |
|
106 { |
|
107 return mIsPoC; |
|
108 } |
|
109 |
|
110 // ---------------------------------------------------------------------------- |
|
111 // LogsEventData::isVoIP |
|
112 // ---------------------------------------------------------------------------- |
|
113 // |
|
114 bool LogsEventData::isVoIP() const |
|
115 { |
|
116 return mIsVoIP; |
|
117 } |
|
118 |
|
119 // ---------------------------------------------------------------------------- |
|
120 // LogsEventData::dataReceived |
|
121 // ---------------------------------------------------------------------------- |
|
122 // |
|
123 long long LogsEventData::dataReceived() const |
|
124 { |
|
125 return mDataReceived; |
|
126 } |
|
127 |
|
128 // ---------------------------------------------------------------------------- |
|
129 // LogsEventData::dataSent |
|
130 // ---------------------------------------------------------------------------- |
|
131 // |
|
132 long long LogsEventData::dataSent() const |
|
133 { |
|
134 return mDataSent; |
|
135 } |
|
136 |
|
137 // ---------------------------------------------------------------------------- |
|
138 // LogsEventData::isEmerg |
|
139 // ---------------------------------------------------------------------------- |
|
140 // |
|
141 bool LogsEventData::isEmerg() const |
|
142 { |
|
143 return mIsEmerg; |
|
144 } |
|
145 |
|
146 // ---------------------------------------------------------------------------- |
|
147 // LogsEventData::MsgPartsNumber |
|
148 // |
|
149 // Msg parts. This info is meaningful only for sms events |
|
150 // ---------------------------------------------------------------------------- |
|
151 // |
|
152 int LogsEventData::msgPartsNumber() const |
|
153 { |
|
154 return mMsgPartsNumber; |
|
155 } |
|
156 |
|
157 // ---------------------------------------------------------------------------- |
|
158 // LogsEventData::ServiceId |
|
159 // |
|
160 // Returns the Service ID of the log event. |
|
161 // ---------------------------------------------------------------------------- |
|
162 // |
|
163 unsigned int LogsEventData::serviceId() const |
|
164 { |
|
165 return mServiceId; |
|
166 } |
|
167 |
|
168 // ---------------------------------------------------------------------------- |
|
169 // |
|
170 // ---------------------------------------------------------------------------- |
|
171 // |
|
172 QString LogsEventData::remoteUrl() const |
|
173 { |
|
174 return mRemoteUrl; |
|
175 } |
|
176 |
|
177 // ---------------------------------------------------------------------------- |
|
178 // |
|
179 // ---------------------------------------------------------------------------- |
|
180 // |
|
181 QString LogsEventData::localUrl() const |
|
182 { |
|
183 return mLocalUrl; |
|
184 } |
|
185 |
|
186 // ---------------------------------------------------------------------------- |
|
187 // Checks whether event data can be used in CS context |
|
188 // ---------------------------------------------------------------------------- |
|
189 // |
|
190 bool LogsEventData::isCsCompatible() |
|
191 { |
|
192 bool compatible( true ); |
|
193 if ( !mRemoteUrl.isEmpty() ){ |
|
194 // Url can start with plus but after that can contain only digits |
|
195 // to be CS compatible. |
|
196 QRegExp rx( "\\+{0,1}\\d*$" ); |
|
197 QRegExpValidator validator(rx, 0); |
|
198 int pos( 0 ); |
|
199 compatible = ( validator.validate( mRemoteUrl, pos ) == QValidator::Acceptable ); |
|
200 } |
|
201 return compatible; |
|
202 } |
|
203 |
|
204 |
|
205 // ---------------------------------------------------------------------------- |
|
206 // LogsEventData::contactLocalId |
|
207 // ---------------------------------------------------------------------------- |
|
208 // |
|
209 unsigned int LogsEventData::contactLocalId() const |
|
210 { |
|
211 return mContactLocalId; |
|
212 } |
|
213 |
|
214 // ---------------------------------------------------------------------------- |
|
215 // LogsEvent::setContactLocalId |
|
216 // ---------------------------------------------------------------------------- |
|
217 // |
|
218 void LogsEventData::setContactLocalId(unsigned int id) |
|
219 { |
|
220 mContactLocalId = id; |
|
221 } |