appinstaller/AppinstUi/Plugin/Tasks/StartupTask/Src/StartupTask.cpp
changeset 80 9dcba1ee99f7
parent 77 d1838696558c
equal deleted inserted replaced
77:d1838696558c 80:9dcba1ee99f7
     1 /*
       
     2 * Copyright (c) 2002-2009 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:   This file contains the implementation of CStartupTask
       
    15 *                class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <dscstore.h>                   // RDscStore
       
    21 #include "StartupTask.h"
       
    22 #include "SWInstStartupTaskParam.h"
       
    23 
       
    24 using namespace SwiUI;
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CStartupTask::CStartupTask
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CStartupTask::CStartupTask()
       
    35     {
       
    36     }
       
    37 
       
    38 // Destructor
       
    39 CStartupTask::~CStartupTask()
       
    40     {
       
    41     iItems.ResetAndDestroy();
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // CStartupTask::SetParameterL
       
    46 // Adds a parameter to the task.
       
    47 // (other items were commented in a header).
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 void CStartupTask::SetParameterL( const TDesC8& aParam, TInt aIndex )
       
    51     {
       
    52     TStartupTaskParam param;
       
    53     TStartupTaskParamPckg pckg( param );
       
    54     pckg.Copy( aParam );
       
    55 
       
    56     CStartupItem* item = CStartupItem::NewL( param );
       
    57     iItems.Insert( item, aIndex );
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------------------------
       
    61 // CStartupTask::SetParameterL
       
    62 // Checks if given RDcsStore exists, and creates it if necessary.
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 void CStartupTask::CreateIfNotExistL( RDscStore& aDsc )
       
    66     {
       
    67     if( !aDsc.DscExistsL() )
       
    68         {
       
    69         aDsc.CreateDscL();
       
    70         }
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CStartupTask::DoExternalizeL
       
    75 // Externalizes the task.
       
    76 // (other items were commented in a header).
       
    77 // -----------------------------------------------------------------------------
       
    78 //
       
    79 void CStartupTask::DoExternalizeL( RWriteStream& aStream ) const
       
    80     {
       
    81     aStream.WriteInt32L( iItems.Count() );
       
    82     for ( TInt index = 0; index < iItems.Count(); index++ )
       
    83         {
       
    84         aStream << *(iItems[index]);
       
    85         }
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CStartupTask::DoInternalizeL
       
    90 // Internalizes the task.
       
    91 // (other items were commented in a header).
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CStartupTask::DoInternalizeL( RReadStream & aStream )
       
    95     {
       
    96     TInt itemCount( aStream.ReadInt32L() );
       
    97     for ( TInt index = 0; index < itemCount; index++ )
       
    98         {
       
    99         CStartupItem* item = CStartupItem::NewL( aStream );
       
   100         iItems.Append( item );
       
   101         }
       
   102     }
       
   103 
       
   104 //  End of File