email/imum/Mtms/Inc/ImumMboxSettingsUtils.inl
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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: ImumMboxSettingsUtils.inl
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <ImumInternalApi.h>
       
    20 #include <ImumInMailboxServices.h>
       
    21 #include <ImumInMailboxUtilities.h>
       
    22 
       
    23 // ---------------------------------------------------------------------------
       
    24 // ImumMboxSettingsUtils::QuickIntL()
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 template<class T>
       
    28 T ImumMboxSettingsUtils::QuickLoadL( 
       
    29     CImumInternalApi& aEmailApi,
       
    30     const TMsvId aMailboxId,
       
    31     const TUint aAttributeKey,
       
    32     const TInt aConnectionIndex )
       
    33     {
       
    34     CImumInSettingsData* settings = 
       
    35         aEmailApi.MailboxServicesL().LoadMailboxSettingsL( aMailboxId );
       
    36     CleanupStack::PushL( settings );
       
    37 
       
    38     T type = QuickGetL<T>( *settings, aAttributeKey, aConnectionIndex );
       
    39     
       
    40     CleanupStack::PopAndDestroy( settings );
       
    41     settings = NULL;
       
    42         
       
    43     return type;
       
    44     }
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // ImumMboxSettingsUtils::QuickIntL()
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 template<class T>
       
    51 T ImumMboxSettingsUtils::QuickGetL( 
       
    52     const CImumInSettingsData& aSettings,
       
    53     const TUint aAttributeKey,
       
    54     const TInt aConnectionIndex )
       
    55     {
       
    56     T type;
       
    57     TInt error = KErrNone;
       
    58     
       
    59     if ( aConnectionIndex == KErrNotFound )
       
    60         {        
       
    61         error = aSettings.GetAttr( aAttributeKey, type );
       
    62         }
       
    63     else
       
    64         {
       
    65         error = aSettings.GetInSetL( aConnectionIndex ).GetAttr( aAttributeKey, type );
       
    66         }
       
    67         
       
    68     User::LeaveIfError( error );    
       
    69         
       
    70     return type;
       
    71     }
       
    72 
       
    73 // End of File