|
1 /* |
|
2 * Copyright (c) 2004 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: Login data refresher. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include <E32std.h> |
|
20 #include <CIMPSSAPSettings.h> |
|
21 #include "CnUiSapLoginDataRefresher.h" |
|
22 #include "MCnUiUiFacade.h" |
|
23 |
|
24 |
|
25 //CONSTS |
|
26 /** |
|
27 * Constants to use. |
|
28 * For future: These could be merged with IMPS Common UI |
|
29 */ |
|
30 const TInt KUsernameMaxLength = 50; |
|
31 const TInt KPasswordMaxLength = 50; |
|
32 |
|
33 |
|
34 |
|
35 // ================= MEMBER FUNCTIONS ======================= |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CnUiSapLoginDataRefresher::RefreshLoginDataL() |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 TBool CnUiSapLoginDataRefresher::RefreshLoginDataL( MCnUiUiFacade& aUi, |
|
41 CIMPSSAPSettings& aSap, |
|
42 TBool aReEdit ) |
|
43 { |
|
44 HBufC* dataBuf = HBufC::NewLC( KUsernameMaxLength ); |
|
45 HBufC* codeBuf = HBufC::NewLC( KPasswordMaxLength ); |
|
46 TPtr data( dataBuf->Des() ); |
|
47 TPtr code( codeBuf->Des() ); |
|
48 |
|
49 data.Copy( aSap.SAPUserId().Left( KUsernameMaxLength ) ); |
|
50 code.Copy( aSap.SAPUserPassword().Left( KPasswordMaxLength ) ); |
|
51 |
|
52 |
|
53 TCnUiLoginDataQueryMode mode = ECnUiNormal; |
|
54 if ( aReEdit ) |
|
55 { |
|
56 mode = ECnUiReEdit; |
|
57 } |
|
58 |
|
59 |
|
60 TBool queryAccepted = aUi.LoginQueryL( data, code, aSap, mode ); |
|
61 if ( queryAccepted ) |
|
62 { |
|
63 aSap.SetSAPUserIdL( *dataBuf ); |
|
64 aSap.SetSAPUserPasswordL( *codeBuf ); |
|
65 } |
|
66 |
|
67 CleanupStack::PopAndDestroy( 2 ); //dataBuf, codeBuf |
|
68 return queryAccepted; |
|
69 } |
|
70 |
|
71 |
|
72 // End of File |