|
1 /* |
|
2 * Copyright (c) 2010 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 "dialerwidgetengine.h" |
|
19 |
|
20 #include <logsdomaincrkeys.h> |
|
21 #include <logsservices.h> |
|
22 |
|
23 DialerWidgetEngine::DialerWidgetEngine(): |
|
24 m_missedCalls(-1) |
|
25 { |
|
26 } |
|
27 |
|
28 DialerWidgetEngine::~DialerWidgetEngine() |
|
29 { |
|
30 delete m_settingsManager; |
|
31 m_settingsManager = NULL; |
|
32 } |
|
33 |
|
34 bool DialerWidgetEngine::initialize() |
|
35 { |
|
36 #ifdef Q_OS_SYMBIAN |
|
37 m_settingsManager = new XQSettingsManager(this); |
|
38 if ( !m_settingsManager ){ |
|
39 return false; |
|
40 } |
|
41 XQSettingsKey settingsKey( XQSettingsKey::TargetCentralRepository, |
|
42 KCRUidLogs.iUid, KLogsNewMissedCalls ); |
|
43 |
|
44 if ( !connect( m_settingsManager, |
|
45 SIGNAL( valueChanged(const XQSettingsKey & ,const QVariant &)), |
|
46 this, SLOT(valueChanged(XQSettingsKey, |
|
47 QVariant)))){ |
|
48 return false; |
|
49 } |
|
50 |
|
51 if(!m_settingsManager->startMonitoring( settingsKey )){ |
|
52 return false; |
|
53 } |
|
54 |
|
55 #endif |
|
56 return true; |
|
57 } |
|
58 |
|
59 void DialerWidgetEngine::valueChanged( |
|
60 const XQSettingsKey &key, |
|
61 const QVariant &value ) |
|
62 { |
|
63 if ( key.key() == (quint32)KLogsNewMissedCalls ){ |
|
64 m_missedCalls = value.toInt(); |
|
65 emit missedCallsCountChanged( m_missedCalls ); |
|
66 } |
|
67 } |
|
68 |
|
69 int DialerWidgetEngine::missedCallsCount() |
|
70 { |
|
71 return m_missedCalls; |
|
72 } |