|
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: Phonebook2 command execution handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CCCAPPCOMMLAUNCHERPBKCMD_H |
|
20 #define C_CCCAPPCOMMLAUNCHERPBKCMD_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 #include <RPbk2LocalizedResourceFile.h> |
|
25 #include <MVPbkSingleContactOperationObserver.h> |
|
26 #include <MVPbkContactStoreObserver.h> |
|
27 #include <MPbk2ContactUiControl.h> |
|
28 #include <MPbk2ContactUiControl2.h> |
|
29 #include <Pbk2Commands.hrh> |
|
30 |
|
31 class CPbk2CommandHandler; |
|
32 class CPbk2ApplicationServices; |
|
33 class MVPbkContactOperationBase; |
|
34 class MVPbkContactLinkArray; |
|
35 class MVPbkBaseContactField; |
|
36 class MVPbkContactLink; |
|
37 class MPbk2Command; |
|
38 class CCCAppCommLauncherPlugin; |
|
39 |
|
40 /** |
|
41 * Class to use Phonebook2 command implementations from out an external application. |
|
42 * ?more_complete_description |
|
43 * |
|
44 * @code |
|
45 * ?good_class_usage_example(s) |
|
46 * @endcode |
|
47 * |
|
48 * @lib ccappcommlauncherplugin.dll |
|
49 * @since S60 v3.2 |
|
50 */ |
|
51 class CCCAppCommLauncherPbkCmd : |
|
52 public CBase, |
|
53 public MVPbkContactStoreObserver, |
|
54 public MVPbkSingleContactOperationObserver, |
|
55 public MPbk2ContactUiControl, |
|
56 public MPbk2ContactUiControl2 |
|
57 { |
|
58 public: |
|
59 |
|
60 static CCCAppCommLauncherPbkCmd* NewL( CCCAppCommLauncherPlugin& aPlugin ); |
|
61 static CCCAppCommLauncherPbkCmd* NewLC( CCCAppCommLauncherPlugin& aPlugin ); |
|
62 |
|
63 /** |
|
64 * Destructor. |
|
65 */ |
|
66 virtual ~CCCAppCommLauncherPbkCmd(); |
|
67 |
|
68 public: // new |
|
69 void ExecutePbk2CmdAssignDefaultL( const TDesC8& aContact ); |
|
70 void ExecutePbk2CmdShowMapL( const HBufC8* aContact, TPbk2CommandId aCommandId ); |
|
71 void ExecutePbk2CmdViewImageL( const TDesC8& aContact ); |
|
72 void ExecutePbk2CmdChangeImageL( const TDesC8& aContact ); |
|
73 void ExecutePbk2CmdRemoveImageL( const TDesC8& aContact ); |
|
74 void ExecutePbk2CmdAddImageL( const TDesC8& aContact ); |
|
75 void ExecutePbk2CmdDeleteL( const TDesC8& aContact ); |
|
76 TBool IsPbk2CommandRunning(); |
|
77 |
|
78 public: // from MVPbkContactStoreObserver |
|
79 |
|
80 void StoreReady( |
|
81 MVPbkContactStore& aContactStore); |
|
82 |
|
83 void StoreUnavailable( |
|
84 MVPbkContactStore& aContactStore, |
|
85 TInt aReason); |
|
86 |
|
87 void HandleStoreEventL( |
|
88 MVPbkContactStore& aContactStore, |
|
89 TVPbkContactStoreEvent aStoreEvent ); |
|
90 |
|
91 public: // from MVPbkSingleContactOperationObserver |
|
92 |
|
93 void VPbkSingleContactOperationComplete( |
|
94 MVPbkContactOperationBase& aOperation, |
|
95 MVPbkStoreContact* aContact ); |
|
96 |
|
97 void VPbkSingleContactOperationFailed( |
|
98 MVPbkContactOperationBase& aOperation, |
|
99 TInt aError ); |
|
100 |
|
101 public: // From MPbk2ContactUiControl |
|
102 |
|
103 MPbk2ContactUiControl* ParentControl() const; |
|
104 TInt NumberOfContacts() const; |
|
105 const MVPbkBaseContact* FocusedContactL() const; |
|
106 const MVPbkViewContact* FocusedViewContactL() const; |
|
107 const MVPbkStoreContact* FocusedStoreContact() const; |
|
108 void SetFocusedContactL( |
|
109 const MVPbkBaseContact& aContact ); |
|
110 void SetFocusedContactL( |
|
111 const MVPbkContactBookmark& aContactBookmark ); |
|
112 void SetFocusedContactL( |
|
113 const MVPbkContactLink& aContactLink ); |
|
114 TInt FocusedContactIndex() const; |
|
115 void SetFocusedContactIndexL( |
|
116 TInt aIndex ); |
|
117 TInt NumberOfContactFields() const; |
|
118 const MVPbkBaseContactField* FocusedField() const; |
|
119 TInt FocusedFieldIndex() const; |
|
120 void SetFocusedFieldIndex( |
|
121 TInt aIndex ); |
|
122 TBool ContactsMarked() const; |
|
123 MVPbkContactLinkArray* SelectedContactsL() const; |
|
124 MVPbkContactLinkArray* SelectedContactsOrFocusedContactL() const; |
|
125 MPbk2ContactLinkIterator* SelectedContactsIteratorL() const; |
|
126 CArrayPtr<MVPbkContactStore>* SelectedContactStoresL() const; |
|
127 void ClearMarks(); |
|
128 void SetSelectedContactL( |
|
129 TInt aIndex, |
|
130 TBool aSelected ); |
|
131 void SetSelectedContactL( |
|
132 const MVPbkContactBookmark& aContactBookmark, |
|
133 TBool aSelected ); |
|
134 void SetSelectedContactL( |
|
135 const MVPbkContactLink& aContactLink, |
|
136 TBool aSelected ); |
|
137 |
|
138 void DynInitMenuPaneL( |
|
139 TInt aResourceId, |
|
140 CEikMenuPane* aMenuPane ) const; |
|
141 void ProcessCommandL( |
|
142 TInt aCommandId ) const; |
|
143 void UpdateAfterCommandExecution(); |
|
144 TInt GetMenuFilteringFlagsL() const; |
|
145 CPbk2ViewState* ControlStateL() const; |
|
146 void RestoreControlStateL( |
|
147 CPbk2ViewState* aState ); |
|
148 const TDesC& FindTextL(); |
|
149 void ResetFindL(); |
|
150 void ShowThumbnail(); |
|
151 void HideThumbnail(); |
|
152 void SetBlank( |
|
153 TBool aBlank ); |
|
154 void RegisterCommand( |
|
155 MPbk2Command* aCommand ); |
|
156 void SetTextL( |
|
157 const TDesC& aText ); |
|
158 TAny* ContactUiControlExtension(TUid aExtensionUid ); |
|
159 |
|
160 public: // From MPbk2ContactUiControl2 |
|
161 TInt CommandItemCount() const; |
|
162 const MPbk2UiControlCmdItem& CommandItemAt( TInt aIndex ) const; |
|
163 const MPbk2UiControlCmdItem* FocusedCommandItem() const; |
|
164 void DeleteCommandItemL( TInt aIndex ); |
|
165 void AddCommandItemL(MPbk2UiControlCmdItem* /*aCommand*/, TInt /*aIndex*/); |
|
166 private: |
|
167 |
|
168 void ConstructL(); |
|
169 CCCAppCommLauncherPbkCmd( CCCAppCommLauncherPlugin& aPlugin ); |
|
170 |
|
171 private: |
|
172 |
|
173 void PreparePbk2ApplicationServicesL(); |
|
174 void HandleError( TInt aError ); |
|
175 |
|
176 public: |
|
177 /* |
|
178 * API reponsible for returning reference to |
|
179 * Phonebook 2 application services. |
|
180 * CPbk2ApplicationServices is Responsible for owning and delivering commonly |
|
181 * used shared objects and providing some common application level services. |
|
182 * @return - Pointer to Application services |
|
183 */ |
|
184 CPbk2ApplicationServices& ApplicationServices() const; |
|
185 private: |
|
186 /** |
|
187 * Pointer to Pbk2 command handler. |
|
188 * Own. |
|
189 */ |
|
190 CPbk2CommandHandler* iCommandHandler; |
|
191 |
|
192 /** |
|
193 * Pointer to Application services. |
|
194 * Own. |
|
195 */ |
|
196 CPbk2ApplicationServices* iAppServices; |
|
197 |
|
198 /// Own: Phonebook 2 commands dll resource file |
|
199 RPbk2LocalizedResourceFile iCommandsResourceFile; |
|
200 |
|
201 /// Own: Phonebook 2 UI controls dll resource file |
|
202 RPbk2LocalizedResourceFile iUiControlsResourceFile; |
|
203 |
|
204 /// Own: Phonebook 2 common UI dll resource file |
|
205 RPbk2LocalizedResourceFile iCommonUiResourceFile; |
|
206 |
|
207 /// Own: MVPbkStoreContact |
|
208 MVPbkStoreContact* iStoreContact; |
|
209 |
|
210 /// Own: MVPbkContactOperationBase |
|
211 MVPbkContactOperationBase* iOperation; |
|
212 |
|
213 /// Own: MVPbkContactLinkArray |
|
214 MVPbkContactLinkArray* iLinks; |
|
215 |
|
216 /// Ref: command in execution |
|
217 MPbk2Command* iCommand; |
|
218 |
|
219 /// Own: TPbk2CommandId |
|
220 TPbk2CommandId iPbk2CommandId; |
|
221 |
|
222 CCCAppCommLauncherPlugin& iPlugin; |
|
223 |
|
224 /// Own: contact store in use, has to be closed when done |
|
225 MVPbkContactStore* iContactStore; |
|
226 |
|
227 /// Own: Boolean for querying if there is a command being executed |
|
228 TBool iCommandInProgress; |
|
229 }; |
|
230 |
|
231 #endif // C_CCCAPPCOMMLAUNCHERPBKCMD_H |