46
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <hbdevicedialogsymbian.h>
|
|
19 |
#include <hbsymbianvariant.h>
|
|
20 |
#include <coreapplicationuisdomainpskeys.h>
|
51
|
21 |
#include <CoreApplicationUIsSDKCRKeys.h>
|
46
|
22 |
#include "hbdevicepowermenusymbian.h"
|
|
23 |
|
|
24 |
|
|
25 |
//These Keys will be used in CHbSymbianVariantMap
|
|
26 |
//Donot Change these strings
|
|
27 |
_LIT(KVolumeLevel, "VolumeLevel");
|
|
28 |
_LIT(KSilenceLatchOn, "SilenceLatchOn"); //Used to latch silencebutton
|
|
29 |
_LIT(KCypherOff, "CypherOff"); //used to poweroffButtonEnabled/Disabled
|
|
30 |
_LIT(KVibrationEnable, "VibrationEnable");
|
|
31 |
_LIT(KOfflineEnable, "OfflineEnable");
|
|
32 |
_LIT(KShutDown, "ShutDown");
|
|
33 |
|
|
34 |
//used to load plugin
|
|
35 |
_LIT(KPluginIdentifier, "com.nokia.hb.devicepowermenu/1.0");
|
|
36 |
|
|
37 |
|
|
38 |
NONSHARABLE_CLASS(CHbDevicePowerMenuPrivate) : public CBase, public MHbDeviceDialogObserver
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
static CHbDevicePowerMenuPrivate* NewL(CHbDevicePowerMenuSymbian* aDialog);
|
|
42 |
virtual ~CHbDevicePowerMenuPrivate();
|
|
43 |
|
|
44 |
void ShowL();
|
|
45 |
void AddVariantL(const TDesC& aKey, const TAny* aData, CHbSymbianVariant::TType aDataType);
|
|
46 |
|
|
47 |
//Set Methods
|
|
48 |
void SetVolume(TInt aVolume);
|
|
49 |
void SetSilenceMode(TBool aEnable);
|
|
50 |
void SetOfflineMode(TBool aChecked);
|
|
51 |
void SetVibrationEnabled(TBool aEnable);
|
|
52 |
void SetPowerOffEnabled(TBool aEnable);
|
|
53 |
|
|
54 |
public:
|
|
55 |
// MHbDeviceDialogObserver
|
|
56 |
void DataReceived(CHbSymbianVariantMap& aData);
|
|
57 |
void DeviceDialogClosed(TInt aCompletionCode);
|
|
58 |
|
|
59 |
private:
|
|
60 |
CHbDevicePowerMenuPrivate();
|
|
61 |
void ConstructL(CHbDevicePowerMenuSymbian* aDialog);
|
|
62 |
|
|
63 |
private:
|
|
64 |
//symbian FW client intreface to load Qt.plugin
|
|
65 |
CHbDeviceDialogSymbian* iDeviceDialog;
|
|
66 |
//Parameter for loading qt.plugin
|
|
67 |
CHbSymbianVariantMap* iVariantMap;
|
|
68 |
//Symbian client interface for Powermenu
|
|
69 |
CHbDevicePowerMenuSymbian* iPowerMenuManager;
|
|
70 |
|
|
71 |
//Variants used in VariantMap
|
|
72 |
TInt iVolumeLevel; //Volume level ranges 1 to 10
|
|
73 |
TBool iSilenceLatchOn; //Silence Enabled or Disbaled
|
|
74 |
TBool iVibrationEnable; //Master Vibarate enabled/Disabled
|
|
75 |
TBool iOfflineEnable; //Oflline Mode enabled or Disabled
|
|
76 |
TBool iCypherOff; //Encryption/Decryption ON/OFF
|
|
77 |
};
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Create an object of CHbDevicePowerMenuPrivate
|
|
81 |
*/
|
|
82 |
CHbDevicePowerMenuPrivate* CHbDevicePowerMenuPrivate::NewL(CHbDevicePowerMenuSymbian* aDialog)
|
|
83 |
{
|
|
84 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::NewL: START") ) );
|
|
85 |
CHbDevicePowerMenuPrivate* self = new (ELeave) CHbDevicePowerMenuPrivate();
|
|
86 |
CleanupStack::PushL(self);
|
|
87 |
self->ConstructL(aDialog);
|
|
88 |
CleanupStack::Pop(self);
|
|
89 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::NewL: END") ) );
|
|
90 |
return self;
|
|
91 |
}
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Constructor
|
|
95 |
*/
|
|
96 |
CHbDevicePowerMenuPrivate::CHbDevicePowerMenuPrivate()
|
|
97 |
{
|
|
98 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::Constructor") ) );
|
|
99 |
//Do nothing
|
|
100 |
}
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Destructor
|
|
104 |
*/
|
|
105 |
CHbDevicePowerMenuPrivate::~CHbDevicePowerMenuPrivate()
|
|
106 |
{
|
|
107 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::Destructor: START") ) );
|
|
108 |
delete iDeviceDialog;
|
|
109 |
delete iVariantMap;
|
|
110 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::Destructor: END") ) );
|
|
111 |
}
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Constrcuts all its member variables
|
|
115 |
*/
|
|
116 |
void CHbDevicePowerMenuPrivate::ConstructL(CHbDevicePowerMenuSymbian* aDialog)
|
|
117 |
{
|
|
118 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::ConstructL: START") ) );
|
|
119 |
iPowerMenuManager = aDialog;
|
|
120 |
iDeviceDialog = CHbDeviceDialogSymbian::NewL();
|
|
121 |
iVariantMap = CHbSymbianVariantMap::NewL();
|
|
122 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::ConstructL: END") ) );
|
|
123 |
}
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Builds all parameters required for showing the PowerMenu Dialog.
|
|
127 |
* Loads the required powermenu plugin and calls show on DeviceDialog.
|
|
128 |
* This Displays the Customized PowerMenu Widget.
|
|
129 |
*/
|
|
130 |
void CHbDevicePowerMenuPrivate::ShowL()
|
|
131 |
{
|
|
132 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::ShowL: START") ) );
|
|
133 |
AddVariantL(KVolumeLevel, &iVolumeLevel, CHbSymbianVariant::EInt);
|
|
134 |
AddVariantL(KSilenceLatchOn, &iSilenceLatchOn, CHbSymbianVariant::EBool);
|
|
135 |
AddVariantL(KVibrationEnable, &iVibrationEnable, CHbSymbianVariant::EBool);
|
|
136 |
AddVariantL(KOfflineEnable, &iOfflineEnable, CHbSymbianVariant::EBool);
|
|
137 |
AddVariantL(KCypherOff, &iCypherOff, CHbSymbianVariant::EBool);
|
|
138 |
//No shutdown varinat will be added to showL
|
|
139 |
User::LeaveIfError(iDeviceDialog->Show(KPluginIdentifier, *iVariantMap, this));
|
|
140 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::ShowL: END") ) );
|
|
141 |
}
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Sets Volume to aVolume
|
|
145 |
*/
|
|
146 |
void CHbDevicePowerMenuPrivate::SetVolume(TInt aVolume)
|
|
147 |
{
|
|
148 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetVolume: START") ) );
|
|
149 |
iVolumeLevel = aVolume;
|
|
150 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetVolume: END") ) );
|
|
151 |
}
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Sets SilenceMode to Enable/Disable
|
|
155 |
*/
|
|
156 |
void CHbDevicePowerMenuPrivate::SetSilenceMode(TBool aEnable)
|
|
157 |
{
|
|
158 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetSilenceMode: START") ) );
|
|
159 |
iSilenceLatchOn = aEnable;
|
|
160 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetSilenceMode: END") ) );
|
|
161 |
}
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Sets OfflineMode to Checked/UnChecked
|
|
165 |
*/
|
|
166 |
void CHbDevicePowerMenuPrivate::SetOfflineMode(TBool aChecked)
|
|
167 |
{
|
|
168 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetOfflineMode: START") ) );
|
|
169 |
iOfflineEnable = aChecked;
|
|
170 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetOfflineMode: END") ) );
|
|
171 |
}
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Sets VibrationEnabled to Checked/UnChecked
|
|
175 |
*/
|
|
176 |
void CHbDevicePowerMenuPrivate::SetVibrationEnabled(TBool aChecked)
|
|
177 |
{
|
|
178 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetVibrationEnabled: START") ) );
|
|
179 |
iVibrationEnable = aChecked;
|
|
180 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetVibrationEnabled: END") ) );
|
|
181 |
}
|
|
182 |
|
|
183 |
/**
|
|
184 |
* Sets PowerOffEnabled to Enable/Disable
|
|
185 |
*/
|
|
186 |
void CHbDevicePowerMenuPrivate::SetPowerOffEnabled(TBool aEnable)
|
|
187 |
{
|
|
188 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetPowerOffEnabled: START") ) );
|
|
189 |
iCypherOff = aEnable;
|
|
190 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::SetPowerOffEnabled: END") ) );
|
|
191 |
}
|
|
192 |
|
|
193 |
/**
|
|
194 |
* Data received from HBDeviceDialog will hit by emit deviceDialogData in plugin
|
|
195 |
* The values received from UI will set to ControlPanel.
|
|
196 |
*/
|
|
197 |
void CHbDevicePowerMenuPrivate::DataReceived(CHbSymbianVariantMap& aData)
|
|
198 |
{
|
|
199 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: START") ) );
|
|
200 |
// Updates received from the plugin.
|
|
201 |
//1. Volume
|
|
202 |
const CHbSymbianVariant* volumeVariant = aData.Get(KVolumeLevel);
|
|
203 |
if(volumeVariant)
|
|
204 |
{
|
|
205 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: volumeVariant::Start") ) );
|
|
206 |
TInt* volumeValue = volumeVariant->Value<TInt>();
|
|
207 |
if(volumeValue)
|
|
208 |
{
|
|
209 |
iVolumeLevel = *volumeValue;
|
|
210 |
iPowerMenuManager->iProfileEngine->SetMasterVolumeL( iVolumeLevel );
|
|
211 |
}
|
|
212 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived:volumeVariant::End") ) );
|
|
213 |
}
|
|
214 |
|
|
215 |
//2. Silence
|
|
216 |
const CHbSymbianVariant* SilenceVariant = aData.Get(KSilenceLatchOn);
|
|
217 |
if(SilenceVariant)
|
|
218 |
{
|
|
219 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: SilenceVariant::Start") ) );
|
|
220 |
TBool* LatchValue = SilenceVariant->Value<TBool>();
|
|
221 |
if(LatchValue)
|
|
222 |
{
|
|
223 |
iSilenceLatchOn = *LatchValue;
|
|
224 |
iPowerMenuManager->iProfileEngine->SetSilenceModeL( iSilenceLatchOn );//member in CHbDevicePowerMenuSymbian
|
|
225 |
}
|
|
226 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: SilenceVariant::End") ) );
|
|
227 |
}
|
|
228 |
|
|
229 |
//3. Vibration
|
|
230 |
const CHbSymbianVariant* VibrationVariant = aData.Get(KVibrationEnable);
|
|
231 |
if(VibrationVariant)
|
|
232 |
{
|
|
233 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: VibrationVariant::Start") ) );
|
|
234 |
TBool* VibrationValue = VibrationVariant->Value<TBool>();
|
|
235 |
if(VibrationValue)
|
|
236 |
{
|
|
237 |
iVibrationEnable = *VibrationValue;
|
|
238 |
iPowerMenuManager->iProfileEngine->SetMasterVibraL( iVibrationEnable );//member in CHbDevicePowerMenuSymbian
|
|
239 |
}
|
|
240 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: VibrationVariant::End") ) );
|
|
241 |
}
|
|
242 |
|
|
243 |
//4.Offline
|
|
244 |
const CHbSymbianVariant* OfflineVariant = aData.Get(KOfflineEnable);
|
|
245 |
if(OfflineVariant)
|
|
246 |
{
|
|
247 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: OfflineVariant::Start") ) );
|
|
248 |
TBool* OfflineValue = OfflineVariant->Value<TBool>();
|
|
249 |
if(OfflineValue)
|
|
250 |
{
|
51
|
251 |
iOfflineEnable = *OfflineValue;
|
|
252 |
// negate the value before storing in cen rep as the n/w conn allowed key is complement of offline mode
|
|
253 |
User::LeaveIfError( iPowerMenuManager->iCenrepOffline->Set(KCoreAppUIsNetworkConnectionAllowed, !iOfflineEnable ) );
|
46
|
254 |
}
|
|
255 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: OfflineVariant::End") ) );
|
|
256 |
}
|
|
257 |
|
|
258 |
//5.shutdown
|
|
259 |
const CHbSymbianVariant* ShutDownVariant = aData.Get(KShutDown);
|
|
260 |
if(ShutDownVariant)
|
|
261 |
{
|
|
262 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: ShutDownVariant::Start") ) );
|
|
263 |
TBool* ShutDownValue = ShutDownVariant->Value<TBool>();
|
|
264 |
if(ShutDownValue)
|
|
265 |
{
|
|
266 |
TBool shutDown = *ShutDownValue;
|
|
267 |
if (shutDown)
|
|
268 |
{
|
|
269 |
iPowerMenuManager->iSysApServer.HandleLongPowerKeyPressedL();
|
|
270 |
}
|
|
271 |
|
|
272 |
}
|
|
273 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: ShutDownVariant::End") ) );
|
|
274 |
}
|
|
275 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DataReceived: END") ) );
|
|
276 |
return;
|
|
277 |
}
|
|
278 |
|
|
279 |
/**
|
|
280 |
* DeviceDialogClosed will be executed by the event emit deviceDialogClosed in plugin.
|
|
281 |
* This will be executed when 1. Tap out side the Dialog to Close
|
|
282 |
* 2. When Power Off Button is clicked.
|
|
283 |
*/
|
|
284 |
void CHbDevicePowerMenuPrivate::DeviceDialogClosed(TInt /*aCompletionCode*/)
|
|
285 |
{
|
|
286 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::DeviceDialogClosed") ) );
|
|
287 |
// Inform sysap to release the memory of power menu custom dialog.
|
|
288 |
RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsPowerMenuCustomDialogOn );
|
|
289 |
}
|
|
290 |
|
|
291 |
/**
|
|
292 |
* Contrcuts VariantMap
|
|
293 |
*/
|
|
294 |
void CHbDevicePowerMenuPrivate::AddVariantL(const TDesC& aKey, const TAny* aData, CHbSymbianVariant::TType aDataType)
|
|
295 |
{
|
|
296 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::AddVariantL: START") ) );
|
|
297 |
CHbSymbianVariant *variant = CHbSymbianVariant::NewL(aData, aDataType);
|
|
298 |
CleanupStack::PushL(variant);
|
|
299 |
//iVariantMap takes the ownerhip of variant
|
|
300 |
User::LeaveIfError(iVariantMap->Add(aKey, variant));
|
|
301 |
CleanupStack::Pop(variant);
|
|
302 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuPrivate::AddVariantL: End") ) );
|
|
303 |
}
|
|
304 |
|
|
305 |
/*
|
|
306 |
* Creates an object of CHbDevicePowerMenuSymbian
|
|
307 |
*/
|
|
308 |
CHbDevicePowerMenuSymbian* CHbDevicePowerMenuSymbian::NewL(CSysApAppUi& aSysApServer)
|
|
309 |
{
|
|
310 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::NewL: START") ) );
|
|
311 |
CHbDevicePowerMenuSymbian* self = new (ELeave) CHbDevicePowerMenuSymbian(aSysApServer);
|
|
312 |
CleanupStack::PushL(self);
|
|
313 |
self->ConstructL();
|
|
314 |
CleanupStack::Pop(self);
|
|
315 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::NewL: END") ) );
|
|
316 |
return self;
|
|
317 |
}
|
|
318 |
|
|
319 |
/*
|
|
320 |
* Destructs the class.
|
|
321 |
*/
|
|
322 |
CHbDevicePowerMenuSymbian::~CHbDevicePowerMenuSymbian()
|
|
323 |
{
|
|
324 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::Destructor: START") ) );
|
|
325 |
delete iCenrepProfile;
|
|
326 |
delete iCenrepOffline;
|
|
327 |
iProfileEngine->Release();
|
|
328 |
delete iPowerMenuPrivate;
|
|
329 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::Destructor: End") ) );
|
|
330 |
}
|
|
331 |
|
|
332 |
/*
|
|
333 |
* Executes the dialog asynchronously.
|
|
334 |
*/
|
|
335 |
void CHbDevicePowerMenuSymbian::ShowL()
|
|
336 |
{
|
|
337 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::ShowL: START") ) );
|
|
338 |
iPowerMenuPrivate->ShowL();
|
|
339 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::ShowL: End") ) );
|
|
340 |
}
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Sets Volume to aVolume
|
|
344 |
*/
|
|
345 |
void CHbDevicePowerMenuSymbian::SetVolume(TInt aVolume)
|
|
346 |
{
|
|
347 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetVolume: START") ) );
|
|
348 |
iPowerMenuPrivate->SetVolume(aVolume);
|
|
349 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetVolume: End") ) );
|
|
350 |
}
|
|
351 |
|
|
352 |
/**
|
|
353 |
* Sets SilenceMode to Enable/Disable
|
|
354 |
*/
|
|
355 |
void CHbDevicePowerMenuSymbian::SetSilenceMode(TBool aEnable)
|
|
356 |
{
|
|
357 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetSilenceMode: START") ) );
|
|
358 |
iPowerMenuPrivate->SetSilenceMode(aEnable);
|
|
359 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetSilenceMode: END") ) );
|
|
360 |
}
|
|
361 |
|
|
362 |
/**
|
|
363 |
* Sets OfflineMode to Checked/UnChecked
|
|
364 |
*/
|
|
365 |
void CHbDevicePowerMenuSymbian::SetOfflineMode(TBool aChecked)
|
|
366 |
{
|
|
367 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetOfflineMode: START") ) );
|
|
368 |
iPowerMenuPrivate->SetOfflineMode(aChecked);
|
|
369 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetOfflineMode: End") ) );
|
|
370 |
}
|
|
371 |
|
|
372 |
/**
|
|
373 |
* Sets VibrationEnabled to Checked/UnChecked
|
|
374 |
*/
|
|
375 |
void CHbDevicePowerMenuSymbian::SetVibrationEnabled(TBool aEnable)
|
|
376 |
{
|
|
377 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetVibrationEnabled: START") ) );
|
|
378 |
iPowerMenuPrivate->SetVibrationEnabled(aEnable);
|
|
379 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetVibrationEnabled: End") ) );
|
|
380 |
}
|
|
381 |
|
|
382 |
/**
|
|
383 |
* Sets PowerOffEnabled to Enable/Disable
|
|
384 |
*/
|
|
385 |
void CHbDevicePowerMenuSymbian::SetPowerOffEnabled(TBool aEnable)
|
|
386 |
{
|
|
387 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetPowerOffEnabled: START") ) );
|
|
388 |
iPowerMenuPrivate->SetPowerOffEnabled(aEnable);
|
|
389 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::SetPowerOffEnabled: END") ) );
|
|
390 |
}
|
|
391 |
|
|
392 |
/*
|
|
393 |
* Constructor.
|
|
394 |
*/
|
|
395 |
CHbDevicePowerMenuSymbian::CHbDevicePowerMenuSymbian(CSysApAppUi& aSysApServer)
|
|
396 |
:iSysApServer(aSysApServer)
|
|
397 |
{
|
|
398 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::Constructor") ) );
|
|
399 |
//Do Nothing
|
|
400 |
}
|
|
401 |
|
|
402 |
/*
|
|
403 |
* 2nd Constructor.
|
|
404 |
* Constructs and initializes all its meber variables
|
|
405 |
*/
|
|
406 |
void CHbDevicePowerMenuSymbian::ConstructL()
|
|
407 |
{
|
|
408 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::ConstructL: START") ) );
|
|
409 |
iProfileEngine = ::CreateProfileEngineExtended2L();
|
51
|
410 |
iCenrepOffline = CRepository::NewL( KCRUidCoreApplicationUIs );
|
46
|
411 |
iCenrepProfile = CRepository::NewL( KCRUidProfileEngine );
|
|
412 |
iPowerMenuPrivate = CHbDevicePowerMenuPrivate::NewL(this);
|
|
413 |
|
|
414 |
//To Sync with Contro panel
|
51
|
415 |
TBool networkConnectionAllowed(EFalse);
|
|
416 |
TInt error = iCenrepOffline->Get( KCoreAppUIsNetworkConnectionAllowed, networkConnectionAllowed );
|
|
417 |
TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: KCoreAppUIsNetworkConnectionAllowed = %d"), error ) );
|
|
418 |
|
|
419 |
// The value of KCoreAppUIsNetworkConnectionAllowed is Inverted status of Offline mode
|
|
420 |
// Hence negate the value and use as Offline mode
|
|
421 |
SetOfflineMode(!networkConnectionAllowed);
|
46
|
422 |
|
|
423 |
TInt masterVolume(0);
|
51
|
424 |
error = iCenrepProfile->Get( KProEngMasterVolume, masterVolume );
|
|
425 |
TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: KProEngMasterVolume = %d"), error ) );
|
|
426 |
SetVolume(masterVolume);
|
46
|
427 |
|
|
428 |
TBool masterVibrate(0);
|
51
|
429 |
error = iCenrepProfile->Get( KProEngMasterVibra, masterVibrate );
|
|
430 |
TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: KProEngMasterVibra = %d"), error ) );
|
46
|
431 |
SetVibrationEnabled(masterVibrate);
|
|
432 |
|
|
433 |
TBool silenceMode(EFalse);
|
51
|
434 |
error = iCenrepProfile->Get( KProEngSilenceMode, silenceMode );
|
|
435 |
TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: KProEngSilenceMode = %d"), error ) );
|
46
|
436 |
SetSilenceMode(silenceMode);
|
|
437 |
|
|
438 |
//Cypheroff is True when No encryption/Decryption is happening
|
|
439 |
TBool cypherOff(!(iSysApServer.IsEncryptionOperationOngoingL()));
|
|
440 |
SetPowerOffEnabled(cypherOff);
|
|
441 |
TRACES( RDebug::Print( _L("CHbDevicePowerMenuSymbian::ConstructL: END") ) );
|
|
442 |
}
|
|
443 |
|