|
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 send message command. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPBK2SENDMESSAGECMD_H |
|
20 #define CPBK2SENDMESSAGECMD_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <MPbk2Command.h> |
|
25 #include <MVPbkSingleContactOperationObserver.h> |
|
26 #include <TSendingCapabilities.h> |
|
27 #include <VPbkFieldType.hrh> |
|
28 #include <RVPbkContactFieldDefaultPriorities.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MVPbkStoreContact; |
|
32 class MVPbkContactOperationBase; |
|
33 class MPbk2CommandObserver; |
|
34 class MVPbkStoreContactField; |
|
35 class MVPbkContactLink; |
|
36 class CPbk2FieldPropertyArray; |
|
37 class MPbk2ContactUiControl; |
|
38 class MVPbkContactLinkArray; |
|
39 class CMessageData; |
|
40 class CPbk2AttachmentFile; |
|
41 class CPbk2ApplicationServices; |
|
42 class CSendUi; |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * Phonebook 2 send message command. |
|
48 * Responsible for: |
|
49 * - displaying select message type query |
|
50 * - performing address select to the contact |
|
51 * - utilizing SendUI to send the message |
|
52 * - sending all messages ( sms, mms, email... ) |
|
53 * - sending post card by creating, filling and finally destroying |
|
54 * the post card file read by post card application |
|
55 */ |
|
56 NONSHARABLE_CLASS(CPbk2SendMessageCmd) : |
|
57 public CActive, |
|
58 public MPbk2Command, |
|
59 public MVPbkSingleContactOperationObserver |
|
60 { |
|
61 public: // Construction and destruction |
|
62 /** |
|
63 * Creates a new instance of this class. |
|
64 * |
|
65 * @param aUiControl UI control. |
|
66 * @return A new instance of this class. |
|
67 */ |
|
68 static CPbk2SendMessageCmd* NewL ( |
|
69 MPbk2ContactUiControl& aUiControl ); |
|
70 |
|
71 /** |
|
72 * Destructor. |
|
73 */ |
|
74 ~CPbk2SendMessageCmd(); |
|
75 |
|
76 public: // From MPbk2Command |
|
77 void ExecuteLD(); |
|
78 void AddObserver( MPbk2CommandObserver& aObserver ); |
|
79 void ResetUiControl(MPbk2ContactUiControl& aUiControl); |
|
80 |
|
81 public: |
|
82 void SetMtmUid( TUid aUid ); |
|
83 |
|
84 private: // From CActive |
|
85 void RunL(); |
|
86 void DoCancel(); |
|
87 TInt RunError( TInt aError ); |
|
88 |
|
89 private: // From MVPbkSingleContactOperationObserver |
|
90 void VPbkSingleContactOperationComplete( |
|
91 MVPbkContactOperationBase& aOperation, |
|
92 MVPbkStoreContact* aContact ); |
|
93 void VPbkSingleContactOperationFailed( |
|
94 MVPbkContactOperationBase& aOperation, |
|
95 TInt aError ); |
|
96 |
|
97 private: // Implementation |
|
98 CPbk2SendMessageCmd ( |
|
99 MPbk2ContactUiControl& aUiControl ); |
|
100 void ConstructL(); |
|
101 TUid ShowWriteQueryL(); |
|
102 void RetrieveContactL( |
|
103 const MVPbkContactLink& aContactLink ); |
|
104 void DoSendMessageL(); |
|
105 void ResolveUrlL(); |
|
106 TInt PrepareAddressSelectL( |
|
107 RVPbkContactFieldDefaultPriorities& aPriorities, |
|
108 TUid aTechType ); |
|
109 void SetAddressFromFieldL( |
|
110 MVPbkStoreContactField& aField ); |
|
111 void ProcessDismissed( |
|
112 TInt aCancelCode ); |
|
113 TInt FilterErrors( |
|
114 TInt aErrorCode ); |
|
115 void IssueRequest(); |
|
116 void IssueStopRequest( |
|
117 TInt aErrorCode ); |
|
118 TInt ToStoreFieldIndexL( |
|
119 TInt aPresIndex ); |
|
120 MVPbkStoreContactField* SelectFieldL( |
|
121 TUint aResourceId, |
|
122 RVPbkContactFieldDefaultPriorities& aPriorities ); |
|
123 void SendPostCardL(); |
|
124 |
|
125 private: // Data structures |
|
126 /// Process states |
|
127 enum TProcessState |
|
128 { |
|
129 ERetrieving, |
|
130 EShowWriteQuery, |
|
131 EResolveURL, |
|
132 EStarting, |
|
133 ELaunching, |
|
134 EStopping |
|
135 }; |
|
136 |
|
137 private: // Data |
|
138 /// Ref: UI control |
|
139 MPbk2ContactUiControl* iUiControl; |
|
140 /// Own: Selected contacts |
|
141 MVPbkContactLinkArray* iSelectedContacts; |
|
142 /// Own: MTM filter |
|
143 CArrayFixFlat<TUid>* iMtmFilter; |
|
144 /// Own: Send MTM uid |
|
145 TUid iMtmUid; |
|
146 /// Own: Sending capabilities |
|
147 TSendingCapabilities iSendingCapabilities; |
|
148 /// Own: The contact to send message to |
|
149 MVPbkStoreContact* iStoreContact; |
|
150 /// Own: The retrieve operation |
|
151 MVPbkContactOperationBase* iRetrieveOperation; |
|
152 /// Ref: The field property array |
|
153 CPbk2FieldPropertyArray* iFieldPropertyArray; |
|
154 /// Ref: Focused field |
|
155 const MVPbkStoreContactField* iFocusedField; |
|
156 /// Ref: Command observer |
|
157 MPbk2CommandObserver* iCommandObserver; |
|
158 /// Own: Message data object |
|
159 CMessageData* iMessageData; |
|
160 /// Own: Current index of a contact in array |
|
161 TInt iCurrentContactLinkIndex; |
|
162 /// Own: The count of valid recipients |
|
163 TInt iRecipientCount; |
|
164 /// Own: Current state of process |
|
165 TProcessState iState; |
|
166 /// Own: Postcard temporary attachment file |
|
167 CPbk2AttachmentFile* iAttachmentFile; |
|
168 /// Own: Initially focused field index |
|
169 TInt iFocusedFieldIndex; |
|
170 /// Own: Application Services pointer |
|
171 CPbk2ApplicationServices* iAppServices; |
|
172 /// Own: Send UI |
|
173 CSendUi* iSendUi; |
|
174 }; |
|
175 |
|
176 #endif // CPBK2SENDMESSAGECMD_H |
|
177 |
|
178 // End of File |