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