|
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 command for editing a contact |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2EDITCONTACTCMD_H |
|
20 #define CPBK2EDITCONTACTCMD_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MPbk2Command.h> |
|
25 #include <MVPbkSingleContactOperationObserver.h> |
|
26 #include <MVPbkContactObserver.h> |
|
27 #include <MPbk2EditedContactObserver.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class MVPbkContactOperationBase; |
|
31 class MVPbkBaseContact; |
|
32 class MPbk2ContactUiControl; |
|
33 class MVPbkContactLink; |
|
34 class MVPbkStoreContactField; |
|
35 class CPbk2ApplicationServices; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * A command for editing a contact. |
|
41 */ |
|
42 NONSHARABLE_CLASS(CPbk2EditContactCmd) : |
|
43 public CBase, |
|
44 public MPbk2Command, |
|
45 public MVPbkSingleContactOperationObserver, |
|
46 public MVPbkContactObserver, |
|
47 public MPbk2EditedContactObserver |
|
48 { |
|
49 public: // Constructors and destructor |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 * |
|
54 * @param aParams The command parameters, if link array is null |
|
55 * then the control is used the get contacts. |
|
56 * |
|
57 * @return A new instance of this class. |
|
58 */ |
|
59 static CPbk2EditContactCmd* NewL(MPbk2ContactUiControl& aUiControl); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CPbk2EditContactCmd(); |
|
65 |
|
66 public: // From MPbk2Command |
|
67 void ExecuteLD(); |
|
68 void AddObserver(MPbk2CommandObserver& aObserver); |
|
69 void ResetUiControl(MPbk2ContactUiControl& aUiControl); |
|
70 |
|
71 private: // From MVPbkSingleContactOperationObserver |
|
72 void VPbkSingleContactOperationComplete( |
|
73 MVPbkContactOperationBase& aOperation, |
|
74 MVPbkStoreContact* aContact); |
|
75 void VPbkSingleContactOperationFailed( |
|
76 MVPbkContactOperationBase& aOperation, |
|
77 TInt aError); |
|
78 |
|
79 private: // From MVPbkContactObserver |
|
80 void ContactOperationCompleted( |
|
81 TContactOpResult aResult); |
|
82 void ContactOperationFailed( |
|
83 TContactOp aOpCode, |
|
84 TInt aErrorCode, |
|
85 TBool aErrorNotified); |
|
86 |
|
87 private: // From MPbk2EditedContactObserver |
|
88 void ContactEditingComplete( |
|
89 MVPbkStoreContact* aEditedContact); |
|
90 void ContactEditingDeletedContact( |
|
91 MVPbkStoreContact* aEditedContact); |
|
92 void ContactEditingAborted(); |
|
93 |
|
94 private: // Implementation |
|
95 CPbk2EditContactCmd( |
|
96 MPbk2ContactUiControl& aUiControl); |
|
97 void ConstructL(); |
|
98 void ExecuteEditorL(); |
|
99 MVPbkStoreContactField* FocusedFieldLC |
|
100 ( MVPbkStoreContact& aStoreContact ); |
|
101 |
|
102 private: // Data |
|
103 /// Ref: UI control |
|
104 MPbk2ContactUiControl* iUiControl; |
|
105 /// Ref: Command observer |
|
106 MPbk2CommandObserver* iCommandObserver; |
|
107 /// Own: Link to contact to edit |
|
108 MVPbkContactLink* iContactLink; |
|
109 /// Own: An operation to get a contact from the link |
|
110 MVPbkContactOperationBase* iContactRetriever; |
|
111 /// Own: The store contact to edit |
|
112 MVPbkStoreContact* iContact; |
|
113 /// Own: The flag indicating if the editing has been aborted |
|
114 TBool iIsEditingAborted; |
|
115 /// Own: Application Services pointer |
|
116 CPbk2ApplicationServices* iAppServices; |
|
117 }; |
|
118 |
|
119 #endif // CPBK2EDITCONTACTCMD_H |
|
120 |
|
121 // End of File |