1 /* |
|
2 * Copyright (c) 2008 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: Utils for IMUiServiceTab modules. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "vimpstutilsdialog.h" |
|
22 #include "vimpstutilstextquerydialog.h" |
|
23 |
|
24 #include <StringLoader.h> |
|
25 #include <AknQueryDialog.h> |
|
26 #include <vimpstuires.rsg> |
|
27 #include <AknQueryDialog.h> |
|
28 |
|
29 #include "uiservicetabtracer.h" |
|
30 |
|
31 |
|
32 // --------------------------------------------------------- |
|
33 // VIMPSTUtilsDialog::DisplayNoteDialogL |
|
34 // (other items were commented in a header). |
|
35 // --------------------------------------------------------- |
|
36 // |
|
37 EXPORT_C TInt VIMPSTUtilsDialog::DisplayNoteDialogL( const TDesC& aText, |
|
38 const TInt aButtonsResourceId, /*= R_AVKON_SOFTKEYS_EMPTY*/ |
|
39 const CAknNoteDialog::TTimeout& aTimeout /*= CAknNoteDialog::EShortTimeout*/ ) |
|
40 { |
|
41 TRACER_AUTO; |
|
42 // CodeScanner warning ignored because CS does not |
|
43 // notice that PrepareLC puts the dialog to cleanupstack |
|
44 CAknNoteDialog* dlg = new ( ELeave ) CAknNoteDialog( // CSI: 35 # See comment above |
|
45 CAknNoteDialog::EConfirmationTone , aTimeout ); |
|
46 |
|
47 //TODO : Modify the function body when required later |
|
48 |
|
49 dlg->PrepareLC( R_IM_INFO_NOTE_TEMPLATE ); |
|
50 dlg->SetTextL( aText ); |
|
51 |
|
52 CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer(); |
|
53 cba.SetCommandSetL( aButtonsResourceId ); |
|
54 |
|
55 return dlg->RunLD(); |
|
56 } |
|
57 |
|
58 |
|
59 // --------------------------------------------------------- |
|
60 // VIMPSTUtilsDialog::DisplayErrorNoteL |
|
61 // (other items were commented in a header). |
|
62 // --------------------------------------------------------- |
|
63 // |
|
64 EXPORT_C TInt VIMPSTUtilsDialog::DisplayErrorNoteL( const TDesC& aText, |
|
65 TBool aSoftkeyOk /*= EFalse*/ ) |
|
66 { |
|
67 TRACER_AUTO; |
|
68 //TODO : Modify the function body when required later |
|
69 if( aSoftkeyOk ) |
|
70 { |
|
71 return VIMPSTUtilsDialog::DisplayQueryDialogL( R_IM_ERROR_NOTE_TEMPLATE_WITH_OK, aText ); |
|
72 } |
|
73 else |
|
74 { |
|
75 // CodeScanner warning ignored because CS does not |
|
76 // notice that PrepareLC puts the dialog to cleanupstack |
|
77 CAknNoteDialog* dlg = // CSI: 35 # See comment above |
|
78 new ( ELeave ) CAknNoteDialog( CAknNoteDialog::EErrorTone , |
|
79 CAknNoteDialog::ELongTimeout ); |
|
80 dlg->PrepareLC( R_IM_ERROR_NOTE_TEMPLATE ); |
|
81 dlg->SetTextL( aText ); |
|
82 return dlg->RunLD(); |
|
83 } |
|
84 } |
|
85 |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // VIMPSTUtilsDialog::DisplayQueryDialogL |
|
89 // (other items were commented in a header). |
|
90 // --------------------------------------------------------- |
|
91 // |
|
92 EXPORT_C TInt VIMPSTUtilsDialog::DisplayQueryDialogL( TInt aDialogResourceId, |
|
93 const TDesC& aPrompt ) |
|
94 { |
|
95 TRACER_AUTO; |
|
96 CAknQueryDialog* dlg = new (ELeave) CAknQueryDialog( |
|
97 CAknQueryDialog::ENoTone ); |
|
98 if( aPrompt != KNullDesC ) |
|
99 { |
|
100 CleanupStack::PushL( dlg ); |
|
101 dlg->SetPromptL( aPrompt ); |
|
102 CleanupStack::Pop( dlg ); |
|
103 } |
|
104 |
|
105 return dlg->ExecuteLD( aDialogResourceId ); |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------- |
|
109 // VIMPSTUtilsDialog::DisplayTextQueryDialogL() |
|
110 // Displays text query dialog |
|
111 // (other items were commented in a header). |
|
112 // --------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C TInt VIMPSTUtilsDialog::DisplayTextQueryDialogL( |
|
115 TDes& aDataText, |
|
116 const TInt aTitleResourceId, |
|
117 const TInt aDialogResourceId, |
|
118 TBool aPredictiveInput /* = EFalse */, |
|
119 TBool aLeftSoftkeyAlwaysVisible /* = EFalse */, |
|
120 TLeftSoftkey /*aLeftSoftkey = EDefault */, |
|
121 TInitialSelectionMode aSelectionMode /* = ESelectAll */, |
|
122 TBool aDomainSelectionQuery /* = EFalse */ ) |
|
123 { |
|
124 TRACER_AUTO; |
|
125 // CodeScanner warning ignored because CS does not |
|
126 // notice that PrepareLC puts the dialog to cleanupstack |
|
127 CAknTextQueryDialog* dlg = CVIMPSTUtilsTextQueryDialog::NewL( aDataText, // CSI: 35 # See comment above |
|
128 CAknQueryDialog::ENoTone, |
|
129 aLeftSoftkeyAlwaysVisible, |
|
130 aDomainSelectionQuery ); |
|
131 |
|
132 dlg->PrepareLC( aDialogResourceId ); |
|
133 HBufC* text = CEikonEnv::Static()->AllocReadResourceLC( aTitleResourceId ); |
|
134 dlg->SetPromptL( *text ); |
|
135 dlg->SetPredictiveTextInputPermitted( aPredictiveInput ); |
|
136 |
|
137 CleanupStack::PopAndDestroy( text ); |
|
138 |
|
139 // Set correct selection mode |
|
140 switch ( aSelectionMode ) |
|
141 { |
|
142 case ESelectNone: |
|
143 { |
|
144 CCoeControl* ctrl = dlg->ControlOrNull( EGeneralQuery ); |
|
145 if ( ctrl ) |
|
146 { |
|
147 CAknQueryControl* query = static_cast<CAknQueryControl*>( ctrl ); |
|
148 ctrl = query->ControlByLayoutOrNull( EDataLayout ); |
|
149 if ( ctrl ) |
|
150 { |
|
151 CEikEdwin* edwin = static_cast<CEikEdwin*>( ctrl ); |
|
152 edwin->AddFlagToUserFlags( CEikEdwin::ENoAutoSelection ); |
|
153 } |
|
154 } |
|
155 break; |
|
156 } |
|
157 default: |
|
158 { |
|
159 // Use default flags in edwin |
|
160 break; |
|
161 } |
|
162 } |
|
163 return ( dlg->RunLD() ); |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------- |
|
167 // VIMPSTUtilsDialog::DisplayListQueryDialogL |
|
168 // (other items were commented in a header). |
|
169 // --------------------------------------------------------- |
|
170 // |
|
171 EXPORT_C TInt VIMPSTUtilsDialog::DisplayListQueryDialogL( TInt* aSelectedIndex, |
|
172 MDesCArray* aItemList, |
|
173 const TInt aDialogResourceId, |
|
174 const TDesC& aAlternativeTitle /*KNullDesC*/, |
|
175 const TDesC& aListEmptyText /*= KNullDesC*/, |
|
176 const TBool aIsForwardQuery /* EFalse */, |
|
177 const TBool /*aIsOnlySelect = EFalse */ ) |
|
178 |
|
179 { |
|
180 TRACER_AUTO; |
|
181 CAknListQueryDialog* dlg = new (ELeave) CAknListQueryDialog( |
|
182 aSelectedIndex ); |
|
183 dlg->PrepareLC( aDialogResourceId ); |
|
184 dlg->SetItemTextArray( aItemList ); |
|
185 dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
186 |
|
187 if ( aAlternativeTitle != KNullDesC ) |
|
188 { |
|
189 dlg->SetHeaderTextL( aAlternativeTitle ); |
|
190 } |
|
191 |
|
192 if ( aItemList->MdcaCount() == 0 ) |
|
193 { |
|
194 CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer(); |
|
195 cba.SetCommandSetL( R_AVKON_SOFTKEYS_CANCEL ); |
|
196 } |
|
197 else |
|
198 { |
|
199 if ( aIsForwardQuery ) |
|
200 { |
|
201 CEikButtonGroupContainer& cba = dlg->ButtonGroupContainer(); |
|
202 cba.SetCommandSetL( R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT ); |
|
203 } |
|
204 } |
|
205 |
|
206 dlg->ListBox()->SetCurrentItemIndex( *aSelectedIndex ); |
|
207 |
|
208 if( aListEmptyText != KNullDesC ) |
|
209 { |
|
210 dlg->ListBox()->View()->SetListEmptyTextL( aListEmptyText ); |
|
211 } |
|
212 |
|
213 return ( dlg->RunLD() ); |
|
214 } |
|
215 |
|
216 |
|
217 // End of File |
|