profilesservices/ProfileEngine/WrapperSrc/CProEngTonesImpl.h
changeset 0 8c5d936e5675
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  This class implements MProEngTones interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CPROENGTONESIMPL_H
       
    21 #define CPROENGTONESIMPL_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <MProEngTones.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class MProfileTones;
       
    29 class MProfileSetTones;
       
    30 class MProfileExtraTones;
       
    31 class MProfileSetExtraTones;
       
    32 class CProEngToneHandler;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 * This class implements MProEngTones interface.
       
    38 *
       
    39 *  @lib ProfileEngine.lib
       
    40 *  @since 3.1
       
    41 */
       
    42 NONSHARABLE_CLASS( CProEngTonesImpl ) : public CBase,
       
    43                                         public MProEngTones
       
    44     {
       
    45     public:  // Constructors and destructor
       
    46 
       
    47         /**
       
    48          * Two-phased constructor.
       
    49          */
       
    50         static CProEngTonesImpl* NewL(
       
    51             const MProfileTones& aProfileTones,
       
    52             MProfileSetTones& aProfileSetTones,
       
    53             const MProfileExtraTones& aProfileExtraTones,
       
    54             MProfileSetExtraTones& aProfileSetExtraTones,
       
    55             TUint32 aModifiableFlags );
       
    56 
       
    57         /**
       
    58          * Destructor.
       
    59          */
       
    60         virtual ~CProEngTonesImpl();
       
    61 
       
    62     public:
       
    63 
       
    64         /**
       
    65          * From MProEngTones
       
    66          */
       
    67         const TDesC& RingingTone1() const;
       
    68 
       
    69         /**
       
    70          * From MProEngTones
       
    71          */
       
    72         const TDesC& RingingTone2() const;
       
    73 
       
    74         /**
       
    75          * From MProEngTones
       
    76          */
       
    77         const TDesC& MessageAlertTone() const;
       
    78 
       
    79         /**
       
    80          * From MProEngTones
       
    81          */
       
    82         const TDesC& EmailAlertTone() const;
       
    83 
       
    84         /**
       
    85          * From MProEngTones
       
    86          */
       
    87         const TDesC& VideoCallRingingTone() const;
       
    88 
       
    89         /**
       
    90          * From MProEngTones
       
    91          */
       
    92         TInt SetRingingTone1L( const TDesC& aRingingTone );
       
    93 
       
    94         /**
       
    95          * From MProEngTones
       
    96          */
       
    97         TInt SetRingingTone2L( const TDesC& aRingingTone );
       
    98 
       
    99         /**
       
   100          * From MProEngTones
       
   101          */
       
   102         TInt SetMessageAlertToneL( const TDesC& aMessageAlertTone );
       
   103 
       
   104         /**
       
   105          * From MProEngTones
       
   106          */
       
   107         TInt SetEmailAlertToneL( const TDesC& aEmailAlertTone );
       
   108 
       
   109         /**
       
   110          * From MProEngTones
       
   111          */
       
   112         TInt SetVideoCallRingingToneL( const TDesC& aRingingTone );
       
   113 
       
   114     public:  // New functions
       
   115 
       
   116         /**
       
   117          * Checks the tones that have been modified by client, so that the
       
   118          * values in them are legal. This method is called from CommitChangeL()
       
   119          * of CProEngProfileImpl.
       
   120          * @since 3.1
       
   121          * @param aToneHandler Tone handler needed for checking the legality
       
   122          *        of the tones.
       
   123          * @return KErrNone if all the tones set are correct,
       
   124          *         KErrNotFound if a tone file cannot be found,
       
   125          *         KErrNotSupported if a file is of an unsupported type or
       
   126          *         KErrPermissionDenied if the file is not allowed
       
   127          *         to be used as a ringing or alert tone.
       
   128          *         KErrGeneral if DRM rights are insufficient.
       
   129 		 *		   KErrArgument if the file is DRM protected audio/MP4 and
       
   130          *		   those are not allowed as alert tones.
       
   131          */
       
   132         TInt CheckTonesL( CProEngToneHandler& aToneHandler );
       
   133 
       
   134         /**
       
   135          * Handles removing of the old tones from the automated content list and
       
   136          * adding of the new tones to the automated content list. This method is
       
   137          * called from CommitChangeL() of CProEngProfileImpl after the changes
       
   138          * has been committed in the underlying Profiles Engine.
       
   139          * @since 3.1
       
   140          * @param aToneHandler Tone handler needed for making the actual auto-
       
   141          *        mated content handling for the tones.
       
   142          *        of the tones.
       
   143          * @param aOldTones contains the tones that are currently set as alert
       
   144          *        tones for the same profile.
       
   145          * @return KErrNone if succesful, otherwise a system wide error code.
       
   146          */
       
   147         TInt HandleAutomatedContent( CProEngToneHandler& aToneHandler,
       
   148                                       const CProEngTonesImpl& aOldTones );
       
   149 
       
   150     private:
       
   151 
       
   152         /**
       
   153          * Replaces KNullDesC with the path to the empty tone.
       
   154          * @since 3.1
       
   155          * @param aTone The tone that is converted if it is KNullDesC.
       
   156          * @return The path to the empty tone if aTone is KNullDesC, otherwise
       
   157          *         the original tone.
       
   158          */
       
   159         const TDesC& ConvertKNullToEmptyTone( const TDesC& aTone ) const;
       
   160 
       
   161     private:
       
   162 
       
   163         /**
       
   164          * C++ constructor.
       
   165          */
       
   166         CProEngTonesImpl( const MProfileTones& aProfileTones,
       
   167                           MProfileSetTones& aProfileSetTones,
       
   168                           const MProfileExtraTones& aProfileExtraTones,
       
   169                           MProfileSetExtraTones& aProfileSetExtraTones,
       
   170                           TUint32 aModifiableFlags );
       
   171 
       
   172         /**
       
   173         * By default Symbian 2nd phase constructor is private.
       
   174         */
       
   175         void ConstructL();
       
   176 
       
   177     private:    // Data
       
   178 
       
   179         // Ref: the interface to the implementation of the profile tones
       
   180         const MProfileTones& iProfileTones;
       
   181 
       
   182         // Ref: the interface to the implementation of the profile set tones
       
   183         MProfileSetTones& iProfileSetTones;
       
   184 
       
   185         // Ref: the interface to the implementation of the profile extra tones
       
   186         const MProfileExtraTones& iProfileExtraTones;
       
   187 
       
   188         // Ref: the interface to the implementation of the set extra tones
       
   189         MProfileSetExtraTones& iProfileSetExtraTones;
       
   190 
       
   191         // Flags to check is modification allowed:
       
   192         TUint32 iModifiableFlags;
       
   193 
       
   194         // Flags that tell which of the tones have been modified by the client
       
   195         TUint32 iModifiedFlags;
       
   196 
       
   197         // Null tone.
       
   198         TBuf<1> iNullTone;
       
   199 
       
   200         // Own: Path to empty tone
       
   201         HBufC* iEmptyTone;
       
   202 
       
   203     };
       
   204 
       
   205 #endif      //  CPROENGTONESIMPL_H
       
   206 
       
   207 // End of File
       
   208