|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Class implementing SIP profile model. |
|
15 * Version : %version: 5.1.6 % << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_MUSSIPPROFILEMODEL_H |
|
22 #define C_MUSSIPPROFILEMODEL_H |
|
23 |
|
24 |
|
25 #include "mmussipprofilehandler.h" |
|
26 #include <e32base.h> |
|
27 #include <sipmanagedprofile.h> |
|
28 #include <gsplugininterface.h> |
|
29 #include <sipprofileregistryobserver.h> |
|
30 |
|
31 |
|
32 class CSIPManagedProfileRegistry; |
|
33 |
|
34 |
|
35 /** |
|
36 * CMusSIPProfileModel model class. |
|
37 * Model class implementing SIP profile model. |
|
38 * |
|
39 * @since S60 v3.2 |
|
40 */ |
|
41 class CMusSIPProfileModel |
|
42 :public CBase, |
|
43 public MSIPProfileRegistryObserver, |
|
44 public MMusSIPProfileHandler |
|
45 { |
|
46 public: |
|
47 |
|
48 static CMusSIPProfileModel* NewL(); |
|
49 |
|
50 /** |
|
51 * Destructor. |
|
52 */ |
|
53 virtual ~CMusSIPProfileModel(); |
|
54 |
|
55 public: // From base class MMusSIPProfileHandler. |
|
56 |
|
57 /** |
|
58 * From MMusSIPProfileHandler. |
|
59 * Returns the index of the default SIP profile. |
|
60 * @return KErrNotFound, if one does not exist, otherwise index of the |
|
61 * default SIP profile. |
|
62 */ |
|
63 virtual TInt DefaultProfileIndex(); |
|
64 |
|
65 /** |
|
66 * From MMusSIPProfileHandler. |
|
67 * Returns the id of the default SIP profile. |
|
68 * @return KErrNotFound, if one does not exist, otherwise id of the |
|
69 * default SIP profile. |
|
70 */ |
|
71 virtual TUint32 DefaultProfileId(); |
|
72 |
|
73 |
|
74 /* |
|
75 * |
|
76 * |
|
77 */ |
|
78 virtual void DisableProfileL(); |
|
79 |
|
80 /* |
|
81 * |
|
82 * |
|
83 */ |
|
84 virtual void EnableProfileL(); |
|
85 |
|
86 /* |
|
87 * |
|
88 * |
|
89 */ |
|
90 virtual TBool ProfileEnabledL(); |
|
91 |
|
92 /** |
|
93 * From MMusSIPProfileHandler. |
|
94 * Returns SIP profile index on locally cached array based on id. |
|
95 * @param aId Profile id |
|
96 * @return Profile index or KErrNotFound if no matching profile is found. |
|
97 */ |
|
98 virtual TInt ProfileIndexByIdL( TUint32 aId ); |
|
99 |
|
100 /** |
|
101 * From MMusSIPProfileHandler. |
|
102 * Returns profile id based on index. |
|
103 * @param aIndex Profile index |
|
104 * @return Profile id or KUnknownProfileId if no matching profile is found. |
|
105 */ |
|
106 virtual TUint32 ProfileIdByIndex( TUint aIndex ); |
|
107 |
|
108 /** |
|
109 * From MMusSIPProfileHandler. |
|
110 * Returns pointer to the SIP profile array, does not change ownership. |
|
111 * Note that previously returned value goes out of scope after a new |
|
112 * call to ProfileArrayL. So it is not advised to store return value |
|
113 * in long persistent variable, but rather to be used like stack |
|
114 * variables for safety. |
|
115 * |
|
116 * @return Pointer to internally cached SIP profile array. |
|
117 */ |
|
118 virtual CArrayPtr<CSIPManagedProfile>* ProfileArrayL(); |
|
119 |
|
120 public: // From base class MSIPProfileRegistryObserver. |
|
121 |
|
122 /** |
|
123 * From MSIPProfileRegistryObserver. |
|
124 * SIP profile information event. |
|
125 * @param aProfileId Id of SIP profile in question. |
|
126 * @param aEvent Type of information event. |
|
127 */ |
|
128 virtual void ProfileRegistryEventOccurred( |
|
129 TUint32 aSIPProfileId, |
|
130 TEvent aEvent ); |
|
131 |
|
132 /** |
|
133 * From MSIPProfileRegistryObserver. |
|
134 * An asynchronous error has occurred related to SIP profile. |
|
135 * @param aSIPProfileId Id of the failed profile. |
|
136 * @param aError An error code. |
|
137 */ |
|
138 virtual void ProfileRegistryErrorOccurred( |
|
139 TUint32 aSIPProfileId, |
|
140 TInt aError ); |
|
141 |
|
142 protected: |
|
143 |
|
144 /** |
|
145 * Reads the profile array from SIP Profile Client. |
|
146 */ |
|
147 void ReadArrayFromEngineL(); |
|
148 |
|
149 /** |
|
150 * Sorts internal array of SIP profiles by id. |
|
151 */ |
|
152 void SortProfilesL(); |
|
153 |
|
154 /** |
|
155 * Deletes internally cached profiles. |
|
156 */ |
|
157 void DeleteProfiles(); |
|
158 |
|
159 /** |
|
160 * Reads profile list from the engine; if reading fails, |
|
161 * keeps the old list safe. |
|
162 */ |
|
163 void ReadProfileListFromEngineSafeL(); |
|
164 |
|
165 private: |
|
166 |
|
167 CMusSIPProfileModel(); |
|
168 |
|
169 void ConstructL(); |
|
170 |
|
171 /** |
|
172 * For deleting RPointerArray in case of leave. |
|
173 */ |
|
174 static void ResetAndDestroy( TAny* aPointerArray ); |
|
175 |
|
176 private: // data |
|
177 |
|
178 /** |
|
179 * Instance of the SIP profile registry engine for managing SIP profiles. |
|
180 * Own. |
|
181 */ |
|
182 CSIPManagedProfileRegistry* iEngine; |
|
183 |
|
184 /** |
|
185 * Locally cached array of SIP profiles. |
|
186 * Own. |
|
187 */ |
|
188 CArrayPtrFlat<CSIPManagedProfile>* iProfiles; |
|
189 |
|
190 }; |
|
191 |
|
192 #endif // C_MUSSIPPROFILEMODEL_H |