messagingappbase/smartmessaging/wmlbc/src/WmlBMUtils30.cpp
branchRCL_3
changeset 27 7fdbb852d323
equal deleted inserted replaced
26:ebe688cedc25 27:7fdbb852d323
       
     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:  
       
    15 *     Class offers static utility functions for CWmlBMSubItem.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 
       
    23 #include "WmlBMUtils30.h"
       
    24 #include <favouritesitemlist.h>         // CFavouritesItemList         
       
    25 
       
    26 // ================= MEMBER FUNCTIONS =======================
       
    27 
       
    28 // ---------------------------------------------------------
       
    29 // WmlBMUtils::DoStoreL
       
    30 // ---------------------------------------------------------
       
    31 //
       
    32 TInt WmlBMUtils::DoStoreL(RFavouritesDb& aDb, CFavouritesItem& aItem)
       
    33     {
       
    34     return aDb.Add(aItem, ETrue);
       
    35     }
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // WmlBMUtils::Exists
       
    39 // ---------------------------------------------------------
       
    40 //
       
    41 TInt WmlBMUtils::Exists( const TDesC& aName, 
       
    42             const CFavouritesItemList& aItemList )
       
    43     {
       
    44     TInt count = aItemList.Count();
       
    45     for (TInt i = 0; i < count; i++)
       
    46         {
       
    47         if (aItemList.At(i)->Name().CompareF(aName) == 0)
       
    48             {
       
    49             return i;
       
    50             }
       
    51         }
       
    52     return KErrNotFound;
       
    53     }
       
    54 
       
    55 /*// ---------------------------------------------------------
       
    56 // WmlBMUtils::RemoveL
       
    57 // ---------------------------------------------------------
       
    58 //
       
    59 void WmlBMUtils::RemoveL( RFavouritesDb& aDb, const TUint32 aUid )
       
    60     {
       
    61     User::LeaveIfError( aDb.Delete( aUid ) );
       
    62     }
       
    63 */
       
    64 // ---------------------------------------------------------
       
    65 // WmlBMUtils::CreateItemList2LC
       
    66 // ---------------------------------------------------------
       
    67 //
       
    68 CFavouritesItemList* WmlBMUtils::CreateItemListLC( 
       
    69     RFavouritesDb& aDb)
       
    70     {
       
    71     CFavouritesItemList* itemList = new (ELeave) CFavouritesItemList;
       
    72     CleanupStack::PushL( itemList );
       
    73     User::LeaveIfError( 
       
    74     	aDb.GetAll(*itemList, KFavouritesNullUid, 
       
    75         		   CFavouritesItem::EItem)
       
    76         		   );
       
    77     return itemList;
       
    78     }
       
    79 
       
    80 // End of file