Changing profile programmatically in Qt
This article provides an API which you can use to read and set the standard Symbian device profiles from your Qt application.
The Profile API can be used for changing between different profiles and also for fetching the current active profile. The main class of the API is XQProfile. The API only works for the predefined profiles so custom profiles are not supported. The API does not provide methods for creating new profiles or modifying profiles that are not predefined. This code snippets/example shows how to change profile programmatically using a convenience API that calls functions in Symbian C++. Note that if you just want to read the profile you should use the Qt Mobility API QSystemDeviceInfo
The method setActiveProfile() of class XQProfile will change profile to given parameter. This snippet requires WriteUserData capability. Self-signing is not possible because a Developer certificate is needed.
Add following lines to your .pro file.
symbian:LIBS += -lprofileengine \
symbian:TARGET.CAPABILITY += WriteDeviceData
/* initialize XQProfile */
XQProfile* profile = new XQProfile(this);
/* to set the profile to General */
bool result = profile->setActiveProfile(XQProfile::ProfileGeneral);
/* to set the profile to Silent */
bool result = profile->setActiveProfile(XQProfile::ProfileSilent);
Tested on device
This application has been tested on Nokia 5800 XpressMusic.
Download Code Example
- Original source code can be downloaded from here : QtProfile.Zip