1 /* |
|
2 * Copyright (c) 2008 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: Implements the CLocSUPLSessionEditor class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <aknappui.h> |
|
21 #include <AknIconArray.h> // Icon Array |
|
22 #include <AknsUtils.h> |
|
23 #include <AknsSkinInstance.h> |
|
24 #include <akntitle.h> // CAknTitlePane |
|
25 #include <avkon.rsg> |
|
26 #include <avkon.hrh> |
|
27 #include <e32math.h> |
|
28 #include <eikapp.h> |
|
29 #include <eikaufty.h> |
|
30 #include <eikcapc.h> |
|
31 #include <eikedwin.h> |
|
32 #include <eikenv.h> |
|
33 #include <eikmenup.h> |
|
34 #include <eikmenub.h> |
|
35 #include <eikspane.h> // Status pane |
|
36 #include <barsread.h> // For TResourceReader |
|
37 #include <bautils.h> |
|
38 #include <AknQueryDialog.h> |
|
39 #include <data_caging_path_literals.hrh> |
|
40 #include <gulicon.h> // Gul Icon |
|
41 #include <StringLoader.h> |
|
42 #include <hlplch.h> |
|
43 |
|
44 #include <epos_csuplsettingsconstants.h> |
|
45 #include <epos_csuplsettingparams.h> |
|
46 |
|
47 #include <locsuplsettingsui.rsg> |
|
48 #include "locsuplsettings.hrh" |
|
49 #include "locsuplsessioneditor.h" |
|
50 #include "locsuplsettingsuiengine.h" |
|
51 #include "locsupldebug.h" |
|
52 |
|
53 // Constants |
|
54 const TInt KMinToSecs = 60; |
|
55 const TInt KHrToSecs = 3600; |
|
56 const TInt KdayToSecs = 86400; |
|
57 const TInt KRealWidth = 50; |
|
58 |
|
59 // ============================ LOCAL FUNCTIONS =============================== |
|
60 |
|
61 // ============================ MEMBER FUNCTIONS =============================== |
|
62 |
|
63 // ----------------------------------------------------------------------------- |
|
64 // CLocSUPLSessionEditor::CLocSUPLSessionEditor |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 CLocSUPLSessionEditor::CLocSUPLSessionEditor( |
|
68 CLocSUPLSettingsUiEngine& aEngine, |
|
69 TInt64 aSessionId |
|
70 ):iEngine( aEngine ), iSessionId( aSessionId ) |
|
71 { |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CLocSUPLSessionEditor::ConstructL |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CLocSUPLSessionEditor::ConstructL() |
|
79 { |
|
80 DEBUG( + CLocSUPLSessionEditor::ConstructL ); |
|
81 CAknForm::ConstructL( R_SUPLSESSION_EDITOR_MENU_BAR ); |
|
82 |
|
83 // Save original title |
|
84 CEikStatusPane* statusPane = iAvkonAppUi->StatusPane(); |
|
85 iTitlePane = ( CAknTitlePane* ) statusPane->ControlL( |
|
86 TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
87 iOriginalTitle = iTitlePane->Text()->AllocL(); |
|
88 |
|
89 iSessionName = HBufC::NewL( KMaxTriggerSessionNameLen ); |
|
90 |
|
91 // Set Session Observer |
|
92 iEngine.SetSessionObserver( this ); |
|
93 |
|
94 DEBUG( - CLocSUPLSessionEditor::ConstructL ); |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CLocSUPLSessionEditor::NewL |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 CLocSUPLSessionEditor* CLocSUPLSessionEditor::NewL( |
|
102 CLocSUPLSettingsUiEngine& aEngine, |
|
103 TInt64 aSessionId |
|
104 ) |
|
105 { |
|
106 CLocSUPLSessionEditor* self = NewLC( aEngine, aSessionId ); |
|
107 CleanupStack::Pop( self ); |
|
108 return self; |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CLocSUPLSessionEditor::NewLC |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 CLocSUPLSessionEditor* CLocSUPLSessionEditor::NewLC( |
|
116 CLocSUPLSettingsUiEngine& aEngine, |
|
117 TInt64 aSessionId |
|
118 ) |
|
119 { |
|
120 CLocSUPLSessionEditor* self = new ( ELeave ) |
|
121 CLocSUPLSessionEditor( aEngine, aSessionId ); |
|
122 CleanupStack::PushL( self ); |
|
123 self->ConstructL(); |
|
124 return self; |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CLocSUPLSessionEditor::~CLocSUPLSessionEditor |
|
129 // ----------------------------------------------------------------------------- |
|
130 // |
|
131 CLocSUPLSessionEditor::~CLocSUPLSessionEditor() |
|
132 { |
|
133 DEBUG( + CLocSUPLSessionEditor::~CLocSUPLSessionEditor ); |
|
134 |
|
135 // Delete Buffer |
|
136 delete iSessionName; |
|
137 |
|
138 // Remove the Observer set |
|
139 iEngine.RemoveSessionObserver(); |
|
140 |
|
141 // Restore title pane. Ownership of iTitlePane transferred. |
|
142 if ( iTitlePane && iOriginalTitle ) |
|
143 { |
|
144 iTitlePane->SetText( iOriginalTitle ); |
|
145 } |
|
146 |
|
147 DEBUG( - CLocSUPLSessionEditor::~CLocSUPLSessionEditor ); |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CLocSUPLSessionEditor::DynInitMenuPaneL |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 void CLocSUPLSessionEditor::DynInitMenuPaneL( |
|
155 TInt aResourceId, |
|
156 CEikMenuPane* aMenuPane ) |
|
157 { |
|
158 DEBUG( + CLocSUPLSessionEditor::DynInitMenuPaneL ); |
|
159 CAknForm::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
160 |
|
161 if ( aResourceId == R_AVKON_FORM_MENUPANE ) |
|
162 { |
|
163 // We do not want to allow the user to modify our Form therefore |
|
164 // Disable the Label, Add, Delete, and Save Field |
|
165 aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue ); |
|
166 aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue ); |
|
167 aMenuPane->SetItemDimmed( EAknFormCmdDelete,ETrue ); |
|
168 aMenuPane->SetItemDimmed( EAknFormCmdSave, ETrue ); |
|
169 aMenuPane->SetItemDimmed( EAknFormCmdEdit, ETrue ); |
|
170 |
|
171 aMenuPane->SetItemDimmed( ELocSessionEditorTerminate, EFalse ); |
|
172 |
|
173 switch( IdOfFocusControl() ) |
|
174 { |
|
175 case ELocSuplSessionNotificationStatus: |
|
176 { |
|
177 aMenuPane->SetItemDimmed( ELocSessionEditorChange, EFalse ); |
|
178 break; |
|
179 } |
|
180 case ELocSuplSessionType: |
|
181 case ELocSuplSessionTimePeriod: |
|
182 case ELocSuplSessionTriggerInterval: |
|
183 case ELocSuplSessionOutstandingTrigger: |
|
184 default: |
|
185 { |
|
186 aMenuPane->SetItemDimmed( ELocSessionEditorChange, ETrue ); |
|
187 break; |
|
188 } |
|
189 } |
|
190 } |
|
191 DEBUG( - CLocSUPLSessionEditor::DynInitMenuPaneL ); |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CLocSUPLSessionEditor::ProcessCommandL |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 void CLocSUPLSessionEditor::ProcessCommandL( TInt aCommandId ) |
|
199 { |
|
200 DEBUG1( + CLocSUPLSessionEditor::ProcessCommandL aCommandId=%d, aCommandId ); |
|
201 CAknForm::ProcessCommandL( aCommandId ); |
|
202 |
|
203 switch ( aCommandId ) |
|
204 { |
|
205 case ELocSessionEditorChange: |
|
206 { |
|
207 TBool status = ETrue; |
|
208 CAknPopupFieldText* notificationStatus = |
|
209 (CAknPopupFieldText*)Control( ELocSuplSessionNotificationStatus ); |
|
210 if(notificationStatus) |
|
211 { |
|
212 if( notificationStatus->CurrentValueIndex() == 0 ) |
|
213 { |
|
214 status = EFalse; |
|
215 } |
|
216 } |
|
217 |
|
218 iEngine.ChangeNotificationStatusL( iSessionId, status ); |
|
219 break; |
|
220 } |
|
221 case ELocSessionEditorTerminate: |
|
222 { |
|
223 if( DeleteConfirmationQueryL() ) |
|
224 { |
|
225 iEngine.RemoveTriggerSessionL( iSessionId ); |
|
226 // Return back to Session view |
|
227 TryExitL( EAknSoftkeyBack ); |
|
228 } |
|
229 break; |
|
230 } |
|
231 case EAknCmdHelp: |
|
232 { |
|
233 HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), |
|
234 iAvkonAppUi->AppHelpContextL() ); |
|
235 break; |
|
236 } |
|
237 case EEikCmdExit: |
|
238 { |
|
239 // The Exit is handled by the Application UI |
|
240 TryExitL( EEikCmdExit ); |
|
241 break; |
|
242 } |
|
243 default: |
|
244 break; |
|
245 } |
|
246 DEBUG( - CLocSUPLSessionEditor::ProcessCommandL ); |
|
247 } |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // CLocSUPLSessionEditor::OfferKeyEventL |
|
251 // ----------------------------------------------------------------------------- |
|
252 // |
|
253 TKeyResponse CLocSUPLSessionEditor::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
254 TEventCode aType ) |
|
255 { |
|
256 DEBUG( CLocSUPLSessionEditor::OfferKeyEventL ); |
|
257 if ( aType == EEventKey ) |
|
258 { |
|
259 if( aKeyEvent.iCode == EKeyBackspace ) |
|
260 { |
|
261 ProcessCommandL( ELocSessionEditorTerminate ); |
|
262 return EKeyWasConsumed; |
|
263 } |
|
264 |
|
265 if ( aKeyEvent.iCode == EKeyEnter || aKeyEvent.iScanCode == EStdKeyEnter ) |
|
266 { |
|
267 if ( IdOfFocusControl() == ELocSuplSessionNotificationStatus ) |
|
268 { |
|
269 ProcessCommandL( ELocSessionEditorChange ); |
|
270 return EKeyWasConsumed; |
|
271 } |
|
272 } |
|
273 } |
|
274 |
|
275 return CAknForm::OfferKeyEventL( aKeyEvent, aType ); |
|
276 } |
|
277 |
|
278 // --------------------------------------------------------------------------- |
|
279 // CLocSUPLSessionEditor ::OkToExitL() |
|
280 // --------------------------------------------------------------------------- |
|
281 // |
|
282 TBool CLocSUPLSessionEditor::OkToExitL( TInt aButtonId ) |
|
283 { |
|
284 DEBUG1( + CLocSUPLSessionEditor::OkToExitL aButtonId=%d, aButtonId ); |
|
285 TBool retVal = EFalse; |
|
286 |
|
287 switch( aButtonId ) |
|
288 { |
|
289 case EAknSoftkeyChange: |
|
290 { |
|
291 ProcessCommandL( ELocSessionEditorChange ); |
|
292 break; |
|
293 } |
|
294 case EAknSoftkeyOptions: //when LSK is pressed |
|
295 { |
|
296 //display menu specific to editor |
|
297 DisplayMenuL(); |
|
298 break; |
|
299 } |
|
300 case EAknSoftkeyBack: |
|
301 case EEikCmdExit: |
|
302 { |
|
303 //close editor |
|
304 retVal = ETrue; |
|
305 break; |
|
306 } |
|
307 case ELocServerEditorNoCmd: |
|
308 default: // close editor in all other cases |
|
309 { |
|
310 break; |
|
311 } |
|
312 } |
|
313 DEBUG1( - CLocSUPLSessionEditor::OkToExitL retVal=%d, retVal ); |
|
314 return retVal; |
|
315 } |
|
316 |
|
317 // --------------------------------------------------------------------------- |
|
318 // CLocSUPLSessionEditor ::PreLayoutDynInitL() |
|
319 // --------------------------------------------------------------------------- |
|
320 // |
|
321 void CLocSUPLSessionEditor::PreLayoutDynInitL() |
|
322 { |
|
323 DEBUG( + CLocSUPLSessionEditor::PreLayoutDynInitL ); |
|
324 CAknForm::PreLayoutDynInitL(); |
|
325 |
|
326 //Load the values into the editor fields |
|
327 LoadFormValuesFromDataL(); |
|
328 |
|
329 DEBUG( - CLocSUPLSessionEditor::PreLayoutDynInitL ); |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------------------------- |
|
333 // CLocSUPLSessionEditor ::PostLayoutDynInitL() |
|
334 // --------------------------------------------------------------------------- |
|
335 // |
|
336 void CLocSUPLSessionEditor::PostLayoutDynInitL() |
|
337 { |
|
338 DEBUG( + CLocSUPLSessionEditor::PostLayoutDynInitL ); |
|
339 CAknForm::PostLayoutDynInitL(); |
|
340 |
|
341 HandleMSKCaptionL(); |
|
342 |
|
343 DEBUG( - CLocSUPLSessionEditor::PostLayoutDynInitL ); |
|
344 } |
|
345 |
|
346 // --------------------------------------------------------------------------- |
|
347 // CLocSUPLSessionEditor ::LineChangedL() |
|
348 // --------------------------------------------------------------------------- |
|
349 // |
|
350 void CLocSUPLSessionEditor::LineChangedL(TInt /*aControlId*/) |
|
351 { |
|
352 HandleMSKCaptionL(); |
|
353 } |
|
354 |
|
355 // ----------------------------------------------------------------------------- |
|
356 // CLocSUPLSessionEditor::ExecuteLD |
|
357 // ----------------------------------------------------------------------------- |
|
358 // |
|
359 TInt CLocSUPLSessionEditor::ExecuteLD() |
|
360 { |
|
361 return CAknForm::ExecuteLD( R_SUPLSESSION_EDITOR_FORM_DIALOG ); |
|
362 } |
|
363 |
|
364 // --------------------------------------------------------------------------- |
|
365 // CLocSUPLSessionEditor ::LoadFormValuesFromDataL() |
|
366 // Called when the form is executed and when the user chooses to discard changes |
|
367 // in QuerySaveChangesL (via DoNotSaveFormDataL). |
|
368 // --------------------------------------------------------------------------- |
|
369 // |
|
370 void CLocSUPLSessionEditor::LoadFormValuesFromDataL() |
|
371 { |
|
372 DEBUG( + CLocSUPLSessionEditor::LoadFormValuesFromDataL ); |
|
373 |
|
374 TUint64 outstandingTriggers = 0; |
|
375 TUint64 timeInterval = 0; |
|
376 TUint64 timePeriod = 0; |
|
377 TBool notificationPresent = EFalse; |
|
378 TBool triggerNotificationStatus = EFalse; |
|
379 CTriggerParams::TTriggerType triggerType; |
|
380 CTriggerParams::TRequestType requestType; |
|
381 |
|
382 iSessionName->Des().Zero(); |
|
383 |
|
384 CTriggerParams *triggerParams = CTriggerParams::NewL(); |
|
385 CleanupStack::PushL( triggerParams ); |
|
386 |
|
387 TInt err = KErrNone; |
|
388 TRAP( err, iEngine.GetTriggerParamsL( iSessionId, triggerParams ) ); |
|
389 |
|
390 if( !err ) |
|
391 { |
|
392 triggerParams->Get( |
|
393 iSessionId, |
|
394 iSessionName->Des(), |
|
395 notificationPresent, |
|
396 triggerNotificationStatus, |
|
397 triggerType, |
|
398 requestType, |
|
399 outstandingTriggers, |
|
400 timeInterval); |
|
401 |
|
402 timePeriod = timeInterval * outstandingTriggers; |
|
403 } |
|
404 |
|
405 CleanupStack::PopAndDestroy( triggerParams ); |
|
406 |
|
407 // update the title pane caption |
|
408 if( !iSessionName->Length() ) |
|
409 { |
|
410 HBufC* unknownString = StringLoader::LoadLC( R_LOC_SERVICES_TITLE_UNKNOWN ); |
|
411 iSessionName->Des().Copy( *unknownString ); |
|
412 CleanupStack::PopAndDestroy( unknownString ); |
|
413 } |
|
414 |
|
415 ChangeTitlePaneTextL( *iSessionName ); |
|
416 |
|
417 // Update the Editor Fields |
|
418 CAknPopupFieldText* notificationStatusPopupFieldText = |
|
419 ( CAknPopupFieldText* ) Control( ELocSuplSessionNotificationStatus ); |
|
420 if( notificationStatusPopupFieldText ) |
|
421 { |
|
422 if( triggerNotificationStatus ) |
|
423 notificationStatusPopupFieldText->SetCurrentValueIndex( 0 ); |
|
424 else |
|
425 notificationStatusPopupFieldText->SetCurrentValueIndex( 1 ); |
|
426 } |
|
427 |
|
428 CAknPopupFieldText* typePopupFieldText = |
|
429 ( CAknPopupFieldText* ) Control( ELocSuplSessionType ); |
|
430 if( typePopupFieldText ) |
|
431 { |
|
432 typePopupFieldText->SetCurrentValueIndex( 0 ); |
|
433 } |
|
434 |
|
435 CAknIntegerEdwin* outstandingTriggersEdwin = |
|
436 static_cast < CAknIntegerEdwin* > ( ControlOrNull( ELocSuplSessionOutstandingTrigger ) ); |
|
437 if( outstandingTriggersEdwin ) |
|
438 { |
|
439 outstandingTriggersEdwin->SetValueL( outstandingTriggers ); |
|
440 |
|
441 outstandingTriggersEdwin->DrawNow(); |
|
442 } |
|
443 |
|
444 // Calculate the Time period |
|
445 HBufC* periodString = NULL; |
|
446 HBufC* intervalString = NULL; |
|
447 GetTimeStringL( intervalString, timeInterval ); |
|
448 GetTimeStringL( periodString, timePeriod ); |
|
449 CleanupStack::PushL( periodString ); |
|
450 CleanupStack::PushL( intervalString ); |
|
451 |
|
452 CEikEdwin* timePeriodEdwin = |
|
453 static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplSessionTimePeriod ) ); |
|
454 if( timePeriodEdwin ) |
|
455 { |
|
456 timePeriodEdwin->SetTextL( periodString ); |
|
457 |
|
458 timePeriodEdwin->DrawNow(); |
|
459 } |
|
460 |
|
461 CEikEdwin* timeIntervalEdwin = |
|
462 static_cast < CEikEdwin* > ( ControlOrNull( ELocSuplSessionTriggerInterval ) ); |
|
463 if( timeIntervalEdwin ) |
|
464 { |
|
465 timeIntervalEdwin->SetTextL( intervalString ); |
|
466 |
|
467 timeIntervalEdwin->DrawNow(); |
|
468 } |
|
469 |
|
470 CleanupStack::PopAndDestroy( ); // intervalString |
|
471 CleanupStack::PopAndDestroy( ); // periodString |
|
472 |
|
473 TBool menuShowing = MenuShowing(); |
|
474 if( menuShowing ) |
|
475 HideMenu(); |
|
476 |
|
477 UpdatePageL( ETrue ); |
|
478 |
|
479 if( menuShowing ) |
|
480 DisplayMenuL(); |
|
481 DEBUG( - CLocSUPLSessionEditor::LoadFormValuesFromDataL ); |
|
482 } |
|
483 |
|
484 // --------------------------------------------------------------------------- |
|
485 // CLocSUPLSessionEditor::ChangeTitlePaneTextL() |
|
486 // Set the Title Text |
|
487 // --------------------------------------------------------------------------- |
|
488 // |
|
489 void CLocSUPLSessionEditor::ChangeTitlePaneTextL( TDesC& aText ) |
|
490 { |
|
491 DEBUG( + CLocSUPLSessionEditor::ChangeTitlePaneTextL ); |
|
492 // Obtain the title from the Status Pane |
|
493 CAknTitlePane* title = static_cast < CAknTitlePane* >( iEikonEnv->AppUiFactory()-> |
|
494 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
495 |
|
496 // Set the Title's buffer |
|
497 HBufC* buf = aText.AllocL(); |
|
498 title->SetText( buf ); // Takes ownership of buf |
|
499 title->DrawNow(); |
|
500 DEBUG( - CLocSUPLSessionEditor::ChangeTitlePaneTextL ); |
|
501 } |
|
502 |
|
503 // --------------------------------------------------------------------------- |
|
504 // CLocSUPLSessionEditor::TogglePopupFieldControlL() |
|
505 // it toggles value of popupfield control |
|
506 // --------------------------------------------------------------------------- |
|
507 // |
|
508 void CLocSUPLSessionEditor::TogglePopupFieldControlL( TInt aControlId ) |
|
509 { |
|
510 DEBUG( + CLocSUPLSessionEditor::TogglePopupFieldControlL ); |
|
511 CAknPopupFieldText* popupFieldText = |
|
512 ( CAknPopupFieldText* ) Control( aControlId ); |
|
513 |
|
514 if( popupFieldText ) |
|
515 { |
|
516 if( popupFieldText->CurrentValueIndex() == 0 ) |
|
517 popupFieldText->SetCurrentValueIndex( 1 ); |
|
518 else |
|
519 popupFieldText->SetCurrentValueIndex( 0 ); |
|
520 |
|
521 UpdatePageL( ETrue ); |
|
522 } |
|
523 DEBUG( - CLocSUPLSessionEditor::TogglePopupFieldControlL ); |
|
524 } |
|
525 |
|
526 // ----------------------------------------------------------------------------- |
|
527 // CLocSUPLSessionEditor::HandleMSKCaptionL() |
|
528 // It changes caption of MSK key |
|
529 // ----------------------------------------------------------------------------- |
|
530 // |
|
531 void CLocSUPLSessionEditor::HandleMSKCaptionL() |
|
532 { |
|
533 DEBUG( + CLocSUPLSessionEditor::HandleMSKCaptionL ); |
|
534 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
535 CleanupStack::PushL( cba ); |
|
536 |
|
537 //attribute specific cba |
|
538 switch ( IdOfFocusControl() ) |
|
539 { |
|
540 case ELocSuplSessionNotificationStatus: |
|
541 { |
|
542 cba->SetCommandSetL( R_SUPLSESSION_EDITOR_OPTIONS_CHANGE_BACK ); |
|
543 break; |
|
544 } |
|
545 case ELocSuplSessionType: |
|
546 case ELocSuplSessionTimePeriod: |
|
547 case ELocSuplSessionTriggerInterval: |
|
548 case ELocSuplSessionOutstandingTrigger: |
|
549 { |
|
550 cba->SetCommandSetL( R_SUPLSESSION_EDITOR_OPTIONS_NOMSK_BACK ); |
|
551 break; |
|
552 } |
|
553 default: |
|
554 { |
|
555 cba->SetCommandSetL( R_SUPLSESSION_EDITOR_OPTIONS_CHANGE_BACK ); |
|
556 break; |
|
557 } |
|
558 } |
|
559 cba->DrawDeferred(); |
|
560 CleanupStack::Pop( cba ); |
|
561 DEBUG( - CLocSUPLSessionEditor::HandleMSKCaptionL ); |
|
562 } |
|
563 |
|
564 // ----------------------------------------------------------------------------- |
|
565 // CLocSUPLSessionEditor::DeleteConfirmationQueryL |
|
566 // ---------------------------------------------------------------------------- |
|
567 // |
|
568 TInt CLocSUPLSessionEditor::DeleteConfirmationQueryL() |
|
569 { |
|
570 HBufC* noteText = NULL; |
|
571 noteText = StringLoader::LoadLC( R_LOC_SUPL_QUERY_TERMINATE, *iSessionName, iEikonEnv ); |
|
572 CAknQueryDialog* query = new( ELeave ) CAknQueryDialog( *noteText ); |
|
573 TInt ret = query->ExecuteLD( R_LOC_SUPL_DELETE_QUERY ); |
|
574 CleanupStack::PopAndDestroy( noteText ); |
|
575 return ret; |
|
576 } |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // CLocSUPLSessionEditor::UpdateSessionL |
|
580 // Calls function to load the values into the editor fields |
|
581 // ---------------------------------------------------------------------------- |
|
582 // |
|
583 void CLocSUPLSessionEditor::UpdateSessionL( TUpdateType aType ) |
|
584 { |
|
585 if( ESessionDeleted == aType ) |
|
586 { |
|
587 TryExitL( EAknSoftkeyBack ); |
|
588 } |
|
589 else |
|
590 { |
|
591 LoadFormValuesFromDataL(); |
|
592 } |
|
593 } |
|
594 |
|
595 // ----------------------------------------------------------------------------- |
|
596 // CLocSUPLSessionEditor::SessionId |
|
597 // Returns the session id |
|
598 // ---------------------------------------------------------------------------- |
|
599 // |
|
600 TInt64 CLocSUPLSessionEditor::SessionId() |
|
601 { |
|
602 return iSessionId; |
|
603 } |
|
604 |
|
605 // ----------------------------------------------------------------------------- |
|
606 // CLocSUPLSessionEditor::GetTimeStringL |
|
607 // ----------------------------------------------------------------------------- |
|
608 // |
|
609 void CLocSUPLSessionEditor::GetTimeStringL(HBufC*& aTimeString, TUint aSeconds) |
|
610 { |
|
611 TBuf<KRealWidth> tempString; |
|
612 |
|
613 if( !aSeconds ) |
|
614 { |
|
615 tempString.Num(aSeconds); |
|
616 AknTextUtils::LanguageSpecificNumberConversion(tempString); |
|
617 aTimeString = StringLoader::LoadL( R_LOC_SUPL_TRIGGER_TIME_MINUTES, tempString ); |
|
618 return; |
|
619 } |
|
620 |
|
621 TReal hrs = TReal(aSeconds)/KHrToSecs; |
|
622 TReal approxValue; |
|
623 TRealFormat fmt(KDefaultRealWidth, 2); |
|
624 if( hrs < 1 ) |
|
625 { |
|
626 TReal mins = TReal(aSeconds)/KMinToSecs; |
|
627 Math::Round( approxValue, mins, 2 ); |
|
628 tempString.Num(approxValue, fmt); |
|
629 AknTextUtils::LanguageSpecificNumberConversion(tempString); |
|
630 aTimeString = StringLoader::LoadL( R_LOC_SUPL_TRIGGER_TIME_MINUTES, tempString ); |
|
631 } |
|
632 else if( hrs == 1 ) |
|
633 { |
|
634 aTimeString = StringLoader::LoadL( R_LOC_SUPL_TRIGGER_TIME_ONEHOUR ); |
|
635 } |
|
636 else |
|
637 { |
|
638 TReal days = TReal(aSeconds)/KdayToSecs; |
|
639 if( days < 1 ) |
|
640 { |
|
641 Math::Round( approxValue, hrs, 2 ); |
|
642 tempString.Num(approxValue, fmt); |
|
643 AknTextUtils::LanguageSpecificNumberConversion(tempString); |
|
644 aTimeString = StringLoader::LoadL( R_LOC_SUPL_TRIGGER_TIME_HOURS, tempString ); |
|
645 } |
|
646 else if( days == 1 ) |
|
647 { |
|
648 aTimeString = StringLoader::LoadL( R_LOC_SUPL_TRIGGER_TIME_ONEDAY ); |
|
649 } |
|
650 else |
|
651 { |
|
652 Math::Round( approxValue, days, 2 ); |
|
653 tempString.Num(approxValue, fmt); |
|
654 AknTextUtils::LanguageSpecificNumberConversion(tempString); |
|
655 aTimeString = StringLoader::LoadL( R_LOC_SUPL_TRIGGER_TIME_DAYS, tempString ); |
|
656 } |
|
657 } |
|
658 } |
|
659 |
|
660 // End of file |
|