1 /* |
|
2 * Copyright (c) 2002 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: Container class of settings view. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPROFILESETTINGSCONTAINER_H |
|
20 #define CPROFILESETTINGSCONTAINER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <aknsettingitemlist.h> // CAknSettingItemList |
|
24 #include <MSSSettingsObserver.h> |
|
25 #include <ConeResLoader.h> // RConeResourceLoader |
|
26 #include <AknTabObserver.h> // MAknTabObserver |
|
27 #include <MProfileChangeObserver.h> |
|
28 #include "MProfileExternalSettingsObserver.h" |
|
29 #include "MProfileExternalSettingsHandler.h" |
|
30 #include <centralrepository.h> |
|
31 #include <cenrepnotifyhandler.h> |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class MProfileViewHandler; |
|
35 class CAknTitlePane; |
|
36 class CProfileEngineHandler; |
|
37 class CProfileIndexHandler; |
|
38 class CProfileTabHandler; |
|
39 class MProfileExtended; |
|
40 class CProfileStruct; |
|
41 class CAknKeySoundSystem; |
|
42 class CProfileChangeNotifyHandler; |
|
43 class MProfilesLocalFeatures; |
|
44 class CProfileSettingsView; |
|
45 class CAknView; |
|
46 class CRepository; |
|
47 class CCenRepNotifyHandler; |
|
48 class CProfileNaviPaneContainer; |
|
49 |
|
50 // CLASS DECLARATION |
|
51 /** |
|
52 * Container class of settings view. |
|
53 * Inherited from... |
|
54 * MSSSettingsObserver |
|
55 * to receive notifications of changes in Alternate Line Service setting. |
|
56 * MAknTabObserver |
|
57 * to receive notifications if tabs are changed. |
|
58 * MProfileChangeObserver |
|
59 * to receive notification when the active profile changes. |
|
60 * |
|
61 * @lib ProfileSettingsView.lib |
|
62 * @since 1.2 |
|
63 */ |
|
64 class CProfileSettingsContainer : public CAknSettingItemList, |
|
65 public MSSSettingsObserver, |
|
66 public MAknTabObserver, |
|
67 public MProfileChangeObserver, |
|
68 public MProfileExternalSettingsObserver, |
|
69 public MCenRepNotifyHandlerCallback |
|
70 { |
|
71 public: // Constructors and destructor |
|
72 |
|
73 /** |
|
74 * Two-phased constructor. |
|
75 * Note, this constructor has been deprecated and should not be used. |
|
76 * @return always NULL. |
|
77 */ |
|
78 IMPORT_C static CProfileSettingsContainer* NewL( |
|
79 CAknView& aAknView, |
|
80 CProfileEngineHandler& aEngineHandler, |
|
81 CProfileIndexHandler* aIndexHandler, |
|
82 CProfileTabHandler* aTabHandler, |
|
83 CAknTitlePane* aTitlePane ); |
|
84 |
|
85 /** |
|
86 * Two-phased constructor. |
|
87 * @param aAknView Parent view to get ClientRect and set MopParent. |
|
88 * @param aEngineHandler Engine handler to access Profile Engine. |
|
89 * @param aExternalSettingsHandler handler class for those settings that |
|
90 * are saved outside of Profiles. |
|
91 * @param aIndexHandler Index handler for supporting several profiles |
|
92 * in view functionality. Can be NULL. |
|
93 * @param aTabHandler Tab handler for supporting tab functionality |
|
94 * in Settings view. Can be NULL. |
|
95 * @param aTitlePane Title pane access for setting title pane text. |
|
96 * Can be NULL. |
|
97 */ |
|
98 IMPORT_C static CProfileSettingsContainer* NewL( |
|
99 MProfileViewHandler& aProfileViewHandler, |
|
100 CProfileEngineHandler& aEngineHandler, |
|
101 MProfileExternalSettingsHandler& aExternalSettingsHandler, |
|
102 CProfileIndexHandler* aIndexHandler, |
|
103 CProfileTabHandler* aTabHandler, |
|
104 CAknTitlePane* aTitlePane ); |
|
105 |
|
106 /** |
|
107 * Two-phased constructor. |
|
108 * @param aAknView Parent view to get ClientRect and set MopParent. |
|
109 * @param aEngineHandler Engine handler to access Profile Engine. |
|
110 * @param aIndexHandler Index handler for supporting several profiles |
|
111 * in view functionality. Can be NULL. |
|
112 * @param aTabHandler Tab handler for supporting tab functionality |
|
113 * in Settings view. Can be NULL. |
|
114 * @param aTitlePane Title pane access for setting title pane text. |
|
115 * Can be NULL. |
|
116 * @param aResourceId the id of the setting item list resource. |
|
117 */ |
|
118 IMPORT_C static CProfileSettingsContainer* NewL( |
|
119 MProfileViewHandler& aProfileViewHandler, |
|
120 CProfileEngineHandler& aEngineHandler, |
|
121 MProfileExternalSettingsHandler& aExternalSettingsHandler, |
|
122 CProfileIndexHandler* aIndexHandler, |
|
123 CProfileTabHandler* aTabHandler, |
|
124 CAknTitlePane* aTitlePane, |
|
125 TInt aResourceId ); |
|
126 |
|
127 /** |
|
128 * Destructor. |
|
129 */ |
|
130 ~CProfileSettingsContainer(); |
|
131 |
|
132 public: // New functions |
|
133 |
|
134 /** |
|
135 * Tells if information of a setting can be changed. |
|
136 * If EFalse is returned, EditItemL for the setting item in question |
|
137 * should not be called and "Change" should be removed from the Options menu. |
|
138 * @param aSettingItemId The setting item ID. |
|
139 * @return Returns if information of a setting can be changed. |
|
140 */ |
|
141 IMPORT_C TBool AllowedToChange( TInt aSettingItemId ) const; |
|
142 |
|
143 /** |
|
144 * Runs CheckFileExistenceL (by calling DoFileCheckL) |
|
145 * @param TAny* aObj CProfileSettingContainer pointer |
|
146 * @return 1 |
|
147 */ |
|
148 static TInt StartFileCheckL( TAny* aObj ); |
|
149 |
|
150 public: // Functions from base classes |
|
151 |
|
152 /** |
|
153 * From CAknSettingItemList. |
|
154 */ |
|
155 IMPORT_C void EditItemL( TInt aIndex, TBool aCalledFromMenu ); |
|
156 |
|
157 public: // from MCentRepNotifyHandlerCallback |
|
158 /** |
|
159 * @see MCentRepNotifyHandlerCallback. |
|
160 * @param aId Id of the key that has changed. |
|
161 * @param aNewValue The new value of the key. |
|
162 */ |
|
163 void HandleNotifyInt( |
|
164 TUint32 aId, TInt aNewValue ); |
|
165 |
|
166 protected: // New functions |
|
167 |
|
168 /** |
|
169 * Frees resources allocated for profile data. |
|
170 * Remember to maintain class state before calling this method! |
|
171 */ |
|
172 void ReleaseProfile(); |
|
173 |
|
174 /** |
|
175 * Reads profile data from Profile Engine. |
|
176 */ |
|
177 void ReadProfileL(); |
|
178 |
|
179 /** |
|
180 * Hides all setting items that have been set hidden for current profile |
|
181 * ands sets visible all that aren't. |
|
182 */ |
|
183 void SetHiddenFlagsL(); |
|
184 |
|
185 /** |
|
186 * Updates all setting items. |
|
187 * Called when the changed settings must be updated to the UI. |
|
188 * @param aReadProfileSettings if this is ETrue, the profile settings are |
|
189 * read from Profiles Engine. |
|
190 */ |
|
191 void UpdateSettingsL( TBool aReadProfileSettings = ETrue ); |
|
192 |
|
193 /** |
|
194 * Creates a setting item for FileListDialog. |
|
195 * @param aFileName Filename. |
|
196 * @param aIdentifier Setting item identifier. |
|
197 * @return Returns the created setting item object. |
|
198 */ |
|
199 CAknSettingItem* CreateFileListSettingItemL( |
|
200 TDes& aFileName, TInt aIdentifier ); |
|
201 |
|
202 /** |
|
203 * Returns the index of a setting item in setting item array. |
|
204 * @param aId Setting item identifier. |
|
205 * @return Returns the index of a setting item if found, otherwise |
|
206 * KErrNotFound. |
|
207 */ |
|
208 TInt IndexForId( TInt aId ) const; |
|
209 |
|
210 /** |
|
211 * Sets one setting item hidden. |
|
212 * @param aId Identifier of the setting item. |
|
213 * @param aArray Pointer to setting item array. |
|
214 * @param aHidden Boolean hidden value. |
|
215 */ |
|
216 void SetItemHidden( TInt aId, CAknSettingItemArray* aArray, TBool aHidden ); |
|
217 |
|
218 /** |
|
219 * Sets title pane text. |
|
220 * @param aTitle Title pane text. |
|
221 * If descriptor has zero length, the application name is used. |
|
222 */ |
|
223 void SetTitlePaneTextL( const TDesC& aTitle ); |
|
224 |
|
225 /** |
|
226 * Updates names of profiles in tabs and/or title pane. |
|
227 */ |
|
228 void UpdateProfileNamesL(); |
|
229 |
|
230 /* |
|
231 * Launches confirmation dialog |
|
232 * @param aTitleText Dialog title text |
|
233 */ |
|
234 void LaunchDialogL( const TDesC& aTitleText ); |
|
235 |
|
236 /* |
|
237 * Chechks that used tones assigned for settings can be found. |
|
238 * If tone is not found, user is informed by confirmation dialog |
|
239 * and tone is replaced with default tone. |
|
240 */ |
|
241 void CheckFileExistenceL(); |
|
242 |
|
243 /* |
|
244 * Checks whether settingitem is hidden |
|
245 * @param aId Identifier of the setting item. |
|
246 * @param aArray Pointer to setting item array. |
|
247 * @return Returns ETrue if item is hidden. |
|
248 */ |
|
249 TBool IsItemHidden( TInt aId, CAknSettingItemArray* aArray ) const; |
|
250 |
|
251 /** |
|
252 * Runs CheckFileExistenceL |
|
253 * @param None |
|
254 * @return None |
|
255 */ |
|
256 void DoFileCheckL(); |
|
257 |
|
258 protected: // Functions from base classes |
|
259 |
|
260 /** |
|
261 * From CAknSettingItemList |
|
262 */ |
|
263 CAknSettingItem* CreateSettingItemL( TInt aIdentifier ); |
|
264 |
|
265 /** |
|
266 * From CCoeControl |
|
267 */ |
|
268 void SizeChanged(); |
|
269 |
|
270 /** |
|
271 * From CCoeControl |
|
272 */ |
|
273 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
274 |
|
275 /** |
|
276 * From CCoeControl |
|
277 */ |
|
278 void HandleResourceChange(TInt aType); |
|
279 |
|
280 /** |
|
281 * From MEikListBoxObserver |
|
282 */ |
|
283 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
284 |
|
285 /** |
|
286 * From MSSSettingsObserver |
|
287 */ |
|
288 void PhoneSettingChanged( |
|
289 TSSSettingsSetting aSetting, |
|
290 TInt aNewValue ); |
|
291 |
|
292 /** |
|
293 * From MAknTabObserver |
|
294 */ |
|
295 void TabChangedL( TInt aIndex ); |
|
296 |
|
297 /** |
|
298 * From MProfileChangeObserver |
|
299 */ |
|
300 void HandleActiveProfileEventL( |
|
301 TProfileEvent aProfileEvent, TInt aProfileId ); |
|
302 |
|
303 /** |
|
304 * From MProfileExternalSettingsObserver |
|
305 */ |
|
306 void HandleExternalSettingsChangedL(); |
|
307 |
|
308 protected: |
|
309 |
|
310 /** |
|
311 * C++ constructor. |
|
312 */ |
|
313 CProfileSettingsContainer( |
|
314 MProfileViewHandler& aProfileViewHandler, |
|
315 CProfileEngineHandler& aEngineHandler, |
|
316 MProfileExternalSettingsHandler& aExternalSettingsHandler, |
|
317 CProfileIndexHandler* aIndexHandler, |
|
318 CProfileTabHandler* aTabHandler, |
|
319 CAknTitlePane* aTitlePane ); |
|
320 |
|
321 /** |
|
322 * Symbian 2nd phase constructor. |
|
323 * @param aRect View rect. |
|
324 * @param aResourceId the id of the setting item list resource. |
|
325 */ |
|
326 void ConstructL( const TRect& aRect, |
|
327 TInt aResourceId ); |
|
328 |
|
329 public: // New functions |
|
330 |
|
331 /** |
|
332 * Is a setting item being edited? |
|
333 * @return ETrue if a setting is being edited, EFalse otherwise. |
|
334 */ |
|
335 IMPORT_C TBool ItemEdited() const; |
|
336 |
|
337 private: |
|
338 TBool PowerSaveMode(); |
|
339 TBool PowerSaveModeL(); |
|
340 TBool PowerSaveMode( TInt aSettingId ); |
|
341 |
|
342 private: // Data |
|
343 |
|
344 // For reading ALS setting and |
|
345 // for receiving change notifications. |
|
346 RSSSettings iSSSettings; |
|
347 |
|
348 // Own: CR session for KProfilesLVFlags (KProEngFeatureIdTTSRingingTone) |
|
349 CRepository* iTTSSession; |
|
350 |
|
351 /// Own: CR session for KProEngDefaultRingingTone |
|
352 CRepository* iSession; |
|
353 |
|
354 // Resource loader. |
|
355 RConeResourceLoader iResourceLoader; |
|
356 |
|
357 // View handler to get ClientRect and set MopParent. |
|
358 MProfileViewHandler& iProfileViewHandler; |
|
359 |
|
360 // Profile Engine handler. |
|
361 CProfileEngineHandler& iEngineHandler; |
|
362 |
|
363 // Ref: Handler for settings that are saved outside of Profiles: |
|
364 MProfileExternalSettingsHandler& iExternalSettingsHandler; |
|
365 |
|
366 // Ref: Index handler. |
|
367 CProfileIndexHandler* iIndexHandler; |
|
368 |
|
369 // Ref: Tab handler. |
|
370 CProfileTabHandler* iTabHandler; |
|
371 |
|
372 // Ref: Title pane access. |
|
373 CAknTitlePane* iTitlePane; |
|
374 |
|
375 // Own: One profile data |
|
376 MProfileExtended* iProfile; |
|
377 |
|
378 // Own: One profile data. |
|
379 CProfileStruct* iCopyProfile; |
|
380 |
|
381 // Alternate Line Service support. |
|
382 TBool iAlternateLineService; |
|
383 |
|
384 // Own: Avkon key sounds |
|
385 CAknKeySoundSystem* iKeySounds; |
|
386 |
|
387 // Own: Profile change notify handler. |
|
388 CProfileChangeNotifyHandler* iNotifier; |
|
389 |
|
390 // ETrue if an item is currently being edited. |
|
391 TBool iItemEdited; |
|
392 |
|
393 // Not own: locally variated features of Profiles: |
|
394 MProfilesLocalFeatures* iLocalFeatures; |
|
395 |
|
396 /// Own: fileserver session |
|
397 RFs* iFs; |
|
398 |
|
399 /// Default tone |
|
400 TFileName* iDefaultTone; |
|
401 |
|
402 // VoIP supported |
|
403 TBool iVoIPStatus; |
|
404 |
|
405 // A CR and notifier for dynamic VoIP |
|
406 CRepository* iVoIPVariation; |
|
407 CCenRepNotifyHandler* iVoIPVariationNotifier; |
|
408 |
|
409 /// Timer to run CheckFileExistenceL |
|
410 CPeriodic* iPeriodic; |
|
411 |
|
412 // Navi Pane Container |
|
413 CProfileNaviPaneContainer* iNaviPaneContainer; |
|
414 }; |
|
415 |
|
416 #endif // CPROFILESETTINGSCONTAINER_H |
|
417 |
|
418 // End of File |
|