×
Namespaces

Variants
Actions
Revision as of 09:17, 21 June 2012 by hamishwillee (Talk | contribs)

Archived:Enabling and disabling keypad lock using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: 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 ExampleTested with
Devices(s): Nokia N95 8GB
Compatibility
Platform(s): S60 3rd Edition, MR
S60 3rd Edition FP1
Article
Keywords: RAknKeyLock, RAknKeyLock::IsKeyLockEnabled(), RAknKeyLock::EnableKeyLock(), RAknKeyLock::EnableWithoutNote(), RAknKeyLock::DisableKeyLock(), RAknKeyLock::DisableWithoutNote(), RAknKeyLock::EnableAutoLockEmulation()
Created: tapla (23 Apr 2008)
Last edited: hamishwillee (21 Jun 2012)


Contents

Overview

This code snippet demonstrates the following use cases regarding enabling and disabling keypad lock:

  1. Offering the user to enable the key lock.
  2. Enabling the key lock and showing a notification ("Keypad locked" or similar).
  3. Enabling the key lock without showing a notification.
  4. Disabling the key lock and showing a notification ("Keypad unlocked" or similar).
  5. Disabling the key lock without showing a notification.
  6. 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>  // 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();

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.
95 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×