|
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: Username and password multiline data query |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <IMPSConnectionUiNG.rsg> |
|
20 |
|
21 #include "ccnouiusernameandpwdquery.h" |
|
22 #include "CnUiIMPSIdValidator.h" |
|
23 #include "MCnUiUiFacade.h" |
|
24 |
|
25 #include <barsread.h> |
|
26 #include <eikcapc.h> |
|
27 #include <LayoutMetaData.cdl.h> |
|
28 #include <stringloader.h> |
|
29 |
|
30 #include <browserlauncher.h> |
|
31 #include <aknmessagequerydialog.h> |
|
32 |
|
33 #include "VariantKeys.h" |
|
34 #include <CentralRepository.h> |
|
35 #include "CnUiResourceFileName.h" |
|
36 |
|
37 #include "orangeim.hrh" |
|
38 #include "impswapreguiddefs.h" |
|
39 #include "CIMPSSharedDataFactory.h" |
|
40 #include "MIMPSSharedData.h" |
|
41 #include "IMPSPresenceConnectionUiConstsNG.h" |
|
42 |
|
43 //Max length of WAP registration URL |
|
44 #define KMaxRegUrlLength 20 |
|
45 |
|
46 // ================= MEMBER FUNCTIONS ======================= |
|
47 CCnOUiUsernameAndPwdQuery* CCnOUiUsernameAndPwdQuery::NewL( TDes& aUserName, |
|
48 TDes& aPwd, |
|
49 TCnUiLoginDataQueryMode aMode, |
|
50 TBool aDomainSelectionQueryVariation, |
|
51 MCnUiUiFacade& aUiFacade ) |
|
52 { |
|
53 TInitialFocus focus; |
|
54 TBool cursorToBeginning = EFalse; |
|
55 |
|
56 switch ( aMode ) |
|
57 { |
|
58 case ECnUiReEdit: |
|
59 { |
|
60 //in re-edit focus always the user name field |
|
61 focus = EFirstLine; |
|
62 break; |
|
63 } |
|
64 case ECnUiNormal: |
|
65 { |
|
66 // detect which line to focus |
|
67 focus = DetectLineToFocus( aUserName, aPwd ); |
|
68 break; |
|
69 } |
|
70 case ECnUiEditPrefilledUser: |
|
71 { |
|
72 // detect which line to focus |
|
73 focus = EFirstLine; |
|
74 cursorToBeginning = ETrue; |
|
75 break; |
|
76 } |
|
77 default: |
|
78 { |
|
79 focus = EFirstLine; |
|
80 break; |
|
81 } |
|
82 } |
|
83 |
|
84 |
|
85 CCnOUiUsernameAndPwdQuery* self = |
|
86 new ( ELeave ) CCnOUiUsernameAndPwdQuery( focus, |
|
87 aUiFacade, |
|
88 aDomainSelectionQueryVariation, |
|
89 cursorToBeginning ); |
|
90 CleanupStack::PushL( self ); |
|
91 self->SetDataL( aUserName, aPwd ); |
|
92 self->ConstructL(); |
|
93 CleanupStack::Pop( self ); |
|
94 return self; |
|
95 } |
|
96 |
|
97 |
|
98 |
|
99 // C++ default constructor can NOT contain any code, that |
|
100 // might leave. |
|
101 // |
|
102 CCnOUiUsernameAndPwdQuery::CCnOUiUsernameAndPwdQuery( TInitialFocus aInitialFocus, |
|
103 MCnUiUiFacade& aUiFacade, |
|
104 TBool aDomainSelectionQueryVariation, |
|
105 TBool aCursorToBeginning /* = EFalse */ ) |
|
106 : CAknMultiLineDataQueryDialog( ENoTone ), |
|
107 iInitialFocus( aInitialFocus ), |
|
108 iCursorToBeginning( aCursorToBeginning ), |
|
109 iUiFacade( aUiFacade ), |
|
110 iDomainSelectionQueryVariation( aDomainSelectionQueryVariation ), |
|
111 iForcedExit( EFalse ) |
|
112 { |
|
113 } |
|
114 |
|
115 //ConstructL |
|
116 void CCnOUiUsernameAndPwdQuery::ConstructL() |
|
117 { |
|
118 iSharedData = CIMPSSharedDataFactory::CreateTemporaryKeyHandlerL( NULL, KBrandingUid ); |
|
119 } |
|
120 |
|
121 |
|
122 // Destructor |
|
123 CCnOUiUsernameAndPwdQuery::~CCnOUiUsernameAndPwdQuery() |
|
124 { |
|
125 iRFs.Close(); |
|
126 delete iBrLauncher; |
|
127 delete iSharedData; |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CCnOUiUsernameAndPwdQuery::SetInitialCurrentLine() |
|
132 // |
|
133 // From CEikDialog |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 void CCnOUiUsernameAndPwdQuery::SetInitialCurrentLine() |
|
137 { |
|
138 //if initial line can't be set, |
|
139 //the error can be only ignored |
|
140 TInt ignore; |
|
141 TRAP( ignore, DoSetInitialCurrentLineL() ); |
|
142 } |
|
143 |
|
144 |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CCnOUiUsernameAndPwdQuery::UpdateLeftSoftKeyL() |
|
148 // (other items were commented in a header). |
|
149 // ----------------------------------------------------------------------------- |
|
150 // |
|
151 void CCnOUiUsernameAndPwdQuery::UpdateLeftSoftKeyL() |
|
152 { |
|
153 } |
|
154 |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CCnOUiUsernameAndPwdQuery::ProcessCommandL() |
|
158 // From CAknDialog |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 void CCnOUiUsernameAndPwdQuery::ProcessCommandL( TInt aCommandId ) |
|
162 { |
|
163 switch ( aCommandId ) |
|
164 { |
|
165 case ERegister: |
|
166 { |
|
167 HideMenu(); |
|
168 if ( ShowTAndCDlgL() == EAknSoftkeyOk ) |
|
169 { |
|
170 // Get pointer to WAP registration settings |
|
171 CRepository* cenRep = CRepository::NewLC( KCRUidIMPSConnUI ); |
|
172 |
|
173 HBufC16 *url = HBufC::NewLC( KMaxRegUrlLength ); |
|
174 TPtr ptr( url->Des() ); |
|
175 TInt urlLength; |
|
176 |
|
177 if ( cenRep->Get( KWAPRegistrationURL, ptr, urlLength ) == KErrOverflow ) |
|
178 { |
|
179 //because there could be an overflow |
|
180 CleanupStack::PopAndDestroy( url ); |
|
181 |
|
182 url = HBufC::NewLC( urlLength ); |
|
183 ptr.Set( url->Des() ); |
|
184 User::LeaveIfError( cenRep->Get( KWAPRegistrationURL, ptr, urlLength ) ); |
|
185 } |
|
186 |
|
187 OpenWebBrowserL( *url ); |
|
188 |
|
189 CleanupStack::PopAndDestroy( url ); |
|
190 CleanupStack::PopAndDestroy( cenRep ); |
|
191 } |
|
192 break; |
|
193 } |
|
194 case EAknSoftkeyOk: |
|
195 { |
|
196 TryExitL( aCommandId ); |
|
197 break; |
|
198 } |
|
199 default: |
|
200 { |
|
201 CAknMultiLineDataQueryDialog::ProcessCommandL( aCommandId ); |
|
202 break; |
|
203 } |
|
204 } |
|
205 } |
|
206 |
|
207 // ----------------------------------------------------------------------------- |
|
208 // CCnOUiUsernameAndPwdQuery::ShowTAndCDlgL() |
|
209 // Shows Terms and conditions |
|
210 // ----------------------------------------------------------------------------- |
|
211 // |
|
212 TInt CCnOUiUsernameAndPwdQuery::ShowTAndCDlgL() |
|
213 { |
|
214 CAknMessageQueryDialog* msgQueryDlg = new( ELeave )CAknMessageQueryDialog( CAknMessageQueryDialog::ENoTone ); |
|
215 CleanupStack::PushL( msgQueryDlg ); |
|
216 msgQueryDlg->PrepareLC( R_MESSAGE_QUERY ); |
|
217 |
|
218 HBufC* resourceText = NULL; |
|
219 resourceText = StringLoader::LoadLC( R_QTN_IM_AGREE_LSK_REGISTER ); |
|
220 msgQueryDlg->ButtonGroupContainer().SetCommandL( 0, EAknSoftkeyOk, *resourceText ); |
|
221 CleanupStack::PopAndDestroy( resourceText ); |
|
222 |
|
223 resourceText = StringLoader::LoadLC( R_QTN_IM_REFUSE_RSK_REGISTER ); |
|
224 msgQueryDlg->ButtonGroupContainer().SetCommandL( 2, EAknSoftkeyCancel, *resourceText ); |
|
225 CleanupStack::PopAndDestroy( resourceText ); |
|
226 |
|
227 resourceText = StringLoader::LoadL( R_QTN_NOTE_TERMS_WAP_ORANGE ); |
|
228 msgQueryDlg->SetMessageText( *resourceText ); |
|
229 |
|
230 resourceText = StringLoader::LoadL( R_QTN_NOTE_TITLE_TERMS_WAP_ORANGE ); |
|
231 msgQueryDlg->SetHeaderText( *resourceText ); |
|
232 |
|
233 CleanupStack::Pop( msgQueryDlg ); |
|
234 |
|
235 TInt command = msgQueryDlg->RunLD(); |
|
236 return command; |
|
237 } |
|
238 |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CCnOUiUsernameAndPwdQuery::OpenWebBrowserL() |
|
242 // Opens native browser for specified URL |
|
243 // ----------------------------------------------------------------------------- |
|
244 // |
|
245 void CCnOUiUsernameAndPwdQuery::OpenWebBrowserL( const TDesC& aUrl ) |
|
246 { |
|
247 if ( !iBrLauncher ) |
|
248 { |
|
249 iBrLauncher = CBrowserLauncher::NewL(); |
|
250 } |
|
251 |
|
252 //Asynchronous operation to launch the browser with aUrl |
|
253 iBrLauncher->LaunchBrowserEmbeddedL( aUrl ); |
|
254 } |
|
255 |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // CCnOUiUsernameAndPwdQuery::DynInitMenuPaneL() |
|
259 // From CAknDialog |
|
260 // ----------------------------------------------------------------------------- |
|
261 // |
|
262 void CCnOUiUsernameAndPwdQuery::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
263 { |
|
264 CAknMultiLineDataQueryDialog::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
265 switch ( aResourceId ) |
|
266 { |
|
267 case R_AVKON_MENUPANE_LANGUAGE_DEFAULT: |
|
268 { |
|
269 if ( CanSignOnL() ) |
|
270 { |
|
271 CEikMenuPaneItem::SData signOn; |
|
272 signOn.iCommandId = EAknSoftkeyOk; |
|
273 signOn.iCascadeId = 0; |
|
274 |
|
275 HBufC* lsk = NULL; |
|
276 lsk = StringLoader::LoadLC( R_QTN_IM_REGISTER_SIGN_OPTION ); |
|
277 signOn.iText.Copy( *lsk ); |
|
278 aMenuPane->AddMenuItemL( signOn ); |
|
279 CleanupStack::PopAndDestroy( lsk ); |
|
280 lsk = NULL; |
|
281 } |
|
282 |
|
283 CEikMenuPaneItem::SData registeration; |
|
284 registeration.iCommandId = ERegister; |
|
285 registeration.iCascadeId = 0; |
|
286 |
|
287 HBufC* rsk = NULL; |
|
288 rsk = StringLoader::LoadLC( R_QTN_IM_REGISTER_LOGIN_OPTION ); |
|
289 registeration.iText.Copy( *rsk ); |
|
290 CleanupStack::PopAndDestroy( rsk ); |
|
291 rsk = NULL; |
|
292 |
|
293 aMenuPane->AddMenuItemL( registeration ); |
|
294 break; |
|
295 } |
|
296 } |
|
297 } |
|
298 |
|
299 |
|
300 // ----------------------------------------------------------------------------- |
|
301 // CCnOUiUsernameAndPwdQuery::CanSignOnL() |
|
302 // From CAknDialog |
|
303 // ----------------------------------------------------------------------------- |
|
304 // |
|
305 TBool CCnOUiUsernameAndPwdQuery::CanSignOnL() |
|
306 { |
|
307 CAknMultilineQueryControl* first = |
|
308 CAknMultiLineDataQueryDialog::FirstControl(); |
|
309 CAknMultilineQueryControl* second = |
|
310 CAknMultiLineDataQueryDialog::SecondControl(); |
|
311 |
|
312 HBufC* firstText = HBufC::NewLC( first->GetTextLength() ); |
|
313 HBufC* secondText = HBufC::NewL( second->GetTextEntryLength() ); |
|
314 |
|
315 TPtr firstPtr( firstText->Des() ); |
|
316 TPtr secondPtr( secondText->Des() ); |
|
317 |
|
318 first->GetText( firstPtr ); |
|
319 firstPtr.TrimAll(); |
|
320 |
|
321 second->GetText( secondPtr ); |
|
322 secondPtr.TrimAll(); |
|
323 |
|
324 TBool returnVal( EFalse ); |
|
325 if ( ( firstPtr.Length() > 0 ) && ( secondPtr.Length() > 0 ) ) |
|
326 { |
|
327 returnVal = ETrue; |
|
328 } |
|
329 |
|
330 delete secondText; |
|
331 CleanupStack::PopAndDestroy( firstText ); |
|
332 |
|
333 return returnVal; |
|
334 } |
|
335 |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CCnOUiUsernameAndPwdQuery::OkToExitL() |
|
339 // |
|
340 // From CEikDialog |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 TBool CCnOUiUsernameAndPwdQuery::OkToExitL( TInt aButtonId ) |
|
344 { |
|
345 if ( iForcedExit ) |
|
346 { |
|
347 // If dialog needs to be exited because user |
|
348 // emptied user id field, allow exit and don't do any checks |
|
349 return ETrue; |
|
350 } |
|
351 |
|
352 if ( aButtonId == EAknSoftkeyOptions || aButtonId == EAknSoftkeyOk ) |
|
353 { |
|
354 if ( !MenuShowing() ) |
|
355 { |
|
356 DisplayMenuL(); |
|
357 return EFalse; |
|
358 } |
|
359 } |
|
360 |
|
361 HBufC* userId = HBufC::NewLC( FirstControl()->GetTextLength() ); |
|
362 TPtr IdPtr( userId->Des() ); |
|
363 FirstControl()->GetText( IdPtr ); |
|
364 |
|
365 // Check userID before changing to next page |
|
366 if ( CnUiIMPSIdValidator::ValidLoginIdL( IdPtr ) ) |
|
367 { |
|
368 CleanupStack::PopAndDestroy( userId ); |
|
369 TBool okValue = CAknMultiLineDataQueryDialog::OkToExitL( aButtonId ); |
|
370 UpdateLeftSoftKeyL(); |
|
371 return okValue; |
|
372 } |
|
373 else |
|
374 { |
|
375 //WV id faulty, show note |
|
376 iUiFacade.ShowNoteL( ECnUiImproperPresenceId, IdPtr ); |
|
377 CleanupStack::PopAndDestroy( userId ); |
|
378 |
|
379 //try to focus whole editor line |
|
380 CEikEdwin* presIdEdwin = ( CEikEdwin* ) |
|
381 FirstControl()->ControlByLayoutOrNull( EMultiDataFirstEdwin ); |
|
382 if ( presIdEdwin ) |
|
383 { |
|
384 TryChangeFocusToL( EMultilineFirstLine ); |
|
385 presIdEdwin->SelectAllL(); |
|
386 } |
|
387 } |
|
388 |
|
389 return EFalse; |
|
390 } |
|
391 |
|
392 // ----------------------------------------------------------------------------- |
|
393 // CCnOUiUsernameAndPwdQuery::TryChangeFocusToL() |
|
394 // From CEikDialog |
|
395 // ----------------------------------------------------------------------------- |
|
396 // |
|
397 void CCnOUiUsernameAndPwdQuery::TryChangeFocusToL( TInt aControlId ) |
|
398 { |
|
399 // This special focusing is only used to revert the focus |
|
400 // back from second line to first line ( landscape mode ). |
|
401 if ( Layout_Meta_Data::IsLandscapeOrientation() && |
|
402 aControlId == EMultilineFirstLine ) |
|
403 { |
|
404 // CAknMultiLineDataQueryDialog does not support changing the query |
|
405 // backwards, so we have to do it "manually". |
|
406 // This is copied from CAknMultiLineDataQueryDialog |
|
407 TBool firstLineEnabled = ETrue; |
|
408 TBool secondLineEnabled = EFalse; |
|
409 CAknMultilineQueryControl* firstControl = FirstControl(); |
|
410 CAknMultilineQueryControl* secondControl = SecondControl(); |
|
411 TInt line1 = FindLineIndex( *firstControl ); |
|
412 TInt line2 = FindLineIndex( *secondControl ); |
|
413 CEikCaptionedControl *ctrl1 = GetLineByLineAndPageIndex( line1, 0 ); |
|
414 CEikCaptionedControl *ctrl2 = GetLineByLineAndPageIndex( line2, 0 ); |
|
415 ctrl1->SetLatent( !firstLineEnabled ); |
|
416 ctrl2->SetLatent( !secondLineEnabled ); |
|
417 ctrl1->SetLatentGroupLineFollows( !firstLineEnabled ); |
|
418 ctrl2->SetLatentGroupLineFollows( !secondLineEnabled ); |
|
419 ctrl1->SetFocusing( firstLineEnabled ); |
|
420 ctrl2->SetFocusing( secondLineEnabled ); |
|
421 } |
|
422 |
|
423 CAknMultiLineDataQueryDialog::TryChangeFocusToL( aControlId ); |
|
424 } |
|
425 |
|
426 // ----------------------------------------------------------------------------- |
|
427 // CCnOUiUsernameAndPwdQuery::HandleResourceChange() |
|
428 // From CEikDialog |
|
429 // ----------------------------------------------------------------------------- |
|
430 // |
|
431 void CCnOUiUsernameAndPwdQuery::HandleResourceChange( TInt aType ) |
|
432 { |
|
433 CAknMultiLineDataQueryDialog::HandleResourceChange( aType ); |
|
434 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
435 { |
|
436 TRAP_IGNORE( UpdateLeftSoftKeyL( ) ); |
|
437 } |
|
438 } |
|
439 |
|
440 // ----------------------------------------------------------------------------- |
|
441 // CCnOUiUsernameAndPwdQuery::NeedToDismissQueryL |
|
442 // From CAknMultiLineDataQueryDialog |
|
443 // ----------------------------------------------------------------------------- |
|
444 // |
|
445 TBool CCnOUiUsernameAndPwdQuery::NeedToDismissQueryL( const TKeyEvent& aKeyEvent ) |
|
446 { |
|
447 // Check if user has emptied user id field |
|
448 // and exit if domain selection query is variated on |
|
449 if ( iDomainSelectionQueryVariation && |
|
450 ( aKeyEvent.iCode == EKeyBackspace || aKeyEvent.iCode == EKeyDelete ) ) |
|
451 { |
|
452 CAknMultilineQueryControl* ctrl = FirstControl(); // user id field |
|
453 CCoeControl* coeCtrl = ctrl->ControlByLayoutOrNull( EMultiDataFirstEdwin ); |
|
454 if ( coeCtrl ) |
|
455 { |
|
456 CEikEdwin* firstEdwin = static_cast<CEikEdwin*>( coeCtrl ); |
|
457 TInt textLen = firstEdwin->TextLength(); |
|
458 TInt cursorPos = firstEdwin->CursorPos(); |
|
459 if ( ( firstEdwin->Selection().Length() == textLen ) |
|
460 || ( textLen == 1 && cursorPos == 1 && aKeyEvent.iCode == EKeyBackspace ) |
|
461 || ( textLen == 1 && cursorPos == 0 && aKeyEvent.iCode == EKeyDelete ) ) |
|
462 { |
|
463 // NeedToDismissQueryL is called first thing in OfferKeyEventL |
|
464 // so if editor length is 1 or whole text is selected at this point |
|
465 // it would be 0 after OfferKeyEventL, clear editor and dismiss dialog |
|
466 firstEdwin->SelectAllL(); |
|
467 firstEdwin->ClearSelectionL(); |
|
468 iForcedExit = ETrue; |
|
469 TryExitL( EAknSoftkeyExit ); |
|
470 return ETrue; |
|
471 } |
|
472 else |
|
473 { |
|
474 // Text in editor, don't dismiss |
|
475 return EFalse; |
|
476 } |
|
477 } |
|
478 } |
|
479 |
|
480 // Else just return EFalse and don't dismiss dialog |
|
481 return EFalse; |
|
482 } |
|
483 |
|
484 // ----------------------------------------------------------------------------- |
|
485 // CCnOUiUsernameAndPwdQuery::DetectLineToFocus() |
|
486 // Private helper. |
|
487 // ----------------------------------------------------------------------------- |
|
488 // |
|
489 CCnOUiUsernameAndPwdQuery::TInitialFocus |
|
490 CCnOUiUsernameAndPwdQuery::DetectLineToFocus( |
|
491 const TDesC& aFirstLine, |
|
492 const TDesC& aSecondLine ) |
|
493 { |
|
494 //focus the second line just if the first one has something in it |
|
495 //and the second one is empty |
|
496 if ( ( aFirstLine.Length() > 0 ) && ( aSecondLine.Length() == 0 ) ) |
|
497 { |
|
498 return ESecondLine; |
|
499 } |
|
500 |
|
501 //else |
|
502 return EFirstLine; |
|
503 } |
|
504 |
|
505 |
|
506 |
|
507 // ----------------------------------------------------------------------------- |
|
508 // CCnOUiUsernameAndPwdQuery::DoSetInitialCurrentLineL() |
|
509 // Private helper. |
|
510 // ----------------------------------------------------------------------------- |
|
511 // |
|
512 void CCnOUiUsernameAndPwdQuery::DoSetInitialCurrentLineL() |
|
513 { |
|
514 ActivateFirstPageL(); |
|
515 |
|
516 // change input mode according to resource variation |
|
517 TBool textualInput = IntResourceValueL( RSC_CHAT_VARIATION_IMPSCU_USERID_TEXTUAL_INPUTMODE ); |
|
518 |
|
519 if ( ! textualInput ) |
|
520 { |
|
521 // default is textual mode, but now we must switch to numeric mode |
|
522 CAknMultilineQueryControl* ctrl = FirstControl(); // user id field |
|
523 CCoeControl* coeCtrl = ctrl->ControlByLayoutOrNull( EMultiDataFirstEdwin ); |
|
524 if ( coeCtrl ) |
|
525 { |
|
526 CEikEdwin* edwin = static_cast<CEikEdwin*>( coeCtrl ); |
|
527 edwin->SetAknEditorInputMode( EAknEditorNumericInputMode ); |
|
528 } |
|
529 } |
|
530 |
|
531 if ( iCursorToBeginning ) |
|
532 { |
|
533 CAknMultilineQueryControl* ctrl = FirstControl(); // user id field |
|
534 CCoeControl* coeCtrl = ctrl->ControlByLayoutOrNull( EMultiDataFirstEdwin ); |
|
535 if ( coeCtrl ) |
|
536 { |
|
537 CEikEdwin* firstEdwin = static_cast<CEikEdwin*>( coeCtrl ); |
|
538 firstEdwin->AddFlagToUserFlags( CEikEdwin::ENoAutoSelection ); |
|
539 } |
|
540 } |
|
541 |
|
542 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
|
543 { |
|
544 // Show the OK-softkey also when password field is empty. |
|
545 UpdateLeftSoftKeyL(); |
|
546 } |
|
547 else if ( iInitialFocus == ESecondLine ) |
|
548 { |
|
549 TryChangeFocusToL( EMultilineSecondLine ); |
|
550 } |
|
551 } |
|
552 |
|
553 // ----------------------------------------------------------------------------- |
|
554 // CCnUiUsernameAndPwdQuery::IntResourceValueL() |
|
555 // ----------------------------------------------------------------------------- |
|
556 // |
|
557 TInt CCnOUiUsernameAndPwdQuery::IntResourceValueL( TInt aResourceId ) |
|
558 { |
|
559 |
|
560 TInt val( 0 ); |
|
561 TInt err ( KErrNone ); |
|
562 |
|
563 CRepository* rep = 0; |
|
564 |
|
565 TRAP( err, rep = CRepository::NewL( KCRUidIMNG ) ); |
|
566 |
|
567 if ( err == KErrNone ) |
|
568 { |
|
569 TInt key = aResourceId + KIMCUStartVariationID; |
|
570 |
|
571 err = rep->Get( key, val ); |
|
572 |
|
573 delete rep; |
|
574 } |
|
575 |
|
576 if ( err != KErrNone ) |
|
577 { |
|
578 |
|
579 RResourceFile resFile; |
|
580 OpenResourceFileLC( resFile ); // Two items in cleanup stack. |
|
581 |
|
582 aResourceId = aResourceId + RSC_CRRSS_CHAT_VARIATION_IMPSCU_START_ID; |
|
583 |
|
584 // read the data to a buffer |
|
585 TInt plainResourceId = 0x00000fff & aResourceId; // Remove offset from id |
|
586 HBufC8* rawDataBuf = resFile.AllocReadLC( plainResourceId ); |
|
587 |
|
588 // it's now as ascii code: \x00 for 0, \x01 for 1, etc. |
|
589 TUint value = ( *rawDataBuf )[ 0 ]; |
|
590 |
|
591 CleanupStack::PopAndDestroy( 2 ); // rawDataBuf, resFile |
|
592 |
|
593 val = value; |
|
594 } |
|
595 |
|
596 return val; |
|
597 |
|
598 } |
|
599 |
|
600 // ----------------------------------------------------------------------------- |
|
601 // CCnUiUsernameAndPwdQuery::OpenResourceFileLC() |
|
602 // !!!Notice!!!. Two variables in cleanupstack after call of this method. |
|
603 // ----------------------------------------------------------------------------- |
|
604 // |
|
605 void CCnOUiUsernameAndPwdQuery::OpenResourceFileLC( RResourceFile& aResourceFile ) |
|
606 { |
|
607 TFileName resourceFileName; |
|
608 iRFs.Close(); |
|
609 User::LeaveIfError( iRFs.Connect() ); |
|
610 |
|
611 TInt err = iSharedData->GetStringKey( ( TIMPSSharedKeys )KBrandingResourceKey, resourceFileName ); |
|
612 if ( err || !resourceFileName.Length() ) |
|
613 { |
|
614 CnUiResourceFileName::NearestVariationForCurrentLanguage( iRFs, resourceFileName ); |
|
615 } |
|
616 aResourceFile.OpenL( iRFs, resourceFileName ); |
|
617 CleanupClosePushL( aResourceFile ); |
|
618 aResourceFile.ConfirmSignatureL(); |
|
619 |
|
620 } |
|
621 |
|
622 // End of File |