|
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 <xqsysinfo.h> |
|
19 #include <xqsettingsmanager.h> |
|
20 #include <xqsettingskey.h> |
|
21 #include <BTSapDomainPSKeys.h> |
|
22 #include <settingsinternalcrkeys.h> |
|
23 #include <CoreApplicationUIsSDKCRKeys.h> |
|
24 #include <NumberGroupingCRKeys.h> |
|
25 |
|
26 #include <etelmm.h> |
|
27 #include <exterror.h> |
|
28 #include <gsmerror.h> |
|
29 |
|
30 #include <hbglobal.h> |
|
31 #include "psuiutils.h" |
|
32 #include "psuilogging.h" |
|
33 |
|
34 /*! |
|
35 PsUiTools::errorCodeTextMapping. |
|
36 */ |
|
37 bool PsUiUtils::errorCodeTextMapping(const int errorcode, QString &errorText) |
|
38 { |
|
39 DPRINT; |
|
40 errorText.clear(); |
|
41 bool errorTextFound(true); |
|
42 |
|
43 switch(errorcode){ |
|
44 case KErrGsmSSSubscriptionViolation: |
|
45 errorText = hbTrId("txt_phone_info_barring_operation_not_successful"); |
|
46 break; |
|
47 case KErrGsmSSUnknownSubscriber: |
|
48 case KErrGsmSSAbsentSubscriber: |
|
49 case KErrGsmSSIllegalOperation: |
|
50 case KErrGsmSSIllegalSubscriber: |
|
51 case KErrGsmSSIllegalEquipment: |
|
52 case KErrGsmSSCallBarred: |
|
53 case KErrGsmSSDataMissing: |
|
54 errorText = hbTrId("txt_phone_info_not_allowed"); |
|
55 break; |
|
56 case KErrGsmSSIncompatibility: |
|
57 errorText = hbTrId("txt_phone_info_conflict_error"); |
|
58 break; |
|
59 case KErrGsmSSSystemFailure: |
|
60 errorText = hbTrId("txt_phone_info_result_unknown"); |
|
61 break; |
|
62 case KErrGsmSSUnexpectedDataValue: |
|
63 case KErrGsmSSResourcesUnavailable: |
|
64 errorText = hbTrId("txt_phone_info_request_rejected"); |
|
65 break; |
|
66 case KErrGsmSSNegativePasswordCheck: |
|
67 case KErrGsmSSPasswordRegistrationFailure: |
|
68 errorText = hbTrId("Password error"); |
|
69 break; |
|
70 case KErrGsmSSPasswordAttemptsViolation: |
|
71 errorText = hbTrId("txt_phone_info_barring_password_blocked"); |
|
72 break; |
|
73 case KErrGsmSMSNoNetworkService: |
|
74 case KErrGsmNoService: |
|
75 errorText = hbTrId("No network coverage"); |
|
76 break; |
|
77 case KErrSsActivationDataLost: |
|
78 errorText = hbTrId("Check network services"); |
|
79 break; |
|
80 case KErrGsmOfflineOpNotAllowed: |
|
81 if(XQSysInfo::isSupported(KFeatureIdOfflineMode)){ |
|
82 XQSettingsManager *xqsettingsManager = new XQSettingsManager(); |
|
83 XQSettingsKey key(XQSettingsKey::TargetPublishAndSubscribe, |
|
84 KPSUidBluetoothSapConnectionState.iUid, |
|
85 KBTSapConnectionState); |
|
86 QVariant startupValue = xqsettingsManager->readItemValue(key); |
|
87 int value = startupValue.toInt(); |
|
88 delete xqsettingsManager; |
|
89 xqsettingsManager = NULL; |
|
90 if (value == EBTSapConnected){ |
|
91 errorText = hbTrId("Operation not possible in SIM access profile mode"); |
|
92 } else { |
|
93 errorText = hbTrId("Operation not possible in Off-line mode"); |
|
94 } |
|
95 } else { |
|
96 errorText = hbTrId("txt_phone_info_request_not_completed"); |
|
97 } |
|
98 |
|
99 break; |
|
100 case KErrGsmSSUnknownAlphabet: |
|
101 errorText = hbTrId("txt_phone_info_invalid_phone_number"); |
|
102 break; |
|
103 default: |
|
104 errorText = hbTrId("txt_phone_info_request_not_completed"); |
|
105 break; |
|
106 } |
|
107 |
|
108 return errorTextFound; |
|
109 } |
|
110 |
|
111 PsUiSettingsWrapper::PsUiSettingsWrapper(QObject *parent): |
|
112 QObject(parent) |
|
113 { |
|
114 m_Settings = new XQSettingsManager(); |
|
115 } |
|
116 |
|
117 PsUiSettingsWrapper::~PsUiSettingsWrapper() |
|
118 { |
|
119 delete m_Settings; |
|
120 } |
|
121 |
|
122 bool PsUiSettingsWrapper::isFeatureCallWaitingDistiquishNotProvisionedEnabled() |
|
123 { |
|
124 bool enabled = readCenrepValue(KCRUidPhoneSettings.iUid, KPSetCallWaiting).toBool(); |
|
125 DPRINT << "enabled: " << enabled; |
|
126 return enabled; |
|
127 } |
|
128 |
|
129 bool PsUiSettingsWrapper::isPhoneOffline() const |
|
130 { |
|
131 bool offLinesupport(false); |
|
132 if (XQSysInfo::isSupported(KFeatureIdOfflineMode)) { |
|
133 offLinesupport = !readCenrepValue( |
|
134 KCRUidCoreApplicationUIs.iUid, |
|
135 KCoreAppUIsNetworkConnectionAllowed).toBool(); |
|
136 } |
|
137 return offLinesupport; |
|
138 } |
|
139 |
|
140 QVariant PsUiSettingsWrapper::readCenrepValue( |
|
141 const long int uid, const unsigned long int key) const |
|
142 { |
|
143 XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, uid, key); |
|
144 QVariant ret = m_Settings->readItemValue(settingsKey); |
|
145 DPRINT << "ret: " << ret; |
|
146 return ret; |
|
147 } |
|
148 |
|
149 bool PsUiSettingsWrapper::numberGroupingSupported() const |
|
150 { |
|
151 return readCenrepValue(KCRUidNumberGrouping.iUid, KNumberGrouping).toBool(); |
|
152 } |
|
153 |