|
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: Handles dialog used in tutorial mode |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <featmgr.h> |
|
21 |
|
22 #include <StringLoader.h> |
|
23 |
|
24 #include <AknNotifierController.h> |
|
25 |
|
26 #include <vuivoicerecognition.rsg> |
|
27 |
|
28 #include "vuivoicerecognition.hrh" |
|
29 |
|
30 #include "vuictutorialmessagedialog.h" |
|
31 #include "vuicpropertyhandler.h" |
|
32 #include "vuicmessagequerydialog.h" |
|
33 |
|
34 #include "rubydebug.h" |
|
35 |
|
36 // CONSTANTS |
|
37 _LIT( KSpace, " " ); |
|
38 |
|
39 // --------------------------------------------------------- |
|
40 // CTutorialMessageDialog::NewL |
|
41 // Two-phased constructor. |
|
42 // --------------------------------------------------------- |
|
43 // |
|
44 CTutorialMessageDialog* CTutorialMessageDialog::NewL() |
|
45 { |
|
46 CTutorialMessageDialog* self = NewLC(); |
|
47 CleanupStack::Pop( self ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------- |
|
52 // CTutorialMessageDialog::NewLC |
|
53 // Two-phased constructor. |
|
54 // --------------------------------------------------------- |
|
55 // |
|
56 CTutorialMessageDialog* CTutorialMessageDialog::NewLC() |
|
57 { |
|
58 CTutorialMessageDialog* self = new (ELeave) CTutorialMessageDialog(); |
|
59 CleanupStack::PushL( self ); |
|
60 self->ConstructL(); |
|
61 return self; |
|
62 } |
|
63 |
|
64 // Destructor |
|
65 CTutorialMessageDialog::~CTutorialMessageDialog() |
|
66 { |
|
67 delete iDlg; |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------- |
|
71 // CTutorialMessageDialog::ShowMessageDialogL |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 TInt CTutorialMessageDialog::ShowMessageDialogL( TInt aDialogResourceId, |
|
75 TInt aHeaderId, |
|
76 TInt aMessagePart1Id, |
|
77 TInt aMessagePart2Id, |
|
78 TInt aCommandResourceId, |
|
79 SecondaryDisplay::TVUISecondaryDisplayDialogs aDialog ) |
|
80 { |
|
81 RUBY_DEBUG_BLOCK( "CTutorialMessageDialog::ShowMessageDialogL" ); |
|
82 |
|
83 // Load resources |
|
84 HBufC* header = StringLoader::LoadLC( aHeaderId ); |
|
85 HBufC* part1 = StringLoader::LoadLC( aMessagePart1Id ); |
|
86 HBufC* part2 = NULL; |
|
87 HBufC* message = part1; |
|
88 |
|
89 if ( aMessagePart2Id ) |
|
90 { |
|
91 part2 = StringLoader::LoadLC( aMessagePart2Id ); |
|
92 message = ConcatenateLC( *part1, *part2 ); |
|
93 } |
|
94 |
|
95 // Create dialog |
|
96 iDlg = CMessageQueryDialog::NewL( &iDlg ); |
|
97 |
|
98 if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) && |
|
99 aDialog != SecondaryDisplay::ECmdVoiceNoNote ) |
|
100 { |
|
101 // Initializes cover support |
|
102 iDlg->PublishDialogL( aDialog, SecondaryDisplay::KCatVoiceUi ); |
|
103 } |
|
104 |
|
105 iDlg->PrepareLC( aDialogResourceId ); |
|
106 |
|
107 // Set softkey labels |
|
108 CEikButtonGroupContainer* cba = &iDlg->ButtonGroupContainer(); |
|
109 cba->SetCommandSetL( aCommandResourceId ); |
|
110 iCommands = aCommandResourceId; |
|
111 |
|
112 // Set message & header texts |
|
113 iDlg->SetMessageTextL( *message ); |
|
114 iDlg->QueryHeading()->SetTextL( *header ); |
|
115 |
|
116 // Show dialog and block until dialog is dismissed |
|
117 // RunLD pops iDlg (pushed in PrepareLC) from CleanupStack |
|
118 TInt returnValue = iDlg->RunLD(); |
|
119 |
|
120 // Enter selection returns EAknSoftkeyOk |
|
121 if ( returnValue == EAknSoftkeyOk ) |
|
122 { |
|
123 if ( aCommandResourceId == R_SOFTKEYS_NEXT_CANCEL__NEXT ) |
|
124 { |
|
125 returnValue = EVoiceInfoSoftKeyNext; |
|
126 } |
|
127 else if ( aCommandResourceId == R_SOFTKEYS_ACTIVATE_CANCEL__ACTIVATE ) |
|
128 { |
|
129 returnValue = EVoiceInfoSoftKeyActivate; |
|
130 } |
|
131 else |
|
132 { |
|
133 returnValue = EAknSoftkeyQuit; |
|
134 } |
|
135 } |
|
136 |
|
137 // Cleanup resources |
|
138 if ( aMessagePart2Id ) |
|
139 { |
|
140 CleanupStack::PopAndDestroy( message ); |
|
141 CleanupStack::PopAndDestroy( part2 ); |
|
142 } |
|
143 CleanupStack::PopAndDestroy( part1 ); |
|
144 CleanupStack::PopAndDestroy( header ); |
|
145 |
|
146 return returnValue; |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CTutorialMessageDialog::CTutorialMessageDialog |
|
151 // C++ default constructor can NOT contain any code, that |
|
152 // might leave. |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 CTutorialMessageDialog::CTutorialMessageDialog() |
|
156 { |
|
157 // Nothing |
|
158 } |
|
159 |
|
160 // ----------------------------------------------------------------------------- |
|
161 // CTutorialMessageDialog::ConstructL |
|
162 // Symbian 2nd phase constructor can leave. |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 void CTutorialMessageDialog::ConstructL() |
|
166 { |
|
167 RUBY_DEBUG_BLOCK( "CTutorialMessageDialog::ConstructL" ); |
|
168 } |
|
169 |
|
170 // --------------------------------------------------------- |
|
171 // CTutorialMessageDialog::ConcatenateLC |
|
172 // --------------------------------------------------------- |
|
173 // |
|
174 HBufC* CTutorialMessageDialog::ConcatenateLC( const TDesC& aString1, |
|
175 const TDesC& aString2 ) |
|
176 { |
|
177 HBufC* string = NULL; |
|
178 if ( aString2.Length() ) |
|
179 { |
|
180 string = HBufC::NewLC( aString1.Length() + aString2.Length() + KSpace.iTypeLength ); |
|
181 string->Des() = aString1; |
|
182 string->Des() += KSpace; |
|
183 string->Des() += aString2; |
|
184 } |
|
185 else |
|
186 { |
|
187 string = HBufC::NewLC( aString1.Length() ); |
|
188 string->Des() = aString1; |
|
189 } |
|
190 return string; |
|
191 } |
|
192 |
|
193 // End of File |
|
194 |
|
195 |