profilesservices/ProfileEngine/EngSrc/CProfileExtraTonesImpl.cpp
changeset 36 48848d132687
parent 32 20bd089f4aaa
child 68 13e71d907dc3
equal deleted inserted replaced
35:159cfcd3c1c5 36:48848d132687
    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();
    40     }
    42     }
    41 
    43 
    42 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    43 // CProfileExtraTonesImpl::ConstructL
    45 // CProfileExtraTonesImpl::ConstructL
    44 // Symbian 2nd phase constructor can leave.
    46 // Symbian 2nd phase constructor can leave.
    45 // -----------------------------------------------------------------------------
    47 // -----------------------------------------------------------------------------
    46 //
    48 //
    47 void CProfileExtraTonesImpl::ConstructL(
    49 void CProfileExtraTonesImpl::ConstructL(
    48     const MProfileExtraTones& aProfileExtraTones )
    50     const MProfileExtraTones2& aProfileExtraTones )
    49     {
    51     {
    50     iIMMessageAlertTone = aProfileExtraTones.IMMessageAlertTone().AllocL();
    52     iIMMessageAlertTone = aProfileExtraTones.IMMessageAlertTone().AllocL();
    51     iEmailAlertTone = aProfileExtraTones.EmailAlertTone().AllocL();
    53     iEmailAlertTone = aProfileExtraTones.EmailAlertTone().AllocL();
    52     iVideoCallRingingTone =
    54     iVideoCallRingingTone =
    53         aProfileExtraTones.VideoCallRingingTone().AllocL();
    55         aProfileExtraTones.VideoCallRingingTone().AllocL();
       
    56     iReminderTone = aProfileExtraTones.ReminderTone().AllocL();
       
    57     iClockAlarmTone = aProfileExtraTones.ClockAlarmTone().AllocL();
    54     }
    58     }
    55 
    59 
    56 // -----------------------------------------------------------------------------
    60 // -----------------------------------------------------------------------------
    57 // CProfileExtraTonesImpl::NewL
    61 // CProfileExtraTonesImpl::NewL
    58 // Two-phased constructor.
    62 // Two-phased constructor.
    73 // CProfileExtraTonesImpl::NewL
    77 // CProfileExtraTonesImpl::NewL
    74 // Two-phased constructor.
    78 // Two-phased constructor.
    75 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
    76 //
    80 //
    77 CProfileExtraTonesImpl* CProfileExtraTonesImpl::NewL(
    81 CProfileExtraTonesImpl* CProfileExtraTonesImpl::NewL(
    78     const MProfileExtraTones& aProfileExtraTones )
    82     const MProfileExtraTones2& aProfileExtraTones )
    79     {
    83     {
    80     CProfileExtraTonesImpl* self = new( ELeave ) CProfileExtraTonesImpl;
    84     CProfileExtraTonesImpl* self = new( ELeave ) CProfileExtraTonesImpl;
    81 
    85 
    82     CleanupStack::PushL( self );
    86     CleanupStack::PushL( self );
    83     self->ConstructL( aProfileExtraTones );
    87     self->ConstructL( aProfileExtraTones );
    91 CProfileExtraTonesImpl::~CProfileExtraTonesImpl()
    95 CProfileExtraTonesImpl::~CProfileExtraTonesImpl()
    92     {
    96     {
    93     delete iIMMessageAlertTone;
    97     delete iIMMessageAlertTone;
    94     delete iEmailAlertTone;
    98     delete iEmailAlertTone;
    95     delete iVideoCallRingingTone;
    99     delete iVideoCallRingingTone;
       
   100     delete iReminderTone;
       
   101     delete iClockAlarmTone;
    96     }
   102     }
    97 
   103 
    98 
   104 
    99 // -----------------------------------------------------------------------------
   105 // -----------------------------------------------------------------------------
   100 // CProfileExtraTonesImpl::InternalizeL
   106 // CProfileExtraTonesImpl::InternalizeL
   131     // Video call ringing tone
   137     // Video call ringing tone
   132     User::LeaveIfError(
   138     User::LeaveIfError(
   133             aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
   139             aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
   134             aProfileId ), toneFile ) );
   140             aProfileId ), toneFile ) );
   135     iVideoCallRingingTone = toneFile.AllocL();
   141     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();
   136     }
   160     }
   137 
   161 
   138 // -----------------------------------------------------------------------------
   162 // -----------------------------------------------------------------------------
   139 // CProfileExtraTonesImpl::ExternalizeL
   163 // CProfileExtraTonesImpl::ExternalizeL
   140 //
   164 //
   156 
   180 
   157     // Video call ringing tone
   181     // Video call ringing tone
   158     User::LeaveIfError(
   182     User::LeaveIfError(
   159             aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
   183             aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngVideoCallTone,
   160             aProfileId ), *iVideoCallRingingTone ) );
   184             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 ) );
   161     }
   195     }
   162 
   196 
   163 // -----------------------------------------------------------------------------
   197 // -----------------------------------------------------------------------------
   164 // CProfileExtraTonesImpl::IMMessageAlertTone
   198 // CProfileExtraTonesImpl::IMMessageAlertTone
   165 //
   199 //
   233     HBufC* tmp = aRingingTone.Left( KMaxFileName ).AllocL();
   267     HBufC* tmp = aRingingTone.Left( KMaxFileName ).AllocL();
   234     delete iVideoCallRingingTone;
   268     delete iVideoCallRingingTone;
   235     iVideoCallRingingTone = tmp;
   269     iVideoCallRingingTone = tmp;
   236     }
   270     }
   237 
   271 
       
   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 
   238 //  End of File
   324 //  End of File