filemanager/src/fmbkupenginewrapper/src/fmbkupengine.cpp
changeset 14 1957042d8c7e
child 16 ada7962b4308
equal deleted inserted replaced
1:d1daf54a55b5 14:1957042d8c7e
       
     1 /*
       
     2  * Copyright (c) 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  * 
       
    15  * Description:
       
    16  *      The source file of the backup engine from backup engine wrapper
       
    17  */
       
    18 
       
    19 #include "fmbkupengine.h"
       
    20 #include "fmbkupengine_p.h"
       
    21 
       
    22 #include "fmbackupsettings.h"
       
    23 #include "fmrestoresettings.h"
       
    24 
       
    25 #include <QObject>
       
    26 FmBkupEngine::FmBkupEngine(QObject* parent):
       
    27     QObject(parent), d(new FmBkupEnginePrivate(this)), iBackupSettings( 0 ), iRestoreSettings( 0 )
       
    28 {
       
    29     connect( d, SIGNAL( notifyPreparing( bool ) ), this, SIGNAL( notifyPreparing( bool ) ) );
       
    30 	connect( d, SIGNAL( notifyStart( bool, int ) ), this, SIGNAL( notifyStart( bool, int ) ) );
       
    31 	connect( d, SIGNAL( notifyUpdate(int) ), this, SIGNAL( notifyUpdate(int) ) );
       
    32 	connect( d, SIGNAL( notifyFinish(int) ), 
       
    33 			this, SIGNAL( notifyFinish(int) ) );
       
    34 	connect( d, SIGNAL( notifyMemoryLow(int, int& ) ), this, SIGNAL( notifyMemoryLow(int, int&) ) );
       
    35 }
       
    36 
       
    37 
       
    38 FmBkupEngine::~FmBkupEngine()
       
    39 {
       
    40     delete d;
       
    41     if( iBackupSettings ) {
       
    42         delete iBackupSettings;
       
    43     }
       
    44     if( iRestoreSettings ) {
       
    45         delete iRestoreSettings;
       
    46     }
       
    47 }
       
    48 
       
    49 bool FmBkupEngine::startBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
       
    50     QList<FmBkupBackupCategory*> backupCategoryList,
       
    51     QString drive, quint32 content)
       
    52 {
       
    53     return d->startBackup( drivesAndOperationList, backupCategoryList, drive, content );
       
    54 }
       
    55 void FmBkupEngine::cancelBackup()
       
    56 {
       
    57 	d->cancelBackup();
       
    58 }
       
    59 bool FmBkupEngine::startRestore( QList<FmBkupDrivesAndOperation* > drivesAndOperationList )
       
    60 {
       
    61    return d->StartRestoreL( drivesAndOperationList );
       
    62 }
       
    63 
       
    64 
       
    65 int FmBkupEngine::error() const
       
    66 {
       
    67     return d->error();
       
    68 }
       
    69 
       
    70 FmBackupSettings *FmBkupEngine::BackupSettingsL()
       
    71 {
       
    72     if ( !iBackupSettings )
       
    73         {
       
    74         iBackupSettings = new FmBackupSettings();
       
    75         }
       
    76     return iBackupSettings;
       
    77 }
       
    78 
       
    79 FmRestoreSettings *FmBkupEngine::RestoreSettingsL()
       
    80 {
       
    81     if ( !iRestoreSettings )
       
    82         {
       
    83         iRestoreSettings = new FmRestoreSettings( *this );
       
    84         }
       
    85     return iRestoreSettings;
       
    86 }
       
    87     
       
    88 void FmBkupEngine::GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > &drivesAndOperationList,
       
    89         QList< FmRestoreInfo > &restoreInfoList,
       
    90         const int aDrive )
       
    91     {
       
    92     d->GetRestoreInfoArray( drivesAndOperationList, restoreInfoList, aDrive );
       
    93     }
       
    94 
       
    95 int FmBkupEngine::deleteBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList )
       
    96     {
       
    97     return d->deleteBackup( drivesAndOperationList );
       
    98     }
       
    99 
       
   100