|
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: Compa Mode Settings model implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <centralrepository.h> |
|
20 #include <AvkonInternalCRKeys.h> |
|
21 |
|
22 #include "akncompagsmodel.h" |
|
23 #include "akncompaflags.h" |
|
24 |
|
25 // -------------------------------------------------------------------------- |
|
26 // |
|
27 // -------------------------------------------------------------------------- |
|
28 CAknCompaGSModel* CAknCompaGSModel::NewL() |
|
29 { |
|
30 CAknCompaGSModel* self = new( ELeave ) CAknCompaGSModel; |
|
31 CleanupStack::PushL( self ); |
|
32 self->ConstructL(); |
|
33 |
|
34 CleanupStack::Pop( self ); |
|
35 return self; |
|
36 } |
|
37 |
|
38 |
|
39 // -------------------------------------------------------------------------- |
|
40 // Constructor |
|
41 // -------------------------------------------------------------------------- |
|
42 CAknCompaGSModel::CAknCompaGSModel() |
|
43 { |
|
44 } |
|
45 |
|
46 |
|
47 // -------------------------------------------------------------------------- |
|
48 // |
|
49 // -------------------------------------------------------------------------- |
|
50 void CAknCompaGSModel::ConstructL() |
|
51 { |
|
52 iRepository = CRepository::NewL(KCRUidAvkon); |
|
53 iRepository->Get(KAknCompaModeFeatures, iFeatures); |
|
54 iRepository->Get(KAknCompaModeSettings, iSettings); |
|
55 } |
|
56 |
|
57 // -------------------------------------------------------------------------- |
|
58 // |
|
59 // -------------------------------------------------------------------------- |
|
60 CAknCompaGSModel::~CAknCompaGSModel() |
|
61 { |
|
62 delete iRepository; |
|
63 } |
|
64 |
|
65 // -------------------------------------------------------------------------- |
|
66 // Check if compatibility mode feature is enabled in the image |
|
67 // -------------------------------------------------------------------------- |
|
68 TBool CAknCompaGSModel::FeatureEnabled() |
|
69 { |
|
70 return iFeatures & KAknCompaFeatureEnaCompaMode; |
|
71 } |
|
72 |
|
73 |
|
74 // -------------------------------------------------------------------------- |
|
75 // Get compatibility mode enable/disable setting |
|
76 // -------------------------------------------------------------------------- |
|
77 TBool CAknCompaGSModel::CompaAppState() |
|
78 { |
|
79 return iSettings & KAknCompaSettingEnaApps; |
|
80 } |
|
81 |
|
82 |
|
83 // -------------------------------------------------------------------------- |
|
84 // Set compatibility mode enable/disable setting |
|
85 // -------------------------------------------------------------------------- |
|
86 void CAknCompaGSModel::SetCompaAppState(TBool aState) |
|
87 { |
|
88 if (FeatureEnabled() && CompaAppState() != aState) |
|
89 { |
|
90 if (aState) |
|
91 { |
|
92 iSettings |= KAknCompaSettingEnaApps; |
|
93 } |
|
94 else |
|
95 { |
|
96 iSettings &= ~KAknCompaSettingEnaApps; |
|
97 } |
|
98 iRepository->Set(KAknCompaModeSettings, iSettings); |
|
99 } |
|
100 } |