15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <hbdevicemessageboxsymbian.h> |
20 #include <AknGlobalNote.h> //CAknGlobalNote |
21 #include <hbdeviceprogressdialogsymbian.h> |
21 #include <aknnotewrappers.h> |
22 #include <hbtextresolversymbian.h> |
22 #include <ConeResLoader.h> |
23 |
23 #include <StringLoader.h> |
24 #include "phcltclientserver.h" |
24 |
25 #include "cphcltussdnotecontroller.h" |
25 #include "PhCltClientServer.h" |
26 #include "tflogger.h" |
26 #include "CPhCltUssdNoteController.h" |
27 |
27 |
28 _LIT(KUssdLocFilename, "ussd_"); |
28 |
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 =============================== |
29 // ============================ MEMBER FUNCTIONS =============================== |
42 |
30 |
43 // ----------------------------------------------------------------------------- |
31 // ----------------------------------------------------------------------------- |
44 // CPhCltUssdNoteController::NewL |
32 // CPhCltUssdNoteController::NewL |
45 // Two-phased constructor. |
33 // Two-phased constructor. |
46 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
47 // |
35 // |
48 CPhCltUssdNoteController* CPhCltUssdNoteController::NewL( |
36 CPhCltUssdNoteController* CPhCltUssdNoteController::NewL( |
49 MPhCltUssdNoteControllerCallBack& aCallBack ) |
37 MPhCltUssdNoteControllerCallBack& aCallBack, |
50 { |
38 TInt aPriority ) |
51 TFLOGSTRING("CPhCltUssdNoteController: NewL call") |
39 { |
52 CPhCltUssdNoteController* self = new( ELeave ) |
40 CPhCltUssdNoteController* self = new( ELeave ) |
53 CPhCltUssdNoteController( aCallBack ); |
41 CPhCltUssdNoteController( aCallBack, aPriority ); |
54 |
42 |
55 CleanupStack::PushL( self ); |
43 CleanupStack::PushL( self ); |
56 self->ConstructL(); |
44 self->ConstructL(); |
57 CleanupStack::Pop( self ); |
45 CleanupStack::Pop( self ); |
58 TFLOGSTRING("CPhCltUssdNoteController: NewL exit") |
|
59 return self; |
46 return self; |
60 } |
47 } |
|
48 |
61 |
49 |
62 // ----------------------------------------------------------------------------- |
50 // ----------------------------------------------------------------------------- |
63 // CPhCltUssdNoteController::ConstructL |
51 // CPhCltUssdNoteController::ConstructL |
64 // Symbian 2nd phase constructor can leave. |
52 // Symbian 2nd phase constructor can leave. |
65 // ----------------------------------------------------------------------------- |
53 // ----------------------------------------------------------------------------- |
66 // |
54 // |
67 void CPhCltUssdNoteController::ConstructL() |
55 void CPhCltUssdNoteController::ConstructL() |
68 { |
56 { |
69 TFLOGSTRING( "CPhCltUssdNoteController: ConstructL call_exit" ) |
57 LoadResourceFileL(); |
70 } |
58 } |
|
59 |
71 |
60 |
72 // ----------------------------------------------------------------------------- |
61 // ----------------------------------------------------------------------------- |
73 // CPhCltUssdNoteController::CPhCltUssdNoteController |
62 // CPhCltUssdNoteController::CPhCltUssdNoteController |
74 // C++ constructor can NOT contain any code, that |
63 // C++ constructor can NOT contain any code, that |
75 // might leave. |
64 // might leave. |
76 // ----------------------------------------------------------------------------- |
65 // ----------------------------------------------------------------------------- |
77 CPhCltUssdNoteController::CPhCltUssdNoteController( |
66 CPhCltUssdNoteController::CPhCltUssdNoteController( |
78 MPhCltUssdNoteControllerCallBack& aCallBack ) |
67 MPhCltUssdNoteControllerCallBack& aCallBack, |
79 : iGlobalWaitNote( NULL ), |
68 TInt aPriority ) |
80 iCallBack( aCallBack ) |
69 : CActive( aPriority ), |
81 { |
70 iCallBack( aCallBack ), |
82 TFLOGSTRING("CPhCltUssdNoteController: CPhCltUssdNoteController call") |
71 iWaitNoteId( KErrNotFound ) |
83 TFLOGSTRING("CPhCltUssdNoteController: CPhCltUssdNoteController exit") |
72 { |
84 } |
73 CActiveScheduler::Add( this ); |
85 |
74 } |
|
75 |
|
76 |
86 // ----------------------------------------------------------------------------- |
77 // ----------------------------------------------------------------------------- |
87 // CPhCltUssdNoteController:~CPhCltUssdNoteController |
78 // CPhCltUssdNoteController:~CPhCltUssdNoteController |
88 // C++ default constructor can NOT contain any code, that |
79 // C++ default constructor can NOT contain any code, that |
89 // might leave. |
80 // might leave. |
90 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
91 // |
82 // |
92 CPhCltUssdNoteController::~CPhCltUssdNoteController() |
83 CPhCltUssdNoteController::~CPhCltUssdNoteController() |
93 { |
84 { |
94 TFLOGSTRING("CPhCltUssdNoteController: ~CPhCltUssdNoteController call") |
85 Cancel(); |
|
86 |
95 DestroyGlobalWaitNote(); |
87 DestroyGlobalWaitNote(); |
96 TFLOGSTRING("CPhCltUssdNoteController: ~CPhCltUssdNoteController exit") |
88 |
97 } |
89 delete iMessageBuffer; |
|
90 iMessageBuffer = NULL; |
|
91 |
|
92 if ( iResourceLoader ) |
|
93 { |
|
94 iResourceLoader->Close(); |
|
95 delete iResourceLoader; |
|
96 iResourceLoader = NULL; |
|
97 } |
|
98 } |
|
99 |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CPhCltUssdNoteController::RunL |
|
103 // |
|
104 // Called when dialog is dismissed by pressing a softkey. |
|
105 // ----------------------------------------------------------------------------- |
|
106 void CPhCltUssdNoteController::RunL() |
|
107 { |
|
108 iCallBack.GlobalWaitNoteDismissedL( iStatus.Int() ); |
|
109 } |
|
110 |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CPhCltUssdNoteController::DoCancel |
|
114 // ----------------------------------------------------------------------------- |
|
115 void CPhCltUssdNoteController::DoCancel() |
|
116 { |
|
117 DestroyGlobalWaitNote(); |
|
118 } |
|
119 |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CPhCltUssdNoteController::ShowInformationNoteL |
|
123 // ----------------------------------------------------------------------------- |
|
124 void CPhCltUssdNoteController::ShowInformationNoteL( TInt aResourceId ) |
|
125 { |
|
126 ShowNoteL( EPhCltUssdInformationNote, aResourceId ); |
|
127 } |
|
128 |
98 |
129 |
99 // ----------------------------------------------------------------------------- |
130 // ----------------------------------------------------------------------------- |
100 // CPhCltUssdNoteController::ShowGlobalInformationNoteL |
131 // CPhCltUssdNoteController::ShowGlobalInformationNoteL |
101 // ----------------------------------------------------------------------------- |
132 // ----------------------------------------------------------------------------- |
102 void CPhCltUssdNoteController::ShowGlobalInformationNoteL( |
133 void CPhCltUssdNoteController::ShowGlobalInformationNoteL( TInt aResourceId ) |
103 const TPhCltUssdInformationType aInfoType ) |
134 { |
104 { |
135 ShowNoteL( EPhCltUssdGlobalInformationNote, aResourceId ); |
105 TFLOGSTRING2("CPhCltUssdNoteController: ShowGlobalInformationNoteL\ |
136 } |
106 aInfoType = %d call", aInfoType) |
137 |
107 const TBool textResolver = HbTextResolverSymbian::Init( |
138 |
108 KUssdLocFilename, KPath ); |
139 // ----------------------------------------------------------------------------- |
109 TFLOGSTRING2("CPhCltUssdNoteController: ShowGlobalInformationNoteL\ |
140 // CPhCltUssdNoteController::ShowGlobalConfirmationNoteL |
110 ussd textResolver = %d", textResolver ) |
141 // ----------------------------------------------------------------------------- |
111 HBufC* temp(NULL); |
142 void CPhCltUssdNoteController::ShowGlobalConfirmationNoteL( TInt aResourceId ) |
112 switch ( aInfoType ) |
143 { |
113 { |
144 ShowNoteL( EPhCltUssdGlobalConfirmationNote, aResourceId ); |
114 case EPhCltUssdUnconfirme: |
145 } |
|
146 |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CPhCltUssdNoteController::ShowGlobalWaitNoteL |
|
150 // ----------------------------------------------------------------------------- |
|
151 void CPhCltUssdNoteController::ShowGlobalWaitNoteL( |
|
152 TInt aResourceId, |
|
153 TInt aSoftkeyResourceId ) |
|
154 { |
|
155 delete iMessageBuffer; |
|
156 iMessageBuffer = NULL; |
|
157 iMessageBuffer = StringLoader::LoadL( aResourceId ); |
|
158 |
|
159 DestroyGlobalWaitNote(); |
|
160 |
|
161 iGlobalWaitNote = CAknGlobalNote::NewL(); |
|
162 |
|
163 if ( aSoftkeyResourceId ) |
|
164 { |
|
165 iGlobalWaitNote->SetSoftkeys( aSoftkeyResourceId ); |
|
166 } |
|
167 |
|
168 SetActive(); |
|
169 |
|
170 iWaitNoteId = iGlobalWaitNote->ShowNoteL( iStatus, |
|
171 EAknGlobalWaitNote, |
|
172 *iMessageBuffer ); |
|
173 } |
|
174 |
|
175 |
|
176 // ----------------------------------------------------------------------------- |
|
177 // CPhCltUssdNoteController::DestroyGlobalWaitNote |
|
178 // ----------------------------------------------------------------------------- |
|
179 void CPhCltUssdNoteController::DestroyGlobalWaitNote() |
|
180 { |
|
181 if ( iGlobalWaitNote ) |
|
182 { |
|
183 if ( iWaitNoteId != KErrNotFound ) |
115 { |
184 { |
116 temp = HbTextResolverSymbian::LoadLC( KUssdUnconfirmed ); |
185 TRAP_IGNORE( iGlobalWaitNote->CancelNoteL( iWaitNoteId ) ); |
|
186 iWaitNoteId = KErrNotFound; |
|
187 } |
|
188 delete iGlobalWaitNote; |
|
189 iGlobalWaitNote = NULL; |
|
190 } |
|
191 } |
|
192 |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CPhCltUssdNoteController::ShowNoteL |
|
196 // |
|
197 // Launches a corresponding dialog with the given string. |
|
198 // ----------------------------------------------------------------------------- |
|
199 // |
|
200 void CPhCltUssdNoteController::ShowNoteL( TPhCltUssdNoteType aType, TInt aResourceId ) |
|
201 { |
|
202 switch ( aType ) |
|
203 { |
|
204 case EPhCltUssdInformationNote: |
|
205 { |
|
206 delete iMessageBuffer; |
|
207 iMessageBuffer = NULL; |
|
208 iMessageBuffer = StringLoader::LoadL( aResourceId ); |
|
209 |
|
210 if ( iMessageBuffer->Length() == 0 ) |
|
211 { |
|
212 break; |
|
213 } |
|
214 CAknInformationNote* dlg = new ( ELeave ) |
|
215 CAknInformationNote( ETrue ); |
|
216 |
|
217 dlg->ExecuteLD( *iMessageBuffer ); |
117 break; |
218 break; |
118 } |
219 } |
119 case EPhCltUssdNotallowed: |
220 case EPhCltUssdGlobalInformationNote: |
|
221 case EPhCltUssdGlobalConfirmationNote: |
120 { |
222 { |
121 temp = HbTextResolverSymbian::LoadLC( KUssdNotAllowed ); |
223 CAknGlobalNote* dlg = CAknGlobalNote::NewLC(); |
|
224 |
|
225 delete iMessageBuffer; |
|
226 iMessageBuffer = NULL; |
|
227 iMessageBuffer = StringLoader::LoadL( aResourceId ); |
|
228 |
|
229 if ( aType == EPhCltUssdGlobalInformationNote ) |
|
230 { |
|
231 dlg->ShowNoteL( EAknGlobalInformationNote , *iMessageBuffer ); |
|
232 } |
|
233 else if ( aType == EPhCltUssdGlobalConfirmationNote ) |
|
234 { |
|
235 dlg->ShowNoteL( EAknGlobalConfirmationNote , *iMessageBuffer ); |
|
236 } |
|
237 CleanupStack::PopAndDestroy(); // dlg |
122 break; |
238 break; |
123 } |
239 } |
124 case EPhCltUssdNoservice: |
240 |
125 { |
241 default: |
126 temp = HbTextResolverSymbian::LoadLC( KUssdNoService ); |
|
127 break; |
242 break; |
128 } |
243 } |
129 case EPhCltUssdOffline: |
244 } |
130 { |
245 |
131 temp = HbTextResolverSymbian::LoadLC( KUssdOffline ); |
246 // ----------------------------------------------------------------------------- |
132 break; |
247 // CPhCltUssdNoteController::LoadResourceFileL |
133 } |
248 // |
134 case EPhCltUssdDone: |
249 // Loads resource file via RConeResourceLoader. |
135 { |
250 // ----------------------------------------------------------------------------- |
136 temp = HbTextResolverSymbian::LoadLC( KUssdDone ); |
251 // |
137 break; |
252 void CPhCltUssdNoteController::LoadResourceFileL() |
138 } |
253 { |
139 case EPhCltUssdNotDone: |
254 // load resource file for notes |
140 { |
255 iResourceLoader = new( ELeave ) RConeResourceLoader( *CCoeEnv::Static() ); |
141 temp = HbTextResolverSymbian::LoadLC( KUssdNotDone ); |
256 TFileName fileName ( KPhCltServerZDrive ); |
142 break; |
257 fileName.Append( KDC_RESOURCE_FILES_DIR ); |
143 } |
258 fileName.Append( KPhCltResourceFileNameAndPath ); |
144 default: |
259 fileName.ZeroTerminate(); |
145 { |
260 iResourceLoader->OpenL( fileName ); |
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 } |
261 } |
235 |
262 |
236 // End of file |
263 // End of file |
237 |
264 |