|
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: Application list for settings listbox. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMCSPLUGINSETTINGSAPPLIST_H |
|
20 #define CMCSPLUGINSETTINGSAPPLIST_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <bamdesca.h> // For MDesCArray |
|
24 #include <apgcli.h> // For RApaLsSession |
|
25 #include <msvapi.h> // For MMsvSessionObserver |
|
26 #include <apgnotif.h> // For MApaAppListServObserver |
|
27 #include <mcsmenu.h> // For MenuContentService |
|
28 #include <propertymap.h>// For HSPS settings property map |
|
29 |
|
30 /** |
|
31 * @ingroup group_mcsplugin |
|
32 * |
|
33 * Observer interface for application list events |
|
34 * |
|
35 * @since S60 v3.2 |
|
36 */ |
|
37 class MMCSPluginListObserver |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * AppList event codes |
|
43 */ |
|
44 enum TScutListEvent |
|
45 { |
|
46 EAppListReady, |
|
47 EAppListUpdated, |
|
48 EBkmListUpdated |
|
49 }; |
|
50 |
|
51 /** |
|
52 * Callback for application list events |
|
53 * |
|
54 * @since S60 v3.2 |
|
55 * @param aEvent AppList event code |
|
56 * @param aAdded ETrue if applications were added, EFalse if removed |
|
57 */ |
|
58 virtual void HandleScutListEventL( |
|
59 TScutListEvent aEvent, TBool aAdded ) = 0; |
|
60 |
|
61 // virtual TBool IsHidden(const TUid& aAppUid) const = 0; |
|
62 |
|
63 }; |
|
64 |
|
65 struct TSettingItem; |
|
66 /** |
|
67 * Application list for settings listbox |
|
68 * |
|
69 * @since S60 v3.2 |
|
70 */ |
|
71 |
|
72 class CMCSPluginWatcher; |
|
73 |
|
74 /** |
|
75 * @ingroup group_mcsplugin |
|
76 * |
|
77 * MCSPluginSettingsAppList class |
|
78 * |
|
79 * @since S60 v9.1 |
|
80 */ |
|
81 class CMCSPluginSettingsAppList : public CBase, //public CActive |
|
82 public MDesCArray, public MMsvSessionObserver |
|
83 { |
|
84 |
|
85 public: |
|
86 /** |
|
87 * Part of the two phased constuction |
|
88 * |
|
89 * @return CMCSPluginSettingsAppList* |
|
90 */ |
|
91 static CMCSPluginSettingsAppList* NewL(); |
|
92 |
|
93 /** |
|
94 * CompareNameL |
|
95 * |
|
96 * @param aFirst |
|
97 * @param aSecond |
|
98 */ |
|
99 static TInt CompareNameL(const CMenuItem& aFirst, const CMenuItem& aSecond); |
|
100 |
|
101 /** |
|
102 * Destructor |
|
103 */ |
|
104 virtual ~CMCSPluginSettingsAppList(); |
|
105 |
|
106 // from base class MDesCArray |
|
107 |
|
108 /** |
|
109 * From MDesCArray |
|
110 * Returns the number of descriptor elements in a descriptor array. |
|
111 * |
|
112 * @since S60 v3.2 |
|
113 * @return The number of descriptor elements in a descriptor array. |
|
114 */ |
|
115 TInt MdcaCount() const; |
|
116 |
|
117 /** |
|
118 * From MDesCArray |
|
119 * Indexes into a descriptor array. |
|
120 * |
|
121 * @since S60 v3.2 |
|
122 * @param aIndex The position of the descriptor element within a descriptor |
|
123 * array. |
|
124 * @return A 16 bit non-modifiable pointer descriptor representing the |
|
125 * descriptor element located at position aIndex within a descriptor |
|
126 * array. |
|
127 */ |
|
128 TPtrC MdcaPoint( TInt aIndex ) const; |
|
129 |
|
130 // from base class MMsvSessionObserver |
|
131 |
|
132 /** |
|
133 * Handles an event from the message server. |
|
134 * Not used, but must be defined to be able to use the messaging server. |
|
135 * |
|
136 * @since S60 v3.2 |
|
137 * @param aEvent Indicates the event type. |
|
138 * @param aArg1 Event type-specific argument value |
|
139 * @param aArg2 Event type-specific argument value |
|
140 * @param aArg3 Event type-specific argument value |
|
141 */ |
|
142 void HandleSessionEventL( TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, |
|
143 TAny* aArg3 ); |
|
144 |
|
145 /** |
|
146 * Starts the asynchronous appliation list initialization |
|
147 * |
|
148 * @since S60 v3.2 |
|
149 */ |
|
150 void StartL(); |
|
151 |
|
152 /** |
|
153 * FindItemL |
|
154 * |
|
155 * @since S60 |
|
156 * @param aProperties |
|
157 * @return TSettingItem |
|
158 */ |
|
159 TSettingItem FindItemL( RPointerArray<HSPluginSettingsIf::CPropertyMap>& |
|
160 aProperties ); |
|
161 |
|
162 /** |
|
163 * |
|
164 * |
|
165 * @since S60 |
|
166 * @param |
|
167 * @return |
|
168 */ |
|
169 CMenuItem& ItemL(const TInt& aIndex ); |
|
170 /** |
|
171 * RemoveMenuItemL |
|
172 * |
|
173 * @param aIndex |
|
174 */ |
|
175 void RemoveMenuItemL( TInt aIndex ); |
|
176 |
|
177 protected: |
|
178 |
|
179 private: |
|
180 /** |
|
181 * Constructor |
|
182 */ |
|
183 CMCSPluginSettingsAppList(); |
|
184 |
|
185 /** |
|
186 * Second-phase constructor. |
|
187 */ |
|
188 void ConstructL(); |
|
189 |
|
190 /** |
|
191 * Adds the static list items to the application list. |
|
192 * For example "New Message" and "New Email" items are added here. |
|
193 * |
|
194 * @since S60 v3.2 |
|
195 */ |
|
196 void AddStaticItemsL(); |
|
197 |
|
198 /** |
|
199 * Finds all mailboxes defined in the device |
|
200 */ |
|
201 CMsvEntry* GetRootEntryL(); |
|
202 |
|
203 /** |
|
204 * Adds remote mailboxes to the application list. |
|
205 * |
|
206 * @since S60 v3.2 |
|
207 */ |
|
208 void AddMailboxesL(); |
|
209 |
|
210 /** |
|
211 * Adds a mailbox to the list |
|
212 * |
|
213 * @since S60 v3.2 |
|
214 * @param aMailbox Name of the mailbox to add |
|
215 */ |
|
216 void AddMailboxL( const TDesC& aMailbox, const TDesC& aMailboxId ); |
|
217 |
|
218 /** |
|
219 * GetID of MCS Plugin Folder |
|
220 * |
|
221 * @return TInt |
|
222 */ |
|
223 TInt GetMCSPluginFolderIdL(); |
|
224 |
|
225 /** |
|
226 * Update menu items |
|
227 * |
|
228 * @return TInt |
|
229 */ |
|
230 TInt UpdateMenuItemsRefCountL( CMenuItem* aItem, TInt aValueToAdd ); |
|
231 |
|
232 private: // data |
|
233 |
|
234 /** |
|
235 * List of application items |
|
236 * Own. |
|
237 */ |
|
238 RPointerArray<CMenuItem> iListItems; |
|
239 |
|
240 /** |
|
241 * Message server session |
|
242 * Own. |
|
243 */ |
|
244 CMsvSession* iMsvSession; |
|
245 |
|
246 /** |
|
247 * Registered observer for application list events |
|
248 */ |
|
249 //MMCSPluginListObserver& iObserver; |
|
250 |
|
251 /** |
|
252 * A flag indicating if the app list should observe changes |
|
253 */ |
|
254 TBool iObserving; |
|
255 |
|
256 /** |
|
257 * iMenu |
|
258 */ |
|
259 RMenu iMenu; |
|
260 |
|
261 /** |
|
262 * iSaveWatcher |
|
263 */ |
|
264 CMCSPluginWatcher* iSaveWatcher; |
|
265 |
|
266 /** |
|
267 * iUpdateWatcher |
|
268 */ |
|
269 CMCSPluginWatcher* iUpdateWatcher; |
|
270 |
|
271 /** |
|
272 * iRemoveWatcher |
|
273 */ |
|
274 CMCSPluginWatcher* iRemoveWatcher; |
|
275 |
|
276 /** |
|
277 * iMCSPluginFolderId |
|
278 */ |
|
279 TInt iMCSPluginFolderId; |
|
280 }; |
|
281 |
|
282 #endif // CMCSPLUGINSETTINGSAPPLIST_H |
|
283 |
|
284 // End of File. |