|
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: Class implementing CCCAppViewPluginBase interface |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CCAPPDETAILSVIEWPLUGIN_H |
|
19 #define C_CCAPPDETAILSVIEWPLUGIN_H |
|
20 |
|
21 #include <ccappviewpluginbase.h> |
|
22 |
|
23 #include <MVPbkContactStoreListObserver.h> |
|
24 #include <RPbk2LocalizedResourceFile.h> |
|
25 #include <mccappviewpluginbase2.h> |
|
26 |
|
27 #include <mccacontactobserver.h> |
|
28 |
|
29 class CAknIcon; |
|
30 class CPbk2ApplicationServices; |
|
31 class MVPbkContactStoreList; |
|
32 class CCCAppDetailsViewMenuHandler; |
|
33 class MCCAParameter; |
|
34 class CCCAppCmsContactFetcherWrapper; |
|
35 class CCAContactorService; |
|
36 |
|
37 /** |
|
38 * Class implementing CCCAppViewPluginBase interface. This is |
|
39 * the main class and controlling the other classes of the plugin. |
|
40 * |
|
41 * @code |
|
42 * ?good_class_usage_example(s) |
|
43 * @endcode |
|
44 * |
|
45 * @lib ccappdetailsviewplugin.dll |
|
46 */ |
|
47 class CCCAppDetailsViewPlugin : |
|
48 public CCCAppViewPluginBase, |
|
49 public MVPbkContactStoreListObserver, |
|
50 public MCCAppPluginsContactObserver, |
|
51 public MCCAppViewPluginBase2 |
|
52 { |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 */ |
|
59 static CCCAppDetailsViewPlugin* NewL(); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 ~CCCAppDetailsViewPlugin(); |
|
65 |
|
66 public: // From MCCAppPluginsContactObserver |
|
67 |
|
68 void NotifyPluginOfContactEventL(); |
|
69 |
|
70 private: // From CAknView |
|
71 |
|
72 void HandleStatusPaneSizeChange(); |
|
73 |
|
74 private: // From CCCAppViewPluginBase |
|
75 |
|
76 void PreparePluginViewL(MCCAppPluginParameter& aPluginParameter ); |
|
77 |
|
78 void ProvideBitmapL(TCCAppIconType aIconType, CAknIcon& aIcon); |
|
79 |
|
80 void NewContainerL(); |
|
81 |
|
82 void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); |
|
83 |
|
84 void HandleCommandL(TInt aCommand); |
|
85 |
|
86 TUid Id() const; |
|
87 |
|
88 void DoActivateL( |
|
89 const TVwsViewId& aPrevViewId, |
|
90 TUid aCustomMessageId, |
|
91 const TDesC8& aCustomMessage ); |
|
92 |
|
93 void DoDeactivate(); |
|
94 |
|
95 TBool CheckVisibilityL(MCCAppPluginParameter& aPluginParameter); |
|
96 |
|
97 TAny* CCCAppViewPluginBaseExtension( TUid aExtensionUid ); |
|
98 |
|
99 public: // new |
|
100 |
|
101 /** |
|
102 * Helper function for get the reference |
|
103 * to container data. |
|
104 * |
|
105 * return container |
|
106 */ |
|
107 CCCAppViewPluginAknContainer& GetContainer() |
|
108 { |
|
109 return *iContainer; |
|
110 } |
|
111 |
|
112 /** |
|
113 * Handles Edit Request. |
|
114 */ |
|
115 void HandleEditRequestL(); |
|
116 |
|
117 /** |
|
118 * Handles Delete Request. |
|
119 */ |
|
120 void HandleDeleteRequestL(); |
|
121 |
|
122 private: // new |
|
123 |
|
124 /** |
|
125 * Helper function for reading and |
|
126 * loading resources needed by plugin. |
|
127 * |
|
128 */ |
|
129 void PrepareViewResourcesL(); |
|
130 |
|
131 /** |
|
132 * Creates menuhandler if not created already. |
|
133 */ |
|
134 void EnsureMenuHandlerCreatedL(); |
|
135 |
|
136 private: |
|
137 |
|
138 CCCAppDetailsViewPlugin(); |
|
139 |
|
140 void ConstructL(); |
|
141 |
|
142 void GetContactDataL(); |
|
143 |
|
144 private: // From MVPbkContactStoreListObserver |
|
145 |
|
146 void OpenComplete(); |
|
147 |
|
148 void StoreReady(MVPbkContactStore& aContactStore ); |
|
149 |
|
150 void StoreUnavailable(MVPbkContactStore& aContactStore, TInt aReason ); |
|
151 |
|
152 void HandleStoreEventL(MVPbkContactStore& aContactStore, TVPbkContactStoreEvent aStoreEvent ); |
|
153 |
|
154 public: |
|
155 /* |
|
156 * Sets the title to the plugin |
|
157 * @param aTitle - title to be set |
|
158 */ |
|
159 void SetTitleL( const TDesC& aTitle ); |
|
160 |
|
161 /** |
|
162 * Sets the CBA labels. |
|
163 * @param aEditable Boolean that tells if contact is editable or not |
|
164 */ |
|
165 void UpdateMSKinCbaL( TBool aEditable ); |
|
166 |
|
167 private: |
|
168 |
|
169 /* Sets the Visibilty of the Plugin to true |
|
170 * and also calls ShowPlugin which will enable this plugin to be visible in the CCA |
|
171 */ |
|
172 void MakeMeVisibleL(); |
|
173 |
|
174 /* Check whether the contact info passed to this view is really valid or not |
|
175 * if not valid dont set the visibility of plugin to true |
|
176 * |
|
177 */ |
|
178 void CheckValidityOfContactInfoL(); |
|
179 |
|
180 /** |
|
181 * Callback function for CIdle object that calls PrepareAllPluginsL(). |
|
182 * |
|
183 * @param aContainer |
|
184 * @return KErrnone always |
|
185 */ |
|
186 static TInt CheckVisibilityCallbackL( TAny* aContainer ); |
|
187 |
|
188 /** |
|
189 * Initiates the preparation of the details view plugins in the background |
|
190 * |
|
191 */ |
|
192 void CheckVisibilityInBackgroundL(); |
|
193 |
|
194 /** |
|
195 * Helper function for getting the CPbk2ApplicationServices instance. |
|
196 * This function creates the CPbk2ApplicationServices if not available |
|
197 * |
|
198 * @return - Reference to CPbk2ApplicationServices |
|
199 */ |
|
200 CPbk2ApplicationServices& GetPbk2AppServicesL(); |
|
201 |
|
202 public: |
|
203 |
|
204 /** |
|
205 * Return pointer to contactor service. |
|
206 */ |
|
207 CCAContactorService* ContactorService(); |
|
208 |
|
209 public: //From MCCAppViewPluginBase2 |
|
210 |
|
211 TBool PluginBusy(); |
|
212 |
|
213 private: // data |
|
214 |
|
215 /** |
|
216 * Pointer to menuhandler. |
|
217 * Own. |
|
218 */ |
|
219 CCCAppDetailsViewMenuHandler* iMenuHandler; |
|
220 |
|
221 /** |
|
222 * Pointer to Application services. |
|
223 * Own. |
|
224 * Dont use this directly, use GetPbk2AppServicesL() API to |
|
225 * get the instance of CPbk2ApplicationServices& |
|
226 */ |
|
227 CPbk2ApplicationServices* iAppServices; |
|
228 |
|
229 /** |
|
230 * |
|
231 */ |
|
232 MVPbkContactStoreList* iStoreList; |
|
233 |
|
234 /** |
|
235 * |
|
236 */ |
|
237 MCCAParameter* iLaunchParameter; |
|
238 /** |
|
239 * |
|
240 */ |
|
241 TInt iFocusedListIndex; |
|
242 |
|
243 /** |
|
244 * |
|
245 */ |
|
246 CActiveSchedulerWait iSchedulerWait; |
|
247 |
|
248 /// Own: Phonebook 2 commands dll resource file |
|
249 RPbk2LocalizedResourceFile iCommandsResourceFile; |
|
250 |
|
251 /// Own: Phonebook 2 UI controls dll resource file |
|
252 RPbk2LocalizedResourceFile iUiControlsResourceFile; |
|
253 |
|
254 /// Own: Phonebook 2 common UI dll resource file |
|
255 RPbk2LocalizedResourceFile iCommonUiResourceFile; |
|
256 |
|
257 //Boolean to decide whether a Plugin is Visible or not in the CCA |
|
258 //Default value is EFalse - this Plugin is NotVisible by default |
|
259 TBool iVisible; |
|
260 |
|
261 //BG task for checking the visibility of this details view plugin |
|
262 CIdle* iBgTaskForCheckingVisibility; |
|
263 |
|
264 /// Not own: CMS is used through CmsHandler to (re)fetch contact data fields |
|
265 CCCAppCmsContactFetcherWrapper* iCmsWrapper; |
|
266 |
|
267 /// Own: Pointer to contactor service. |
|
268 CCAContactorService* iContactorService; |
|
269 |
|
270 }; |
|
271 |
|
272 #endif // C_CCAPPDETAILSVIEWPLUGIN_H |
|
273 |
|
274 // End of File |