appinstaller/AppinstUi/Plugin/Tasks/StartupTask/Src/StartupTaskAdd.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 CStartupTaskAdd
       
    15 *                class member functions.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <dscstore.h>                   // RDscStore
       
    21 #include <dscitem.h>                    // CDscItem
       
    22 #include "StartupTaskAdd.h"
       
    23 #include "SWInstDebug.h"
       
    24 
       
    25 using namespace SwiUI;
       
    26 
       
    27 // ============================ MEMBER FUNCTIONS ===============================
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CStartupTaskAdd::CStartupTaskAdd
       
    31 // C++ default constructor can NOT contain any code, that
       
    32 // might leave.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CStartupTaskAdd::CStartupTaskAdd()
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CStartupTaskAdd::NewL
       
    41 // Two-phased constructor.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 CStartupTaskAdd* CStartupTaskAdd::NewL()
       
    45     {
       
    46     return new(ELeave) CStartupTaskAdd();
       
    47     }
       
    48 
       
    49 // Destructor
       
    50 CStartupTaskAdd::~CStartupTaskAdd()
       
    51     {
       
    52     }
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CStartupTaskAdd::ExecuteL
       
    56 // Executes the task.
       
    57 // (other items were commented in a header).
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 void CStartupTaskAdd::ExecuteL()
       
    61     {
       
    62     RDscStore dsc;
       
    63     dsc.OpenL();
       
    64     CleanupClosePushL( dsc );
       
    65     CreateIfNotExistL( dsc );
       
    66 
       
    67     for( TInt index = 0; index < iItems.Count(); index++ )
       
    68         {
       
    69         const TDesC& fileName = iItems[index]->ExecutableFile();
       
    70 
       
    71         CDscItem* item = CDscItem::NewLC( fileName, KNullDesC );
       
    72         // Currently only EStartupItemExPolicyNone is supported,
       
    73         // hence CStartupItem::RecoveryPolicy() is not used.
       
    74 
       
    75         FLOG_1( _L("StartupTaskAdd: Adding %S"), &fileName );
       
    76         dsc.AddItemL( *item );
       
    77 
       
    78         CleanupStack::PopAndDestroy( item );
       
    79         }
       
    80 
       
    81     CleanupStack::PopAndDestroy( &dsc );
       
    82     }
       
    83 
       
    84 
       
    85 //  End of File