|
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: This class provides some useful methods to launch different dialogs. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef IMDIALOGUTILS_H |
|
21 #define IMDIALOGUTILS_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <eiklbm.h> |
|
25 #include <avkon.rsg> // for R_AVKON_SOFTKEYS_EMPTY |
|
26 #include <aknnotedialog.h> |
|
27 // CLASS DECLARATION |
|
28 |
|
29 /** |
|
30 * This class provides some useful methods to launch different dialogs. |
|
31 * |
|
32 * @lib chat.app |
|
33 * @since |
|
34 */ |
|
35 class IMDialogUtils |
|
36 { |
|
37 public: // Enumerations |
|
38 |
|
39 enum TLeftSoftkey |
|
40 { |
|
41 EDefault = 0, |
|
42 ESend, |
|
43 EOk |
|
44 }; |
|
45 |
|
46 enum TInitialSelectionMode |
|
47 { |
|
48 ESelectAll = 0, // Default mode |
|
49 ESelectNone |
|
50 }; |
|
51 |
|
52 public: // New functions |
|
53 |
|
54 /** |
|
55 * Displays information note with given text |
|
56 * @since |
|
57 * @param aText Text to show in note |
|
58 */ |
|
59 IMPORT_C static void DisplayInformationNoteL( const TDesC& aText ); |
|
60 |
|
61 /** |
|
62 * Displays information note with given text |
|
63 * @since |
|
64 * @param aTextResource Resource for information text () |
|
65 * @param aParameter Parameter data. If not given, then text is loaded |
|
66 * with just AllocReadResourceLC |
|
67 */ |
|
68 IMPORT_C static void DisplayInformationNoteL( TInt aTextResource, |
|
69 const TDesC& aParameter = KNullDesC ); |
|
70 |
|
71 /** |
|
72 * This method displays popuplist |
|
73 * @param aItemList Item list for dialog |
|
74 * @param aTitleResourceId Resource id of title |
|
75 * @param aOwnerShipType Ownershiptype |
|
76 * @param aEmptyListPrompt Prompt of empty list |
|
77 */ |
|
78 IMPORT_C static void DisplayPopupListL( MDesCArray* aItemList, |
|
79 const TInt aTitleResourceId, |
|
80 TListBoxModelItemArrayOwnership aOwnerShipType, |
|
81 const TInt aEmptyListPrompt = KErrNotFound ); |
|
82 |
|
83 IMPORT_C static void DisplayPopupListL( TInt& aSelectedIndex, MDesCArray* aItemList, |
|
84 const TDesC& aTitle, |
|
85 TListBoxModelItemArrayOwnership aOwnerShipType, |
|
86 const TInt aEmptyListPrompt /*=-1*/ ); |
|
87 /** |
|
88 * This method displays Text Query Dialog |
|
89 * @param aDataText Descriptor whom written data is stored |
|
90 * @param aTitleResourceId Resource ID of title text |
|
91 * @param aDialogResource Resource of dialog |
|
92 * @param aPredictiveInput Enable T9 predictive input (when ETrue) |
|
93 * @param aLeftSoftkeyAlwaysVisible Is LSK always visible, or visible |
|
94 * only when there is text in the editor. |
|
95 * @param aLeftSoftkey Left soft key of dialog. |
|
96 * @param aSelectionMode Initial selection mode in dialog editor. |
|
97 * @param aDomainSelectionQuery Is domain selection variated on or not, |
|
98 * ETrue causes dialog to exit when editor field |
|
99 * is cleared by user. |
|
100 * @return KeyCode (e.g. EAknSoftKeyOk) |
|
101 */ |
|
102 IMPORT_C static TInt DisplayTextQueryDialogL( TDes& aDataText, |
|
103 const TInt aTitleResourceId, |
|
104 const TInt aDialogResourceId, |
|
105 TBool aPredictiveInput = EFalse, |
|
106 TBool aLeftSoftkeyAlwaysVisible = EFalse, |
|
107 TLeftSoftkey aLeftSoftkey = EDefault, |
|
108 TInitialSelectionMode aSelectionMode = ESelectAll, |
|
109 TBool aDomainSelectionQuery = EFalse ); |
|
110 |
|
111 /** |
|
112 * Displays message query dialog |
|
113 * @param aDialogResourceId Dialog resource |
|
114 * @param aMsgText Message text (empty by default) |
|
115 * @param aHeaderText Header text (empty by default) |
|
116 * @param aPredictiveInput Turn on T9 support if ETrue (off by default) |
|
117 * @return status |
|
118 */ |
|
119 IMPORT_C static TInt DisplayMessageQueryDialogL( const TInt aDialogResourceId, |
|
120 const TDesC& aMsgText = KNullDesC, |
|
121 const TDesC& aHeaderText = KNullDesC, |
|
122 TBool aPredictiveInput = EFalse ); |
|
123 |
|
124 /** |
|
125 * Displays multiselection list query dialog. |
|
126 * Returns NULL if aItemList is empty or if user cancels the query! |
|
127 * |
|
128 * @param aItemList List of items in selection list |
|
129 * @param aTitle Dialog title |
|
130 * @return Selected items, NOTE THAT THE OWNERSHIP IS TRANSFERRED TO CALLER! |
|
131 */ |
|
132 IMPORT_C static CDesCArray* MultiselectionListQueryDialogL( |
|
133 const MDesCArray& aItemList, |
|
134 const TDesC& aTitle ); |
|
135 |
|
136 /** |
|
137 * This method displays multiselection List Query Dialog. |
|
138 * NOTE that it is the responsibility of the caller to use |
|
139 * cleanupstack for aItemList (ownership is NOT transferred to the |
|
140 * list box). |
|
141 * @param aIndexArray Array of selections that are selected in dialog |
|
142 * @param aItemList Array of list items (must be formatted) |
|
143 * @param aDialogResourceId Resource ID of dialog |
|
144 * @param aArrayOfSelectionIndexes Array of predefined indexes (not mandatory) |
|
145 * @param aListEmptyText Text to be shown if the list is empty |
|
146 * @param aAlternativeTitle Alternative title text |
|
147 * @param aIsForwardQuery The dialog is for forwarding the message (ETrue) |
|
148 * @return KeyCode (e.g. EAknSoftKeyOk) |
|
149 */ |
|
150 IMPORT_C static TInt DisplayListQueryDialogL( CArrayFix< TInt >* aIndexArray, |
|
151 MDesCArray* aItemList, |
|
152 const TInt aDialogResourceId, |
|
153 CArrayFix< TInt >* aArrayOfSelectionIndexes = NULL, |
|
154 const TDesC& aListEmptyText = KNullDesC, |
|
155 const TDesC& aAlternativeTitle = KNullDesC ); |
|
156 |
|
157 /** |
|
158 * This method displays singleselection List Query Dialog |
|
159 * NOTE that it is the responsibility of the caller to use |
|
160 * cleanupstack for aItemList (ownership is NOT transferred to the |
|
161 * list box). |
|
162 * @param aSelectedIndex Index of selected item |
|
163 * @param aItemList List of Items (Must be formatted) |
|
164 * @param aDialogResourceId Resource ID of dialog |
|
165 * @param aIsForwardQuery The dialog is for forwarding the message (ETrue) |
|
166 * @return KeyCode (e.g. EAknSoftKeyOk) |
|
167 */ |
|
168 IMPORT_C static TInt DisplayListQueryDialogL( TInt* aSelectedIndex, |
|
169 MDesCArray* aItemList, |
|
170 const TInt aDialogResourceId, |
|
171 const TDesC& aAlternativeTitle = KNullDesC, |
|
172 const TDesC& aListEmptyText = KNullDesC, |
|
173 const TBool aIsForwardQuery = EFalse, |
|
174 const TBool aIsOnlySelect = EFalse ); |
|
175 |
|
176 /** |
|
177 * This method displays note dialogs e.g. confirmation dialog |
|
178 * Note dialog's type is defined in resource file |
|
179 * @param aResourceId Resource ID of dialog |
|
180 * @return KeyCode (e.g. EAknSoftKeyOk) |
|
181 */ |
|
182 IMPORT_C static TInt DisplayNoteDialogL( const TInt aResourceId ); |
|
183 |
|
184 /** |
|
185 * This method displays note dialogs e.g. confirmation dialog |
|
186 * Note dialog's type is defined in resource file |
|
187 * @param aText Prompt text of dialog |
|
188 * @param aButtonsResourceId tells buttons that are shown with note, default none |
|
189 * @param aTimeout timeout when note showing stops |
|
190 * @return KeyCode (e.g. EAknSoftKeyOk) |
|
191 */ |
|
192 IMPORT_C static TInt DisplayNoteDialogL( const TDesC& aText, |
|
193 const TInt aButtonsResourceId = R_AVKON_SOFTKEYS_EMPTY, |
|
194 const CAknNoteDialog::TTimeout& aTimeout = CAknNoteDialog::EShortTimeout ); |
|
195 |
|
196 /** |
|
197 * This method displays error notes for corresponding resource Id |
|
198 * @param aResourceId Id for resource to be shown |
|
199 * @return KeyCode |
|
200 */ |
|
201 IMPORT_C static TInt DisplayErrorNoteL( const TInt aResourceId ); |
|
202 |
|
203 /** |
|
204 * This method displays error notes for corresponding resource Id |
|
205 * @param aText Prompt text of dialog |
|
206 * @param aSoftkeyOk Should there be OK softkey |
|
207 * @return KeyCode |
|
208 */ |
|
209 IMPORT_C static TInt DisplayErrorNoteL( const TDesC& aText, TBool aSoftkeyOk = EFalse ); |
|
210 |
|
211 /** |
|
212 * Displays query dialog with given data |
|
213 * @param aDialogResourceId Dialogs resource id |
|
214 * @param aTextResourceId Resource id of the text |
|
215 * @return Dialog dismiss key |
|
216 */ |
|
217 IMPORT_C static TInt DisplayQueryDialogL( TInt aDialogResourceId, |
|
218 TInt aTextResourceId ); |
|
219 |
|
220 /** |
|
221 * Displays query dialog with given data |
|
222 * @param aDialogResourceId Dialogs resource id |
|
223 * @param aPrompt Prompt text |
|
224 * @return Dialog dismiss key |
|
225 */ |
|
226 IMPORT_C static TInt DisplayQueryDialogL( TInt aDialogResourceId, |
|
227 const TDesC& aPrompt = KNullDesC ); |
|
228 |
|
229 /** |
|
230 * Displays YES/NO query dialog with given text prompt |
|
231 * @param aTextResourceId Resource id of the text |
|
232 * @return Dialog dismiss key |
|
233 */ |
|
234 IMPORT_C static TInt DisplayYesNoConfirmationDialogL( TInt aTextResourceId ); |
|
235 |
|
236 /** |
|
237 * Displays YES/NO query dialog with given text prompt |
|
238 * @param aPrompt Prompt text |
|
239 * @return Dialog dismiss key |
|
240 */ |
|
241 IMPORT_C static TInt DisplayYesNoConfirmationDialogL( const TDesC& aPrompt ); |
|
242 |
|
243 /** |
|
244 * Displays Error notification with OK softkey and given text prompt |
|
245 * @param aTextResourceId Resource id of the text |
|
246 * @return Dialog dismiss key (EAknSoftKeyOk) |
|
247 */ |
|
248 IMPORT_C static TInt DisplayErrorConfirmationNoteL( TInt aTextResourceId ); |
|
249 |
|
250 /** |
|
251 * Displays Error notification with OK softkey and given text prompt |
|
252 * @param aPrompt Prompt text |
|
253 * @return Dialog dismiss key (EAknSoftKeyOk) |
|
254 */ |
|
255 IMPORT_C static TInt DisplayErrorConfirmationNoteL( const TDesC& aPrompt ); |
|
256 |
|
257 /** |
|
258 * Displays confirmation notification with given text prompt and |
|
259 * without softkeys |
|
260 * @param aPrompt Prompt text |
|
261 * @return Dialog dismiss key (EAknSoftKeyOk) |
|
262 */ |
|
263 IMPORT_C static TInt DisplayConfirmationNoteL( TInt aTextResourceId ); |
|
264 }; |
|
265 |
|
266 #endif // IMDIALOGUTILS_H |
|
267 |
|
268 // End of File |