buildverification/autosmoketest/agenda/Src/TestAgendaServerLaunchProgress.cpp
branchRCL_3
changeset 11 493058e57c8c
parent 0 9736f095102e
equal deleted inserted replaced
10:4ca382093dae 11:493058e57c8c
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // This contains CTestAgendaServerLaunchProgress
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "TestAgendaServerLaunchProgress.h"
       
    19 #include <calentryview.h>
       
    20 
       
    21 CTestAgendaServerLaunchProgress* CTestAgendaServerLaunchProgress::NewL(CTestAgendaBase* aAgendaBase)
       
    22 /**
       
    23  * @return - Instance of the agenda progress callback
       
    24  */
       
    25 	{
       
    26 	CTestAgendaServerLaunchProgress*	progress = new (ELeave) CTestAgendaServerLaunchProgress(aAgendaBase);
       
    27 	CleanupStack::PushL(progress);
       
    28 	progress->ConstructL();
       
    29 	CleanupStack::Pop(progress);
       
    30 	return progress;
       
    31 	}
       
    32 
       
    33 CTestAgendaServerLaunchProgress::CTestAgendaServerLaunchProgress(CTestAgendaBase* aAgendaBase)
       
    34 :	CActive(EPriorityStandard)
       
    35 ,	iAgendaBase(aAgendaBase)
       
    36 /**
       
    37 constructor
       
    38 */
       
    39 	{
       
    40 	}
       
    41 
       
    42 void CTestAgendaServerLaunchProgress::ConstructL()
       
    43 /**
       
    44 constructor
       
    45 */
       
    46 	{
       
    47 	//adding this active object into an active scheduler
       
    48 	CActiveScheduler::Add(this);
       
    49 	}
       
    50 
       
    51 CTestAgendaServerLaunchProgress::~CTestAgendaServerLaunchProgress()
       
    52 /**
       
    53 destructor
       
    54 */
       
    55 	{
       
    56  	}
       
    57 
       
    58 void CTestAgendaServerLaunchProgress::Completed(TInt aError)
       
    59 /**
       
    60 callback function invoked after the file is completely loaded.
       
    61 @param	TInt aError
       
    62 */
       
    63 	{
       
    64 	if(aError != KErrNone)
       
    65 		{
       
    66 		iAgendaBase ->INFO_PRINTF2(_L("Opening the agenda database file failed with error %D"),aError);
       
    67 		iAgendaBase ->SetTestStepResult(EFail);
       
    68 		}
       
    69 	else
       
    70 		{
       
    71 		iAgendaBase ->INFO_PRINTF1(_L("Opening the Agenda database succesful"));
       
    72 		}
       
    73 		CActiveScheduler::Stop();
       
    74 	}
       
    75 
       
    76 void CTestAgendaServerLaunchProgress::Progress(TInt aPercentageCompleted)
       
    77 /**
       
    78 callback function invoked to indicate the progress
       
    79 @param aPercentageCompleted percent file loaded
       
    80 */
       
    81 	{
       
    82 	//log the progress percentage of saving the entries
       
    83 	iAgendaBase ->INFO_PRINTF2(_L("%D%% completed opening the agenda database"),aPercentageCompleted);
       
    84 	}
       
    85 
       
    86 TBool CTestAgendaServerLaunchProgress::NotifyProgress()
       
    87     {
       
    88 	return ETrue;
       
    89     }
       
    90     
       
    91 void CTestAgendaServerLaunchProgress::RunL()
       
    92 /**
       
    93 RunL from CActive class, opens the agenda database file, and builds the indices
       
    94 @leave system wide error code
       
    95 */
       
    96 	{
       
    97 	CCalEntryView* calEntryViewPtr = CCalEntryView::NewL(iAgendaBase->CalSession(), *this);
       
    98 	iAgendaBase->SetCalEntryView(calEntryViewPtr);
       
    99 	}
       
   100 
       
   101 void CTestAgendaServerLaunchProgress::DoCancel()
       
   102 /**
       
   103 DoCancel of the active object
       
   104 */
       
   105 	{
       
   106 	iAgendaBase ->INFO_PRINTF1(_L("Inside do cancel of the active object"));
       
   107 	}
       
   108 
       
   109 
       
   110 void CTestAgendaServerLaunchProgress::Start(void)
       
   111 /**
       
   112 starts the saving process
       
   113 */
       
   114 	{
       
   115 	TRequestStatus *threadStatus=&iStatus;
       
   116 	User::RequestComplete(threadStatus,KErrNone);
       
   117 	SetActive();
       
   118 	}
       
   119 	
       
   120