35
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2010 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: Presence settings UI model header.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef PSUIGSPLUGINMODEL_H
|
|
22 |
#define PSUIGSPLUGINMODEL_H
|
|
23 |
|
|
24 |
// INCLUDES
|
|
25 |
#include <e32base.h>
|
|
26 |
#include <badesca.h>
|
|
27 |
#include <sipprofileregistryobserver.h>
|
|
28 |
#include <pressettingsapi.h>
|
|
29 |
#include "psuigsplugin.hrh"
|
|
30 |
|
|
31 |
// FORWARD DECLARATIONS
|
|
32 |
|
|
33 |
// CLASS DECLARATION
|
|
34 |
class RPresenceSettingsArray;
|
|
35 |
class CSIPManagedProfileRegistry;
|
|
36 |
class CSIPManagedProfile;
|
|
37 |
|
|
38 |
// Constants
|
|
39 |
_LIT( KPSUIGSPluginPanicCategory, "PSUIGSPlugin" );
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Presence settings UI model
|
|
43 |
*
|
|
44 |
* @lib PSUIGSPlugin.lib
|
|
45 |
* @since Series60_3.2
|
|
46 |
*/
|
|
47 |
class CPSUIGSPluginModel :
|
|
48 |
public CBase,
|
|
49 |
public MDesCArray,
|
|
50 |
public MSIPProfileRegistryObserver
|
|
51 |
{
|
|
52 |
|
|
53 |
public: // Constructors and destructor
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Symbian OS two-phased constructor
|
|
57 |
*/
|
|
58 |
static CPSUIGSPluginModel* NewL();
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Destructor.
|
|
62 |
*/
|
|
63 |
~CPSUIGSPluginModel();
|
|
64 |
|
|
65 |
public: // New
|
|
66 |
|
|
67 |
//
|
|
68 |
//
|
|
69 |
// Presence settings related
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Retrieves current presence settings from system
|
|
73 |
*/
|
|
74 |
void RetrieveSettingsL();
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Stores current presence settings to system
|
|
78 |
*/
|
|
79 |
void SaveSettingsL();
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Checks are the compulsory fields filled.
|
|
83 |
*
|
|
84 |
* @return boolean about filled fields
|
|
85 |
*/
|
|
86 |
TBool AllCompulsoryFieldsFilled();
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Prepares iSettingSet for editing
|
|
90 |
*
|
|
91 |
* @param aIndex of presence settings to be edited
|
|
92 |
*/
|
|
93 |
void EditSettingsL( TInt aIndex );
|
|
94 |
|
|
95 |
/**
|
|
96 |
* Refreshes the presence settings related arrays
|
|
97 |
*/
|
|
98 |
void RefreshPSArraysL();
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Prepares the iSettingSet and iSettingId
|
|
102 |
* with default values
|
|
103 |
*/
|
|
104 |
void CreateDefaultSettingsL();
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Prepares the iSettingSet and iSettingId
|
|
108 |
* with values from indexed presence setting
|
|
109 |
*
|
|
110 |
* @param aIndex is the presence settings to be duplicated
|
|
111 |
*/
|
|
112 |
void DuplicateExistingSettingsL( TInt aIndex );
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Creates new name for to be created settings. If aOriginal
|
|
116 |
* provided, then will use that as a base. If not, then will
|
|
117 |
* create the name based on default naming. Adds numbering to
|
|
118 |
* end of name if needed.
|
|
119 |
* Note : aOriginal will be stored to cleanupstack if provided
|
|
120 |
*
|
|
121 |
* @param aOriginal is optional base name
|
|
122 |
*
|
|
123 |
*/
|
|
124 |
HBufC* CreateSettingNameLC( HBufC* aOriginal = NULL );
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Deletes indexed settings through presence settings API.
|
|
128 |
*
|
|
129 |
* @param aToBeDeleted to be deleted settings
|
|
130 |
* @param aIsIndex tells is aToBeDeleted index or id
|
|
131 |
*/
|
|
132 |
void DeleteSettingsL( TInt aToBeDeleted, TBool aIsIndex );
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Returns name of the indexed settings.
|
|
136 |
*
|
|
137 |
* @param aIndex of the wanted name
|
|
138 |
* @return HBufC* containing the name
|
|
139 |
*/
|
|
140 |
HBufC* SettingNameLC( TInt aIndex );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Checks if there already is settings with the same name.
|
|
144 |
*/
|
|
145 |
TBool IsItDuplicatePSName();
|
|
146 |
|
|
147 |
/**
|
|
148 |
* Returns iPSNameArray, which contains names of the
|
|
149 |
* different setting sets. Ownership of array stays in
|
|
150 |
* CPSUIGSPluginModel.
|
|
151 |
*
|
|
152 |
* @return CDesCArray* containing the names of the settings
|
|
153 |
*/
|
|
154 |
CDesCArray* SettingNames();
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Returns a reference to iSettingSet.
|
|
158 |
*
|
|
159 |
* @return TPresSettingsSet& containing one set of the settings
|
|
160 |
*/
|
|
161 |
TPresSettingsSet& SettingsSet();
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Checks the validity of SIP- and XDM-fields,
|
|
165 |
* if not valid empties the fields.
|
|
166 |
*/
|
|
167 |
void ClearInvalidSIPAndXDMSettingsL();
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Returns a reference to iSettingSetId.
|
|
171 |
*
|
|
172 |
* @return TInt& containing setting id
|
|
173 |
*/
|
|
174 |
TInt& SettingsId();
|
|
175 |
|
|
176 |
/**
|
|
177 |
* Returns a reference to iPSIdArray.
|
|
178 |
*
|
|
179 |
* @return RArray<TInt>& containing iPSIdArray
|
|
180 |
*/
|
|
181 |
RArray<TInt>& SettingsIDArray();
|
|
182 |
|
|
183 |
//
|
|
184 |
//
|
|
185 |
// SIP related
|
|
186 |
|
|
187 |
/**
|
|
188 |
* Fetches names of defined SIP-profiles
|
|
189 |
* Refreshes also SIP related arrays.
|
|
190 |
*
|
|
191 |
* @return descriptor array of names
|
|
192 |
*/
|
|
193 |
CDesCArray* SipProfilesLC();
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Fetches the ID of indexed SIP profile
|
|
197 |
*
|
|
198 |
* @param aIndex is the index in the array
|
|
199 |
* @return ID of the SIP profile
|
|
200 |
*/
|
|
201 |
TInt SipProfileId( TInt aIndex );
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Fetches the index of ID'ed SIP profile
|
|
205 |
*
|
|
206 |
* @param aId is ID of the SIP profile
|
|
207 |
* @return index in the array
|
|
208 |
*/
|
|
209 |
TInt SipProfileIndex( TInt aId );
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Fetches the name of ID'ed SIP profile
|
|
213 |
* Refreshes also SIP related arrays.
|
|
214 |
*
|
|
215 |
* @param aId is ID of the SIP profile
|
|
216 |
* @return descriptor containing the name
|
|
217 |
*/
|
|
218 |
HBufC* SipProfileNameL( TInt aId );
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Checks if SIP profile used by presence settings is in use
|
|
222 |
*
|
|
223 |
* @param aIndex is the index in the array
|
|
224 |
* @return ETrue if profile is registered
|
|
225 |
*/
|
|
226 |
TBool IsSipProfileRegisteredL( TInt aIndex );
|
|
227 |
|
|
228 |
//
|
|
229 |
//
|
|
230 |
// XDM related
|
|
231 |
|
|
232 |
/**
|
|
233 |
* Fetches names of defined XDM settings.
|
|
234 |
* Refreshes also XDM related arrays.
|
|
235 |
*
|
|
236 |
* @return descriptor array of names
|
|
237 |
*/
|
|
238 |
CDesCArray* XdmCollectionNamesL();
|
|
239 |
|
|
240 |
/**
|
|
241 |
* Fetches the name of ID'ed XDM setting
|
|
242 |
*
|
|
243 |
* @param aId is ID of the SIP profile
|
|
244 |
* @return descriptor containing the name
|
|
245 |
*/
|
|
246 |
HBufC* XdmCollectionNameL( TInt aId );
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Fetches the index of ID'ed XDM setting
|
|
250 |
*
|
|
251 |
* @param aId is ID of the SIP profile
|
|
252 |
* @return index in the array
|
|
253 |
*/
|
|
254 |
TInt XdmSettingIndex( TInt aId );
|
|
255 |
|
|
256 |
/**
|
|
257 |
* Fetches the ID of indexed XDM setting
|
|
258 |
*
|
|
259 |
* @param aIndex is the index in the array
|
|
260 |
* @return ID of the SIP profile
|
|
261 |
*/
|
|
262 |
TInt XdmSettingId( TInt aIndex );
|
|
263 |
|
|
264 |
private: // New
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Destroys given array. Used with TCleanupItem.
|
|
268 |
*
|
|
269 |
* @param pointerarray to be deleted
|
|
270 |
*/
|
|
271 |
static void ResetAndDestroy( TAny* aPointerArray );
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Refreshes the SIP profile array. Needs to be
|
|
275 |
* called before calling most of the SIP-related methods.
|
|
276 |
*/
|
|
277 |
void ReadSipArrayFromEngineL();
|
|
278 |
|
|
279 |
/**
|
|
280 |
* Checks if there is ordinal numbering at the end of
|
|
281 |
* descriptor and rips it off if there is.
|
|
282 |
*
|
|
283 |
* @return HBufC* containing the name ready for the numbering
|
|
284 |
*/
|
|
285 |
HBufC* GetPrefixL( HBufC* aName );
|
|
286 |
|
|
287 |
/**
|
|
288 |
* Re-arranges presence settings (name and id arrays)
|
|
289 |
* to alphabetical order.
|
|
290 |
*/
|
|
291 |
void ReArrangePresenceSettingsL();
|
|
292 |
|
|
293 |
/**
|
|
294 |
* Cleans links to specific presence settings for
|
|
295 |
* service provider settings.
|
|
296 |
*
|
|
297 |
* @param aPresenceId presence settings id.
|
|
298 |
*/
|
|
299 |
void CleanServiceProviderSettingsDataL( TInt aPresenceId );
|
|
300 |
|
|
301 |
private: // Functions from base classes
|
|
302 |
|
|
303 |
/**
|
|
304 |
* from MSIPProfileRegistryObserver
|
|
305 |
* Refreshes in most cases SIP related arrays.
|
|
306 |
*
|
|
307 |
* See base class.
|
|
308 |
*/
|
|
309 |
void ProfileRegistryEventOccurred(
|
|
310 |
TUint32 aSIPProfileId,
|
|
311 |
TEvent aEvent );
|
|
312 |
|
|
313 |
/**
|
|
314 |
* from MSIPProfileRegistryObserver
|
|
315 |
* Refreshes SIP related arrays.
|
|
316 |
*
|
|
317 |
* See base class.
|
|
318 |
*/
|
|
319 |
void ProfileRegistryErrorOccurred(
|
|
320 |
TUint32 aSIPProfileId,
|
|
321 |
TInt aError);
|
|
322 |
|
|
323 |
/**
|
|
324 |
* from MDesCArray
|
|
325 |
* See base class.
|
|
326 |
*/
|
|
327 |
TInt MdcaCount() const;
|
|
328 |
|
|
329 |
/**
|
|
330 |
* from MDesCArray
|
|
331 |
* See base class.
|
|
332 |
*/
|
|
333 |
TPtrC16 MdcaPoint( TInt aIndex ) const;
|
|
334 |
|
|
335 |
private: // Constructors
|
|
336 |
|
|
337 |
/**
|
|
338 |
* C++ default constructor.
|
|
339 |
*/
|
|
340 |
CPSUIGSPluginModel();
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Symbian OS default constructor.
|
|
344 |
*/
|
|
345 |
void ConstructL();
|
|
346 |
|
|
347 |
private: // Data
|
|
348 |
|
|
349 |
// Currently edited presence settings
|
|
350 |
TPresSettingsSet iSettingSet;
|
|
351 |
// Setting identifier
|
|
352 |
TInt iSettingId;
|
|
353 |
// SIP profile registry
|
|
354 |
CSIPManagedProfileRegistry* iSIPEngine;
|
|
355 |
// SIP profile array
|
|
356 |
CArrayPtrFlat<CSIPManagedProfile>* iSIPProfiles;
|
|
357 |
// XDM ID array
|
|
358 |
RArray<TInt> iXdmIdArray;
|
|
359 |
// XDM name array
|
|
360 |
CDesCArray* iXdmNameArray;
|
|
361 |
// Presence settings id array
|
|
362 |
RArray<TInt> iPSIdArray;
|
|
363 |
// Presence settings name array
|
|
364 |
CDesCArray* iPSNameArray;
|
|
365 |
// Texts for the MDesCArray
|
|
366 |
HBufC* iVisibleSettingName;
|
|
367 |
|
|
368 |
};
|
|
369 |
|
|
370 |
/**
|
|
371 |
* Small utility class to store presence settings
|
|
372 |
* name and id.
|
|
373 |
* Used in CPSUIGSPluginModel::ReArrangePresenceSettingsL().
|
|
374 |
*
|
|
375 |
* @lib PSUIGSPlugin.lib
|
|
376 |
* @since Series60_3.2
|
|
377 |
*/
|
|
378 |
class CPSUINameIDPair :
|
|
379 |
public CBase
|
|
380 |
{
|
|
381 |
public :
|
|
382 |
inline ~CPSUINameIDPair() { delete iName; };
|
|
383 |
|
|
384 |
public :
|
|
385 |
TInt iID;
|
|
386 |
HBufC* iName;
|
|
387 |
};
|
|
388 |
|
|
389 |
#endif // PSUIGSPLUGINMODEL_H
|
|
390 |
// End of File
|