profilesservices/ProfileEngine/WrapperSrc/CProEngToneSettingsImpl.cpp
changeset 0 8c5d936e5675
child 8 f62c3a3d66b8
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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 CProEngToneSettingsImpl.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CProEngToneSettingsImpl.h"
       
    22 #include    <MProfileTones.h>
       
    23 #include    <MProfileExtraTones.h>
       
    24 #include    "MProfileSetTones.h"
       
    25 #include    "MProfileSetExtraTones.h"
       
    26 #include    "MProfileExtended.h"
       
    27 
       
    28 // ============================ MEMBER FUNCTIONS ===============================
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CProEngToneSettingsImpl::CProEngToneSettingsImpl
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CProEngToneSettingsImpl::CProEngToneSettingsImpl(
       
    35         TProfileToneSettings& aToneSettings,
       
    36         TUint32 aModifiableFlags )
       
    37     : iToneSettings( aToneSettings ), iModifiableFlags( aModifiableFlags )
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CProEngToneSettingsImpl::NewL
       
    43 // Two-phased constructor.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CProEngToneSettingsImpl* CProEngToneSettingsImpl::NewL(
       
    47         TProfileToneSettings& aToneSettings,
       
    48         TUint32 aModifiableFlags )
       
    49     {
       
    50     return new ( ELeave ) CProEngToneSettingsImpl(
       
    51             aToneSettings, aModifiableFlags );
       
    52     }
       
    53 
       
    54 // Destructor
       
    55 CProEngToneSettingsImpl::~CProEngToneSettingsImpl()
       
    56     {
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CProEngToneSettingsImpl::RingingType
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 TProfileRingingType CProEngToneSettingsImpl::RingingType() const
       
    64     {
       
    65     return iToneSettings.iRingingType;
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CProEngToneSettingsImpl::KeypadVolume
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 TProfileKeypadVolume CProEngToneSettingsImpl::KeypadVolume() const
       
    73     {
       
    74     return iToneSettings.iKeypadVolume;
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // CProEngToneSettingsImpl::
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 TProfileRingingVolume CProEngToneSettingsImpl::RingingVolume() const
       
    82     {
       
    83     TProfileRingingVolume volume =
       
    84         TProfileRingingVolume( iToneSettings.iRingingVolume );
       
    85     return volume;
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CProEngToneSettingsImpl::
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 TBool CProEngToneSettingsImpl::VibratingAlert() const
       
    93     {
       
    94     return iToneSettings.iVibratingAlert;
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CProEngToneSettingsImpl::
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 TBool CProEngToneSettingsImpl::WarningAndGameTones() const
       
   102     {
       
   103     return iToneSettings.iWarningAndGameTones;
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CProEngToneSettingsImpl::
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 TBool CProEngToneSettingsImpl::TextToSpeech() const
       
   111     {
       
   112     return iToneSettings.iTextToSpeech;
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CProEngToneSettingsImpl::
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 TInt CProEngToneSettingsImpl::SetRingingType( TProfileRingingType aRingingType )
       
   120     {
       
   121     if( iModifiableFlags & EProfileFlagRingingType )
       
   122         {
       
   123         iToneSettings.iRingingType = aRingingType;
       
   124         return KErrNone;
       
   125         }
       
   126     return KErrAccessDenied;
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CProEngToneSettingsImpl::
       
   131 // -----------------------------------------------------------------------------
       
   132 //
       
   133 TInt CProEngToneSettingsImpl::SetKeypadVolume(
       
   134         TProfileKeypadVolume aKeypadVolume )
       
   135     {
       
   136     if( iModifiableFlags & EProfileFlagKeypadVolume )
       
   137         {
       
   138         iToneSettings.iKeypadVolume = aKeypadVolume;
       
   139         return KErrNone;
       
   140         }
       
   141     return KErrAccessDenied;
       
   142     }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CProEngToneSettingsImpl::
       
   146 // -----------------------------------------------------------------------------
       
   147 //
       
   148 TInt CProEngToneSettingsImpl::SetRingingVolume(
       
   149         TProfileRingingVolume aRingingVolume )
       
   150     {
       
   151     if( iModifiableFlags & EProfileFlagRingingVolume )
       
   152         {
       
   153         iToneSettings.iRingingVolume = aRingingVolume;
       
   154         return KErrNone;
       
   155         }
       
   156     return KErrAccessDenied;
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CProEngToneSettingsImpl::
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 TInt CProEngToneSettingsImpl::SetVibratingAlert( TBool aVibratingAlert )
       
   164     {
       
   165     if( iModifiableFlags & EProfileFlagVibratingAlert )
       
   166         {
       
   167         iToneSettings.iVibratingAlert = aVibratingAlert;
       
   168         return KErrNone;
       
   169         }
       
   170     return KErrAccessDenied;
       
   171     }
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 // CProEngToneSettingsImpl::
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 TInt CProEngToneSettingsImpl::SetWarningAndGameTones( TBool aWarningAndGameTones )
       
   178     {
       
   179     if( iModifiableFlags & EProfileFlagWarningTones )
       
   180         {
       
   181         iToneSettings.iWarningAndGameTones = aWarningAndGameTones;
       
   182         return KErrNone;
       
   183         }
       
   184     return KErrAccessDenied;
       
   185     }
       
   186 
       
   187 // -----------------------------------------------------------------------------
       
   188 // CProEngToneSettingsImpl::
       
   189 // -----------------------------------------------------------------------------
       
   190 //
       
   191 TInt CProEngToneSettingsImpl::SetTextToSpeech( TBool aTextToSpeech )
       
   192     {
       
   193     if( iModifiableFlags & EProfileFlagTextToSpeechTone )
       
   194         {
       
   195         iToneSettings.iTextToSpeech = aTextToSpeech;
       
   196         return KErrNone;
       
   197         }
       
   198     return KErrAccessDenied;
       
   199     }
       
   200 
       
   201 
       
   202 //  End of File
       
   203