|
1 /* |
|
2 * Copyright (c) 2006 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: Declares contact details dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CCACONTACTDETAILSDIALOG_H |
|
20 #define CCACONTACTDETAILSDIALOG_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <aknform.h> |
|
24 #include <eiklbo.h> |
|
25 #include <bldvariant.hrh> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CCAStatusPaneHandler; |
|
29 class CAknDoubleStyleListBox; |
|
30 class MCAContactEditPC; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 /** |
|
34 * This class declares dialog for contact details |
|
35 * @lib chatNG.app |
|
36 * @since 3.2 |
|
37 */ |
|
38 class CCAContactDetailsDialog : public CAknDialog, |
|
39 public MEikListBoxObserver |
|
40 { |
|
41 |
|
42 public: // Constructors and destructor |
|
43 |
|
44 /** |
|
45 * C++ default constructor. |
|
46 * @since 3.2 |
|
47 * @see CCAContactDetailsDialog::NewL |
|
48 */ |
|
49 CCAContactDetailsDialog( |
|
50 TBool& aWasSaved, |
|
51 const HBufC* aListId, |
|
52 const TDesC& aNickname, |
|
53 TInt aIndex ); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 virtual ~CCAContactDetailsDialog(); |
|
59 |
|
60 /** |
|
61 * Symbian default constructor. |
|
62 * @param aWasSaved ETrue, if the contact was saved (if edited) |
|
63 * otherwise show the contact details |
|
64 * @param aIndex The index of the contact to edit/view |
|
65 * @param aListId The list id (must be zero length, but valid string, if no list) |
|
66 * @param aNickname Nickname (optional) |
|
67 * @since 3.2 |
|
68 */ |
|
69 static CCAContactDetailsDialog* NewL( |
|
70 TBool& aWasSaved, |
|
71 TInt aIndex, |
|
72 const TDesC& aListId, |
|
73 const TDesC& aNickname = KNullDesC ); |
|
74 |
|
75 /** |
|
76 * 2nd level constructor for this class |
|
77 * @since 3.2 |
|
78 * @see CCAContactDetailsDialog::NewL |
|
79 */ |
|
80 void ConstructL(); |
|
81 |
|
82 public: // new methods |
|
83 |
|
84 /** |
|
85 * Invoke the dialog. |
|
86 * Just a wrapper for ExecuteLD with proper resource ID, |
|
87 * to make it simpler for callers. |
|
88 * @since 3.2 |
|
89 */ |
|
90 void ShowLD(); |
|
91 |
|
92 /** |
|
93 * Help Key Support |
|
94 * This function is called by the Framework to get the context to launch |
|
95 * Help |
|
96 * |
|
97 * @param aContext The context that contains the appid and the help id. |
|
98 */ |
|
99 void GetHelpContext( TCoeHelpContext& aContext ) const; |
|
100 |
|
101 private: //new functions |
|
102 |
|
103 /** |
|
104 * Update the internal item text array with the data from the current |
|
105 * contact |
|
106 * @since 3.2 |
|
107 */ |
|
108 void UpdateItemTextArrayL(); |
|
109 |
|
110 /** |
|
111 * Helper for UpdateItemTextArrayL. |
|
112 * Appends correctly formatted text to the given item text array. |
|
113 * @param aItemTextArray The item text array |
|
114 * @param aStringResource The string resource for the label |
|
115 * @param aText The text of the entry |
|
116 * @since 3.2 |
|
117 */ |
|
118 void AppendToItemArrayL( |
|
119 CDesCArray& aItemTextArray, |
|
120 TInt aStringResource, |
|
121 const TDesC& aText ); |
|
122 |
|
123 /** |
|
124 * Maps the given list box item index to the Contact Editor control id. |
|
125 * If the currently selected list box item index is unavailable in the |
|
126 * control editor, the method will find the next suitable one. |
|
127 * @param aItemIndex The listbox item index |
|
128 * @return The control id in the editor |
|
129 * @since 3.2 |
|
130 */ |
|
131 TInt MapIndexToControlId( TInt aItemIndex ); |
|
132 |
|
133 /** |
|
134 * Update the title bar text and icon |
|
135 * @since 3.2 |
|
136 */ |
|
137 void UpdateTitleBarL(); |
|
138 |
|
139 /** |
|
140 * Deletes currently viewed contact. |
|
141 * @return General error code or KErrNone. |
|
142 * @since 3.2 |
|
143 */ |
|
144 TInt DeleteCurrentContactL(); |
|
145 |
|
146 /** |
|
147 * Launch contact editor with the currently focused item. |
|
148 * @since 3.2 |
|
149 * @return None |
|
150 */ |
|
151 void LaunchContactEditorL(); |
|
152 |
|
153 |
|
154 private: //From MEikCommandObserver |
|
155 |
|
156 /** |
|
157 * Processes user commands. |
|
158 * @see MEikCommandObserver |
|
159 */ |
|
160 void ProcessCommandL( TInt aCommand ); |
|
161 |
|
162 private: //from MEikMenuObserver |
|
163 |
|
164 /** |
|
165 * Dynamically initialises menu pane |
|
166 * @see MEikMenuObserver |
|
167 */ |
|
168 void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); |
|
169 |
|
170 protected: // Functions from CEikDialog |
|
171 |
|
172 /** |
|
173 * From CEikDialog Sets the layout for dialog |
|
174 */ |
|
175 void PreLayoutDynInitL(); |
|
176 |
|
177 /** |
|
178 * From CEikDialog. This method is called when buttons are pressed |
|
179 * @param aButtonId Button id, if OK-button then dialog is dismissed |
|
180 * @return EFalse if cancel is pressed |
|
181 */ |
|
182 TBool OkToExitL( TInt aButtonId ); |
|
183 |
|
184 /** |
|
185 * From CCoeControl. Handles the keyevents |
|
186 * @param aKeyEvent The key event. |
|
187 * @param aType The type of key event: EEventKey, |
|
188 * EEventKeyUp or EEventKeyDown. |
|
189 * @return Indicates whether or not the key event |
|
190 * was used by this control |
|
191 */ |
|
192 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
193 TEventCode aType ); |
|
194 |
|
195 /** |
|
196 * From MEikListBoxObserver, Handles event's generated by listbox |
|
197 * @param aListBox Pointer to listbox from where this event originated |
|
198 * @param aEventType Type of event received. |
|
199 */ |
|
200 void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ); |
|
201 |
|
202 /** |
|
203 * @see CAknDialog |
|
204 * @since S60 v3.1 |
|
205 */ |
|
206 void SetSizeAndPosition( const TSize& aSize ); |
|
207 |
|
208 private: // Data |
|
209 |
|
210 //Handle to titlepane. doesn't own |
|
211 CCAStatusPaneHandler* iTitlePane; |
|
212 |
|
213 // Owns. Contact's list ID |
|
214 const HBufC* iListId; |
|
215 |
|
216 // nickname |
|
217 const TDesC& iNickname; |
|
218 |
|
219 // owned |
|
220 CDesCArrayFlat* iItemTextArray; |
|
221 |
|
222 // ETrue if contact was saved by invocation of Contact Editor, |
|
223 // used by caller to optimize refresh |
|
224 TBool& iWasSaved; |
|
225 |
|
226 // variated functionality |
|
227 // alias support |
|
228 TBool iAliasEnabled; |
|
229 // nickname support |
|
230 TBool iNicknameEnabled; |
|
231 |
|
232 // viewing own data (ETrue) |
|
233 TBool iOwnData; |
|
234 |
|
235 // Does contact still exist |
|
236 TBool iValidContact; |
|
237 |
|
238 // Owns. Contacts id |
|
239 HBufC* iContactId; |
|
240 |
|
241 // map listbox index to given akn form control id. |
|
242 // always contains "all" list box indexes which |
|
243 // the details dialog can show. empty items are |
|
244 // marked with EChatEditDummy. |
|
245 RArray<TInt> iIndexToControlIdMapping; |
|
246 |
|
247 //Does'nt own - process component object for contact |
|
248 MCAContactEditPC *iCCAContactEditPC; |
|
249 |
|
250 //index of the contact chosen w.r.t MainViewArrayPC |
|
251 //the contact to edit. |
|
252 TInt iIndexOfContact; |
|
253 |
|
254 //the contact is deleting |
|
255 TBool iMovingFlag; |
|
256 }; |
|
257 |
|
258 #endif // CCACONTACTDETAILSDIALOG_H |
|
259 |
|
260 // End of File |