ncdengine/provider/client/src/ncdparentoftransparentnodeproxy.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Contains CNcdParentOfTransparentNodeProxy class implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ncdparentoftransparentnodeproxy.h"
       
    20 #include "catalogsdebug.h"
       
    21 #include "ncdnodefunctionids.h"
       
    22 #include "catalogsclientserver.h"
       
    23 
       
    24 
       
    25 // ======== PUBLIC MEMBER FUNCTIONS ========
       
    26 
       
    27 CNcdParentOfTransparentNodeProxy::CNcdParentOfTransparentNodeProxy( MCatalogsClientServer& aSession,
       
    28                                                                     TInt aHandle,
       
    29                                                                     CNcdNodeManagerProxy& aNodeManager,
       
    30                                                                     CNcdOperationManagerProxy& aOperationManager,
       
    31                                                                     CNcdFavoriteManagerProxy& aFavoriteManager ) 
       
    32 : CNcdNodeFolderProxy( aSession, aHandle, aNodeManager, aOperationManager, aFavoriteManager )
       
    33     {
       
    34     }
       
    35 
       
    36 
       
    37 void CNcdParentOfTransparentNodeProxy::ConstructL()
       
    38     {
       
    39     CNcdNodeFolderProxy::ConstructL(); 
       
    40     }
       
    41 
       
    42 
       
    43 CNcdParentOfTransparentNodeProxy::~CNcdParentOfTransparentNodeProxy()
       
    44     {
       
    45     }
       
    46 
       
    47 
       
    48 TInt CNcdParentOfTransparentNodeProxy::ServerChildCount() const
       
    49     {
       
    50     return iServerChildCount;
       
    51     }
       
    52 
       
    53     
       
    54 void CNcdParentOfTransparentNodeProxy::InternalizeNodeDataL( RReadStream& aStream )
       
    55     {
       
    56     DLTRACEIN((""));
       
    57     
       
    58     // First internalize parent data
       
    59     CNcdNodeFolderProxy::InternalizeNodeDataL( aStream );
       
    60     
       
    61     // Then get the parent of transparent node specific data
       
    62     iServerChildCount = aStream.ReadInt32L();
       
    63     
       
    64     DLTRACEOUT((""));
       
    65     }
       
    66     
       
    67 TBool CNcdParentOfTransparentNodeProxy::IsTransparentChildExpiredL() const
       
    68     {
       
    69     DLTRACEIN((""));
       
    70     HBufC8* data( NULL );
       
    71         
       
    72     // Because we do not know the exact size of the data id, use
       
    73     // the alloc method, which creates the buffer of the right size
       
    74     // and sets the pointer to point to the created buffer.
       
    75     User::LeaveIfError(
       
    76             ClientServerSession().
       
    77                 SendSyncAlloc( NcdNodeFunctionIds::ENcdIsTransparentChildExpired,
       
    78                                KNullDesC8,
       
    79                                data,
       
    80                                Handle(),
       
    81                                0 ) );
       
    82 
       
    83     if ( data == NULL )
       
    84         {
       
    85         User::Leave( KErrNotFound );
       
    86         }
       
    87 
       
    88     CleanupStack::PushL( data );
       
    89     
       
    90     // Read the data from the stream
       
    91     RDesReadStream stream( *data );
       
    92     CleanupClosePushL( stream );
       
    93     
       
    94     TBool isTransparentChildExpired = stream.ReadInt32L();
       
    95     
       
    96     // Closes the stream
       
    97     CleanupStack::PopAndDestroy( &stream ); 
       
    98     CleanupStack::PopAndDestroy( data );
       
    99     
       
   100     return isTransparentChildExpired;
       
   101     }