|
1 /* |
|
2 * Copyright (c) 2002-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: A contact editor strategy for the new contact creation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CPBK2CONTACTEDITORNEWCONTACT_H |
|
21 #define CPBK2CONTACTEDITORNEWCONTACT_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <MVPbkContactObserver.h> |
|
26 #include "MPbk2ContactEditorStrategy.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TPbk2ContactEditorParams; |
|
30 class CPbk2PresentationContact; |
|
31 class CPbk2InputAbsorber; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * A contact editor strategy for the new contact creation. |
|
37 */ |
|
38 NONSHARABLE_CLASS(CPbk2ContactEditorNewContact) : |
|
39 public CActive, |
|
40 public MPbk2ContactEditorStrategy, |
|
41 private MVPbkContactObserver |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor. |
|
47 * |
|
48 * @param aParams The contact editor parameters. |
|
49 * @param aContact Presentation level contact. |
|
50 * @return A new instance of this class. |
|
51 */ |
|
52 static CPbk2ContactEditorNewContact* NewL( |
|
53 TPbk2ContactEditorParams& aParams, |
|
54 CPbk2PresentationContact* aContact); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 ~CPbk2ContactEditorNewContact(); |
|
60 |
|
61 private: // From CActive |
|
62 void RunL(); |
|
63 void DoCancel(); |
|
64 TInt RunError(TInt aError); |
|
65 |
|
66 public: // From MPbk2ContactEditorStrategy |
|
67 void SaveContactL( |
|
68 MPbk2ContactEditorEventObserver& aObserver, |
|
69 MPbk2ContactEditorEventObserver::TParams& aParams); |
|
70 void DeleteContactL( |
|
71 MPbk2ContactEditorEventObserver& aObserver, |
|
72 MPbk2ContactEditorEventObserver::TParams& aParams); |
|
73 const TDesC& DefaultTitle() const; |
|
74 void SwitchContactL( |
|
75 CPbk2PresentationContact* aContact); |
|
76 void GetHelpContext(TCoeHelpContext &aContext) const; |
|
77 TBool StopQuery(); |
|
78 |
|
79 private: // From MVPbkContactObserver |
|
80 void ContactOperationCompleted( |
|
81 MVPbkContactObserver::TContactOpResult aResult); |
|
82 void ContactOperationFailed( |
|
83 MVPbkContactObserver::TContactOp aOpCode, |
|
84 TInt aErrorCode, TBool aErrorNotified); |
|
85 |
|
86 private: // Implementation |
|
87 CPbk2ContactEditorNewContact( |
|
88 CPbk2PresentationContact* aContact); |
|
89 void ConstructL(); |
|
90 static TInt IdleDeleteCallBack( |
|
91 TAny* aSelf); |
|
92 void HandleIdleDelete(); |
|
93 |
|
94 private: // Data |
|
95 /// Ref: The new contact |
|
96 CPbk2PresentationContact* iContact; |
|
97 /// Own: For absorbing user input while saving the contact |
|
98 CPbk2InputAbsorber* iInputAbsorber; |
|
99 /// Ref: The current contact event observer |
|
100 MPbk2ContactEditorEventObserver* iObserver; |
|
101 /// Own: Parameters for the event observer |
|
102 MPbk2ContactEditorEventObserver::TParams iEditorParams; |
|
103 /// Own: For asynchronously completing DeleteContactL |
|
104 CIdle* iIdleDelete; |
|
105 /// Own: "New contact" title for the editor |
|
106 HBufC* iDefaultTitle; |
|
107 /// Own: Last result of completed event |
|
108 MVPbkContactObserver::TContactOpResult iLatestResult; |
|
109 }; |
|
110 |
|
111 #endif // CPBK2CONTACTEDITORNEWCONTACT_H |
|
112 |
|
113 // End of File |