Revision: 201011 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 21:31:25 +0300
branchRCL_3
changeset 11 bc161388e3ce
parent 10 b79ee333c41d
child 12 2854d7196aaf
Revision: 201011 Kit: 201013
package_definition.xml
profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileFileListSettingItem.cpp
profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileSettingsContainer.cpp
profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileToneHandler.cpp
profilesapplication/Profiles/ProfileApp/SettingsViewSrc/ProfileMmfInfoUtility.cpp
profilesapplication/Profiles/ProfileApp/SettingsViewSrc/ProfileMmfInfoUtility.h
profilesapplication/Profiles/ProfileApp/group/ProfileSettingsView.mmp
profilesapplication/Profiles/ProfileApp/loc/ProfileApp.loc
--- a/package_definition.xml	Mon Mar 15 12:40:33 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
-  <package id="profile" name="Profiles" levels="app">
-    <collection id="profilesapplication" name="Profiles Application" level="app">
-      <component id="profiles" filter="s60" name="Profiles">
-        <unit bldFile="profilesapplication/profiles/group"/>
-        	<!-- this can only have one unit. can the test be #included? -->
-        <unit bldFile="profilesapplication/profiles/profileapp/tsrc/public/basic/group"/>
-        	<!-- should these be #included? -->
-        <!-- <unit bldFile="profilesapplication/profiles/gsprofilesplugin/group"/> -->
-        <!-- <unit bldFile="profilesapplication/profiles/profileaiwprovider/group"/> -->
-        <!-- <unit bldFile="profilesapplication/profiles/profileapp/group"/> -->
-        <!-- <unit bldFile="profilesapplication/profiles/profilesgstonesplugin/group"/> -->
-      </component>
-      <component id="profilesapplication_test" filter="s60" purpose="development" name="Profiles Application Test">
-      <!-- does this need to be built? -->
-        <!-- <unit bldFile="profilesapplication/tsrc/public/basic/group"/> -->
-      </component>
-      <component id="profile_help" filter="s60" name="Profiles Help">
-        <unit bldFile="help/group"/>
-      </component>
-    </collection>
-    <collection id="profile_info" name="Profiles Info" level="app">
-      <component id="profile_plat" filter="s60" name="Profiles Platform Interfaces" class="api">
-        <unit bldFile="profile_plat/group"/>
-      </component>
-    </collection>
-  </package>
-</SystemDefinition>
--- a/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileFileListSettingItem.cpp	Mon Mar 15 12:40:33 2010 +0200
+++ b/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileFileListSettingItem.cpp	Wed Mar 31 21:31:25 2010 +0300
@@ -30,6 +30,7 @@
 #include <ProfileSettingsView.rsg>
 #include <data_caging_path_literals.hrh>
 #include <CLFContentListing.hrh>	// For TCLFMediaType::ECLFMediaTypeVideo
+#include <featdiscovery.h> // CFeatureDiscovery
 
 // for mediafilelist
 #include <mediafilelist.h>
@@ -193,9 +194,13 @@
         }
        
     // Size limit for voice call tone files
+    // Messaging tone size is also limited if the
+    // "FF_LIMITED_MESSAGE_AND_ALARM_TONE_SIZE" feature flag is enabled
     if ( id == EProfileSettingRingingToneId      ||
          id == EProfileSettingRingingToneLine1Id ||
-         id == EProfileSettingRingingToneLine2Id )
+         id == EProfileSettingRingingToneLine2Id ||
+         ( id == EProfileSettingMessageAlertToneId &&
+           CFeatureDiscovery::IsFeatureSupportedL( KFeatureIdFfLimitedMessageAndAlarmToneSize ) ) )
         {
         TInt sizeLimitKB = 0;
         CRepository* cenrep = CRepository::NewL( KCRUidProfileEngine );
@@ -204,7 +209,6 @@
         CleanupStack::PopAndDestroy(); // cenrep
 
         list->SetAttrL( CMediaFileList::EAttrFileSize, sizeLimitKB );
-        
 
         }
 
--- a/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileSettingsContainer.cpp	Mon Mar 15 12:40:33 2010 +0200
+++ b/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileSettingsContainer.cpp	Wed Mar 31 21:31:25 2010 +0300
@@ -51,6 +51,7 @@
 #include    <featmgr.h>
 #include    <MProfileExtended.h>
 
+#include    <MProfileTones.h>
 #include    <MProfile3DToneSettings.h>
 #include    <MProfileFeedbackSettings.h>
 #include    <MProfileExtraSettings.h>
@@ -76,6 +77,7 @@
 #include    <psmsrvdomaincrkeys.h>
 #include    <e32property.h>
 #include    <ProfileEnginePrivatePSKeys.h>
+#include    <TProfileToneSettings.h>
 
 namespace
 	{
@@ -536,7 +538,9 @@
     CAknSettingItemArray* array = SettingItemArray();
     TUint32 flags( iProfile->VisibleFlags() );
     TInt profileId( 0 );
-
+	const MProfileTones& tones = iProfile->ProfileTones();
+	const TProfileToneSettings& toneSettings = tones.ToneSettings();
+	
     TBool hide3DEcho = EFalse;
     TInt effect = iProfile->ProfileExtraSettings().Profile3DToneSettings().Effect();
     if ( effect == EProfile3DEffectOff || effect == EProfile3DEffectStereoWidening )
@@ -614,10 +618,17 @@
 		
 	SetItemHidden( EProfileSettingVibratingAlertId, array,
         ~flags & EProfileFlagVibratingAlert );
-        
-	SetItemHidden( EProfileSettingEmailVibratingAlertId, array,
-        ~flags & EProfileFlagVibratingAlert );
-    SetItemHidden( EProfileSettingKeypadVolumeId, array,
+
+	if(!iCopyProfile->iVibratingAlert)
+	   {
+	   SetItemHidden( EProfileSettingEmailVibratingAlertId, array,ETrue );	
+	   }
+	else
+	   {
+	   SetItemHidden( EProfileSettingEmailVibratingAlertId, array,EFalse );
+	   }         
+
+	SetItemHidden( EProfileSettingKeypadVolumeId, array,
         ~flags & EProfileFlagKeypadVolume );
         
     SetItemHidden( EProfileSettingWarningAndGameTonesId, array,
@@ -788,7 +799,13 @@
     	{
     	iIndexHandler->StoreIndices();
     	}
-
+    
+    TInt vibratingAlert = iCopyProfile->iVibratingAlert;
+    if( identifier == EProfileSettingVibratingAlertId && iIndexHandler )
+      	{
+      	iIndexHandler->StoreIndices();
+      	}
+    
     // Set boolean value to ETrue that we know that the settings container
     // is in editing mode.
     iItemEdited = ETrue;
@@ -834,6 +851,11 @@
             {
             UpdateSettingsL( EFalse );  // hide 3DEcho if 3DEffect is off
             }
+        
+        if ( vibratingAlert != iCopyProfile->iVibratingAlert )
+          	{
+          	UpdateSettingsL( EFalse ); //hide emailVibrating alert if vibrating alert is off
+           	}
         }
     // If the setting is an external (= only in Tones View):
     iExternalSettingsHandler.StoreIfChangedL( identifier );
--- a/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileToneHandler.cpp	Mon Mar 15 12:40:33 2010 +0200
+++ b/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/CProfileToneHandler.cpp	Wed Mar 31 21:31:25 2010 +0300
@@ -463,15 +463,15 @@
 		}
 		
 	// Check whether file is supported by MMF
-    TBuf8<KMaxDataTypeLength> tempDataType;
-    tempDataType.Copy( dataType );
-
-    if( !ProfileMmfInfoUtility::IsMimeTypeSupportedL( tempDataType ) )
-    	{
-    	// File is not supported by MMF
-    	return KErrNotSupported;
-    	}
-
+	TBuf8<KMaxDataTypeLength> tempDataType;
+	tempDataType.Copy( dataType );
+    if (!ProfileMmfInfoUtility::IsMimeTypeSupportedL(tempDataType)
+			&& !ProfileMmfInfoUtility::IsHeaderDataSupportedL(aFileName))
+		{
+		// File is not supported by MMF
+		return KErrNotSupported;
+		}
+    
 	// Operator requirement. Check if the tones of this data type are blocked:
     if( iProfilesFeatures->IsBlockedType( dataType ) ||
         iProfilesFeatures->IsExcludedType( dataType ) )
--- a/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/ProfileMmfInfoUtility.cpp	Mon Mar 15 12:40:33 2010 +0200
+++ b/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/ProfileMmfInfoUtility.cpp	Wed Mar 31 21:31:25 2010 +0300
@@ -27,7 +27,7 @@
 #include <e32std.h>
 #include <badesca.h>
 #include <mmf/common/mmfcontrollerpluginresolver.h>
-
+#include <caf/caf.h>
 namespace
 	{
 	// CONSTANTS
@@ -88,5 +88,72 @@
     return result;
     }
 
+// -----------------------------------------------------------------------------
+// CProfileMmfInfoUtility::IsHeaderDataSupportedL
+// -----------------------------------------------------------------------------
+//
+TBool ProfileMmfInfoUtility::IsHeaderDataSupportedL( const TDesC& aFileName )
+	{
+	TBool result( EFalse );
+	//the max header length is 256 bytes
+	const TInt KMaxHeaderLength( 256 );
+	HBufC8* header = HBufC8::NewLC( KMaxHeaderLength );
+	TPtr8 headerPtr = header->Des();
+	GetFileHeaderDataL( aFileName, headerPtr, KMaxHeaderLength );
+	CMMFFormatSelectionParameters* formatPrms =
+			CMMFFormatSelectionParameters::NewLC();
+	CMMFControllerPluginSelectionParameters* controllerPrms =
+			CMMFControllerPluginSelectionParameters::NewLC();
+
+	// Empty format parameters means: "get all the supported formats"
+	controllerPrms->SetRequiredPlayFormatSupportL( *formatPrms );
+	RMMFControllerImplInfoArray cntrlArray;
+	controllerPrms->ListImplementationsL( cntrlArray );
+
+	for ( TInt i( cntrlArray.Count() - 1 ); i >= 0 && !result; --i )
+		{
+		const RMMFFormatImplInfoArray& infoArray( cntrlArray[i]->PlayFormats() );
+
+		for ( TInt j(infoArray.Count() - 1); j >= 0; --j )
+			{
+			if ( infoArray[j]->SupportsHeaderDataL( *header ) )
+				{
+				result = ETrue;
+				break;
+				}
+			}
+		}
+
+	cntrlArray.ResetAndDestroy();
+	cntrlArray.Close();
+	CleanupStack::PopAndDestroy( 3, header );//controllerPrms, formatPrms and header
+
+	return result;
+	}
+
+// -----------------------------------------------------------------------------
+// CProfileMmfInfoUtility::GetFileHeaderDataL
+// -----------------------------------------------------------------------------
+//
+void ProfileMmfInfoUtility::GetFileHeaderDataL( const TDesC& aFileName,
+		TDes8& aHeaderData, TInt aMaxHeaderLength )
+	{
+	TInt error = KErrNone;
+	using namespace ContentAccess;
+	TVirtualPathPtr path( aFileName, ContentAccess::KDefaultContentObject );
+	CData* data = CData::NewLC( path, EContentShareReadWrite );
+	TInt size = 0;
+	data->DataSizeL( size );
+	if ( size > 0 )
+		{
+		if ( size > aMaxHeaderLength )
+			size = aMaxHeaderLength;
+		TInt pos = 0;
+		error = data->Seek( ESeekStart, pos );
+		error = data->Read( aHeaderData, size );
+		}
+	CleanupStack::PopAndDestroy(); // data
+	}
+
 //  End of File
 
--- a/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/ProfileMmfInfoUtility.h	Mon Mar 15 12:40:33 2010 +0200
+++ b/profilesapplication/Profiles/ProfileApp/SettingsViewSrc/ProfileMmfInfoUtility.h	Wed Mar 31 21:31:25 2010 +0300
@@ -45,6 +45,15 @@
          *         EFalse otherwise.
          */
         static TBool IsMimeTypeSupportedL( const TDesC8& aMimeType );
+        
+        /**
+         * Checks if the given file's header data is supported 
+         * by MMF, especially for m4a drm files.
+         * @param aFileName the name of the file to be judged.
+         * @return ETrue if the given file is supported by MMF,
+         *         EFalse otherwise.
+         */
+        static TBool IsHeaderDataSupportedL( const TDesC& aFileName );
 
     private:  // Constructor and destructor
 
@@ -56,6 +65,15 @@
 
         // Destructor.
         ~ProfileMmfInfoUtility() {};
+        
+        //internal use
+        /**
+         * Get the header data of the file
+         * @param aFileName specifies the name of the file.
+         * @param aHeaderData contains the header data of the file.
+         * @param aMaxLength the length of header data.         
+         */
+        static void GetFileHeaderDataL(const TDesC& aFileName, TDes8& aHeaderData, TInt aMaxLength);
     };
 
 #endif      // PROFILEMMFINFOUTILITY_H
--- a/profilesapplication/Profiles/ProfileApp/group/ProfileSettingsView.mmp	Mon Mar 15 12:40:33 2010 +0200
+++ b/profilesapplication/Profiles/ProfileApp/group/ProfileSettingsView.mmp	Wed Mar 31 21:31:25 2010 +0300
@@ -73,6 +73,7 @@
 LIBRARY         cntmodel.lib // Contact database
 LIBRARY         pbkeng.lib // Phone Book contact engine
 LIBRARY         commonengine.lib // Shared data
+LIBRARY         featdiscovery.lib // CFeatureDiscovery
 LIBRARY         featmgr.lib // Feature Manager
 LIBRARY         sssettings.lib // Phone settings (Alternate Line Service)
 LIBRARY         mediaclientaudio.lib // MultiMedia Framework, audio client
--- a/profilesapplication/Profiles/ProfileApp/loc/ProfileApp.loc	Mon Mar 15 12:40:33 2010 +0200
+++ b/profilesapplication/Profiles/ProfileApp/loc/ProfileApp.loc	Wed Mar 31 21:31:25 2010 +0300
@@ -48,11 +48,11 @@
 //l: list_setting_pane_t1
 #define qtn_mode_vt_tone "Video Call tone"
 
-// d:Error note shown when ringing tone can't be set
+// d:Error note shown when a tone can't be set
 // d:because tone maximum file size is exceeded.
 // l:popup_note_window
 // r:3.1
-#define qtn_profiles_tone_maxsize_error "Files larger than %N KB cannot be set as ringing tone"
+#define qtn_profiles_tone_maxsize_error "Unable to use tone. File size exceeds %N kB."
 
 //d: Profile settings list item for ringing type
 //l: list_setting_pane_t1