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: 7 % << 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 <sipprofileregistryobserver.h> |
|
28 |
|
29 |
|
30 class CSIPManagedProfileRegistry; |
|
31 class CMusSettingsModel; |
|
32 |
|
33 |
|
34 /** |
|
35 * CMusSIPProfileModel model class. |
|
36 * Model class implementing SIP profile model. |
|
37 */ |
|
38 class CMusSIPProfileModel |
|
39 :public CBase, |
|
40 public MSIPProfileRegistryObserver, |
|
41 public MMusSIPProfileHandler |
|
42 { |
|
43 public: |
|
44 |
|
45 static CMusSIPProfileModel* NewL(); |
|
46 |
|
47 /** |
|
48 * Destructor. |
|
49 */ |
|
50 virtual ~CMusSIPProfileModel(); |
|
51 |
|
52 public: // From base class MMusSIPProfileHandler. |
|
53 |
|
54 /** |
|
55 * From MMusSIPProfileHandler. |
|
56 * Returns the index of the default SIP profile. |
|
57 * @return KErrNotFound, if one does not exist, otherwise index of the |
|
58 * default SIP profile. |
|
59 */ |
|
60 virtual TInt DefaultProfileIndex(); |
|
61 |
|
62 /** |
|
63 * From MMusSIPProfileHandler. |
|
64 * Returns the id of the default SIP profile. |
|
65 * @return KErrNotFound, if one does not exist, otherwise id of the |
|
66 * default SIP profile. |
|
67 */ |
|
68 virtual TUint32 DefaultProfileId(); |
|
69 |
|
70 |
|
71 /* |
|
72 * |
|
73 * |
|
74 */ |
|
75 virtual void DisableProfileL(); |
|
76 |
|
77 /* |
|
78 * |
|
79 * |
|
80 */ |
|
81 virtual void EnableProfileL(); |
|
82 |
|
83 /* |
|
84 * |
|
85 * |
|
86 */ |
|
87 virtual TBool ProfileEnabledL(); |
|
88 |
|
89 /** |
|
90 * From MMusSIPProfileHandler. |
|
91 * Returns SIP profile index on locally cached array based on id. |
|
92 * @param aId Profile id |
|
93 * @return Profile index or KErrNotFound if no matching profile is found. |
|
94 */ |
|
95 virtual TInt ProfileIndexByIdL( TUint32 aId ); |
|
96 |
|
97 /** |
|
98 * From MMusSIPProfileHandler. |
|
99 * Returns profile id based on index. |
|
100 * @param aIndex Profile index |
|
101 * @return Profile id or KUnknownProfileId if no matching profile is found. |
|
102 */ |
|
103 virtual TUint32 ProfileIdByIndex( TUint aIndex ); |
|
104 |
|
105 /** |
|
106 * From MMusSIPProfileHandler. |
|
107 * Returns a reference to the SIP profile array. |
|
108 * Note that previously returned value goes out of scope after a new |
|
109 * call to ProfileArrayL. So it is not advised to store return value |
|
110 * in long persistent variable, but rather to be used like stack |
|
111 * variables for safety. |
|
112 * |
|
113 * @return Reference to internally cached SIP profile array. |
|
114 */ |
|
115 virtual RPointerArray<CSIPProfile>& ProfileArrayL(); |
|
116 |
|
117 public: // From base class MSIPProfileRegistryObserver. |
|
118 |
|
119 /** |
|
120 * From MSIPProfileRegistryObserver. |
|
121 * SIP profile information event. |
|
122 * @param aProfileId Id of SIP profile in question. |
|
123 * @param aEvent Type of information event. |
|
124 */ |
|
125 virtual void ProfileRegistryEventOccurred( |
|
126 TUint32 aSIPProfileId, |
|
127 TEvent aEvent ); |
|
128 |
|
129 /** |
|
130 * From MSIPProfileRegistryObserver. |
|
131 * An asynchronous error has occurred related to SIP profile. |
|
132 * @param aSIPProfileId Id of the failed profile. |
|
133 * @param aError An error code. |
|
134 */ |
|
135 virtual void ProfileRegistryErrorOccurred( |
|
136 TUint32 aSIPProfileId, |
|
137 TInt aError ); |
|
138 |
|
139 |
|
140 |
|
141 /** |
|
142 * Set CMusSettingsModel to handle ProfileRegistry Event. |
|
143 * @param aCMusSettingsModel the CMusSettingsModel to handle ProfileRegistry Event |
|
144 */ |
|
145 void SetCMusSettingsModel(CMusSettingsModel* aCMusSettingsModel); |
|
146 |
|
147 protected: |
|
148 |
|
149 /** |
|
150 * Sorts internal array of SIP profiles by id. |
|
151 */ |
|
152 void SortProfilesL(); |
|
153 |
|
154 |
|
155 private: |
|
156 |
|
157 CMusSIPProfileModel(); |
|
158 |
|
159 void ConstructL(); |
|
160 |
|
161 |
|
162 private: // data |
|
163 |
|
164 /** |
|
165 * Instance of the SIP profile registry engine for managing SIP profiles. |
|
166 * Own. |
|
167 */ |
|
168 CSIPManagedProfileRegistry* iEngine; |
|
169 |
|
170 /** |
|
171 * Locally cached array of SIP profiles. |
|
172 */ |
|
173 RPointerArray<CSIPProfile> iProfiles; |
|
174 |
|
175 /** |
|
176 * CMusSettingsModel to handle ProfileRegistry |
|
177 * Event |
|
178 */ |
|
179 CMusSettingsModel* iCMusSettingsModel; |
|
180 |
|
181 }; |
|
182 |
|
183 #endif // C_MUSSIPPROFILEMODEL_H |
|