60 // CESMRFeatureSettings::ConstructL |
59 // CESMRFeatureSettings::ConstructL |
61 // Reads settings from CenRep |
60 // Reads settings from CenRep |
62 // --------------------------------------------------------------------------- |
61 // --------------------------------------------------------------------------- |
63 // |
62 // |
64 void CESMRFeatureSettings::ConstructL() |
63 void CESMRFeatureSettings::ConstructL() |
65 { |
64 { |
66 FUNC_LOG; |
65 FUNC_LOG; |
67 // <cmail> Removed unneeded cleanup function. |
66 |
68 FeatureManager::InitializeLibL(); |
67 // Read settings from central repository. These are read-only settings, |
69 |
68 // so these must be read only once at this object lifetime. |
70 TBool locationIntegrationSupported = FeatureManager::FeatureSupported( |
69 CRepository* settings = NULL; |
71 KFeatureIdFfFsCalendarLocation ); |
70 TRAPD( err, settings = CRepository::NewL( KCRUidESMRUIFeatures ) ); |
72 |
71 |
73 FeatureManager::UnInitializeLib(); |
72 if ( err == KErrNone ) |
74 |
|
75 if ( locationIntegrationSupported ) |
|
76 { |
73 { |
77 // Read settings from central repository. These are read-only settings, |
74 settings->Get( KESMRUIFeatureMnFwIntegration, |
78 // so these must be read only once at this object lifetime. |
75 iFeatures[ EESMRUIMnFwIntegrationIndex ] ); |
79 CRepository* settings = NULL; |
76 |
80 TRAPD( err, settings = CRepository::NewL( KCRUidESMRUIFeatures ) ); |
77 settings->Get( KESMRUIFeatureContactsIntegration, |
|
78 iFeatures[ EESMRUIContactsIntegrationIndex ] ); |
|
79 |
|
80 settings->Get( KESMRUIFeatureLandmarksIntegration, |
|
81 iFeatures[ EESMRUILandmarksIntegrationIndex ] ); |
|
82 |
|
83 settings->Get( KESMRUIFeaturePreviousLocationsList, |
|
84 iFeatures[ EESMRUIPreviousLocationsListIndex ] ); |
81 |
85 |
82 if ( err == KErrNone ) |
86 settings->Get( KMRUIFeatureMeetingRequestViewerCmailOnly, |
83 { |
87 iFeatures[ EMRUIMeetingRequestViewerCmailIndex ] ); |
84 settings->Get( KESMRUIFeatureMnFwIntegration, |
88 |
85 iLocationFeatures[ EESMRUIMnFwIntegrationIndex ] ); |
89 delete settings; |
86 |
90 } |
87 settings->Get( KESMRUIFeatureContactsIntegration, |
|
88 iLocationFeatures[ EESMRUIContactsIntegrationIndex ] ); |
|
89 |
|
90 settings->Get( KESMRUIFeatureLandmarksIntegration, |
|
91 iLocationFeatures[ EESMRUILandmarksIntegrationIndex ] ); |
|
92 |
|
93 settings->Get( KESMRUIFeaturePreviousLocationsList, |
|
94 iLocationFeatures[ EESMRUIPreviousLocationsListIndex ] ); |
|
95 |
|
96 delete settings; |
|
97 } |
|
98 } |
|
99 // </cmail> |
|
100 } |
91 } |
101 |
92 |
102 |
93 |
103 // --------------------------------------------------------------------------- |
94 // --------------------------------------------------------------------------- |
104 // CESMRFeatureSettings* CESMRFeatureSettings::NewL |
95 // CESMRFeatureSettings* CESMRFeatureSettings::NewL |
149 // Single flags |
140 // Single flags |
150 case EESMRUIMnFwIntegration: |
141 case EESMRUIMnFwIntegration: |
151 case EESMRUIContactsIntegration: |
142 case EESMRUIContactsIntegration: |
152 case EESMRUILandmarksIntegration: |
143 case EESMRUILandmarksIntegration: |
153 case EESMRUIPreviousLocationsList: |
144 case EESMRUIPreviousLocationsList: |
|
145 case EMRUIMeetingRequestViewerCmailOnly: |
154 { |
146 { |
155 TInt index = MapFeature( aFeatures ); |
147 TInt index = MapFeature( aFeatures ); |
156 if ( index > KErrNotFound |
148 if ( index > KErrNotFound |
157 && iLocationFeatures[ index ] ) // codescanner::accessArrayElementWithoutCheck2 |
149 && iFeatures[ index ] ) // codescanner::accessArrayElementWithoutCheck2 |
158 { |
150 { |
159 featureSupported = ETrue; |
151 featureSupported = ETrue; |
160 } |
152 } |
161 break; |
153 break; |
162 } |
154 } |
163 |
155 |
164 // All flag |
156 // All flag |
165 case EESMRUILocationFeatures: |
157 case EESMRUILocationFeatures: |
166 { |
158 { |
167 for ( TInt i = 0; i < EESMRUINumLocationFeatures; ++i ) |
159 for ( TInt i = 0; i < KNumLocationFeatures; ++i ) |
168 { |
160 { |
169 if ( iLocationFeatures[ i ] ) // codescanner::accessArrayElementWithoutCheck2 |
161 if ( iFeatures[ i ] ) // codescanner::accessArrayElementWithoutCheck2 |
170 { |
162 { |
171 featureSupported = ETrue; |
163 featureSupported = ETrue; |
172 break; // for-loop |
164 break; // for-loop |
173 } |
165 } |
174 } |
166 } |
177 |
169 |
178 // Combined flags |
170 // Combined flags |
179 default: |
171 default: |
180 { |
172 { |
181 TUint mask = 0x1; |
173 TUint mask = 0x1; |
182 for ( TInt i = 0; i < EESMRUINumLocationFeatures; ++i ) |
174 for ( TInt i = 0; i < EESMRUINumFeatures; ++i ) |
183 { |
175 { |
184 TUint feature = aFeatures & mask; |
176 TUint feature = aFeatures & mask; |
185 TInt index = MapFeature( feature ); |
177 TInt index = MapFeature( feature ); |
186 if ( ( index > KErrNotFound ) |
178 if ( ( index > KErrNotFound ) |
187 && ( feature < EESMRUILocationFeatures ) |
179 && ( feature < EMRUIAllFeatures ) |
188 && iLocationFeatures[ index ] ) // codescanner::accessArrayElementWithoutCheck2 |
180 && iFeatures[ index ] ) // codescanner::accessArrayElementWithoutCheck2 |
189 { |
181 { |
190 featureSupported = ETrue; |
182 featureSupported = ETrue; |
191 break; |
183 break; |
192 } |
184 } |
193 else if ( feature > EESMRUILocationFeatures ) |
185 else if ( feature > EMRUIAllFeatures ) |
194 { |
186 { |
195 __ASSERT_DEBUG( EFalse, User::Panic( KPanicCategory, EUnknownFeature) ); |
187 __ASSERT_DEBUG( EFalse, User::Panic( KPanicCategory, EUnknownFeature) ); |
196 } |
188 } |
197 |
189 |
198 // Test next feature |
190 // Test next feature |
238 case EESMRUIPreviousLocationsList: |
230 case EESMRUIPreviousLocationsList: |
239 { |
231 { |
240 index = EESMRUIPreviousLocationsListIndex; |
232 index = EESMRUIPreviousLocationsListIndex; |
241 break; |
233 break; |
242 } |
234 } |
|
235 case EMRUIMeetingRequestViewerCmailOnly: |
|
236 { |
|
237 index = EMRUIMeetingRequestViewerCmailIndex; |
|
238 break; |
|
239 } |
243 default: // Illegal flags |
240 default: // Illegal flags |
244 { |
241 { |
245 __ASSERT_DEBUG( EFalse, User::Panic( KPanicCategory, EUnknownFeature) ); |
242 __ASSERT_DEBUG( EFalse, User::Panic( KPanicCategory, EUnknownFeature) ); |
246 break; |
243 break; |
247 } |
244 } |