profilesservices/ProfileEngine/EngSrc/CProfilePttSettingsImpl.cpp
changeset 0 8c5d936e5675
child 24 8ee96d21d9bf
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Implementation of the CProfilePttSettingsImpl.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "CProfilePttSettingsImpl.h"
       
    22 #include <centralrepository.h>
       
    23 #include "ProfileEngUtils.h"
       
    24 #include "ProfileEnginePrivateCRKeys.h"
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CProfilePttSettingsImpl::ConstructL
       
    30 // Symbian 2nd phase constructor can leave.
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 void CProfilePttSettingsImpl::ConstructL()
       
    34     {
       
    35     iPttRingingTone = KNullDesC().AllocL();
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CProfilePttSettingsImpl::ConstructL
       
    40 // Symbian 2nd phase constructor can leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void CProfilePttSettingsImpl::ConstructL(
       
    44     const MProfilePttSettings& aProfilePttSettings )
       
    45     {
       
    46     iPttRingingTone = aProfilePttSettings.PttRingingTone().AllocL();
       
    47     iPttStatus = aProfilePttSettings.PttStatus();
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CProfilePttSettingsImpl::NewL
       
    52 // Two-phased constructor.
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 CProfilePttSettingsImpl* CProfilePttSettingsImpl::NewL()
       
    56     {
       
    57     CProfilePttSettingsImpl* self = new( ELeave ) CProfilePttSettingsImpl;
       
    58 
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     CleanupStack::Pop();
       
    62 
       
    63     return self;
       
    64     }
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CProfilePttSettingsImpl::NewL
       
    68 // Two-phased constructor.
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 CProfilePttSettingsImpl* CProfilePttSettingsImpl::NewL(
       
    72     const MProfilePttSettings& aProfilePttSettings )
       
    73     {
       
    74     CProfilePttSettingsImpl* self = new( ELeave ) CProfilePttSettingsImpl;
       
    75 
       
    76     CleanupStack::PushL( self );
       
    77     self->ConstructL( aProfilePttSettings );
       
    78     CleanupStack::Pop();
       
    79 
       
    80     return self;
       
    81     }
       
    82 
       
    83 
       
    84 // Destructor
       
    85 CProfilePttSettingsImpl::~CProfilePttSettingsImpl()
       
    86     {
       
    87     delete iPttRingingTone;
       
    88     }
       
    89 
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CProfilePttSettingsImpl::InternalizeL
       
    93 //
       
    94 // (other items were commented in a header).
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 void CProfilePttSettingsImpl::InternalizeL( CRepository& aCenRep,
       
    98                                             TInt aProfileId )
       
    99     {
       
   100     delete iPttRingingTone;
       
   101     iPttRingingTone = NULL;
       
   102 
       
   103     TFileName toneFile;
       
   104 
       
   105     // PTT ringing tone
       
   106     User::LeaveIfError(
       
   107             aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngPttTone,
       
   108             aProfileId ), toneFile ) );
       
   109     iPttRingingTone = toneFile.AllocL();
       
   110 
       
   111     // PTT status
       
   112     TInt status( 0 );
       
   113     User::LeaveIfError(
       
   114             aCenRep.Get( ProfileEngUtils::ResolveKey( KProEngPttStatus,
       
   115             aProfileId ), status ) );
       
   116     iPttStatus = TProfilePttStatus( status );
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CProfilePttSettingsImpl::ExternalizeL
       
   121 //
       
   122 // (other items were commented in a header).
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 void CProfilePttSettingsImpl::ExternalizeL( CRepository& aCenRep,
       
   126                                             TInt aProfileId ) const
       
   127     {
       
   128     // PTT Ringing tone
       
   129     User::LeaveIfError(
       
   130             aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngPttTone,
       
   131             aProfileId ), *iPttRingingTone ) );
       
   132 
       
   133     // PTT status
       
   134     User::LeaveIfError(
       
   135             aCenRep.Set( ProfileEngUtils::ResolveKey( KProEngPttStatus,
       
   136             aProfileId ), iPttStatus ) );
       
   137 
       
   138     }
       
   139 
       
   140 // -----------------------------------------------------------------------------
       
   141 // CProfilePttSettingsImpl::PttRingingTone
       
   142 //
       
   143 // (other items were commented in a header).
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 const TDesC& CProfilePttSettingsImpl::PttRingingTone() const
       
   147     {
       
   148     return *iPttRingingTone;
       
   149     }
       
   150 
       
   151 // -----------------------------------------------------------------------------
       
   152 // CProfilePttSettingsImpl::SetPttRingingToneL
       
   153 //
       
   154 // (other items were commented in a header).
       
   155 // -----------------------------------------------------------------------------
       
   156 //
       
   157 void CProfilePttSettingsImpl::SetPttRingingToneL( const TDesC& aPttRingingTone )
       
   158     {
       
   159     HBufC* tmp = aPttRingingTone.Left( KMaxFileName ).AllocL();
       
   160     delete iPttRingingTone;
       
   161     iPttRingingTone = tmp;
       
   162     }
       
   163 
       
   164 // -----------------------------------------------------------------------------
       
   165 // CProfilePttSettingsImpl::PttStatus
       
   166 //
       
   167 // (other items were commented in a header).
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 TProfilePttStatus CProfilePttSettingsImpl::PttStatus() const
       
   171     {
       
   172     return iPttStatus;
       
   173     }
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CProfilePttSettingsImpl::PttStatus
       
   177 //
       
   178 // (other items were commented in a header).
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 void CProfilePttSettingsImpl::SetPttStatus( TProfilePttStatus aPttStatus )
       
   182     {
       
   183     iPttStatus = aPttStatus;
       
   184     }
       
   185 
       
   186 //  End of File
       
   187