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