author | hgs |
Fri, 15 Oct 2010 12:58:46 +0300 | |
changeset 78 | baacf668fe89 |
parent 76 | cfea66083b62 |
permissions | -rw-r--r-- |
37 | 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 |
||
19 |
#include <etelmm.h> |
|
20 |
#include <xqsysinfo.h> |
|
21 |
#include <xqsettingsmanager.h> |
|
22 |
#include <xqsettingskey.h> |
|
23 |
#include <e32base.h> |
|
24 |
#include <etelmm.h> |
|
25 |
#include <exterror.h> |
|
26 |
#include <gsmerror.h> |
|
27 |
#include <settingsinternalcrkeys.h> |
|
28 |
#include <LogsDomainCRKeys.h> |
|
29 |
#include <BTSapDomainPSKeys.h> |
|
30 |
#include <NumberGroupingCRKeys.h> |
|
31 |
#include <hbglobal.h> |
|
32 |
#include <CoreApplicationUIsSDKCRKeys.h> |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
33 |
#include <telephonyvariant.hrh> |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
34 |
#include <telinternalcrkeys.h> |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
35 |
#include <ctsydomainpskeys.h> |
37 | 36 |
#include "cptelephonyutilsdefs.h" |
37 |
#include "cpplugincommon.h" |
|
38 |
#include "cppluginlogging.h" |
|
39 |
||
40 |
const int CenrepKeyValueOff = 0; |
|
41 |
const int CenrepKeyValueOn = 1; |
|
42 |
||
43 |
const int SoftRejectTextDefault = 0; |
|
44 |
const int SoftRejectTextUserDefined = 1; |
|
45 |
||
46 |
/*! |
|
47 |
Tools::voipSupported |
|
48 |
*/ |
|
49 |
bool Tools::voipSupported() |
|
50 |
{ |
|
51 |
return XQSysInfo::isSupported(KFeatureIdCommonVoip); |
|
52 |
} |
|
53 |
||
54 |
/*! |
|
55 |
Tools::videoSupported |
|
56 |
*/ |
|
57 |
bool Tools::videoSupported() |
|
58 |
{ |
|
59 |
return XQSysInfo::isSupported(KFeatureIdCsVideoTelephony); |
|
60 |
} |
|
61 |
||
76 | 62 |
SettingsWrapper::SettingsWrapper(QObject *parent): |
50 | 63 |
QObject(parent), |
78 | 64 |
m_settings(NULL) |
37 | 65 |
{ |
50 | 66 |
m_settings = new XQSettingsManager(this); |
78 | 67 |
|
37 | 68 |
} |
69 |
||
76 | 70 |
SettingsWrapper::~SettingsWrapper() |
37 | 71 |
{ |
50 | 72 |
|
37 | 73 |
} |
74 |
||
76 | 75 |
bool SettingsWrapper::showCallDuration() |
37 | 76 |
{ |
77 |
bool showDuration; |
|
78 |
if (CenrepKeyValueOn == readCenrepValue(KCRUidLogs.iUid, KLogsShowCallDuration).toInt()) { |
|
79 |
showDuration = true; |
|
80 |
} else { |
|
81 |
showDuration = false; |
|
82 |
} |
|
83 |
||
84 |
DPRINT << "show call duration:" << showDuration; |
|
85 |
return showDuration; |
|
86 |
} |
|
87 |
||
76 | 88 |
int SettingsWrapper::setShowCallDuration(bool value) |
37 | 89 |
{ |
90 |
int cenrepValue; |
|
91 |
DPRINT << "show call duration:" << value; |
|
92 |
||
93 |
if (value) { |
|
94 |
cenrepValue = CenrepKeyValueOn; |
|
95 |
} else { |
|
96 |
cenrepValue = CenrepKeyValueOff; |
|
97 |
} |
|
98 |
return writeCenrepValue(KCRUidLogs.iUid, KLogsShowCallDuration, cenrepValue ); |
|
99 |
} |
|
100 |
||
76 | 101 |
int SettingsWrapper::readVtVideoSending() |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
102 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
103 |
DPRINT << ": IN"; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
104 |
return readCenrepValue(KCRUidTelephonySettings.iUid, KSettingsVTVideoSending).toInt(); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
105 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
106 |
|
76 | 107 |
int SettingsWrapper::writeVtVideoSending(int value) |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
108 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
109 |
DPRINT << ": IN"; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
110 |
return writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsVTVideoSending, value); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
111 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
112 |
|
76 | 113 |
void SettingsWrapper::readSoftRejectText(QString &text, bool &userDefined ) |
37 | 114 |
{ |
115 |
if (SoftRejectTextDefault == |
|
116 |
readCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectDefaultInUse ).toInt()) { |
|
117 |
userDefined = false; |
|
118 |
} else { |
|
119 |
userDefined = true; |
|
120 |
} |
|
121 |
||
122 |
text = readCenrepString(KCRUidTelephonySettings.iUid, KSettingsSoftRejectText); |
|
123 |
DPRINT << "text:" << text << " ,userDefined:" << userDefined; |
|
124 |
} |
|
125 |
||
76 | 126 |
int SettingsWrapper::writeSoftRejectText(const QString &text, bool userDefined ) |
37 | 127 |
{ |
128 |
int err = writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectText, text); |
|
129 |
int cenrepValue; |
|
130 |
if (userDefined) { |
|
131 |
cenrepValue = SoftRejectTextUserDefined; |
|
132 |
} else { |
|
133 |
cenrepValue = SoftRejectTextDefault; |
|
134 |
} |
|
135 |
err |= writeCenrepValue(KCRUidTelephonySettings.iUid, KSettingsSoftRejectDefaultInUse, cenrepValue); |
|
136 |
DPRINT << "text:" << text << " ,userDefined:" << userDefined << " , err:" << err; |
|
137 |
return err; |
|
138 |
} |
|
139 |
||
76 | 140 |
bool SettingsWrapper::numberGroupingSupported() const |
37 | 141 |
{ |
142 |
return readCenrepValue(KCRUidNumberGrouping.iUid, KNumberGrouping).toBool(); |
|
143 |
} |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
144 |
|
76 | 145 |
bool SettingsWrapper::forbiddenIconSupported() const |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
146 |
{ |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
147 |
int keyValue = readCenrepValue(KCRUidTelVariation.iUid, KTelVariationFlags).toInt(); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
148 |
return (KTelephonyLVFlagForbiddenIcon & keyValue); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
45
diff
changeset
|
149 |
} |
37 | 150 |
|
76 | 151 |
QVariant SettingsWrapper::readCenrepValue( |
37 | 152 |
const long int uid, const unsigned long int key) const |
153 |
{ |
|
154 |
XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key); |
|
50 | 155 |
QVariant ret = m_settings->readItemValue(settingsKey); |
37 | 156 |
DPRINT << "ret: " << ret; |
157 |
return ret; |
|
158 |
} |
|
159 |
||
76 | 160 |
QVariant SettingsWrapper::readPubSubValue( |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
161 |
const long int uid, const unsigned long int key) const |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
162 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
163 |
XQSettingsKey settingsKey(XQSettingsKey::TargetPublishAndSubscribe, uid, key); |
50 | 164 |
QVariant ret = m_settings->readItemValue(settingsKey); |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
165 |
DPRINT << "PubSub ret: " << ret; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
166 |
return ret; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
167 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
168 |
|
76 | 169 |
QString SettingsWrapper::readCenrepString( |
37 | 170 |
const long int uid, const unsigned long int key) const |
171 |
{ |
|
172 |
XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key); |
|
50 | 173 |
QString text = m_settings->readItemValue(settingsKey, XQSettingsManager::TypeString).toString(); |
37 | 174 |
DPRINT << "text: " << text; |
175 |
return text; |
|
176 |
} |
|
177 |
||
76 | 178 |
int SettingsWrapper::writeCenrepValue( |
37 | 179 |
const long int uid, const unsigned long int key, const QVariant &settingsKeyValue ) const |
180 |
{ |
|
181 |
DPRINT << "uid:" << uid << ", key:" << key << ", settingsKeyValue:" << settingsKeyValue; |
|
182 |
XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key); |
|
50 | 183 |
int err = m_settings->writeItemValue(settingsKey, settingsKeyValue ); |
37 | 184 |
DPRINT << "err: " << err; |
185 |
return err; |
|
186 |
} |
|
187 |
||
76 | 188 |
bool SettingsWrapper::isFeatureCallWaitingDistiquishNotProvisionedEnabled() |
37 | 189 |
{ |
190 |
bool enabled = readCenrepValue(KCRUidPhoneSettings.iUid, KPSetCallWaiting).toBool(); |
|
191 |
DPRINT << "enabled: " << enabled; |
|
192 |
return enabled; |
|
193 |
} |
|
194 |
||
76 | 195 |
bool SettingsWrapper::isPhoneOffline() const |
37 | 196 |
{ |
60 | 197 |
bool networkConnectionAllowed = readCenrepValue(KCRUidCoreApplicationUIs.iUid, |
198 |
KCoreAppUIsNetworkConnectionAllowed).toBool(); |
|
199 |
// 0 = Offline Mode, 1 = Online Mode |
|
200 |
DPRINT << "networkConnectionAllowed: " << networkConnectionAllowed; |
|
201 |
return !networkConnectionAllowed; |
|
37 | 202 |
} |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
203 |
|
76 | 204 |
bool SettingsWrapper::isOngoingCall() const |
45
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
205 |
{ |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
206 |
bool callOngoing(false); |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
207 |
if (EPSCTsyCallStateNone < |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
208 |
readPubSubValue(KPSUidCtsyCallInformation.iUid, KCTsyCallState).toInt()) { |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
209 |
callOngoing = true; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
210 |
} |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
211 |
return callOngoing; |
6b911d05207e
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
212 |
} |
78 | 213 |
|
214 |
bool SettingsWrapper::isConnectedToNetwork() const |
|
215 |
{ |
|
216 |
DPRINT << ": IN"; |
|
217 |
||
218 |
const QScopedPointer<QSystemNetworkInfo> networkInfo(new QSystemNetworkInfo); |
|
219 |
bool connected(false); |
|
220 |
||
221 |
QSystemNetworkInfo::NetworkStatus wcdmaStatus = |
|
222 |
networkInfo->networkStatus(QSystemNetworkInfo::WcdmaMode); |
|
223 |
QSystemNetworkInfo::NetworkStatus gsmStatus = |
|
224 |
networkInfo->networkStatus(QSystemNetworkInfo::GsmMode); |
|
225 |
||
226 |
if (QSystemNetworkInfo::Connected == wcdmaStatus || |
|
227 |
QSystemNetworkInfo::HomeNetwork == wcdmaStatus || |
|
228 |
QSystemNetworkInfo::Roaming == wcdmaStatus || |
|
229 |
QSystemNetworkInfo::Connected == gsmStatus || |
|
230 |
QSystemNetworkInfo::HomeNetwork == gsmStatus || |
|
231 |
QSystemNetworkInfo::Roaming == gsmStatus) { |
|
232 |
connected = true; |
|
233 |
} |
|
234 |
DPRINT << ": OUT " << connected; |
|
235 |
return connected; |
|
236 |
} |