20
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2007 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: Phonebook 2 add to group command object.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CPGUADDMEMBERSCMD_H
|
|
20 |
#define CPGUADDMEMBERSCMD_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <MPbk2FetchDlgObserver.h>
|
|
25 |
#include <MPbk2ContactRelocatorObserver.h>
|
|
26 |
#include <MVPbkContactObserver.h>
|
|
27 |
#include <MVPbkSingleContactOperationObserver.h>
|
|
28 |
#include <MVPbkContactViewObserver.h>
|
|
29 |
#include <MPbk2Command.h>
|
|
30 |
#include <MVPbkContactSelector.h>
|
|
31 |
#include <MPbk2ProcessDecorator.h>
|
|
32 |
|
|
33 |
// FORWARD DECLARATIONS
|
|
34 |
class MPbk2ContactUiControl;
|
|
35 |
class MVPbkContactGroup;
|
|
36 |
class MVPbkContactLink;
|
|
37 |
class MVPbkContactLinkArray;
|
|
38 |
class CVPbkContactLinkArray;
|
|
39 |
class MVPbkContactOperationBase;
|
|
40 |
class MVPbkContactViewBase;
|
|
41 |
class CPbk2ContactRelocator;
|
|
42 |
|
|
43 |
// CLASS DECLARATION
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Phonebook 2 add to group command object.
|
|
47 |
*/
|
|
48 |
class CPguAddMembersCmd : public CActive,
|
|
49 |
public MPbk2Command,
|
|
50 |
private MVPbkSingleContactOperationObserver,
|
|
51 |
private MVPbkContactObserver,
|
|
52 |
private MPbk2FetchDlgObserver,
|
|
53 |
private MVPbkContactViewObserver,
|
|
54 |
private MVPbkContactSelector,
|
|
55 |
private MPbk2ContactRelocatorObserver,
|
|
56 |
private MPbk2ProcessDecoratorObserver
|
|
57 |
{
|
|
58 |
public: // Construction and destruction
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Creates a new instance of this class.
|
|
62 |
*
|
|
63 |
* @param aGroup Group link.
|
|
64 |
* @param aUiControl UI control.
|
|
65 |
* @return A new instance of this class.
|
|
66 |
*/
|
|
67 |
static CPguAddMembersCmd* NewLC(
|
|
68 |
MVPbkContactLink& aGroup,
|
|
69 |
MPbk2ContactUiControl& aUiControl );
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Destructor.
|
|
73 |
*/
|
|
74 |
~CPguAddMembersCmd();
|
|
75 |
|
|
76 |
public: // From MPbk2Command
|
|
77 |
void ExecuteLD();
|
|
78 |
void AddObserver(
|
|
79 |
MPbk2CommandObserver& aObserver );
|
|
80 |
void ResetUiControl(
|
|
81 |
MPbk2ContactUiControl& aUiControl );
|
|
82 |
|
|
83 |
private: // From CActive
|
|
84 |
void RunL();
|
|
85 |
void DoCancel();
|
|
86 |
TInt RunError(
|
|
87 |
TInt aError );
|
|
88 |
|
|
89 |
private: // From MVPbkSingleContactOperationObserver
|
|
90 |
void VPbkSingleContactOperationComplete(
|
|
91 |
MVPbkContactOperationBase& aOperation,
|
|
92 |
MVPbkStoreContact* aContact );
|
|
93 |
void VPbkSingleContactOperationFailed(
|
|
94 |
MVPbkContactOperationBase& aOperation,
|
|
95 |
TInt aError );
|
|
96 |
|
|
97 |
private: // From MVPbkContactObserver
|
|
98 |
void ContactOperationCompleted(
|
|
99 |
TContactOpResult aResult );
|
|
100 |
void ContactOperationFailed(
|
|
101 |
TContactOp aOpCode,
|
|
102 |
TInt aErrorCode,
|
|
103 |
TBool aErrorNotified );
|
|
104 |
|
|
105 |
private: // From MVPbkContactViewObserver
|
|
106 |
void ContactViewReady(
|
|
107 |
MVPbkContactViewBase& aView );
|
|
108 |
void ContactViewUnavailable(
|
|
109 |
MVPbkContactViewBase& aView );
|
|
110 |
void ContactAddedToView(
|
|
111 |
MVPbkContactViewBase& aView,
|
|
112 |
TInt aIndex,
|
|
113 |
const MVPbkContactLink& aContactLink );
|
|
114 |
void ContactRemovedFromView(
|
|
115 |
MVPbkContactViewBase& aView,
|
|
116 |
TInt aIndex,
|
|
117 |
const MVPbkContactLink& aContactLink );
|
|
118 |
void ContactViewError(
|
|
119 |
MVPbkContactViewBase& aView,
|
|
120 |
TInt aError,
|
|
121 |
TBool aErrorNotified );
|
|
122 |
|
|
123 |
private: // From MVPbkContactSelector
|
|
124 |
TBool IsContactIncluded(
|
|
125 |
const MVPbkBaseContact& aContact );
|
|
126 |
|
|
127 |
private: // From MPbk2FetchDlgObserver
|
|
128 |
TPbk2FetchAcceptSelection AcceptFetchSelectionL(
|
|
129 |
TInt aNumMarkedEntries,
|
|
130 |
MVPbkContactLink& aLastSelection );
|
|
131 |
void FetchCompletedL(
|
|
132 |
MVPbkContactLinkArray* aMarkedEntries );
|
|
133 |
void FetchCanceled();
|
|
134 |
void FetchAborted();
|
|
135 |
TBool FetchOkToExit();
|
|
136 |
|
|
137 |
private: // From MPbk2ContactRelocatorObserver
|
|
138 |
void ContactRelocatedL(
|
|
139 |
MVPbkStoreContact* aRelocatedContact );
|
|
140 |
void ContactRelocationFailed(
|
|
141 |
TInt aReason,
|
|
142 |
MVPbkStoreContact* aContact );
|
|
143 |
void ContactsRelocationFailed(
|
|
144 |
TInt aReason,
|
|
145 |
CVPbkContactLinkArray* aContacts );
|
|
146 |
void RelocationProcessComplete();
|
|
147 |
|
|
148 |
public: // From MPbk2ProcessDecoratorObserver
|
|
149 |
void ProcessDismissed(
|
|
150 |
TInt aCancelCode );
|
|
151 |
|
|
152 |
private: // Implementation
|
|
153 |
CPguAddMembersCmd(
|
|
154 |
MVPbkContactLink& aContactGroup,
|
|
155 |
MPbk2ContactUiControl& aUiControl );
|
|
156 |
void ConstructL();
|
|
157 |
void HandleContactLockedEventL();
|
|
158 |
void DoLaunchFetchDialogL();
|
|
159 |
void PrepareFetchResultsL(
|
|
160 |
MVPbkContactLinkArray* aMarkedEntries );
|
|
161 |
void CheckContactsL();
|
|
162 |
void BeginRelocationL();
|
|
163 |
void RelocateContactsL();
|
|
164 |
void RelocateContactL(
|
|
165 |
MVPbkStoreContact* aStoreContact );
|
|
166 |
void AddContactsToGroupL();
|
|
167 |
void CommitTransactionL();
|
|
168 |
void FinishCommand(
|
|
169 |
TInt aResult );
|
|
170 |
void ShowRelocationNoteL(
|
|
171 |
TInt aCount );
|
|
172 |
void ShowProgressNoteL();
|
|
173 |
void IssueRequest();
|
|
174 |
void IssueStopRequest();
|
|
175 |
void SetFocusToLastAddedL();
|
|
176 |
|
|
177 |
private: // Data structures
|
|
178 |
/// Process states
|
|
179 |
enum TState
|
|
180 |
{
|
|
181 |
ERetrievingContact,
|
|
182 |
EHandleContactLockedEvent,
|
|
183 |
ECheckContacts,
|
|
184 |
ERelocateContacts,
|
|
185 |
EShowingProgressNote,
|
|
186 |
EAddingContactsToGroup,
|
|
187 |
ECommitingTransaction,
|
|
188 |
EStopping
|
|
189 |
};
|
|
190 |
|
|
191 |
private: // Data
|
|
192 |
/// Ref: UI control
|
|
193 |
MPbk2ContactUiControl* iUiControl;
|
|
194 |
/// Ref: Command observer
|
|
195 |
MPbk2CommandObserver* iCommandObserver;
|
|
196 |
/// Own: Retrieve group operation
|
|
197 |
MVPbkContactOperationBase* iRetrieveGroupOperation;
|
|
198 |
/// Own: Retrieve contact operation
|
|
199 |
MVPbkContactOperationBase* iRetrieveContactOperation;
|
|
200 |
/// Ref: A group where to add members
|
|
201 |
MVPbkContactLink& iGroupLink;
|
|
202 |
/// Own: Contact group
|
|
203 |
MVPbkContactGroup* iContactGroup;
|
|
204 |
/// Own: A filtered view for dialog
|
|
205 |
MVPbkContactViewBase* iFilteredView;
|
|
206 |
/// Own: Entries to add to group
|
|
207 |
CVPbkContactLinkArray* iEntriesToAdd;
|
|
208 |
/// Own: Entries to relocate
|
|
209 |
CVPbkContactLinkArray* iEntriesToRelocate;
|
|
210 |
/// Own: Contact relocator
|
|
211 |
CPbk2ContactRelocator* iContactRelocator;
|
|
212 |
/// Own: Decorator for the wait note process
|
|
213 |
MPbk2ProcessDecorator* iDecorator;
|
|
214 |
/// Own: Contacts that already belongs to the group
|
|
215 |
MVPbkContactLinkArray* iContactsInGroup;
|
|
216 |
/// Own: State of the command
|
|
217 |
TState iState;
|
|
218 |
/// Own: count of contacts already added to group
|
|
219 |
TInt iAddedContactsCount;
|
|
220 |
/// Own: counter of contacts
|
|
221 |
TInt iContactsCounter;
|
|
222 |
/// Own: Contact
|
|
223 |
MVPbkStoreContact* iContact;
|
|
224 |
};
|
|
225 |
|
|
226 |
#endif // CPGUADDMEMBERSCMD_H
|
|
227 |
|
|
228 |
// End of File
|