ScShortcuts Engine Wrapper API
Article Metadata
Code Example
Source file: Media:ShortCutExample.zip
Article
Created: ltomuta
(16 Jun 2007)
Last edited: hamishwillee
(26 Jul 2012)
Note: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.
Contents |
APIPurpose
This API can be used to change the softkey shortcuts in Active Idle Screen of the S60 3rd Edition phones.
Use cases
To assign shortcut for S60 Calendar application.In the active idle screen we will get left soft key option for launching Calendar
Example code
Header Files
#include<MScShortcutEngineWrapperObserver.h>
#include<cscshortcutenginewrapper.h>
Library : scshortcutenginewrapper.lib
Capabities Required : ReadUserData ReadDeviceData WriteDeviceData
- Derive your class from MScShortcutEngineWrapperObserver
- Provide implementations for MScShortcutEngineWrapperObserver::HandleShortcutEvent() and MScShortcutEngineWrapperObserver::HandleShortcutError() methods.
- Create an object for CScShortcutWrapper
- Call AsynchronouslyPrepareShortcutListL(RPointerArray&).If the list gets created successfully then MScShortcutEngineWrapperObserver::HandleShortcutEvent() will be called along with "EShortcutListComplete" event.
- Inside MScShortcutEngineWrapperObserver::HandleShortcutEvent() implementation call CScShortcutWrapper::SetShortcutL( ).The index which we pass as argument to the above mentioned API call will decide the application as to which we are creating the shorcut for.
RFs iSession;
CScShortcutEngineWrapper* iShortcut;
RPointerArray<CScWrapperShortcut> iPArray;
//In the ConstructL
iSession.Connect();
iShortcut=CScShortcutEngineWrapper::NewL(iSession,*this);
iShortcut->AsynchronouslyPrepareShortcutListL(iPArray);
//Implementing MScShortcutEngineWrapperObserver::HandleShortcutEvent() method
void CShortCutEngineUsage::HandleShortcutEvent( TScShortcutEvent aEvent )
{
if(aEvent==EShortcutListComplete)
{
//note here 1 is the index to denote that we are creating a shortcut for calendar application
iShortcut->SetShorcutL(CScShortcutEngineWrapper::EKeyTypeLeft,1)
}
}


There is something missing in the given example: the call to CScShortcutEngineWrapper::NewL fails with error -46 (permission denied) if the right capabilities is not specified in the elf2e32.exe (post linker) command. The capabilities are ReadDeviceData WriteDeviceData, meaning that you need a certificate in order to use this API
Capability missing in the example project
A few comments here:
CAPABILITY ReadDeviceData WriteDeviceData ReadUserData
ltomuta 13:40, 25 September 2007 (UTC)
Fails on N95 device
Hi,
I tried to build an example using ScShortcutsEngineWrapper API for N95 device.
Below statement gives out "System Error!" alert note on the device:
"iShortcut=CScShortcutEngineWrapper::NewL(iSession,*this);"
But initializing "CScWrapperShortcut" object does not give any error!
May I request for insights on this issue!
Thanks!