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