65
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 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 the License "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:
|
|
15 |
* Helper class that pops up several dialogs.
|
|
16 |
*
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
|
|
23 |
// System includes
|
|
24 |
#include <aknnotewrappers.h>
|
|
25 |
#include <BrowserNG.rsg>
|
|
26 |
#include <StringLoader.h>
|
|
27 |
#include <AknNoteDialog.h>
|
|
28 |
|
|
29 |
// User includes
|
|
30 |
#include "BrowserDialogs.h"
|
|
31 |
|
|
32 |
// ================= MEMBER FUNCTIONS =========================================
|
|
33 |
// ----------------------------------------------------------------------------
|
|
34 |
// TBrowserDialogs::DialogPromptReqL
|
|
35 |
// ----------------------------------------------------------------------------
|
|
36 |
//
|
|
37 |
TInt TBrowserDialogs::DialogPromptReqL( const TDesC& aMsg,
|
|
38 |
TDes* aResp,
|
|
39 |
TBool aIsUrlAddress,
|
|
40 |
TInt aMaxLength
|
|
41 |
)
|
|
42 |
{
|
|
43 |
TPtrC msg( aMsg );
|
|
44 |
CAknTextQueryDialog* dialog = new( ELeave )CAknTextQueryDialog( *aResp, msg );
|
|
45 |
if( aMaxLength )
|
|
46 |
{
|
|
47 |
dialog->SetMaxLength(aMaxLength);
|
|
48 |
}
|
|
49 |
TInt resource;
|
|
50 |
if ( aIsUrlAddress )
|
|
51 |
{
|
|
52 |
resource = R_WB_SCRIPT_PROMPT_URL_ADDRESS;
|
|
53 |
}
|
|
54 |
else
|
|
55 |
{
|
|
56 |
resource = R_WB_SCRIPT_PROMPT_LINES;
|
|
57 |
}
|
|
58 |
dialog->SetPredictiveTextInputPermitted(ETrue);
|
|
59 |
return dialog->ExecuteLD( resource );
|
|
60 |
}
|
|
61 |
|
|
62 |
|
|
63 |
// ----------------------------------------------------------------------------
|
|
64 |
// TBrowserDialogs::DialogQueryReqL
|
|
65 |
// ----------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
TInt TBrowserDialogs::DialogQueryReqL( const TDesC& aMsg,
|
|
68 |
const TDesC& aYesMessage,
|
|
69 |
const TDesC& aNoMessage )
|
|
70 |
{
|
|
71 |
TPtrC msg(aMsg);
|
|
72 |
CAknQueryDialog* dialog =
|
|
73 |
new ( ELeave ) CAknQueryDialog( msg, CAknQueryDialog::ENoTone );
|
|
74 |
|
|
75 |
dialog->PrepareLC( R_WB_SCRIPT_QUERY_LINES );
|
|
76 |
|
|
77 |
if( aYesMessage.Length() )
|
|
78 |
{
|
|
79 |
dialog->ButtonGroupContainer().SetCommandL(EAknSoftkeyYes, aYesMessage );
|
|
80 |
}
|
|
81 |
|
|
82 |
if( aNoMessage.Length() )
|
|
83 |
{
|
|
84 |
dialog->ButtonGroupContainer().SetCommandL(EAknSoftkeyNo, aNoMessage );
|
|
85 |
}
|
|
86 |
|
|
87 |
return dialog->RunLD();
|
|
88 |
}
|
|
89 |
|
|
90 |
// ----------------------------------------------------------------------------
|
|
91 |
// TBrowserDialogs::ConfirmQueryDialogL
|
|
92 |
// ----------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
TInt TBrowserDialogs::ConfirmQueryDialogL( const TInt aPromptResourceId,
|
|
95 |
TInt aResId, TInt aAnimation )
|
|
96 |
{
|
|
97 |
HBufC* prompt = StringLoader::LoadLC( aPromptResourceId );
|
|
98 |
TInt ret = ConfirmQueryDialogL( *prompt, aResId, aAnimation );
|
|
99 |
CleanupStack::PopAndDestroy(); // prompt
|
|
100 |
return ret;
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
// ----------------------------------------------------------------------------
|
|
106 |
// TBrowserDialogs::ConfirmQueryDialogL
|
|
107 |
// ----------------------------------------------------------------------------
|
|
108 |
//
|
|
109 |
TInt TBrowserDialogs::ConfirmQueryDialogL( const TDesC& aPrompt,
|
|
110 |
TInt aResId,
|
|
111 |
TInt aAnimation )
|
|
112 |
{
|
|
113 |
CAknQueryDialog* dialog = new (ELeave) CAknQueryDialog();
|
|
114 |
|
|
115 |
// TO DO: Store dialog pointer for CBrowserDialogsProvider::CancelAll()
|
|
116 |
|
|
117 |
dialog->PrepareLC( R_BROWSER_CONFIRM_QUERY );
|
|
118 |
// passing prompt text in constructor is depracated according to
|
|
119 |
// AknQueryDialog.h
|
|
120 |
dialog->SetPromptL( aPrompt );
|
|
121 |
if( aResId )
|
|
122 |
{
|
|
123 |
dialog->ButtonGroupContainer().SetCommandSetL( aResId );
|
|
124 |
}
|
|
125 |
|
|
126 |
if( aAnimation )
|
|
127 |
{
|
|
128 |
CAknQueryControl* control = STATIC_CAST( CAknQueryControl*, dialog->Control(EGeneralQuery) );
|
|
129 |
control->SetAnimationL( aAnimation );
|
|
130 |
}
|
|
131 |
|
|
132 |
return dialog->RunLD();
|
|
133 |
}
|
|
134 |
|
|
135 |
|
|
136 |
// ---------------------------------------------------------
|
|
137 |
// TBrowserDialogs::ConfirmQueryYesNoL
|
|
138 |
// ---------------------------------------------------------
|
|
139 |
//
|
|
140 |
TBool TBrowserDialogs::ConfirmQueryYesNoL( TDesC& aPrompt )
|
|
141 |
{
|
|
142 |
return ConfirmQueryDialogL( aPrompt );
|
|
143 |
}
|
|
144 |
|
|
145 |
|
|
146 |
// ----------------------------------------------------------------------------
|
|
147 |
// TBrowserDialogs::ConfirmQueryYesNoL
|
|
148 |
// ----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
TBool TBrowserDialogs::ConfirmQueryYesNoL( const TInt aPromptResourceId )
|
|
151 |
{
|
|
152 |
HBufC* prompt = StringLoader::LoadLC( aPromptResourceId );
|
|
153 |
TBool ret = ConfirmQueryYesNoL( *prompt );
|
|
154 |
CleanupStack::PopAndDestroy(); // prompt
|
|
155 |
return ret;
|
|
156 |
}
|
|
157 |
|
|
158 |
|
|
159 |
// ----------------------------------------------------------------------------
|
|
160 |
// TBrowserDialogs::ConfirmQueryYesNoL
|
|
161 |
// ----------------------------------------------------------------------------
|
|
162 |
//
|
|
163 |
TBool TBrowserDialogs::ConfirmQueryYesNoL
|
|
164 |
( const TInt aPromptResourceId, const TDesC& aString )
|
|
165 |
{
|
|
166 |
HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, aString );
|
|
167 |
TBool ret = ConfirmQueryYesNoL( *prompt );
|
|
168 |
CleanupStack::PopAndDestroy(); // prompt
|
|
169 |
return ret;
|
|
170 |
}
|
|
171 |
|
|
172 |
|
|
173 |
// ----------------------------------------------------------------------------
|
|
174 |
// TBrowserDialogs::ConfirmQueryYesNoL
|
|
175 |
// ----------------------------------------------------------------------------
|
|
176 |
//
|
|
177 |
TBool TBrowserDialogs::ConfirmQueryYesNoL
|
|
178 |
( const TInt aPromptResourceId, const TInt aNum )
|
|
179 |
{
|
|
180 |
HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, aNum );
|
|
181 |
TBool ret = ConfirmQueryYesNoL( *prompt );
|
|
182 |
CleanupStack::PopAndDestroy(); // prompt
|
|
183 |
return ret;
|
|
184 |
}
|
|
185 |
|
|
186 |
|
|
187 |
// ----------------------------------------------------------------------------
|
|
188 |
// TBrowserDialogs::InfoNoteL
|
|
189 |
// ----------------------------------------------------------------------------
|
|
190 |
//
|
|
191 |
void TBrowserDialogs::InfoNoteL( TInt aDialogResourceId,
|
|
192 |
const TDesC& aPrompt )
|
|
193 |
{
|
|
194 |
CAknNoteDialog* dialog = new (ELeave) CAknNoteDialog
|
|
195 |
( REINTERPRET_CAST( CEikDialog**, &dialog ) );
|
|
196 |
dialog->PrepareLC( aDialogResourceId ) ;
|
|
197 |
dialog->SetCurrentLabelL( EGeneralNote, aPrompt );
|
|
198 |
dialog->RunDlgLD( CAknNoteDialog::EShortTimeout , CAknNoteDialog::ENoTone );
|
|
199 |
}
|
|
200 |
|
|
201 |
|
|
202 |
// ----------------------------------------------------------------------------
|
|
203 |
// TBrowserDialogs::InfoNoteL
|
|
204 |
// ----------------------------------------------------------------------------
|
|
205 |
//
|
|
206 |
void TBrowserDialogs::InfoNoteL
|
|
207 |
( TInt aDialogResourceId, const TInt aPromptResourceId )
|
|
208 |
{
|
|
209 |
HBufC* prompt = StringLoader::LoadLC( aPromptResourceId );
|
|
210 |
InfoNoteL( aDialogResourceId, *prompt );
|
|
211 |
CleanupStack::PopAndDestroy(); // prompt
|
|
212 |
}
|
|
213 |
|
|
214 |
|
|
215 |
// ----------------------------------------------------------------------------
|
|
216 |
// TBrowserDialogs::InfoNoteL
|
|
217 |
// ----------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
void TBrowserDialogs::InfoNoteL ( TInt aDialogResourceId,
|
|
220 |
const TInt aPromptResourceId,
|
|
221 |
const TDesC& aString )
|
|
222 |
{
|
|
223 |
HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, aString );
|
|
224 |
InfoNoteL( aDialogResourceId, *prompt );
|
|
225 |
CleanupStack::PopAndDestroy(); // prompt
|
|
226 |
}
|
|
227 |
|
|
228 |
|
|
229 |
// ----------------------------------------------------------------------------
|
|
230 |
// TBrowserDialogs::InfoNoteL
|
|
231 |
// ----------------------------------------------------------------------------
|
|
232 |
//
|
|
233 |
void TBrowserDialogs::InfoNoteL
|
|
234 |
( TInt aDialogResourceId, const TInt aPromptResourceId, const TInt aNum )
|
|
235 |
{
|
|
236 |
HBufC* prompt = StringLoader::LoadLC( aPromptResourceId, aNum );
|
|
237 |
InfoNoteL( aDialogResourceId, *prompt );
|
|
238 |
CleanupStack::PopAndDestroy(); // prompt
|
|
239 |
}
|
|
240 |
|
|
241 |
|
|
242 |
// ----------------------------------------------------------------------------
|
|
243 |
// TBrowserDialogs::ErrorNoteL
|
|
244 |
// ----------------------------------------------------------------------------
|
|
245 |
//
|
|
246 |
void TBrowserDialogs::ErrorNoteL( const TInt aPromptResourceId )
|
|
247 |
{
|
|
248 |
HBufC* prompt = StringLoader::LoadLC( aPromptResourceId );
|
|
249 |
ErrorNoteL( *prompt );
|
|
250 |
CleanupStack::PopAndDestroy(); // prompt
|
|
251 |
}
|
|
252 |
|
|
253 |
|
|
254 |
// ----------------------------------------------------------------------------
|
|
255 |
// TBrowserDialogs::ErrorNoteL
|
|
256 |
// ----------------------------------------------------------------------------
|
|
257 |
//
|
|
258 |
void TBrowserDialogs::ErrorNoteL( const TDesC& aPrompt )
|
|
259 |
{
|
|
260 |
CAknErrorNote* note = new ( ELeave ) CAknErrorNote();
|
|
261 |
note->ExecuteLD( aPrompt );
|
|
262 |
}
|
|
263 |
|
|
264 |
// End of File
|