Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 11:39, 24 August 2007.

TSS000456 - Changing the active theme

From Forum Nokia Wiki


Subject:

Changing the active theme TSS000456

 

Platform(s): Device(s), SW version(s):
S60 3rd Edition  

Category:

Symbian C++

Subcategory:

-

Description:

Description:
The S60 3rd Edition SDK does not provide a way to activate a specific theme from 3rd-party applications.
However, the required API (Skin Server API) is part of the Extensions plug-in package for S60 3rd Edition SDK.
Solution:
To change the active theme:
1. Connect to Skin Server.  
    #include <AknSSrvClient.h> // link against aknskinsrv.lib
    RAknsSrvSession skinsSession;
    User::LeaveIfError( skinsSession.Connect( this ) );
    CleanupClosePushL( skinsSession );
2. Fetch the package ID of the current skin.
    #include <centralrepository.h> // link against centralrepository.lib
    #include <AknSkinsInternalCRKeys.h>
    void CMyThemeManager::StoreCurrentSkinIdL()
        {
        TAknsPkgIDBuf pidBuf;       
        CRepository* repository = CRepository::NewL(KCRUidPersonalisation );               
        TInt retVal = repository->Get( KPslnActiveSkinUid, pidBuf );
        delete repository;
        repository = NULL;
        iOriginalSkinPid.SetFromDesL( pidBuf ); // iOriginalSkinPid is of type TAknsPkgID
        }
3. Get a list of installed skin packages.
    CArrayPtr<CAknsSrvSkinInformationPkg>* skinInfoArray =
                skinsSession.EnumerateSkinPackagesL();
    CleanupStack::PushL( skinInfoArray );
4. Go through installed packages and switch to the first available new skin.
    TInt retValue( KErrNone );
    if ( skinInfoArray->Count() > 0 )
        {
        for ( TInt i = 0; i < skinInfoArray->Count(); i++ )
            {
            TAknsPkgID pkgId = skinInfoArray->At( i )->PID();
            if ( pkgId != iOriginalSkinPid )
                {
                // Activates a complete skin package
                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 value needs to be updated
        // if the new skin resides on memory card and the
        // previous one resided in phone memory (and vice versa)   
        delete repository;
        repository = NULL;
        }

Creation date:

October 19, 2006

Last modified:

June 4, 2007
Related Discussions
Thread Thread Starter Forum Replies Last Post
Series 60 Theme Studio...how can i sign my themes ? MIsterSCOTCH Digital Rights Management & Content Downloading 0 2005-06-30 18:14
S40 Theme Studio freeze dress Themes/Carbide.ui 2 2007-03-20 22:06
Problem on S60 Theme Studio Chiwinglam Graphics & Video & Streaming 4 2005-12-22 20:13
Theme maker 2.2 platform 40 series cillie Themes/Carbide.ui 4 2007-05-04 19:19
Theme Studio 2.2 diego_dj General Discussion 2 2007-05-21 13:28
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZKnowledgeBaseContentQ
     qfnZtypeQUqfnTypeZTechnicalSolutionQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX