20 #include "logslogger.h" |
20 #include "logslogger.h" |
21 #include "logsconfigurationparams.h" |
21 #include "logsconfigurationparams.h" |
22 #include "logsengdefs.h" |
22 #include "logsengdefs.h" |
23 |
23 |
24 //SYSTEM |
24 //SYSTEM |
|
25 #include <xqsettingsmanager.h> |
25 #include <qcontactmanager.h> |
26 #include <qcontactmanager.h> |
26 |
27 #include <LogsDomainCRKeys.h> |
27 |
28 |
28 static LogsCommonData* mLogsCommonInstance = 0; |
29 static LogsCommonData* mLogsCommonInstance = 0; |
29 |
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // Telephony Configuration API |
|
34 // Keys under this category are used in defining telephony configuration. |
|
35 const TUid logsTelConfigurationCRUid = {0x102828B8}; |
|
36 |
|
37 // Amount of digits to be used in contact matching. |
|
38 // This allows a customer to variate the amount of digits to be matched. |
|
39 const TUint32 logsTelMatchDigits = 0x00000001; |
|
40 |
|
41 const int logsNotInitialized = -1; |
|
42 |
30 // ----------------------------------------------------------------------------- |
43 // ----------------------------------------------------------------------------- |
31 // |
44 // |
32 // ----------------------------------------------------------------------------- |
45 // ----------------------------------------------------------------------------- |
33 // |
46 // |
34 LogsCommonData::LogsCommonData() : |
47 LogsCommonData::LogsCommonData() : |
35 mContactManager(0), mMaxReadSize(-1), |
48 mContactManager(0), mMaxReadSize(-1), |
36 mMaxReadSizeDir(LogsEvent::DirUndefined), mMatchLen(logsDefaultMatchLength) |
49 mMaxReadSizeDir(LogsEvent::DirUndefined), |
|
50 mSettingsManager(new XQSettingsManager()), |
|
51 mMatchLen(logsDefaultMatchLength), |
|
52 mPredictiveSearchStatus(logsNotInitialized) |
37 { |
53 { |
38 LOGS_QDEBUG( "logs [ENG] <-> LogsCommonData::LogsCommonData()" ) |
54 LOGS_QDEBUG( "logs [ENG] <-> LogsCommonData::LogsCommonData()" ) |
39 } |
55 } |
40 |
56 |
41 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
134 |
151 |
135 // ----------------------------------------------------------------------------- |
152 // ----------------------------------------------------------------------------- |
136 // |
153 // |
137 // ----------------------------------------------------------------------------- |
154 // ----------------------------------------------------------------------------- |
138 // |
155 // |
139 void LogsCommonData::setTelNumMatchLen(int matchLen) |
|
140 { |
|
141 mMatchLen = matchLen; |
|
142 } |
|
143 |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 int LogsCommonData::telNumMatchLen() const |
156 int LogsCommonData::telNumMatchLen() const |
149 { |
157 { |
150 return mMatchLen; |
158 return mMatchLen; |
151 } |
159 } |
152 |
160 |
|
161 |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 int LogsCommonData::predictiveSearchStatus() |
|
168 { |
|
169 if (mPredictiveSearchStatus == logsNotInitialized) { |
|
170 mPredictiveSearchStatus = getPredictiveSearchStatus(); |
|
171 } |
|
172 return mPredictiveSearchStatus; |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 int LogsCommonData::getPredictiveSearchStatus() |
|
180 { |
|
181 int status(logsNotInitialized); |
|
182 LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::getPredictiveSearchStatus()" ) |
|
183 XQSettingsKey key(XQSettingsKey::TargetCentralRepository, |
|
184 KCRUidLogs.iUid, |
|
185 KLogsPredictiveSearch); |
|
186 QVariant value = mSettingsManager->readItemValue(key, |
|
187 XQSettingsManager::TypeInt); |
|
188 if (!value.isNull()) { |
|
189 status = value.toInt(); |
|
190 } |
|
191 LOGS_QDEBUG_2( "logs [ENG] <- LogsCommonData::getPredictiveSearchStatus(), status: ", status ) |
|
192 return status; |
|
193 } |
|
194 |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 // ----------------------------------------------------------------------------- |
|
199 // |
|
200 int LogsCommonData::setPredictiveSearch(bool enabled) |
|
201 { |
|
202 int err(-1); |
|
203 LOGS_QDEBUG_2( "logs [ENG] -> LogsCommonData::setPredictiveSearch(), enabled: ", enabled ) |
|
204 if (predictiveSearchStatus() != 0) { |
|
205 XQSettingsKey key(XQSettingsKey::TargetCentralRepository, |
|
206 KCRUidLogs.iUid, |
|
207 KLogsPredictiveSearch); |
|
208 int value = enabled ? 1 : 2; |
|
209 if (mSettingsManager->writeItemValue(key, QVariant(value))) { |
|
210 err = 0; |
|
211 mPredictiveSearchStatus = value; |
|
212 } |
|
213 } |
|
214 LOGS_QDEBUG_2( "logs [ENG] <- LogsCommonData::setPredictiveSearch(), err: ", err ) |
|
215 return err; |
|
216 } |
|
217 |
|
218 // ----------------------------------------------------------------------------- |
|
219 // |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 int LogsCommonData::clearMissedCallsCounter() |
|
223 { |
|
224 int err(-1); |
|
225 XQSettingsKey key(XQSettingsKey::TargetCentralRepository, |
|
226 KCRUidLogs.iUid, |
|
227 KLogsNewMissedCalls); |
|
228 QVariant value = mSettingsManager->readItemValue( |
|
229 key, XQSettingsManager::TypeInt); |
|
230 if (!value.isNull()) { |
|
231 err = 0; |
|
232 if (value.toInt() > 0) { |
|
233 err = mSettingsManager->writeItemValue(key, 0) ? 0 : -1; |
|
234 } |
|
235 } |
|
236 return err; |
|
237 } |
|
238 |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 // ----------------------------------------------------------------------------- |
|
242 // |
|
243 bool LogsCommonData::getTelNumMatchLen(int& matchLen) |
|
244 { |
|
245 bool ok(false); |
|
246 //use local manager, since normally this function is called only once, |
|
247 //after that we can clean related cenrep handler resources |
|
248 XQSettingsManager manager; |
|
249 XQSettingsKey key(XQSettingsKey::TargetCentralRepository, |
|
250 logsTelConfigurationCRUid.iUid, |
|
251 logsTelMatchDigits); |
|
252 QVariant value = manager.readItemValue( |
|
253 key, XQSettingsManager::TypeInt); |
|
254 if (!value.isNull()) { |
|
255 matchLen = value.toInt(); |
|
256 mMatchLen = matchLen; |
|
257 ok = true; |
|
258 } |
|
259 return ok; |
|
260 } |
|
261 |
153 // End of file |
262 // End of file |
154 |
263 |