21 #include <e32base.h> |
21 #include <e32base.h> |
22 #include <AknQueryDialog.h> |
22 #include <AknQueryDialog.h> |
23 #include "SecUiAutoLockSettingPage.h" |
23 #include "SecUiAutoLockSettingPage.h" |
24 #include "secui.hrh" |
24 #include "secui.hrh" |
25 #include <featmgr.h> |
25 #include <featmgr.h> |
26 /** |
26 |
27 *CAutolockQuery used in autolock period query |
27 |
28 */ |
|
29 class CAutolockQuery |
|
30 : public CAknNumberQueryDialog |
|
31 { |
|
32 public: // Constructors and destructors |
|
33 /** |
|
34 * C++ constructor. |
|
35 */ |
|
36 CAutolockQuery(TInt& aNumber,const TTone aTone = ENoTone); |
|
37 protected: // From base classes |
|
38 /** |
|
39 * From CCAknNumberQueryDialog |
|
40 */ |
|
41 void PreLayoutDynInitL(); |
|
42 }; |
|
43 // |
28 // |
44 // ---------------------------------------------------------- |
29 // ---------------------------------------------------------- |
45 // CAutoLockSettingPage::CAutoLockSettingPage() |
30 // CAutoLockSettingPage::CAutoLockSettingPage() |
46 // C++ default constructor |
31 // C++ default constructor |
47 // ---------------------------------------------------------- |
32 // ---------------------------------------------------------- |
48 // |
33 // |
49 CAutoLockSettingPage::CAutoLockSettingPage(TInt aResourceId, TInt& aCurrentSelectionItem, CDesCArrayFlat* aItemArray, TInt& aAutoLockValue) : |
34 CAutoLockSettingPage::CAutoLockSettingPage(TInt aResourceId, TInt& aCurrentSelectionItem, CDesCArrayFlat* aItemArray, TInt& aAutoLockValue) : |
50 CAknRadioButtonSettingPage(aResourceId, aCurrentSelectionItem, aItemArray),iAutoLockValue(aAutoLockValue) |
35 CBase(),iAutoLockValue(aAutoLockValue) |
51 |
36 |
52 { |
37 { |
53 iOriginalIndex = aCurrentSelectionItem; |
|
54 } |
38 } |
55 |
39 |
56 // |
40 // |
57 // ---------------------------------------------------------- |
41 // ---------------------------------------------------------- |
58 // CAutoLockSettingPage::ConstructL() |
42 // CAutoLockSettingPage::ConstructL() |
59 // Symbian OS default constructor |
43 // Symbian OS default constructor |
60 // ---------------------------------------------------------- |
44 // ---------------------------------------------------------- |
61 // |
45 // |
62 void CAutoLockSettingPage::ConstructL() |
46 void CAutoLockSettingPage::ConstructL() |
63 { |
47 { |
64 CAknRadioButtonSettingPage::ConstructL(); |
|
65 const TSize screenSize = iCoeEnv->ScreenDevice()->SizeInPixels(); |
|
66 FeatureManager::InitializeLibL(); |
|
67 } |
48 } |
68 |
49 |
69 // |
50 // |
70 // ---------------------------------------------------------- |
51 // ---------------------------------------------------------- |
71 // CAutoLockSettingPage::CAutoLockSettingPage() |
52 // CAutoLockSettingPage::CAutoLockSettingPage() |
72 // Destructor |
53 // Destructor |
73 // ---------------------------------------------------------- |
54 // ---------------------------------------------------------- |
74 // |
55 // |
75 CAutoLockSettingPage::~CAutoLockSettingPage() |
56 CAutoLockSettingPage::~CAutoLockSettingPage() |
76 { |
57 { |
77 FeatureManager::UnInitializeLib(); |
|
78 } |
58 } |
79 |
59 |
80 // |
60 // |
81 // ---------------------------------------------------------- |
61 // ---------------------------------------------------------- |
82 // CAutoLockSettingPage::ProcessCommandL() |
62 // CAutoLockSettingPage::ProcessCommandL() |
83 // |
63 // |
84 // ---------------------------------------------------------- |
64 // ---------------------------------------------------------- |
85 // |
65 // |
86 void CAutoLockSettingPage::ProcessCommandL(TInt aCommandId) |
66 void CAutoLockSettingPage::ProcessCommandL(TInt aCommandId) |
87 { |
67 { |
88 TInt cur = ListBoxControl()->CurrentItemIndex(); |
68 |
89 // Respond to softkey events |
|
90 |
|
91 switch (aCommandId) |
|
92 { |
|
93 case EAknSoftkeySelect: |
|
94 case EAknSoftkeyOk: |
|
95 // autolock off |
|
96 if (cur == 0) |
|
97 { |
|
98 iAutoLockValue = 0; |
|
99 if(iOriginalIndex == 0) |
|
100 { //User re-selected "Autolock off"; no use in changing lock setting |
|
101 AttemptExitL(EFalse); |
|
102 } |
|
103 else |
|
104 { |
|
105 AttemptExitL(ETrue); |
|
106 } |
|
107 |
|
108 } |
|
109 // user defined |
|
110 if (cur == 1) |
|
111 { |
|
112 CAutolockQuery* dlg = new (ELeave) CAutolockQuery(iAutoLockValue); |
|
113 dlg->PrepareLC(R_AUTOLOCK_TIME_QUERY); |
|
114 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
|
115 { |
|
116 //set min and max values from SCP server to the dialog. |
|
117 TInt minimum = 0; |
|
118 if(iMaximum <= 0) //maximum value has not been defined; default value used instead. |
|
119 iMaximum = 1440; |
|
120 dlg->SetMinimumAndMaximum(minimum, iMaximum); |
|
121 } |
|
122 if(dlg->RunLD()) |
|
123 { |
|
124 AttemptExitL(ETrue); |
|
125 } |
|
126 else |
|
127 AttemptExitL(EFalse); |
|
128 } |
|
129 break; |
|
130 |
|
131 default: |
|
132 CAknSettingPage::ProcessCommandL(aCommandId); |
|
133 break; |
|
134 } |
|
135 |
|
136 } |
69 } |
137 // |
70 // |
138 // ---------------------------------------------------------- |
71 // ---------------------------------------------------------- |
139 // CAutoLockSettingPage::SetPeriodMaximumValue() |
72 // CAutoLockSettingPage::SetPeriodMaximumValue() |
140 // |
73 // |
141 // ---------------------------------------------------------- |
74 // ---------------------------------------------------------- |
142 // |
75 // |
143 void CAutoLockSettingPage::SetPeriodMaximumValue(TInt aMaximumValue) |
76 void CAutoLockSettingPage::SetPeriodMaximumValue(TInt aMaximumValue) |
144 { |
77 { |
145 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
|
146 { |
|
147 iMaximum = aMaximumValue; |
|
148 } |
|
149 } |
78 } |
150 |
79 |
151 //--------------------------------------------------------------------------------------- |
80 //--------------------------------------------------------------------------------------- |
152 // CAutoLockSettingPage::HandlePointerEventL() |
81 // CAutoLockSettingPage::HandlePointerEventL() |
153 // Passes pointer events to CAknRadioButtonSettingPage |
82 // Passes pointer events to CAknRadioButtonSettingPage |
155 //--------------------------------------------------------------------------------------- |
84 //--------------------------------------------------------------------------------------- |
156 // |
85 // |
157 |
86 |
158 void CAutoLockSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
87 void CAutoLockSettingPage::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
159 { |
88 { |
160 if ( AknLayoutUtils::PenEnabled() ) |
89 } |
161 { |
|
162 TInt cur = ListBoxControl()->CurrentItemIndex(); |
|
163 CAknRadioButtonSettingPage::HandlePointerEventL(aPointerEvent); |
|
164 //only take into account the "Up" event. Otherwise we'll end up having 2 dialogs. |
|
165 if(aPointerEvent.iType == TPointerEvent::EButton1Up) |
|
166 { |
|
167 |
|
168 //only react to the event if the pen is actually inside the dialog. |
|
169 if(ListBoxControl()->Rect().Contains(aPointerEvent.iPosition)) |
|
170 { |
|
171 // autolock off |
|
172 if (cur == 0) |
|
173 { |
|
174 iAutoLockValue = 0; |
|
175 if(iOriginalIndex == 0) |
|
176 { //User re-selected "Autolock off"; no use in changing lock setting |
|
177 AttemptExitL(EFalse); |
|
178 } |
|
179 else |
|
180 { |
|
181 AttemptExitL(ETrue); |
|
182 } |
|
183 } |
|
184 // user defined |
|
185 if (cur == 1) |
|
186 { |
|
187 CAutolockQuery* dlg = new (ELeave) CAutolockQuery(iAutoLockValue); |
|
188 dlg->PrepareLC(R_AUTOLOCK_TIME_QUERY); |
|
189 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
|
190 { |
|
191 //set min and max values from SCP server to the dialog. |
|
192 TInt minimum = 0; |
|
193 if(iMaximum <= 0) //maximum value has not been defined; default value used instead. |
|
194 iMaximum = 1440; |
|
195 dlg->SetMinimumAndMaximum(minimum, iMaximum); |
|
196 } |
|
197 if(dlg->RunLD()) |
|
198 { |
|
199 AttemptExitL(ETrue); |
|
200 } |
|
201 else |
|
202 AttemptExitL(EFalse); |
|
203 } |
|
204 |
|
205 } |
|
206 } |
|
207 } |
|
208 } |
|
209 // |
|
210 // --------------------------------------------------------- |
|
211 // CAutolockQuery::CAutolockQuery() |
|
212 // |
|
213 // --------------------------------------------------------- |
|
214 // |
|
215 CAutolockQuery::CAutolockQuery(TInt& aNumber,const TTone aTone) |
|
216 : CAknNumberQueryDialog( aNumber, aTone) |
|
217 { |
|
218 } |
|
219 |
|
220 // |
|
221 // --------------------------------------------------------- |
|
222 // CAutolockQuery::PreLayoutDynInitL() |
|
223 // |
|
224 // --------------------------------------------------------- |
|
225 // |
|
226 void CAutolockQuery::PreLayoutDynInitL() |
|
227 { |
|
228 CAknNumberQueryDialog::PreLayoutDynInitL(); |
|
229 if (iNumber == 0) |
|
230 { |
|
231 MakeLeftSoftkeyVisible(EFalse); |
|
232 } |
|
233 } |
|
234 |
|
235 // End of file |
90 // End of file |
236 |
91 |