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