|
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 server app attribute address select phase. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPBK2ATTRIBUTEADDRESSSELECTPHASE_H |
|
19 #define CPBK2ATTRIBUTEADDRESSSELECTPHASE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <MVPbkSingleContactOperationObserver.h> |
|
24 #include <MPbk2KeyEventHandler.h> |
|
25 #include <Pbk2ServerAppIPC.h> |
|
26 #include <MVPbkContactStoreObserver.h> |
|
27 #include "MPbk2ServicePhase.h" |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CVPbkContactLinkArray; |
|
31 class MPbk2DialogEliminator; |
|
32 class MPbk2ServicePhaseObserver; |
|
33 class MVPbkContactOperationBase; |
|
34 class MVPbkStoreContact; |
|
35 class MVPbkStoreContactField; |
|
36 class CPbk2KeyEventDealer; |
|
37 class CEikonEnv; |
|
38 class MVPbkContactOperationBase; |
|
39 class CVPbkContactLinkArray; |
|
40 class CVPbkxSPContacts; |
|
41 class MVPbkContactLinkArray; |
|
42 // CLASS DECLARATION |
|
43 |
|
44 /** |
|
45 * Phonebook 2 server app attribute address select phase. |
|
46 * Responsible for performing address select. |
|
47 */ |
|
48 class CPbk2AttributeAddressSelectPhase : |
|
49 public CBase, |
|
50 public MPbk2ServicePhase, |
|
51 private MVPbkSingleContactOperationObserver, |
|
52 private MPbk2KeyEventHandler, |
|
53 public MVPbkContactStoreObserver |
|
54 { |
|
55 public: // Construction |
|
56 |
|
57 /** |
|
58 * Creates a new instance of this class. |
|
59 * |
|
60 * @param aObserver Observer. |
|
61 * @param aStoreContact Contact to operate with, |
|
62 * ownership is taken. |
|
63 * @param aAttributeData Attribute data. |
|
64 * @param aRskBack Indicates whether the RSK should be Back. |
|
65 * @return A new instance of this class. |
|
66 */ |
|
67 static CPbk2AttributeAddressSelectPhase* NewL( |
|
68 MPbk2ServicePhaseObserver& aObserver, |
|
69 MVPbkContactLinkArray* aContactLinks, |
|
70 TPbk2AttributeAssignData aAttributeData, |
|
71 TBool aRskBack ); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 ~CPbk2AttributeAddressSelectPhase(); |
|
77 |
|
78 public: // From MPbk2ServicePhase |
|
79 void LaunchServicePhaseL(); |
|
80 void CancelServicePhase(); |
|
81 void RequestCancelL( |
|
82 TInt aExitCommandId ); |
|
83 void AcceptDelayedL( |
|
84 const TDesC8& aContactLinkBuffer ); |
|
85 MVPbkContactLinkArray* Results() const; |
|
86 TInt ExtraResultData() const; |
|
87 MVPbkStoreContact* TakeStoreContact(); |
|
88 HBufC* FieldContent() const; |
|
89 |
|
90 private: // From MVPbkSingleContactOperationObserver |
|
91 void VPbkSingleContactOperationComplete( |
|
92 MVPbkContactOperationBase& aOperation, |
|
93 MVPbkStoreContact* aContact ); |
|
94 void VPbkSingleContactOperationFailed( |
|
95 MVPbkContactOperationBase& aOperation, |
|
96 TInt aError ); |
|
97 |
|
98 private: // From MPbk2KeyEventHandler |
|
99 TBool Pbk2ProcessKeyEventL( |
|
100 const TKeyEvent& aKeyEvent, |
|
101 TEventCode aType ); |
|
102 |
|
103 private: // From MVPbkContactStoreObserver |
|
104 void StoreReady( |
|
105 MVPbkContactStore& aContactStore ); |
|
106 void StoreUnavailable( |
|
107 MVPbkContactStore& aContactStore, |
|
108 TInt aReason ); |
|
109 void HandleStoreEventL( |
|
110 MVPbkContactStore& aContactStore, |
|
111 TVPbkContactStoreEvent aEvent ); |
|
112 |
|
113 private: // Implementation |
|
114 CPbk2AttributeAddressSelectPhase( |
|
115 MPbk2ServicePhaseObserver& aObserver, |
|
116 TPbk2AttributeAssignData aAttributeData, |
|
117 TBool aRskBack ); |
|
118 void ConstructL( |
|
119 MVPbkContactLinkArray* aContactLinks ); |
|
120 void RetrieveContactL(); |
|
121 void SelectAddressesL(); |
|
122 MVPbkStoreContactField* CheckIfFieldAlreadySelectedL(); |
|
123 TInt AddressSelectResourceId( |
|
124 TPbk2AttributeAssignData aAttributeData ); |
|
125 TInt CorrectRSK( |
|
126 TInt aAddressSelectResourceId ); |
|
127 void AppendResultL( |
|
128 const MVPbkStoreContactField* aField ); |
|
129 |
|
130 |
|
131 private: // Data |
|
132 /// Ref: Observer |
|
133 MPbk2ServicePhaseObserver& iObserver; |
|
134 /// Own: Results array |
|
135 CVPbkContactLinkArray* iResults; |
|
136 /// Own: Attribute data |
|
137 TPbk2AttributeAssignData iAttributeData; |
|
138 /// Own: Indicates whether the RSK should be Back |
|
139 TBool iRskBack; |
|
140 /// Ref: For address select dialog's exit handling |
|
141 MPbk2DialogEliminator* iAddressSelectEliminator; |
|
142 /// Own: Contact retrieve operation |
|
143 MVPbkContactOperationBase* iRetrieveOperation; |
|
144 /// Own: Store contact |
|
145 MVPbkStoreContact* iStoreContact; |
|
146 /// Own: Key event dealer |
|
147 CPbk2KeyEventDealer* iDealer; |
|
148 /// Own: Contact links to operate with |
|
149 CVPbkContactLinkArray* iContactLinks; |
|
150 /// Ref: Eikon enviroment |
|
151 CEikonEnv* iEikEnv; |
|
152 }; |
|
153 |
|
154 #endif // CPBK2ATTRIBUTEADDRESSSELECTPHASE_H |
|
155 |
|
156 // End of File |