emailcontacts/remotecontactlookup/settingplugin/src/cfscrclsettingcontrol.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
       
     2 * Copyright (c) 2008 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:  Remote Contact Lookup Extension setting control
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "emailtrace.h"
       
    21 #include <coecntrl.h>
       
    22 #include <aknsettingitemlist.h>
       
    23 //<cmail>
       
    24 #include "cpbkxremotecontactlookupenv.h"
       
    25 //</cmail>
       
    26 #include <fscrclsettingres.rsg>
       
    27 #include "cfscrclsettingcontrol.h"
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CFscRclSettingControl::CFscRclSettingControl
       
    31 // C++ default constructor can NOT contain any code, that might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CFscRclSettingControl::CFscRclSettingControl()
       
    35     {
       
    36     FUNC_LOG;
       
    37     // No implementation required
       
    38     }
       
    39 
       
    40 // ----------------------------------------------------------------------------
       
    41 // CFscRclSettingControl::ConstructL
       
    42 // Actual constructor.
       
    43 // ----------------------------------------------------------------------------
       
    44 //
       
    45 void CFscRclSettingControl::ConstructL()
       
    46     {
       
    47     FUNC_LOG;
       
    48     ConstructFromResourceL( R_RCL_SETTING_LIST );
       
    49     }
       
    50 
       
    51 // -----------------------------------------------------------------------------
       
    52 // CFscRclSettingControl::NewLC
       
    53 // CFscRclSettingControl two-phased constructor.
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CFscRclSettingControl* CFscRclSettingControl::NewLC()
       
    57     {
       
    58     FUNC_LOG;
       
    59     CFscRclSettingControl* self = new (ELeave)CFscRclSettingControl();
       
    60     CleanupStack::PushL(self);
       
    61     self->ConstructL();
       
    62     return self;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CFscRclSettingControl::NewL
       
    67 // CFscRclSettingControl two-phased constructor.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CFscRclSettingControl* CFscRclSettingControl::NewL()
       
    71     {
       
    72     FUNC_LOG;
       
    73     CFscRclSettingControl* self = CFscRclSettingControl::NewLC();
       
    74     CleanupStack::Pop(self);
       
    75     return self;
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CFscRclSettingControl::~CFscRclSettingControl
       
    80 // CFscRclSettingControl Destructor
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 CFscRclSettingControl::~CFscRclSettingControl()
       
    84     {
       
    85     FUNC_LOG;
       
    86     delete iRclEnv;
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------------------------
       
    90 //              MPbk2SettingsControlExtension implementation
       
    91 // -----------------------------------------------------------------------------
       
    92 // CFscRclSettingControl::ModifySettingItemListL
       
    93 // Adds RCL settings top item into the Phonebook2 settings list
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CFscRclSettingControl::ModifySettingItemListL( 
       
    97         CAknSettingItemList& aSettingItemList )
       
    98     {
       
    99     FUNC_LOG;
       
   100     // Get Phonebook2 settings list
       
   101     CAknSettingItemArray *pbk2settings = aSettingItemList.SettingItemArray();
       
   102     
       
   103     TRAP_IGNORE( iRclEnv = CPbkxRemoteContactLookupEnv::NewL() );
       
   104     
       
   105     if ( iRclEnv )
       
   106         {
       
   107         // try to add Remote Contact Lookup setting item
       
   108         // if adding fails, continue without rcl setting item
       
   109         TRAP_IGNORE(
       
   110             {
       
   111             MPbkxRemoteContactLookupSettingsUi* rclSettingsUi = 
       
   112                 iRclEnv->SettingsUiL();
       
   113             iRclSettingItem = rclSettingsUi->
       
   114                 NewDefaultProtocolAccountSelectorSettingItemL();
       
   115 
       
   116             pbk2settings->AppendL( iRclSettingItem );
       
   117             pbk2settings->RecalculateVisibleIndicesL();
       
   118             iRclSettingItem->SetHidden( EFalse );
       
   119         
       
   120             });    
       
   121         }
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CFscRclSettingControl::CreateSettingItemL
       
   126 // Creates settings item
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 CAknSettingItem* CFscRclSettingControl::CreateSettingItemL(TInt /*aSettingId*/)
       
   130     {
       
   131     FUNC_LOG;
       
   132     return iRclSettingItem;
       
   133     }
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 //                      MPbk2UiReleasable implementation
       
   137 // -----------------------------------------------------------------------------
       
   138 // CFscRclSettingControl::DoRelease
       
   139 // Release this
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 void CFscRclSettingControl::DoRelease()
       
   143     {
       
   144     FUNC_LOG;
       
   145     delete this;
       
   146     }
       
   147 
       
   148 //  End of File
       
   149