camerauis/cameraapp/generic/GsCamcorderPlugin/src/GSCamCaptureToneSettingItem.cpp
branchRCL_3
changeset 16 d486e5e3cc9a
equal deleted inserted replaced
12:8c55c525d5d7 16:d486e5e3cc9a
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Setting item for capture tone
       
    15 */
       
    16 
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include <centralrepository.h>
       
    20 #include "GSCamCaptureToneSettingItem.h"
       
    21 #include "camuidconstants.h"
       
    22 #include "CamSettings.hrh"
       
    23 
       
    24 // CONSTANTS
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 // ---------------------------------------------------------------------------
       
    28 // CGSCamCaptureToneSettingItem::CGSCamCaptureToneSettingItem
       
    29 // C++ constructor
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CGSCamCaptureToneSettingItem::CGSCamCaptureToneSettingItem(TInt aIdentifier,
       
    33         TInt& aValue) :
       
    34     CAknEnumeratedTextPopupSettingItem(aIdentifier, aValue)
       
    35     {
       
    36 
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // CGSCamCaptureToneSettingItem::~CGSCamCaptureToneSettingItem
       
    41 // Destructor.
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 CGSCamCaptureToneSettingItem::~CGSCamCaptureToneSettingItem()
       
    45     {
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CGSCamCaptureToneSettingItem::CGSCamCaptureToneSettingItem
       
    50 // 
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 void CGSCamCaptureToneSettingItem::CompleteConstructionL()
       
    54     {
       
    55     CAknEnumeratedTextPopupSettingItem::CompleteConstructionL();
       
    56 
       
    57     // get the KCCorEnableCaptureToneOff key value from cenrep
       
    58     CRepository* repository = NULL;
       
    59     TInt shutterSoundEnabled = 0; //by default enabled
       
    60     TRAPD(ret, repository = CRepository::NewL(KCRUidCamcorderFeatures));
       
    61     if (ret == KErrNone)
       
    62         {
       
    63         const TUint32 KCCorShutterSound = 0x00000007;
       
    64         ret = repository->Get(KCCorShutterSound,
       
    65                 shutterSoundEnabled);
       
    66         }
       
    67     delete repository;
       
    68     repository = NULL;
       
    69 
       
    70     if ( shutterSoundEnabled == 1 )
       
    71         {
       
    72         // if enabled, delete off from the list
       
    73         // if disabled, off option is shown to the user
       
    74         // under capture tone selection menu
       
    75         CArrayPtr<CAknEnumeratedText>
       
    76                 * itemArray =
       
    77                         static_cast<CAknEnumeratedTextPopupSettingItem*>(this)->EnumeratedTextArray();
       
    78 
       
    79         TInt count = itemArray->Count();
       
    80         
       
    81         for(TInt idx = 0; idx < count; idx++)
       
    82             {
       
    83             TInt value = itemArray->At( idx )->EnumerationValue();
       
    84             if(value == ECamSettToneOff)
       
    85                 {
       
    86                 itemArray->Delete(idx);
       
    87                 }
       
    88             }
       
    89         }
       
    90     }