taskswitcher/contextengine/tsfswserver/engine/src/tsfswidgetlist.cpp
changeset 4 4d54b72983ae
child 11 ff572dfe6d86
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
       
     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:  web widget list
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "tsfswidgetlist.h"
       
    20 #include <widgetregistrydata.h>
       
    21 
       
    22 // --------------------------------------------------------------------------
       
    23 // CTsFsWidgetList::NewL
       
    24 // --------------------------------------------------------------------------
       
    25 //
       
    26 CTsFsWidgetList* CTsFsWidgetList::NewL()
       
    27     {
       
    28     return new (ELeave) CTsFsWidgetList;
       
    29     }
       
    30 
       
    31 // --------------------------------------------------------------------------
       
    32 // CTsFsWidgetList::CTsFsWidgetList
       
    33 // --------------------------------------------------------------------------
       
    34 //   
       
    35 CTsFsWidgetList::CTsFsWidgetList()
       
    36     {
       
    37     }
       
    38 
       
    39 // --------------------------------------------------------------------------
       
    40 // CTsFsWidgetList::~CTsFsWidgetList
       
    41 // --------------------------------------------------------------------------
       
    42 //
       
    43 CTsFsWidgetList::~CTsFsWidgetList()
       
    44     {
       
    45     ResetArrayOfWidgetInfo( iRunningWidgets );        
       
    46     iRunningWidgets.Reset();
       
    47     }
       
    48 
       
    49 // --------------------------------------------------------------------------
       
    50 // CTsFsWidgetList::CleanupConnect
       
    51 // --------------------------------------------------------------------------
       
    52 //
       
    53 void CTsFsWidgetList::CleanupConnect( TAny* aThis )
       
    54     {
       
    55     CTsFsWidgetList* self = static_cast<CTsFsWidgetList*>( aThis );
       
    56     self->iWidgetRegistryClientSession.Disconnect();
       
    57     }
       
    58 
       
    59 // --------------------------------------------------------------------------
       
    60 // CTsFsWidgetList::InitializeWidgetListL
       
    61 // --------------------------------------------------------------------------
       
    62 //
       
    63 void CTsFsWidgetList::InitializeWidgetListL()
       
    64     {
       
    65     ResetArrayOfWidgetInfo( iRunningWidgets );
       
    66     iRunningWidgets.Reset();
       
    67     User::LeaveIfError( iWidgetRegistryClientSession.Connect() );
       
    68     CleanupStack::PushL( TCleanupItem( CleanupConnect, this) );
       
    69     iWidgetRegistryClientSession.RunningWidgetsL(iRunningWidgets);
       
    70     CleanupStack::Pop(); // clean WidgetRegistryClientSession item
       
    71     iWidgetRegistryClientSession.Disconnect();
       
    72     }
       
    73 
       
    74 // --------------------------------------------------------------------------
       
    75 // CTsFsWidgetList::ResetArrayOfWidgetInfo
       
    76 // --------------------------------------------------------------------------
       
    77 //
       
    78 void CTsFsWidgetList::ResetArrayOfWidgetInfo( 
       
    79         RWidgetInfoArray& aWidgetInfoArr )
       
    80     {
       
    81     for ( TInt i = 0; i < aWidgetInfoArr.Count(); i++ )
       
    82         {
       
    83         CWidgetInfo *item = aWidgetInfoArr[i];
       
    84         delete item;
       
    85         }
       
    86     }
       
    87 
       
    88 
       
    89 // end of file