Archived:Enabling and disabling keypad lock using Symbian C++
hamishwillee
(Talk | contribs) |
m (Lpvalente -) |
||
| Line 1: | Line 1: | ||
| − | |||
[[Category:Symbian C++]][[Category:Code Examples]][[Category:Hardware]][[Category:S60 3rd Edition FP1]][[Category:Code Snippet]] | [[Category:Symbian C++]][[Category:Code Examples]][[Category:Hardware]][[Category:S60 3rd Edition FP1]][[Category:Code Snippet]] | ||
| + | {{Archived|timestamp=20120313101106|user=roy.debjit| }} | ||
| + | |||
{{ArticleMetaData <!-- v1.2 --> | {{ArticleMetaData <!-- v1.2 --> | ||
|sourcecode= [[Media:ExampleStub CS000932.zip]] [[Media:CS000932 Enabling and disabling keypad lock.diff.zip]] | |sourcecode= [[Media:ExampleStub CS000932.zip]] [[Media:CS000932 Enabling and disabling keypad lock.diff.zip]] | ||
| Line 30: | Line 31: | ||
==Overview== | ==Overview== | ||
| − | This code snippet demonstrates the following use cases regarding enabling and disabling keypad lock: | + | {{Abstract|This code snippet demonstrates the following use cases regarding enabling and disabling keypad lock: |
# Offering the user to enable the key lock. | # Offering the user to enable the key lock. | ||
| Line 37: | Line 38: | ||
# Disabling the key lock and showing a notification ("Keypad unlocked" or similar). | # Disabling the key lock and showing a notification ("Keypad unlocked" or similar). | ||
# Disabling the key lock without showing a notification. | # Disabling the key lock without showing a notification. | ||
| − | # Locking the device keys similarly to device lock (unlocking requires a lock code). | + | # Locking the device keys similarly to device lock (unlocking requires a lock code).}} |
This snippet can be self-signed. | This snippet can be self-signed. | ||
Latest revision as of 16:31, 17 August 2012
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
Article Metadata
Code Example
Source file: Media:ExampleStub CS000932.zip Media:CS000932 Enabling and disabling keypad lock.diff.zip
Tested with
Devices(s): Nokia N95 8GB
Compatibility
Platform(s): S60 3rd Edition, MR
Article
Keywords: RAknKeyLock, RAknKeyLock::IsKeyLockEnabled(), RAknKeyLock::EnableKeyLock(), RAknKeyLock::EnableWithoutNote(), RAknKeyLock::DisableKeyLock(), RAknKeyLock::DisableWithoutNote(), RAknKeyLock::EnableAutoLockEmulation()
Created: tapla
(23 Apr 2008)
Last edited: lpvalente
(17 Aug 2012)
Contents |
Overview
This code snippet demonstrates the following use cases regarding enabling and disabling keypad lock:
- Offering the user to enable the key lock.
- Enabling the key lock and showing a notification ("Keypad locked" or similar).
- Enabling the key lock without showing a notification.
- Disabling the key lock and showing a notification ("Keypad unlocked" or similar).
- Disabling the key lock without showing a notification.
- Locking the device keys similarly to device lock (unlocking requires a lock code).
This snippet can be self-signed.
MMP file
The following libraries are required:
LIBRARY avkon.lib
Source file
#include <aknkeylock.h> // RAknKeyLockRAknKeyLock 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();
Supplementary material
- You can test the keypad lock features in action in a simple, executable application into which this code snippet has been patched. The application is available for download at: Media:ExampleStub CS000932.zip
- You can examine all the changes that are required to implement keypad lock handling in an application. The changes are provided in unified diff and color-coded diff formats: Media:CS000932 Enabling and disabling keypad lock.diff.zip
- For general information on applying the patch, see Using Diffs.
- For unpatched stub applications, see Example stub.

