|
1 /* |
|
2 * Copyright (c) 2009 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: Touch button configuration. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "cphonecenrepproxy.h" |
|
20 #include <barsread.h> |
|
21 #include <coemain.h> |
|
22 |
|
23 #include "tphonetouchbuttonconfig.h" |
|
24 #include "phoneui.pan" |
|
25 |
|
26 // CenRep keys |
|
27 const TUid KCRUidTelTouchButtonsVariation = {0x2001B2E6}; |
|
28 const TUint32 KTelButtonsIncomingCall = 1; |
|
29 |
|
30 // ======== MEMBER FUNCTIONS ======== |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // Constructs and returns an application object. |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 TPhoneTouchButtonConfig::TPhoneTouchButtonConfig() |
|
37 { |
|
38 for ( TInt i = 0; i < iConfiguration.Count(); i++ ) |
|
39 { |
|
40 iConfiguration[i] = KErrNotFound; |
|
41 } |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // ReadConfiguration |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 TInt TPhoneTouchButtonConfig::ReadConfiguration() |
|
49 { |
|
50 TFixedArray<TInt,EPhoneButtonConfigCount> keys; |
|
51 |
|
52 TRAPD( err, |
|
53 { |
|
54 // read configuration key values |
|
55 ReadCenRepKeysL( keys ); |
|
56 // read button set resource ids |
|
57 ReadConfigResourceL( keys ); |
|
58 } ); |
|
59 |
|
60 return err; |
|
61 } |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // ReadCenRepKeysL |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void TPhoneTouchButtonConfig::ReadCenRepKeysL( |
|
68 TFixedArray<TInt,KTelButtonsConfigKeyCount>& aKeyValues ) const |
|
69 { |
|
70 for ( TInt i = 0; i < KTelButtonsConfigKeyCount; i ++ ) |
|
71 { |
|
72 TInt key = MapToCenRepKey(i); |
|
73 if ( key != KErrNotFound ) |
|
74 { |
|
75 const TInt err = CPhoneCenRepProxy::Instance()->GetInt( |
|
76 KCRUidTelTouchButtonsVariation, key, aKeyValues[i] ); |
|
77 aKeyValues[i] -= 1; // map to range 0..n |
|
78 if ( err ) |
|
79 { |
|
80 aKeyValues[i] = 0; // default |
|
81 } |
|
82 } |
|
83 else |
|
84 { |
|
85 aKeyValues[i] = 0; // default |
|
86 } |
|
87 } |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------------------------- |
|
91 // ReadConfigResourceL |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void TPhoneTouchButtonConfig::ReadConfigResourceL( |
|
95 const TFixedArray<TInt,KTelButtonsConfigKeyCount>& /*aKeyValues*/ ) |
|
96 { |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // MapToCenRepKey |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 TInt TPhoneTouchButtonConfig::MapToCenRepKey( TInt aButtons ) const |
|
104 { |
|
105 switch ( aButtons ) |
|
106 { |
|
107 case EPhoneConfigIncomingCallButtons: |
|
108 return KTelButtonsIncomingCall; |
|
109 default: |
|
110 return KErrNotFound; |
|
111 } |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // ResourceId |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 TInt TPhoneTouchButtonConfig::ResourceId( |
|
119 TPhoneUIConfigurableButtons aButtons, |
|
120 TInt aDefaultResourceId ) const |
|
121 { |
|
122 if ( iConfiguration[aButtons] != KErrNotFound ) |
|
123 { |
|
124 return iConfiguration[aButtons]; |
|
125 } |
|
126 else |
|
127 { |
|
128 return aDefaultResourceId; |
|
129 } |
|
130 |
|
131 } |
|
132 |
|
133 // End of File |