|
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 go to URL command object. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2GOTOURLCMD_H |
|
20 #define CPBK2GOTOURLCMD_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "MPbk2Command.h" |
|
25 #include "MPbk2ProcessDecorator.h" |
|
26 #include <MVPbkSingleContactOperationObserver.h> |
|
27 #include <AknServerApp.h> |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class CVPbkContactManager; |
|
31 class MVPbkContactLink; |
|
32 class MVPbkStoreContact; |
|
33 class CBrowserLauncher; |
|
34 class MVPbkStoreContactField; |
|
35 class CPbk2FieldPropertyArray; |
|
36 class MPbk2ContactUiControl; |
|
37 class CPbk2ApplicationServices; |
|
38 |
|
39 // CLASS DECLARATION |
|
40 |
|
41 /** |
|
42 * Phonebook 2 go to URL command object. |
|
43 */ |
|
44 NONSHARABLE_CLASS(CPbk2GoToURLCmd) : |
|
45 public CActive, |
|
46 public MPbk2Command, |
|
47 public MPbk2ProcessDecoratorObserver, |
|
48 public MVPbkSingleContactOperationObserver, |
|
49 public MAknServerAppExitObserver |
|
50 { |
|
51 public: // Construction and destruction |
|
52 |
|
53 /** |
|
54 * Creates a new instance of this class. |
|
55 * |
|
56 * @param aUiControl Contact UI control. |
|
57 * @return A new instance of this class. |
|
58 */ |
|
59 static CPbk2GoToURLCmd* NewL( |
|
60 MPbk2ContactUiControl& aUiControl ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 ~CPbk2GoToURLCmd(); |
|
66 |
|
67 private: // From CActive |
|
68 void DoCancel(); |
|
69 void RunL(); |
|
70 TInt RunError( |
|
71 TInt aError ); |
|
72 |
|
73 public: // From MPbk2Command |
|
74 void ExecuteLD(); |
|
75 void AddObserver( |
|
76 MPbk2CommandObserver& aObserver ); |
|
77 void ResetUiControl( |
|
78 MPbk2ContactUiControl& aUiControl ); |
|
79 |
|
80 private: // From MPbk2ProcessDecoratorObserver |
|
81 void ProcessDismissed( |
|
82 TInt aCancelCode ); |
|
83 |
|
84 private: // From MVPbkSingleContactOperationObserver |
|
85 void VPbkSingleContactOperationComplete( |
|
86 MVPbkContactOperationBase& aOperation, |
|
87 MVPbkStoreContact* aContact ); |
|
88 void VPbkSingleContactOperationFailed( |
|
89 MVPbkContactOperationBase& aOperation, |
|
90 TInt aError ); |
|
91 |
|
92 private: // From MAknServerAppExitObserver |
|
93 void HandleServerAppExit( |
|
94 TInt aReason ); |
|
95 |
|
96 private: // Implementation |
|
97 CPbk2GoToURLCmd( |
|
98 MPbk2ContactUiControl& aUiControl ); |
|
99 void ConstructL(); |
|
100 void RetrieveContactL( |
|
101 const MVPbkContactLink& aContactLink ); |
|
102 void DoLaunchBrowserL(); |
|
103 void ResolveUrlL(); |
|
104 void SetURLFromFieldL( |
|
105 MVPbkStoreContactField& aField ); |
|
106 void IssueRequest(); |
|
107 void IssueStopRequest(); |
|
108 |
|
109 private: // Data structures |
|
110 /// Process states |
|
111 enum TProcessState |
|
112 { |
|
113 ERetrieving, |
|
114 EResolveURL, |
|
115 EStarting, |
|
116 ELaunching, |
|
117 EStopping |
|
118 }; |
|
119 |
|
120 private: // Data |
|
121 /// Ref: UI control |
|
122 MPbk2ContactUiControl* iUiControl; |
|
123 /// Ref: Command observer |
|
124 MPbk2CommandObserver* iCommandObserver; |
|
125 /// Own: Contact link |
|
126 MVPbkContactLink* iContactLink; |
|
127 /// Own: Browser launcher |
|
128 CBrowserLauncher* iBrowserLauncher; |
|
129 /// Own: Retrieve operation |
|
130 MVPbkContactOperationBase* iRetrieveOperation; |
|
131 /// Own: Store contact |
|
132 MVPbkStoreContact* iStoreContact; |
|
133 /// Own: URL |
|
134 HBufC* iURL; |
|
135 /// Ref: Phonebook 2 field properties |
|
136 CPbk2FieldPropertyArray* iFieldPropertyArray; |
|
137 /// Own: Current state of process |
|
138 TProcessState iState; |
|
139 /// Own: Application Services pointer |
|
140 CPbk2ApplicationServices* iAppServices; |
|
141 }; |
|
142 |
|
143 #endif // CPBK2GOTOURLCMD_H |
|
144 |
|
145 // End of File |