1 /* |
|
2 * Copyright (c) 2005 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: Model for Device & SIM security plug-in. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDES |
|
20 #include "GSSimSecPluginModel.h" |
|
21 |
|
22 #include <settingsinternalcrkeys.h> |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 |
|
26 // EXTERNAL FUNCTION PROTOTYPES |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 |
|
32 // LOCAL CONSTANTS AND MACROS |
|
33 const TInt KGSSettingOff = 0; |
|
34 // default value for autolock period |
|
35 const TInt KGSDefaultAutoLockTime = 0; |
|
36 |
|
37 // MODULE DATA STRUCTURES |
|
38 |
|
39 // LOCAL FUNCTION PROTOTYPES |
|
40 |
|
41 // ============================= LOCAL FUNCTIONS ============================== |
|
42 |
|
43 // ========================= MEMBER FUNCTIONS ================================= |
|
44 |
|
45 // ---------------------------------------------------------------------------- |
|
46 // CGSSimSecPluginModel::NewL |
|
47 // |
|
48 // Symbian OS two-phased constructor |
|
49 // ---------------------------------------------------------------------------- |
|
50 // |
|
51 CGSSimSecPluginModel* CGSSimSecPluginModel::NewL() |
|
52 { |
|
53 CGSSimSecPluginModel* self = new( ELeave ) CGSSimSecPluginModel; |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 |
|
57 CleanupStack::Pop( self ); |
|
58 return self; |
|
59 } |
|
60 |
|
61 |
|
62 // ---------------------------------------------------------------------------- |
|
63 // CGSSimSecPluginModel::CGSSimSecPluginModel |
|
64 // |
|
65 // |
|
66 // C++ default constructor can NOT contain any code, that might leave. |
|
67 // ---------------------------------------------------------------------------- |
|
68 // |
|
69 CGSSimSecPluginModel::CGSSimSecPluginModel() |
|
70 { |
|
71 |
|
72 } |
|
73 |
|
74 |
|
75 // ---------------------------------------------------------------------------- |
|
76 // CGSSimSecPluginModel::ConstructL |
|
77 // |
|
78 // Symbian OS default constructor can leave. |
|
79 // ---------------------------------------------------------------------------- |
|
80 // |
|
81 void CGSSimSecPluginModel::ConstructL() |
|
82 { |
|
83 iSecurityRepository = CRepository::NewL( KCRUidSecuritySettings ); |
|
84 iPersonalizationRepository = |
|
85 CRepository::NewL( KCRUidPersonalizationSettings ); |
|
86 } |
|
87 |
|
88 |
|
89 // ---------------------------------------------------------------------------- |
|
90 // CGSSimSecPluginModel::~CGSSimSecPluginModel |
|
91 // |
|
92 // Destructor |
|
93 // ---------------------------------------------------------------------------- |
|
94 // |
|
95 CGSSimSecPluginModel::~CGSSimSecPluginModel() |
|
96 { |
|
97 delete iSecurityRepository; |
|
98 iSecurityRepository = NULL; |
|
99 |
|
100 delete iPersonalizationRepository; |
|
101 iPersonalizationRepository = NULL; |
|
102 } |
|
103 |
|
104 |
|
105 // ---------------------------------------------------------------------------- |
|
106 // CGSSimSecPluginModel::AutoLockPeriod() |
|
107 // |
|
108 // Reads Autolock period from .ini file and returns it |
|
109 // ---------------------------------------------------------------------------- |
|
110 // |
|
111 TInt CGSSimSecPluginModel::AutoLockPeriod() |
|
112 { |
|
113 TInt period = KGSSettingOff; |
|
114 |
|
115 if ( iSecurityRepository-> |
|
116 Get( KSettingsAutoLockTime, period ) != KErrNone ) |
|
117 { |
|
118 period = KGSDefaultAutoLockTime; |
|
119 iSecurityRepository->Set( KSettingsAutoLockTime, period ); |
|
120 } |
|
121 |
|
122 return period; |
|
123 } |
|
124 |
|
125 // ---------------------------------------------------------------------------- |
|
126 // CGSSimSecPluginModel::SetAutoLockPeriod |
|
127 // |
|
128 // Writes Autolock period time to Cenrep |
|
129 // ---------------------------------------------------------------------------- |
|
130 // |
|
131 TBool CGSSimSecPluginModel::SetAutoLockPeriod( TInt aLockTime ) |
|
132 { |
|
133 TInt ret = iSecurityRepository->Set( KSettingsAutoLockTime, aLockTime ); |
|
134 |
|
135 return ret; |
|
136 } |
|
137 |
|
138 // ---------------------------------------------------------------------------- |
|
139 // CGSSimSecPluginModel::SatOperations() |
|
140 // |
|
141 // Reads SatOperations value from .ini file and returns it |
|
142 // ---------------------------------------------------------------------------- |
|
143 // |
|
144 TInt CGSSimSecPluginModel::SatOperations() |
|
145 { |
|
146 TInt value = KGSSettingOff; |
|
147 |
|
148 iPersonalizationRepository->Get( KSettingsConfirmSatOperations, value ); |
|
149 |
|
150 return value; |
|
151 } |
|
152 |
|
153 |
|
154 // ---------------------------------------------------------------------------- |
|
155 // CGSSimSecPluginModel::SetSatOperations |
|
156 // |
|
157 // Write user changes to the .ini file |
|
158 // ---------------------------------------------------------------------------- |
|
159 // |
|
160 TBool CGSSimSecPluginModel::SetSatOperations( TInt aValue ) |
|
161 { |
|
162 TInt ret = iPersonalizationRepository-> |
|
163 Set( KSettingsConfirmSatOperations, aValue ); |
|
164 |
|
165 return ret; |
|
166 } |
|
167 |
|
168 |
|
169 // ---------------------------------------------------------------------------- |
|
170 // CGSSimSecPluginModel::ConfirmSatOperationsSupport |
|
171 // |
|
172 // Get Confirm Sat Operations supported value |
|
173 // ---------------------------------------------------------------------------- |
|
174 // |
|
175 TInt CGSSimSecPluginModel::ConfirmSatOperationsSupport() |
|
176 { |
|
177 TInt ret = 0; |
|
178 iPersonalizationRepository-> |
|
179 Get( KSettingsConfirmSatOperationsSupported, ret ); |
|
180 |
|
181 return ret; |
|
182 } |
|
183 |
|
184 // End of File |
|