filemanager/src/fmbkupenginewrapper/private/win32/fmbkupengine_p.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:24:39 +0300
changeset 16 ada7962b4308
parent 14 1957042d8c7e
child 18 edd66bde63a4
child 25 b7bfdea70ca2
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 * 
 * Contributors:
 *     
 * 
 * Description:
 *      The header file of the backup engine implement for win32
 */

#ifndef FMBKUPENGINEPRIVATE_H
#define FMBKUPENGINEPRIVATE_H

// INCLUDES
#include "fmbkupengine.h"

// FORWARD DECLARATIONS



#include <QString>
#include <QStringList>

#include <QThread>

class FmBkupThread;


// CLASS DECLARATION
class FmBkupEnginePrivate : public QObject
{
Q_OBJECT
public:
    FmBkupEnginePrivate(FmBkupEngine* bkupEngine);
    ~FmBkupEnginePrivate();
    
    bool startBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
    QList<FmBkupBackupCategory*> backupCategoryList,
    QString drive, quint32 content);
    
    void cancelBackup();
    int deleteBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList );

//    TUint32 FmgrToBkupMask( const TUint32 aFmrgMask );
    int error();
    
    //
    bool StartRestoreL( QList<FmBkupDrivesAndOperation* > drivesAndOperationList );
    void GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
            QList< FmRestoreInfo > &restoreInfoList,
            const int aDrive = 0 );
private:
    int DriverNameToNumber( QString driverName );
    QString NumberToDriverName( int driver );
    
    TBool HasMultipleBackupTargets();

signals:
    void notifyPreparing( bool cancelable );
	void notifyStart( bool cancelable, int totalCount );
	void notifyUpdate( int count );
	void notifyFinish( int err );
	void notifyMemoryLow( int memoryValue, int &userError );
	
public slots:
    void onNotifyPreparing( bool cancelable );
    void onNotifyStart( bool cancelable, int totalCount );
	void onNotifyUpdate( int count );
	void onNotifyFinish( int err );
	void onNotifyMemoryLow( int memoryValue, int &userError );

private:
    int mError;
    FmBkupEngine* q;
    FmBkupThread* mBkupThread;

    QList< FmRestoreInfo > selection;
};



class FmBkupThread : public QThread
{
    Q_OBJECT
public:
    enum RunType
    {
        RunTypeNone,
        RunTypeBackup,
        RunTypeRestore
    };

    FmBkupThread( QObject *parent );
    ~FmBkupThread();

    int asyncBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList,
QList<FmBkupBackupCategory*> backupCategoryList,QString drive, quint32 content );
    int asyncRestore( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, QList< FmRestoreInfo > selection );
    void stop();

signals:
    void notifyPreparing( bool cancelable );
    void notifyStart( bool cancelable, int totalCount );
	void notifyUpdate( int totalCount );
	void notifyFinish( int err );
	void notifyMemoryLow( int memoryValue, int &userError );

protected:
    void run();

private:
    volatile bool mStop;
    RunType mRunType;

    QList<FmBkupDrivesAndOperation* > mDrivesAndOperationList;
    QList<FmBkupBackupCategory*> mBackupCategoryList;
    QString mDrive;
    quint32 mContent;
    QList< FmRestoreInfo > mSelection;

};


#endif /*FMBKUPENGINEPRIVATE_H*/

// End of file