|
1 /* |
|
2 * Copyright (c) 2009-2010 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: Ussd note controller |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <hbdevicemessageboxsymbian.h> |
|
21 #include <hbdeviceprogressdialogsymbian.h> |
|
22 #include <hbtextresolversymbian.h> |
|
23 |
|
24 #include "phcltclientserver.h" |
|
25 #include "cphcltussdnotecontroller.h" |
|
26 #include "tflogger.h" |
|
27 |
|
28 _LIT(KUssdLocFilename, "ussd_"); |
|
29 _LIT(KCommonLocFilename, "common_"); |
|
30 _LIT(KPath, "z:\\resource\\qt\\translations"); |
|
31 _LIT(KUssdRequesting, "txt_common_info_requesting"); // Requesting |
|
32 _LIT(KUssdDone, "txt_ussd_dpopinfo_done"); // Done |
|
33 _LIT(KUssdNotDone, "txt_ussd_dpopinfo_not_done"); // NotDone |
|
34 _LIT(KUssdNotAllowed, "txt_ussd_dpopinfo_not_allowed"); //NotAllowed |
|
35 _LIT(KUssdUnconfirmed, "txt_ussd_dpopinfo_request_not_confirmed"); // Unconfirmed |
|
36 _LIT(KUssdNoService, "txt_ussd_dpopinfo_no_service"); // NoService |
|
37 _LIT(KUssdOffline, "txt_ussd_dpopinfo_unable_to_use_network_phone_is"); // Offline |
|
38 _LIT(KUssdHide, "txt_common_button_hide"); // Hide |
|
39 |
|
40 const int KPhCltUssdProgressBarMaxLength = 10; |
|
41 // ============================ MEMBER FUNCTIONS =============================== |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CPhCltUssdNoteController::NewL |
|
45 // Two-phased constructor. |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 CPhCltUssdNoteController* CPhCltUssdNoteController::NewL( |
|
49 MPhCltUssdNoteControllerCallBack& aCallBack ) |
|
50 { |
|
51 TFLOGSTRING("CPhCltUssdNoteController: NewL call") |
|
52 CPhCltUssdNoteController* self = new( ELeave ) |
|
53 CPhCltUssdNoteController( aCallBack ); |
|
54 |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop( self ); |
|
58 TFLOGSTRING("CPhCltUssdNoteController: NewL exit") |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CPhCltUssdNoteController::ConstructL |
|
64 // Symbian 2nd phase constructor can leave. |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 void CPhCltUssdNoteController::ConstructL() |
|
68 { |
|
69 TFLOGSTRING( "CPhCltUssdNoteController: ConstructL call_exit" ) |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CPhCltUssdNoteController::CPhCltUssdNoteController |
|
74 // C++ constructor can NOT contain any code, that |
|
75 // might leave. |
|
76 // ----------------------------------------------------------------------------- |
|
77 CPhCltUssdNoteController::CPhCltUssdNoteController( |
|
78 MPhCltUssdNoteControllerCallBack& aCallBack ) |
|
79 : iGlobalWaitNote( NULL ), |
|
80 iCallBack( aCallBack ) |
|
81 { |
|
82 TFLOGSTRING("CPhCltUssdNoteController: CPhCltUssdNoteController call") |
|
83 TFLOGSTRING("CPhCltUssdNoteController: CPhCltUssdNoteController exit") |
|
84 } |
|
85 |
|
86 // ----------------------------------------------------------------------------- |
|
87 // CPhCltUssdNoteController:~CPhCltUssdNoteController |
|
88 // C++ default constructor can NOT contain any code, that |
|
89 // might leave. |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 CPhCltUssdNoteController::~CPhCltUssdNoteController() |
|
93 { |
|
94 TFLOGSTRING("CPhCltUssdNoteController: ~CPhCltUssdNoteController call") |
|
95 DestroyGlobalWaitNote(); |
|
96 TFLOGSTRING("CPhCltUssdNoteController: ~CPhCltUssdNoteController exit") |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CPhCltUssdNoteController::ShowGlobalInformationNoteL |
|
101 // ----------------------------------------------------------------------------- |
|
102 void CPhCltUssdNoteController::ShowGlobalInformationNoteL( |
|
103 const TPhCltUssdInformationType aInfoType ) |
|
104 { |
|
105 TFLOGSTRING2("CPhCltUssdNoteController: ShowGlobalInformationNoteL\ |
|
106 aInfoType = %d call", aInfoType) |
|
107 const TBool textResolver = HbTextResolverSymbian::Init( |
|
108 KUssdLocFilename, KPath ); |
|
109 TFLOGSTRING2("CPhCltUssdNoteController: ShowGlobalInformationNoteL\ |
|
110 ussd textResolver = %d", textResolver ) |
|
111 HBufC* temp(NULL); |
|
112 switch ( aInfoType ) |
|
113 { |
|
114 case EPhCltUssdUnconfirme: |
|
115 { |
|
116 temp = HbTextResolverSymbian::LoadLC( KUssdUnconfirmed ); |
|
117 break; |
|
118 } |
|
119 case EPhCltUssdNotallowed: |
|
120 { |
|
121 temp = HbTextResolverSymbian::LoadLC( KUssdNotAllowed ); |
|
122 break; |
|
123 } |
|
124 case EPhCltUssdNoservice: |
|
125 { |
|
126 temp = HbTextResolverSymbian::LoadLC( KUssdNoService ); |
|
127 break; |
|
128 } |
|
129 case EPhCltUssdOffline: |
|
130 { |
|
131 temp = HbTextResolverSymbian::LoadLC( KUssdOffline ); |
|
132 break; |
|
133 } |
|
134 case EPhCltUssdDone: |
|
135 { |
|
136 temp = HbTextResolverSymbian::LoadLC( KUssdDone ); |
|
137 break; |
|
138 } |
|
139 case EPhCltUssdNotDone: |
|
140 { |
|
141 temp = HbTextResolverSymbian::LoadLC( KUssdNotDone ); |
|
142 break; |
|
143 } |
|
144 default: |
|
145 { |
|
146 User::Leave( KErrArgument ); |
|
147 break; |
|
148 } |
|
149 } |
|
150 CHbDeviceMessageBoxSymbian* dlg = CHbDeviceMessageBoxSymbian::NewL( |
|
151 CHbDeviceMessageBoxSymbian::EInformation); |
|
152 CleanupStack::PushL( dlg ); |
|
153 dlg->SetTextL( temp->Des() ); |
|
154 dlg->SetButton( CHbDeviceMessageBoxSymbian::EAcceptButton, ETrue ); |
|
155 dlg->ExecL(); |
|
156 CleanupStack::PopAndDestroy( dlg ); |
|
157 CleanupStack::PopAndDestroy( temp ); |
|
158 TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalInformationNoteL exit") |
|
159 } |
|
160 |
|
161 // ----------------------------------------------------------------------------- |
|
162 // CPhCltUssdNoteController::ShowGlobalWaitNoteL |
|
163 // ----------------------------------------------------------------------------- |
|
164 void CPhCltUssdNoteController::ShowGlobalWaitNoteL( ) |
|
165 { |
|
166 TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL call") |
|
167 DestroyGlobalWaitNote(); |
|
168 TBool textResolver = HbTextResolverSymbian::Init( |
|
169 KCommonLocFilename, KPath ); |
|
170 TFLOGSTRING2("CPhCltUssdNoteController: ConstructL\ |
|
171 init common textResolver = %d", textResolver ) |
|
172 //CHbDeviceProgressDialogSymbian |
|
173 iGlobalWaitNote = CHbDeviceProgressDialogSymbian::NewL( |
|
174 CHbDeviceProgressDialogSymbian::EProgressDialog ); |
|
175 CleanupStack::PushL( iGlobalWaitNote ); |
|
176 HBufC* context = HbTextResolverSymbian::LoadLC( KUssdRequesting ); |
|
177 iGlobalWaitNote->SetTextL( context->Des() ); |
|
178 HBufC* bottonText = HbTextResolverSymbian::LoadLC( KUssdHide ); |
|
179 iGlobalWaitNote->SetButtonTextL( bottonText->Des() ); |
|
180 iGlobalWaitNote->SetObserver( this ); |
|
181 TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL before setactive") |
|
182 iGlobalWaitNote->SetRange(0,KPhCltUssdProgressBarMaxLength); |
|
183 iGlobalWaitNote->SetProgressValue( KPhCltUssdProgressBarMaxLength ); |
|
184 iGlobalWaitNote->SetAutoClose( EFalse ); |
|
185 iGlobalWaitNote->ShowL(); |
|
186 TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL after ShowL") |
|
187 CleanupStack::PopAndDestroy( bottonText ); |
|
188 CleanupStack::PopAndDestroy( context ); |
|
189 CleanupStack::Pop( iGlobalWaitNote ); |
|
190 TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL after setactive") |
|
191 TFLOGSTRING("CPhCltUssdNoteController: ShowGlobalWaitNoteL exit") |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CPhCltUssdNoteController::DestroyGlobalWaitNote |
|
196 // ----------------------------------------------------------------------------- |
|
197 void CPhCltUssdNoteController::DestroyGlobalWaitNote() |
|
198 { |
|
199 TFLOGSTRING("CPhCltUssdNoteController: DestroyGlobalWaitNote call") |
|
200 if ( iGlobalWaitNote ) |
|
201 { |
|
202 iGlobalWaitNote->Close(); |
|
203 delete iGlobalWaitNote; |
|
204 iGlobalWaitNote = NULL; |
|
205 } |
|
206 TFLOGSTRING("CPhCltUssdNoteController: DestroyGlobalWaitNote exit") |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CPhCltUssdNoteController::ProgressDialogCancelled |
|
211 // |
|
212 // |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CPhCltUssdNoteController::ProgressDialogCancelled( |
|
216 const CHbDeviceProgressDialogSymbian* /*aProgressDialog*/) |
|
217 { |
|
218 TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogCancelled call") |
|
219 iCallBack.GlobalWaitNoteHidden(); |
|
220 TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogCancelled exit") |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CPhCltUssdNoteController::ProgressDialogClosed |
|
225 // |
|
226 // |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 void CPhCltUssdNoteController::ProgressDialogClosed( |
|
230 const CHbDeviceProgressDialogSymbian* /*aProgressDialog*/) |
|
231 { |
|
232 TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogClosed call") |
|
233 TFLOGSTRING("CPhCltUssdNoteController: ProgressDialogClosed exit") |
|
234 } |
|
235 |
|
236 // End of file |
|
237 |