| ID | CS000932 | Creation date | May 2, 2008 |
| Platform | S60 3rd Edition, MR | Tested on devices | Nokia N95 8GB |
| Category | Symbian C++ | Subcategory | Hardware |
| Keywords (APIs, classes, methods, functions): RAknKeyLock, RAknKeyLock::IsKeyLockEnabled(), RAknKeyLock::EnableKeyLock(), RAknKeyLock::EnableWithoutNote(), RAknKeyLock::DisableKeyLock(), RAknKeyLock::DisableWithoutNote(), RAknKeyLock::EnableAutoLockEmulation() |
This code snippet demonstrates the following use cases regarding enabling and disabling keypad lock:
This snippet can be self-signed.
The following libraries are required:
LIBRARY avkon.lib
#include <aknkeylock.h> // RAknKeyLock
RAknKeyLock keyLock;
// Connect to the notifier server so that key lock state notifications can be
// displayed
User::LeaveIfError(keyLock.Connect());
// USE CASE 1
// If the key lock is not enabled, ask the user whether it should be
if (!keyLock.IsKeyLockEnabled())
{
keyLock.OfferKeyLock();
}
// USE CASE 2
// If the key lock is not enabled, enable it and show a notification
if (!keyLock.IsKeyLockEnabled())
{
keyLock.EnableKeyLock();
}
// USE CASE 3
// If the key lock is not enabled, enable it without showing a notification
if (!keyLock.IsKeyLockEnabled())
{
keyLock.EnableWithoutNote();
}
// USE CASE 4
// If the key lock is enabled, disable it and show a notification
if (keyLock.IsKeyLockEnabled())
{
keyLock.DisableKeyLock();
}
// USE CASE 5
// If the key lock is enabled, disable it without showing a notification
if (keyLock.IsKeyLockEnabled())
{
keyLock.DisableWithoutNote();
}
// USE CASE 6
// Lock the device keys similarly to device lock (unlocking requires a lock
// code)
keyLock.EnableAutoLockEmulation();
// Close the session with the notifier server
keyLock.Close();
No related wiki articles found