Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
This page was last modified 15:43, 23 June 2008.

Handle Profile Activation

From Forum Nokia Wiki

You can get notifocations for profile activations and handle them inside your applications.

In Header File

#include <settinginfo.h>	// CSettingInfo
#include <settinginfoids.h>	// CSettingInfo ID's
 
//Implement MSettingInfoObserver interface
 
class MyClass:public MSettingInfoObserver 
{
/*
 * Notification handler method
 *
 * param aID			is the ID of changed setting
 *
 * param aNewValue		is the new value of the changed setting
 * given as text, and to be (possibly) 
 *converted into an integer when needed 
 */
		
void HandleNotificationL( SettingInfo::TSettingID aID,
const TDesC& aNewValue );
 
private:
 
CSettingInfo*				iSettings;
}

In the CPP File

CMyClass::ConstructL()
{
     // Create a new instance of CSettingInfo. All profile 
	// non observalbe properties (all except the profile
	// index) are read using this instance
 
	iSettings = CSettingInfo::NewL(this);
 
   // Order notifications when profile is changed
	TInt err = iSettings->NotifyChanges(SettingInfo::EActiveProfile);
	if(err != KErrNone)
	{
	  // an error occured, show message to user
	  //iView->ShowMessageL(KErrOrderingProfileChangeNotifies);
 
	}
 
}
 
 
//=========================================================================
//
//
//
//
//==========================================================================
 
 
void CMyClass::HandleNotificationL(SettingInfo::TSettingID aID, 
const TDesC& aNewValue )
{
	TInt err(0);
	switch(aID)
	{
	case SettingInfo::EActiveProfile:
		{
			// First, parse the NEW active profile index 
			// out from the value string by using TLex
			//TInt profileIdx(iProperties.profileIndex);
			//this->iapp->InForeGround();
 
			TLex parsed(aNewValue);
			TInt value;
 
			if ( (err = parsed.Val(value)) == KErrNone )
			{
                            //Parsing successful
 
                           if(value==0)
                           //"General" Profile is Activated
                           if(value==1)
                           //"Silent" Profile is Activated
                          if(value==2)
                           //"meeting" Profile is Activated
                          if(value==3)
                           //"Outdoor" Profile is Activated
                          if(value==4)
                           //"Pager" Profile is Activated
                          if(value==5)
                           //"Offline" Profile is Activated
 
 
			}
			else 
			{
				// parsing failed.....
 
			}
		break;
	  }
 
	default:
		break;
	}
}
 
Powered by MediaWiki
RDF Facets: qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX