Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

(Difference between revisions)

How to change the active theme

From Wiki
Jump to: navigation, search
lenclud (Talk | contribs)
(SAVE THE NEW SKIN PACKAGE ID IN CENTRAL REPOSITORY)
lenclud (Talk | contribs)
(NECESSARY CAPABILITIES)
Line 83: Line 83:
 
</code>
 
</code>
  
===NECESSARY CAPABILITIES===
+
===Required capabilities===
 
<code>WriteDeviceData</code>
 
<code>WriteDeviceData</code>
  

Revision as of 08:51, 29 May 2009


This document will very briefly explain how to change the active theme on a S60 3rd Edition device. The information in this document is provided as is and the code samples are not meant to be of commercial quality.

Please note that you need to download and install the Extensions Plug-ins for your S60 SDKs to gain access to APIs you need. Extensions Plug-ins are available for all S60 3rd Edition and S60 5th Edition SDKs. Fron the Extensions plug-ins you will need ExtendedSkinsAPI and PersonalisationSkinsSettingsAPI.

Contents

Connect to Skin Server

#include <AknSSrvClient.h> // aknskinsrv.lib

RAknsSrvSession skinsSession;
User::LeaveIfError( skinsSession.Connect( this ) );
CleanupClosePushL( skinsSession );

Fetch the package ID of the current skin

#include <centralrepository.h> // centralrepository.lib
#include <AknSkinsInternalCRKeys.h>
// iOriginalSkinPid is of type TAknsPkgID
void CMyThemeManager::StoreCurrentSkinIdL()
{
TAknsPkgIDBuf pidBuf;
CRepository* repository =
CRepository::NewL( KCRUidPersonalisation );
TInt retVal = repository->Get( KPslnActiveSkinUid, pidBuf );
delete repository;
repository = NULL;
iOriginalSkinPid.SetFromDesL( pidBuf );
}

Get a list of installed skin packages

Please see aknssrvclient.h file for more details on how to work with skins residing on memory card.

CArrayPtr< CAknsSrvSkinInformationPkg >* skinInfoArray = 
skinsSession.EnumerateSkinPackagesL();
CleanupStack::PushL( skinInfoArray );

GO THROUGH INSTALLED PACKAGES AND SWITCH TO THE FIRST AVAILABLE NEW SKIN

TInt retValue( KErrNone );
TInt i( 0 );
if ( skinInfoArray->Count() > 0 )
{
for ( i; i < skinInfoArray->Count(); i++ )
{
TAknsPkgID pkgId = skinInfoArray->At( i )->PID();
if ( pkgId != iOriginalSkinPid )
{
//Activate a complete skin package at once.
retValue = skinsSession.SetAllDefinitionSets( pkgId );
if ( retValue == KErrNone )
{
SetNewSkinIdL( pkgId );
}
break;
}
}
}

Save the new skin package ID in central repository

void CMyThemeManager::SetNewSkinIdL( TAknsPkgID aPkgId )
{
TAknsPkgIDBuf pidBuf;
aPkgId.CopyToDes( pidBuf );
CRepository* repository =
CRepository::NewL( KCRUidPersonalisation );
TInt retVal = repository->Set( KPslnActiveSkinUid, pidBuf );
 
// KPslnActiveSkinLocation has to be changed also
// if new skin resides on mmc whereas old one resided in phone mem
// ...and vice versa
 
delete repository;
repository = NULL;
}

FREE ALLOCATED RESOURCES (FROM PARTS 1&3)

skinInfoArray->ResetAndDestroy();        
CleanupStack::PopAndDestroy( 2 ); // skinsSession, skinInfoArray

Required capabilities

WriteDeviceData

Related topics

180 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.

×