×
Namespaces

Variants
Actions
(Difference between revisions)

How to change the active theme

From Nokia Developer Wiki
Jump to: navigation, search
petrosoi (Talk | contribs)
(This article will very briefly explain how to change the active theme on a S60 3rd Edition device.)
 
giri_dorna (Talk | contribs)
Line 1: Line 1:
[[Category:[[Category:Symbian C++]][[Category:Themes]]]]
+
[[Category:Symbian C++]][[Category:Themes]]
This document will very briefly explain how to change the active theme on a S60 3rd Edition device.
+
This document will very briefly explain how to change the active theme on a [[S60#S60 Editions|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.
 
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-in package for S60 3rd Edition SDK for Symbian OS, for C++, MR, Version 3 from http://www.forum.nokia.com/info/sw.nokia.com/id/53439e01-f605-4491-96f4-62d003bd4c0c/S60_3rd_SDK_MR_API_Plug-In_Pack1.zip.html  
+
Please note that you need to download and install the Extensions plug-in package for [[S60#S60 Editions|S60 3rd Edition]] [[SDK]] for [[Symbian OS]], for C++, MR, Version 3 from [http://www.forum.nokia.com/info/sw.nokia.com/id/53439e01-f605-4491-96f4-62d003bd4c0c/S60_3rd_SDK_MR_API_Plug-In_Pack1.zip.html here] to gain access to the needed [[API]]s.
to gain access to the needed APIs.
+
  
At the time of writing, the API plugin is only available for S60 3rd MR.
+
At the time of writing, the [[API]] plugin is only available for [[S60#S60 Editions|S60 3rd MR]].
  
 
1. CONNECT TO SKIN SERVER
 
1. CONNECT TO SKIN SERVER
<code>#include <AknSSrvClient.h> // aknskinsrv.lib
+
<code cpp>#include <AknSSrvClient.h> // aknskinsrv.lib
 
 
 
RAknsSrvSession skinsSession;
 
RAknsSrvSession skinsSession;
Line 18: Line 17:
  
 
2. FETCH THE PACKAGE ID OF THE CURRENT SKIN
 
2. FETCH THE PACKAGE ID OF THE CURRENT SKIN
<code>#include <centralrepository.h> // centralrepository.lib
+
<code cpp>#include <centralrepository.h> // centralrepository.lib
 
#include <AknSkinsInternalCRKeys.h>
 
#include <AknSkinsInternalCRKeys.h>
 
…</code>
 
…</code>
Line 37: Line 36:
 
3. GET A LIST OF INSTALLED SKIN PACKAGES  
 
3. 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.
+
Please see ''aknssrvclient.h'' file for more details on how to work with skins residing on memory card.
 
<code>CArrayPtr< CAknsSrvSkinInformationPkg >* skinInfoArray =  
 
<code>CArrayPtr< CAknsSrvSkinInformationPkg >* skinInfoArray =  
 
             skinsSession.EnumerateSkinPackagesL();
 
             skinsSession.EnumerateSkinPackagesL();
Line 44: Line 43:
 
4. GO THROUGH INSTALLED PACKAGES AND SWITCH TO THE FIRST AVAILABLE NEW SKIN
 
4. GO THROUGH INSTALLED PACKAGES AND SWITCH TO THE FIRST AVAILABLE NEW SKIN
  
<code>TInt retValue( KErrNone );
+
<code cpp>TInt retValue( KErrNone );
 
     TInt i( 0 );
 
     TInt i( 0 );
 
     if ( skinInfoArray->Count() > 0 )
 
     if ( skinInfoArray->Count() > 0 )
Line 64: Line 63:
 
         }</code>
 
         }</code>
 
5. SAVE THE NEW SKIN PACKAGE ID IN CENTRAL REPOSITORY
 
5. SAVE THE NEW SKIN PACKAGE ID IN CENTRAL REPOSITORY
<code>
+
<code cpp>
 
void CMyThemeManager::SetNewSkinIdL( TAknsPkgID aPkgId )
 
void CMyThemeManager::SetNewSkinIdL( TAknsPkgID aPkgId )
 
     {
 
     {
Line 83: Line 82:
 
6. FREE ALLOCATED RESOURCES (FROM PARTS 1&3)
 
6. FREE ALLOCATED RESOURCES (FROM PARTS 1&3)
  
<code>skinInfoArray->ResetAndDestroy();         
+
<code cpp>skinInfoArray->ResetAndDestroy();         
 
CleanupStack::PopAndDestroy( 2 ); // skinsSession, skinInfoArray
 
CleanupStack::PopAndDestroy( 2 ); // skinsSession, skinInfoArray
 
</code>
 
</code>

Revision as of 14:20, 28 May 2007

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-in package for S60 3rd Edition SDK for Symbian OS, for C++, MR, Version 3 from here to gain access to the needed APIs.

At the time of writing, the API plugin is only available for S60 3rd MR.

1. CONNECT TO SKIN SERVER

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

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


2. 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 );
}

3. 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 );

4. 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;
}
}
}

5. 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;
}

6. FREE ALLOCATED RESOURCES (FROM PARTS 1&3)

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

7. NECESSARY CAPABILITIES

WriteDeviceData
251 page views in the last 30 days.