114
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Encapsulates hsps liw service
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#ifndef C_CHomeScreenSettingsIf_H
|
|
18 |
#define C_CHomeScreenSettingsIf_H
|
|
19 |
|
|
20 |
#include <e32base.h>
|
|
21 |
#include <liwcommon.h> // for MLiwNotifyCallback
|
|
22 |
#include <mhomescreensettingsif.h>
|
|
23 |
#include <mhomescreensettingsobserver.h>
|
|
24 |
|
|
25 |
class CLiwServiceHandler;
|
|
26 |
class MLiwInterface;
|
|
27 |
class CLiwCriteriaItem;
|
|
28 |
class CLiwMap;
|
|
29 |
class CLiwList;
|
|
30 |
class MDesC8Array;
|
|
31 |
class CLiwDefaultMap;
|
|
32 |
class CLiwDefaultList;
|
|
33 |
class MLiwNotifyCallback;
|
|
34 |
class CLiwGenericParamList;
|
|
35 |
|
|
36 |
|
|
37 |
namespace HSPluginSettingsIf{
|
|
38 |
|
|
39 |
class CHspsConfiguration;
|
|
40 |
class CItemMap;
|
|
41 |
class CPropertyMap;
|
|
42 |
class MHomescreenSettingsObserver;
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Wrapper for hsps liw service
|
|
46 |
*
|
|
47 |
*
|
|
48 |
* @code
|
|
49 |
*
|
|
50 |
* @endcode
|
|
51 |
*
|
|
52 |
* @lib HomeScreenSettingsIf.lib
|
|
53 |
* @since S60 v5.0
|
|
54 |
*/
|
|
55 |
NONSHARABLE_CLASS( CHomescreenSettings ) :
|
|
56 |
public CBase,
|
|
57 |
public MLiwNotifyCallback,
|
|
58 |
public MHomescreenSettingsIf
|
|
59 |
{
|
|
60 |
public: // static methods
|
|
61 |
/**
|
|
62 |
* Get instance to settings API.
|
|
63 |
*
|
|
64 |
* InitializeL must be called before calling this method.
|
|
65 |
* Otherwise NULL is returned. InitializeL and Instance
|
|
66 |
* must be called within same thread since TLS is used
|
|
67 |
* to storage instance data.
|
|
68 |
*
|
|
69 |
* @return CHomescreenSettings* Pointer to settings api.
|
|
70 |
* Can return NULL in case of
|
|
71 |
* error.
|
|
72 |
*/
|
|
73 |
IMPORT_C static CHomescreenSettings* Instance();
|
|
74 |
|
|
75 |
/**
|
|
76 |
* Initialize settings api.
|
|
77 |
*
|
|
78 |
* There must be one UnInitialize call for each Initialize call
|
|
79 |
* in order to prevent memory leaking.
|
|
80 |
* (Implementation contains reference counting)
|
|
81 |
*/
|
|
82 |
IMPORT_C static void InitializeL( const TDesC8& aAppUid );
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Uninitialize settings api.
|
|
86 |
*
|
|
87 |
* There must be one UnInitialize call for each Initialize call
|
|
88 |
* in order to prevent memory leaking.
|
|
89 |
* (Implementation contains reference counting)
|
|
90 |
*/
|
|
91 |
IMPORT_C static void UnInitialize();
|
|
92 |
|
|
93 |
public:
|
|
94 |
/**
|
|
95 |
* Add observer
|
|
96 |
*
|
|
97 |
* @param aObserver Observer to be added.
|
|
98 |
*/
|
|
99 |
IMPORT_C void AddObserverL( MHomeScreenSettingsObserver* aObserver );
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Remove observer
|
|
103 |
*
|
|
104 |
* @param aObserver Observer to be removed.
|
|
105 |
*/
|
|
106 |
IMPORT_C void RemoveObserver( MHomeScreenSettingsObserver* aObserver );
|
|
107 |
|
|
108 |
public:
|
|
109 |
/**
|
|
110 |
* From MHomescreenSettingsIf
|
|
111 |
* Stores defined plugin’s settings.
|
|
112 |
* Plugin is identified with unique plugin ID used in application’s
|
|
113 |
* configuration
|
|
114 |
*
|
|
115 |
* @param aPluginId Pluging’s ID which settings are stored
|
|
116 |
* @param aSettings List of item maps
|
|
117 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
118 |
*/
|
|
119 |
IMPORT_C TInt GetSettingsL(
|
|
120 |
const TDesC8& aPluginId,
|
|
121 |
RPointerArray<CItemMap>& aSettings );
|
|
122 |
|
|
123 |
/**
|
|
124 |
* From MHomescreenSettingsIf
|
|
125 |
* Stores defined plugin’s settings.
|
|
126 |
* Plugin is identified with unique plugin ID used in application’s
|
|
127 |
* configuration
|
|
128 |
*
|
|
129 |
* @param aPluginId Pluging’s ID which settings are stored
|
|
130 |
* @param aSettings List of item maps
|
|
131 |
* @param aStoringParam parameter to tell whether plugin configuration need to be saved also if parameter is ETrue.
|
|
132 |
* @return Operation status. KErrNone (success), KErrNotFound
|
|
133 |
*/
|
|
134 |
IMPORT_C TInt SetSettingsL(
|
|
135 |
const TDesC8& aPluginId,
|
|
136 |
const RPointerArray<CItemMap>& aSettings,
|
|
137 |
const TBool aStoringParam );
|
|
138 |
|
|
139 |
protected:
|
|
140 |
/**
|
|
141 |
* Two-phased constructor.
|
|
142 |
*
|
|
143 |
* @param aAppUid Application uid in integer format
|
|
144 |
*/
|
|
145 |
static CHomescreenSettings* NewL( const TDesC8& aAppUid );
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Two-phased constructor.
|
|
149 |
*
|
|
150 |
* @param aAppUid Application uid in integer format
|
|
151 |
*/
|
|
152 |
static CHomescreenSettings* NewLC(
|
|
153 |
const TDesC8& aAppUid );
|
|
154 |
|
|
155 |
/**
|
|
156 |
* Destructor.
|
|
157 |
*/
|
|
158 |
virtual ~CHomescreenSettings();
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Constructor.
|
|
162 |
*/
|
|
163 |
CHomescreenSettings();
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Second phase constructor
|
|
167 |
*
|
|
168 |
* @param aAppUid Application uid in integer format
|
|
169 |
*/
|
|
170 |
void ConstructL( const TDesC8& aAppUid );
|
|
171 |
|
|
172 |
/**
|
|
173 |
* Processes all items configuration setting
|
|
174 |
* @param aItemList item list
|
|
175 |
* @param aTarget output hsps configuration
|
|
176 |
*/
|
|
177 |
void ProcessConfigurationSettingsL(
|
|
178 |
const CLiwList& aItemList,
|
|
179 |
CHspsConfiguration& aTarget );
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Processes all items' properties configuration
|
|
183 |
*
|
|
184 |
* @param aPropertyMapList input properties
|
|
185 |
* @param aItemMap output item
|
|
186 |
*/
|
|
187 |
void ProcessConfItemPropertiesL(
|
|
188 |
const CLiwList& aPropertyMapList,
|
|
189 |
CItemMap& aItemMap );
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Fills liw map from given item
|
|
193 |
* @param aMap liw item map to fill in
|
|
194 |
* @param aItemMap item map
|
|
195 |
*/
|
|
196 |
void FillMapFromItemL( CLiwDefaultMap& aMap, const CItemMap& aItemMap );
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Fills liw map from given item properties
|
|
200 |
* @param aMap liw map to fill in
|
|
201 |
* @param aItemMap item properiteis map
|
|
202 |
*/
|
|
203 |
void FillMapFromPropertiesL(
|
|
204 |
CLiwDefaultList& aInPropertyMapList,
|
|
205 |
const RPointerArray<CPropertyMap>& aProperties );
|
|
206 |
|
|
207 |
/**
|
|
208 |
* Sets plugin settings
|
|
209 |
* @param aPluginId plugin id
|
|
210 |
* @param aSettings array of items to set
|
|
211 |
* @param aStoringParam parameter to tell whether plugin configuration need to be saved.
|
|
212 |
* @return
|
|
213 |
*/
|
|
214 |
TInt SetPluginSettingsL(
|
|
215 |
const TDesC8& aPluginId,
|
|
216 |
const RPointerArray<CItemMap>& aSettings,
|
|
217 |
const TDesC8& aStoringParam );
|
|
218 |
|
|
219 |
protected:
|
|
220 |
/**
|
|
221 |
* From MLiwNotifyCallback
|
|
222 |
* Handle HSPS notifications
|
|
223 |
*
|
|
224 |
* @param aCmdId Command id
|
|
225 |
* @param aEventId Event id
|
|
226 |
* @param aEventParamList Event parameters
|
|
227 |
* @param aInParamList In parameters
|
|
228 |
*/
|
|
229 |
TInt HandleNotifyL(TInt aCmdId, TInt aEventId,
|
|
230 |
CLiwGenericParamList& aEventParamList,
|
|
231 |
const CLiwGenericParamList& aInParamList);
|
|
232 |
|
|
233 |
private: // data
|
|
234 |
/**
|
|
235 |
* Owned. SAPI service handler.
|
|
236 |
*/
|
|
237 |
CLiwServiceHandler* iServiceHandler;
|
|
238 |
/**
|
|
239 |
* Owned. HSPS SAPI service.
|
|
240 |
*/
|
|
241 |
CLiwCriteriaItem* iHspsService;
|
|
242 |
/**
|
|
243 |
* Owned. Provides hsps services.
|
|
244 |
*/
|
|
245 |
MLiwInterface* iHspsInterface;
|
|
246 |
|
|
247 |
/*
|
|
248 |
* Asynchronous service request tarnsaction id
|
|
249 |
*/
|
|
250 |
TInt iTransactionId;
|
|
251 |
|
|
252 |
/*
|
|
253 |
* List of observers. Items not owned!
|
|
254 |
*/
|
|
255 |
RPointerArray<MHomeScreenSettingsObserver> iObservers;
|
|
256 |
};
|
|
257 |
|
|
258 |
} //namespace HSPluginSettingsIf
|
|
259 |
|
|
260 |
#endif // C_CHomeScreenSettingsIf_H
|