1 /* |
|
2 * Copyright (c) 2010 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.mj.impl.javacontrolpanel; |
|
19 |
|
20 import com.nokia.mj.impl.utils.Logger; |
|
21 |
|
22 |
|
23 class SecurityConfig |
|
24 { |
|
25 private static final String SECURITY_WARNINGS_USER_DEFINED_MODE = "1"; |
|
26 private static final String SECURITY_WARNINGS_DEFAULT_MODE = "2"; |
|
27 |
|
28 private static final int S60_SECURITY_POLICY_ID = 1; |
|
29 private static final int MSA_SECURITY_POLICY_ID = 2; |
|
30 private static final int ATT_SECURITY_POLICY_ID = 3; |
|
31 |
|
32 public static final String MODES[] = { "Default", "User"}; |
|
33 public static final String POLICIES[] = { "S60", "MSA", "AT&T"}; |
|
34 |
|
35 public SecurityConfig() |
|
36 { |
|
37 } |
|
38 |
|
39 public int getSecurityPolicy() |
|
40 { |
|
41 int index = _getSecurityPolicy() - 1; |
|
42 return index; |
|
43 } |
|
44 |
|
45 public void setSecurityPolicy(int aPolicyIndex) |
|
46 { |
|
47 int id = aPolicyIndex + 1; |
|
48 _setSecurityPolicy(id); |
|
49 } |
|
50 |
|
51 public int getWarningsMode() |
|
52 { |
|
53 String mode = _getSecurityWarningsMode(); |
|
54 int index = 0; |
|
55 if (mode.compareTo(SECURITY_WARNINGS_USER_DEFINED_MODE) == 0 ) |
|
56 { |
|
57 index = 1; |
|
58 } |
|
59 return index; |
|
60 } |
|
61 |
|
62 public void setWarningsMode(int aModeIndex) |
|
63 { |
|
64 if (aModeIndex == 0) |
|
65 { |
|
66 _setSecurityWarningsMode(SECURITY_WARNINGS_DEFAULT_MODE); |
|
67 } |
|
68 else |
|
69 { |
|
70 _setSecurityWarningsMode(SECURITY_WARNINGS_USER_DEFINED_MODE); |
|
71 } |
|
72 } |
|
73 |
|
74 private native String _getSecurityWarningsMode(); |
|
75 private native void _setSecurityWarningsMode(String aMode); |
|
76 private native int _getSecurityPolicy(); |
|
77 private native void _setSecurityPolicy(int aPolicyId); |
|
78 |
|
79 } |
|