profilesservices/ProfileEngine/EngSrc/CProfileExtraTonesImpl.cpp
changeset 68 13e71d907dc3
parent 36 48848d132687
equal deleted inserted replaced
40:6465d5bb863a 68:13e71d907dc3
    17 
    17 
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include "CProfileExtraTonesImpl.h"
    21 #include "CProfileExtraTonesImpl.h"
       
    22 #include "ProfilesVariant.hrh"
       
    23 #include <s32strm.h>
       
    24 #include <centralrepository.h>
    22 #include "ProfileEngUtils.h"
    25 #include "ProfileEngUtils.h"
    23 #include "ProfileEnginePrivateCRKeys.h"
    26 #include "ProfileEnginePrivateCRKeys.h"
    24 #include <ProfilesVariant.hrh>
       
    25 #include <s32strm.h>
       
    26 #include <centralrepository.h>
       
    27 
    27 
    28 // ============================ MEMBER FUNCTIONS ===============================
    28 // ============================ MEMBER FUNCTIONS ===============================
    29 
    29 
    30 // -----------------------------------------------------------------------------
    30 // -----------------------------------------------------------------------------
    31 // CProfileExtraTonesImpl::ConstructL
    31 // CProfileExtraTonesImpl::ConstructL
    35 void CProfileExtraTonesImpl::ConstructL()
    35 void CProfileExtraTonesImpl::ConstructL()
    36     {
    36     {
    37     iIMMessageAlertTone = KNullDesC().AllocL();
    37     iIMMessageAlertTone = KNullDesC().AllocL();
    38     iEmailAlertTone = KNullDesC().AllocL();
    38     iEmailAlertTone = KNullDesC().AllocL();
    39     iVideoCallRingingTone = KNullDesC().AllocL();
    39     iVideoCallRingingTone = KNullDesC().AllocL();
    40     iReminderTone = KNullDesC().AllocL();
       
    41     iClockAlarmTone = KNullDesC().AllocL();
       
    42     }
    40     }
    43 
    41 
    44 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
    45 // CProfileExtraTonesImpl::ConstructL
    43 // CProfileExtraTonesImpl::ConstructL
    46 // Symbian 2nd phase constructor can leave.
    44 // Symbian 2nd phase constructor can leave.
    47 // -----------------------------------------------------------------------------
    45 // -----------------------------------------------------------------------------
    48 //
    46 //
    49 void CProfileExtraTonesImpl::ConstructL(
    47 void CProfileExtraTonesImpl::ConstructL(
    50     const MProfileExtraTones2& aProfileExtraTones )
    48     const MProfileExtraTones& aProfileExtraTones )
    51     {
    49     {
    52     iIMMessageAlertTone = aProfileExtraTones.IMMessageAlertTone().AllocL();
    50     iIMMessageAlertTone = aProfileExtraTones.IMMessageAlertTone().AllocL();
    53     iEmailAlertTone = aProfileExtraTones.EmailAlertTone().AllocL();
    51     iEmailAlertTone = aProfileExtraTones.EmailAlertTone().AllocL();
    54     iVideoCallRingingTone =
    52     iVideoCallRingingTone =
    55         aProfileExtraTones.VideoCallRingingTone().AllocL();
    53         aProfileExtraTones.VideoCallRingingTone().AllocL();
    56     iReminderTone = aProfileExtraTones.ReminderTone().AllocL();
       
    57     iClockAlarmTone = aProfileExtraTones.ClockAlarmTone().AllocL();
       
    58     }
    54     }
    59 
    55 
    60 // -----------------------------------------------------------------------------
    56 // -----------------------------------------------------------------------------
    61 // CProfileExtraTonesImpl::NewL
    57 // CProfileExtraTonesImpl::NewL
    62 // Two-phased constructor.
    58 // Two-phased constructor.
    77 // CProfileExtraTonesImpl::NewL
    73 // CProfileExtraTonesImpl::NewL
    78 // Two-phased constructor.
    74 // Two-phased constructor.
    79 // -----------------------------------------------------------------------------
    75 // -----------------------------------------------------------------------------
    80 //
    76 //
    81 CProfileExtraTonesImpl* CProfileExtraTonesImpl::NewL(
    77 CProfileExtraTonesImpl* CProfileExtraTonesImpl::NewL(
    82     const MProfileExtraTones2& aProfileExtraTones )
    78     const MProfileExtraTones& aProfileExtraTones )
    83     {
    79     {
    84     CProfileExtraTonesImpl* self = new( ELeave ) CProfileExtraTonesImpl;
    80     CProfileExtraTonesImpl* self = new( ELeave ) CProfileExtraTonesImpl;
    85 
    81 
    86     CleanupStack::PushL( self );
    82     CleanupStack::PushL( self );
    87     self->ConstructL( aProfileExtraTones );
    83     self->ConstructL( aProfileExtraTones );
    95 CProfileExtraTonesImpl::~CProfileExtraTonesImpl()
    91 CProfileExtraTonesImpl::~CProfileExtraTonesImpl()
    96     {
    92     {
    97     delete iIMMessageAlertTone;
    93     delete iIMMessageAlertTone;
    98     delete iEmailAlertTone;
    94     delete iEmailAlertTone;
    99     delete iVideoCallRingingTone;
    95     delete iVideoCallRingingTone;
   100     delete iReminderTone;
       
   101     delete iClockAlarmTone;
       
   102     }
    96     }
   103 
    97 
   104 
    98 
   105 // -----------------------------------------------------------------------------
    99 // -----------------------------------------------------------------------------
   106 // CProfileExtraTonesImpl::InternalizeL
   100 // CProfileExtraTonesImpl::InternalizeL
   137     // Video call ringing tone
   131     // Video call ringing tone
   138     User::LeaveIfError(
   132     User::LeaveIfError(
   139             aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
   133             aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
   140             aProfileId ), toneFile ) );
   134             aProfileId ), toneFile ) );
   141     iVideoCallRingingTone = toneFile.AllocL();
   135     iVideoCallRingingTone = toneFile.AllocL();
   142     
       
   143     delete iReminderTone;
       
   144     iReminderTone = NULL;
       
   145     
       
   146     // Reminder tone
       
   147     User::LeaveIfError(
       
   148             aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngReminderTone,
       
   149             aProfileId ), toneFile ) );
       
   150     iReminderTone = toneFile.AllocL();
       
   151     
       
   152     delete iClockAlarmTone;
       
   153     iClockAlarmTone = NULL;
       
   154     
       
   155     // Clock alarm tone
       
   156     User::LeaveIfError(
       
   157             aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngClockAlarmTone,
       
   158             aProfileId ), toneFile ) );
       
   159     iClockAlarmTone = toneFile.AllocL();
       
   160     }
   136     }
   161 
   137 
   162 // -----------------------------------------------------------------------------
   138 // -----------------------------------------------------------------------------
   163 // CProfileExtraTonesImpl::ExternalizeL
   139 // CProfileExtraTonesImpl::ExternalizeL
   164 //
   140 //
   180 
   156 
   181     // Video call ringing tone
   157     // Video call ringing tone
   182     User::LeaveIfError(
   158     User::LeaveIfError(
   183             aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
   159             aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
   184             aProfileId ), *iVideoCallRingingTone ) );
   160             aProfileId ), *iVideoCallRingingTone ) );
   185     
       
   186     // Reminder Tone
       
   187     User::LeaveIfError(
       
   188             aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngReminderTone,
       
   189             aProfileId ), *iReminderTone ) );
       
   190     
       
   191     // Clock Alarm Tone
       
   192     User::LeaveIfError(
       
   193             aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngClockAlarmTone,
       
   194             aProfileId ), *iClockAlarmTone ) );
       
   195     }
   161     }
   196 
   162 
   197 // -----------------------------------------------------------------------------
   163 // -----------------------------------------------------------------------------
   198 // CProfileExtraTonesImpl::IMMessageAlertTone
   164 // CProfileExtraTonesImpl::IMMessageAlertTone
   199 //
   165 //
   267     HBufC* tmp = aRingingTone.Left( KMaxFileName ).AllocL();
   233     HBufC* tmp = aRingingTone.Left( KMaxFileName ).AllocL();
   268     delete iVideoCallRingingTone;
   234     delete iVideoCallRingingTone;
   269     iVideoCallRingingTone = tmp;
   235     iVideoCallRingingTone = tmp;
   270     }
   236     }
   271 
   237 
   272 
       
   273 
       
   274 // -----------------------------------------------------------------------------
       
   275 // CProfileExtraTonesImpl::ReminderTone
       
   276 //
       
   277 // (other items were commented in a header).
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 const TDesC& CProfileExtraTonesImpl::ReminderTone() const
       
   281     {
       
   282     return *iReminderTone;
       
   283     }
       
   284 
       
   285 // -----------------------------------------------------------------------------
       
   286 // CProfileExtraTonesImpl::SetReminderToneL
       
   287 //
       
   288 // (other items were commented in a header).
       
   289 // -----------------------------------------------------------------------------
       
   290 //
       
   291 void CProfileExtraTonesImpl::SetReminderToneL( 
       
   292         const TDesC& aReminderTone )
       
   293     {
       
   294     HBufC* tmp = aReminderTone.Left( KMaxFileName ).AllocL();
       
   295     delete iReminderTone;
       
   296     iReminderTone = tmp;
       
   297     }
       
   298 
       
   299 // -----------------------------------------------------------------------------
       
   300 // CProfileExtraTonesImpl::ClockAlarmTone
       
   301 //
       
   302 // (other items were commented in a header).
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 const TDesC& CProfileExtraTonesImpl::ClockAlarmTone() const
       
   306     {
       
   307     return *iClockAlarmTone;
       
   308     }
       
   309 
       
   310 // -----------------------------------------------------------------------------
       
   311 // CProfileExtraTonesImpl::SetClockAlarmToneL
       
   312 //
       
   313 // (other items were commented in a header).
       
   314 // -----------------------------------------------------------------------------
       
   315 //
       
   316 void CProfileExtraTonesImpl::SetClockAlarmToneL( 
       
   317         const TDesC& aClockAlarmTone )
       
   318     {
       
   319     HBufC* tmp = aClockAlarmTone.Left( KMaxFileName ).AllocL();
       
   320     delete iClockAlarmTone;
       
   321     iClockAlarmTone = tmp;    
       
   322     }
       
   323 
       
   324 //  End of File
   238 //  End of File