psln/Src/pslntaskgenericupdate.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2003-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:  Background task for generic tasks.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "pslntaskgenericupdate.h"
       
    20 #include "PslnUi.h"
       
    21 #include "PslnGeneralThemeView.h"
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // C++ constructor can NOT contain any code, that might leave.
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CPslnTaskGenericUpdate::CPslnTaskGenericUpdate( 
       
    30     CPslnUi& aUi,
       
    31     TPslnModelFunctionPtr aModelFunc, 
       
    32     TBool aUpdateList ) : iUi( aUi ), 
       
    33                           iModelFunc( aModelFunc ),
       
    34                           iUpdateList( aUpdateList ), 
       
    35                           iDone( EFalse ), 
       
    36                           iCallErr( KErrNone )
       
    37     {
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // Return ETrue when the process is done.
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 TBool CPslnTaskGenericUpdate::IsProcessDone() const
       
    45     {
       
    46     return iDone;
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // Completes one cycle of the process.
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 void CPslnTaskGenericUpdate::StepL()
       
    54     {
       
    55     if( IsProcessDone() ) 
       
    56         {
       
    57         return;
       
    58         }
       
    59 
       
    60     TRAP( iCallErr, ( iUi.Model()->*iModelFunc)() );
       
    61 
       
    62     if( iUpdateList )
       
    63         {
       
    64         static_cast<CPslnGeneralThemeView*>
       
    65             ( iUi.View( KPslnGeneralView ) )->
       
    66                 UpdateSkinListItemsL();
       
    67         }
       
    68 
       
    69     iDone = ETrue;
       
    70     }
       
    71 
       
    72 // End of file
       
    73