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