applayerpluginsandutils/bookmarksupport/src/bookmarkfolder.cpp
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <bookmark.h>
       
    17 #include "bkmrkfolder.h"
       
    18 
       
    19 /**
       
    20 RBkFolder constructor
       
    21 @publishedPartner
       
    22 @released
       
    23 */
       
    24 EXPORT_C RBkFolder::RBkFolder() : RBkNode()
       
    25 	{
       
    26 	}
       
    27 
       
    28 /**
       
    29 Moves the given bookmark item into this folder. Append simply adds the bookmark to the end of
       
    30 the folder's child list.
       
    31 
       
    32 @param aBookmarkItem The bookmark item to add
       
    33 @publishedPartner
       
    34 @released
       
    35 */
       
    36 EXPORT_C void RBkFolder::AppendL(RBkNode& aBookmarkItem)
       
    37 	{
       
    38 	Folder()->AppendL(*(aBookmarkItem.Item()));
       
    39 	}
       
    40 	
       
    41 /**
       
    42 Moves the given bookmark item into this folder. Insert adds the bookmark into a specific position
       
    43 in the folder's child list. The item is just added to the end if the specified index is greater
       
    44 than the number of current children.
       
    45 
       
    46 @param aBookmarkItem The bookmark item to add
       
    47 @param aIndexPosition The index position in which to place the bookmark item
       
    48 @publishedPartner
       
    49 @released
       
    50 */
       
    51 EXPORT_C void RBkFolder::InsertL(RBkNode& aBookmarkItem, TInt aIndexPosition)
       
    52 	{
       
    53 	Folder()->InsertL(*(aBookmarkItem.Item()), aIndexPosition);
       
    54 	}
       
    55 
       
    56 /**
       
    57 Shifts the position of a bookmark item in the child list.
       
    58 
       
    59 @param aOldPosition The index position of the bookmark item to be moved
       
    60 @param aNewPosition The new index position where the bookmark item is to be placed
       
    61 @return A error if either index values are out of range
       
    62 @publishedPartner
       
    63 @released
       
    64 */
       
    65 EXPORT_C TInt RBkFolder::Move(TInt aOldPosition, TInt aNewPosition)
       
    66 	{
       
    67 	return Folder()->Move(aOldPosition, aNewPosition);
       
    68 	}
       
    69 	
       
    70 /**
       
    71 Returns the number of items in the folder's child list
       
    72 
       
    73 @return Number of children in the folder's child list.
       
    74 @publishedPartner
       
    75 @released
       
    76 */
       
    77 EXPORT_C TInt RBkFolder::Count() const
       
    78 	{
       
    79 	return Folder()->Count();
       
    80 	}
       
    81 
       
    82 /**
       
    83 Gets the index of the child with the given ID.
       
    84 
       
    85 @param aItem Id of the bookmark item to be found
       
    86 @return The index value or KErrNotFound
       
    87 @publishedPartner
       
    88 @released
       
    89 */
       
    90 EXPORT_C TInt RBkFolder::Index(const RBkNode& aItem) const
       
    91 	{
       
    92 	return Folder()->Index(*(aItem.Item()));
       
    93 	}
       
    94 
       
    95 /**
       
    96 Method for opening a handle to a child bookmark item by index value
       
    97 
       
    98 @param aIndex Index position to retrieve
       
    99 @return An open handle to the bookmark item
       
   100 @publishedPartner
       
   101 @released
       
   102 */
       
   103 EXPORT_C RBkNode RBkFolder::OpenItemL(TInt aIndex)
       
   104 	{
       
   105 	return Folder()->At(aIndex).OpenItemL();
       
   106 	}
       
   107 
       
   108 /**
       
   109 Not intended for external use
       
   110 
       
   111 @internalComponent
       
   112 */
       
   113 CBookmarkFolder* RBkFolder::Folder() const
       
   114 	{
       
   115 	// The handle must be open and attached to a concrete bookmark object
       
   116 	__ASSERT_ALWAYS(iItem, User::Panic(Bookmark::KBookmarkErrHandleNotOpen, Bookmark::KErrNotOpen));
       
   117 
       
   118 	return static_cast<CBookmarkFolder*>(iItem);
       
   119 	}
       
   120 
       
   121