filemanager/bkupengine/src/CMMCScBkupEngine.cpp
changeset 0 6a9f87576119
equal deleted inserted replaced
-1:000000000000 0:6a9f87576119
       
     1 /*
       
     2 * Copyright (c) 2005-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: CMMCScBkupEngine implementation
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 #include "CMMCScBkupEngine.h"
       
    20 
       
    21 // User includes
       
    22 #include "CMMCScBkupEngineImpl.h"
       
    23 
       
    24 
       
    25 // ========================= MEMBER FUNCTIONS ================================
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // CMMCScBkupEngine::CMMCScBkupEngine()
       
    29 // 
       
    30 // C++ constructor.
       
    31 // ---------------------------------------------------------------------------
       
    32 CMMCScBkupEngine::CMMCScBkupEngine()
       
    33     {
       
    34     }
       
    35 
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // CMMCScBkupEngine::~CMMCScBkupEngine()
       
    39 // 
       
    40 // Destructor.
       
    41 // ---------------------------------------------------------------------------
       
    42 EXPORT_C CMMCScBkupEngine::~CMMCScBkupEngine()
       
    43     {
       
    44     delete iEngine;
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CMMCScBkupEngine::ConstructL()
       
    50 // 
       
    51 // Second phase constructor
       
    52 // ---------------------------------------------------------------------------
       
    53 void CMMCScBkupEngine::ConstructL( RFs& aFsSession )
       
    54     {
       
    55     iEngine = CMMCScBkupEngineImpl::NewL( aFsSession );
       
    56     }
       
    57 
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // CMMCScBkupEngine::NewL()
       
    61 // 
       
    62 // Static constructor
       
    63 // ---------------------------------------------------------------------------
       
    64 EXPORT_C CMMCScBkupEngine* CMMCScBkupEngine::NewL( RFs& aFsSession )
       
    65     {
       
    66     CMMCScBkupEngine* self = new(ELeave) CMMCScBkupEngine();
       
    67     CleanupStack::PushL( self );
       
    68     self->ConstructL( aFsSession );
       
    69     CleanupStack::Pop( self );
       
    70     return self;
       
    71     }
       
    72 
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CMMCScBkupEngine::StartOperationL()
       
    76 // 
       
    77 // 
       
    78 // ---------------------------------------------------------------------------
       
    79 EXPORT_C void CMMCScBkupEngine::StartOperationL(TMMCScBkupOperationType aOperation, MMMCScBkupEngineObserver& aObserver, CMMCScBkupOpParamsBase* aParams)
       
    80     {
       
    81     TRAPD(err, iEngine->StartOperationL( aOperation, aObserver, aParams ));
       
    82 
       
    83     if(err != KErrNone)
       
    84         {
       
    85         TRAP_IGNORE( aObserver.HandleBkupEngineEventL( MMMCScBkupEngineObserver::ECommonOperationError, err) );
       
    86         TRAP_IGNORE( aObserver.HandleBkupEngineEventL( MMMCScBkupEngineObserver::ECommonOperationEnded, err) );
       
    87         // Call cleanup externally, because engine cannot be yet in active state and resources remain unfreed
       
    88         iEngine->CleanupL(KErrCancel);
       
    89         }
       
    90     }
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // CMMCScBkupEngine::CancelOperation()
       
    95 // 
       
    96 // 
       
    97 // ---------------------------------------------------------------------------
       
    98 EXPORT_C void CMMCScBkupEngine::CancelOperation()
       
    99     {
       
   100     iEngine->Cancel();
       
   101     }
       
   102 
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // CMMCScBkupEngine::ValidArchiveForRestore()
       
   106 // 
       
   107 // 
       
   108 // ---------------------------------------------------------------------------
       
   109 EXPORT_C TBool CMMCScBkupEngine::ValidArchiveForRestore( const TDesC& aFileName )
       
   110     {
       
   111     TBool archiveOkay = EFalse;
       
   112     //
       
   113     TRAPD(err, archiveOkay = iEngine->ValidArchiveForRestoreL( aFileName ) );
       
   114     if  ( err != KErrNone )
       
   115         {
       
   116         archiveOkay = EFalse;
       
   117         }
       
   118     //
       
   119     return archiveOkay;
       
   120     }
       
   121 
       
   122 
       
   123 // ---------------------------------------------------------------------------
       
   124 // CMMCScBkupEngine::TotalOperationSizeL()
       
   125 // 
       
   126 // 
       
   127 // ---------------------------------------------------------------------------
       
   128 EXPORT_C TInt64 CMMCScBkupEngine::TotalOperationSizeL() const
       
   129     {
       
   130     return iEngine->TotalOperationSizeL();
       
   131     }
       
   132 
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // CMMCScBkupEngine::RebootRequired()
       
   136 // 
       
   137 // NOTE: This method is not used in S60 3.x - Sysap handles the reboot
       
   138 // ---------------------------------------------------------------------------
       
   139 EXPORT_C TBool CMMCScBkupEngine::RebootRequired() const
       
   140     {
       
   141     return iEngine->RebootRequired();
       
   142     }
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // CMMCScBkupEngine::ListArchivesL()
       
   146 // 
       
   147 // Provide a list of archives available on all drives
       
   148 // ---------------------------------------------------------------------------
       
   149 EXPORT_C void CMMCScBkupEngine::ListArchivesL(
       
   150         RPointerArray< CMMCScBkupArchiveInfo >& aArchives,
       
   151         CMMCScBkupOpParamsBase* aParams,
       
   152         const TUint32 aDriveAttMatch,
       
   153         const TInt aDriveMatch ) const
       
   154     {
       
   155     return iEngine->ListArchivesL(
       
   156         aArchives, aParams, aDriveAttMatch, aDriveMatch );
       
   157     }