|
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 contact editor strategy for editing contact. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2CONTACTEDITOREDITCONTACT_H |
|
20 #define CPBK2CONTACTEDITOREDITCONTACT_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MVPbkContactObserver.h> |
|
25 #include "MPbk2ContactEditorStrategy.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class TPbk2ContactEditorParams; |
|
29 class CPbk2PresentationContact; |
|
30 class CPbk2InputAbsorber; |
|
31 class MPbk2ContactNameFormatter; |
|
32 class CPbk2ApplicationServices; |
|
33 class CPbk2GeneralConfirmationQuery; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * Phonebook 2 contact editor strategy for editing contact. |
|
39 * Responsible for implementing contact editing strategy interface |
|
40 * for a existing contact being edited. |
|
41 */ |
|
42 NONSHARABLE_CLASS(CPbk2ContactEditorEditContact) : |
|
43 public CActive, |
|
44 public MPbk2ContactEditorStrategy, |
|
45 private MVPbkContactObserver |
|
46 { |
|
47 public: // Constructors and destructor |
|
48 |
|
49 /** |
|
50 * Creates a new instance of this class. |
|
51 * |
|
52 * @param aParams The contact editor parameters. |
|
53 * @param aContact Presentation level contact. |
|
54 * @return A new instance of this class. |
|
55 */ |
|
56 static CPbk2ContactEditorEditContact* NewL( |
|
57 TPbk2ContactEditorParams& aParams, |
|
58 CPbk2PresentationContact* aContact ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 ~CPbk2ContactEditorEditContact(); |
|
64 |
|
65 private: // From CActive |
|
66 void RunL(); |
|
67 void DoCancel(); |
|
68 TInt RunError( |
|
69 TInt aError ); |
|
70 |
|
71 public: // From MPbk2ContactEditorStrategy |
|
72 void SaveContactL( |
|
73 MPbk2ContactEditorEventObserver& aObserver, |
|
74 MPbk2ContactEditorEventObserver::TParams& aParams ); |
|
75 void DeleteContactL( |
|
76 MPbk2ContactEditorEventObserver& aObserver, |
|
77 MPbk2ContactEditorEventObserver::TParams& aParams ); |
|
78 const TDesC& DefaultTitle() const; |
|
79 void SwitchContactL( |
|
80 CPbk2PresentationContact* aContact ); |
|
81 void GetHelpContext( |
|
82 TCoeHelpContext &aContext ) const; |
|
83 TBool StopQuery(); |
|
84 |
|
85 private: // From MVPbkContactObserver |
|
86 void ContactOperationCompleted( |
|
87 MVPbkContactObserver::TContactOpResult aResult ); |
|
88 void ContactOperationFailed( |
|
89 MVPbkContactObserver::TContactOp aOpCode, |
|
90 TInt aErrorCode, |
|
91 TBool aErrorNotified ); |
|
92 |
|
93 private: // Implementation |
|
94 CPbk2ContactEditorEditContact( |
|
95 CPbk2PresentationContact* aContact ); |
|
96 void ConstructL(); |
|
97 static TInt IdleDeleteCallBack( |
|
98 TAny* aSelf ); |
|
99 void HandleIdleDelete(); |
|
100 void CancelDeleteL(); |
|
101 |
|
102 private: // Data |
|
103 TBool IsActualContactEmpty(); |
|
104 |
|
105 private: // Data |
|
106 /// Ref: The edited contact |
|
107 CPbk2PresentationContact* iContact; |
|
108 /// Own: For absorbing user input while saving the contact |
|
109 CPbk2InputAbsorber* iInputAbsorber; |
|
110 /// Ref: The current contact event observer |
|
111 MPbk2ContactEditorEventObserver* iObserver; |
|
112 /// Own: Parameters for the event observer |
|
113 MPbk2ContactEditorEventObserver::TParams iEditorParams; |
|
114 /// Ref: For unnamed default title |
|
115 MPbk2ContactNameFormatter* iNameFormatter; |
|
116 /// Own: For asynchronously completing DeleteContactL |
|
117 CIdle* iIdleDelete; |
|
118 /// Own: Last result of completed event |
|
119 MVPbkContactObserver::TContactOpResult iLatestResult; |
|
120 /// Ref: Pbk2 application services |
|
121 CPbk2ApplicationServices* iAppServices; |
|
122 /// Own: Query dialog |
|
123 CPbk2GeneralConfirmationQuery* iQuery; |
|
124 /// Own: Check if the contact is real empty when creating edit dialog |
|
125 TBool iIsEmpty; |
|
126 }; |
|
127 |
|
128 #endif // CPBK2CONTACTEDITOREDITCONTACT_H |
|
129 |
|
130 // End of File |