|
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: Declaration of CSsmLocaleObserverSup class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_SSMLOCALEOBSERVERSUP_H |
|
19 #define C_SSMLOCALEOBSERVERSUP_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <e32property.h> |
|
23 #include <f32file.h> |
|
24 #include <ssm/ssmutility.h> |
|
25 |
|
26 class CEnvironmentChangeNotifier; |
|
27 |
|
28 /** |
|
29 * SSM Utility plugin which stores locale data to file when it changes and |
|
30 * after data has been restored from a backup file. |
|
31 */ |
|
32 NONSHARABLE_CLASS( CSsmLocaleObserverSup ) : public CActive, public MSsmUtility |
|
33 { |
|
34 |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Two-phase constructor. |
|
39 */ |
|
40 IMPORT_C static MSsmUtility* NewL(); |
|
41 |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 virtual ~CSsmLocaleObserverSup(); |
|
46 |
|
47 /** |
|
48 * Call-back method, called when there is a change in locale data. |
|
49 */ |
|
50 void EnvChangeOccurredL(); |
|
51 |
|
52 private: // From CActive |
|
53 |
|
54 void RunL(); |
|
55 void DoCancel(); |
|
56 |
|
57 private: // From MSsmUtility |
|
58 |
|
59 void InitializeL(); |
|
60 void StartL(); |
|
61 void Release(); |
|
62 |
|
63 private: |
|
64 |
|
65 /** |
|
66 * First phase constructor. |
|
67 */ |
|
68 CSsmLocaleObserverSup(); |
|
69 |
|
70 /** |
|
71 * Activate the active object. |
|
72 */ |
|
73 void Activate(); |
|
74 |
|
75 /** |
|
76 * Copied fron SysLocale. |
|
77 * SaveLocaleL saves TLocale class to the given directory |
|
78 * and initiates missing independent data, if any. |
|
79 * Note, that independent data is created only once and it is |
|
80 * shared by all the locales. Therefore, it is recommended |
|
81 * to call this method upon early boot phase of a device. |
|
82 * @param aPath Directory path containing locale data files. |
|
83 * (e.g. "c:\dir" or c:\dir\") |
|
84 */ |
|
85 void SaveLocaleL( const TDesC& aPath ); |
|
86 |
|
87 /** |
|
88 * Copied fron SysLocale. |
|
89 * LoadLocaleL restores TLocale class from the given directory. |
|
90 * If locale independent data (see note) |
|
91 * exists, its data overrides the restored TLocale data. |
|
92 * @param aPath Directory path containing locale data files |
|
93 * (e.g. "c:\dir" or c:\dir\") |
|
94 */ |
|
95 void LoadLocaleL( const TDesC& aPath ); |
|
96 |
|
97 /** |
|
98 * Stores locale independent data. |
|
99 */ |
|
100 void SaveIndependentDataL( const TLocale& aLocale, const TDesC& aPath ); |
|
101 |
|
102 /** |
|
103 * Loads locale independent data. |
|
104 */ |
|
105 void LoadIndependentDataL( TLocale& aLocale, const TDesC& aPath ); |
|
106 |
|
107 private: // data |
|
108 |
|
109 /** |
|
110 * Publish & subscribe interface for KUidBackupRestoreKey key. |
|
111 */ |
|
112 RProperty iProperty; |
|
113 |
|
114 /** |
|
115 * Indicates if restore activity is currently taking place. |
|
116 */ |
|
117 TBool iRestoreActive; |
|
118 |
|
119 /** |
|
120 * An environment change notifier that notifies us when any change |
|
121 * happens in the environment. |
|
122 */ |
|
123 CEnvironmentChangeNotifier* iEnvChangeNotifier; |
|
124 |
|
125 /** |
|
126 * File server session for writing the locale data files. |
|
127 */ |
|
128 RFs iFs; |
|
129 |
|
130 }; |
|
131 |
|
132 #endif // C_SSMLOCALEOBSERVERSUP_H |