|
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 header file of the backup engine implement for win32 |
|
17 */ |
|
18 |
|
19 #ifndef FMBKUPENGINEPRIVATE_H |
|
20 #define FMBKUPENGINEPRIVATE_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "fmbkupengine.h" |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 |
|
27 |
|
28 |
|
29 #include <QString> |
|
30 #include <QStringList> |
|
31 |
|
32 #include <QThread> |
|
33 |
|
34 class FmBkupThread; |
|
35 |
|
36 |
|
37 // CLASS DECLARATION |
|
38 class FmBkupEnginePrivate : public QObject |
|
39 { |
|
40 Q_OBJECT |
|
41 public: |
|
42 FmBkupEnginePrivate(FmBkupEngine* bkupEngine); |
|
43 ~FmBkupEnginePrivate(); |
|
44 |
|
45 bool startBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
|
46 QList<FmBkupBackupCategory*> backupCategoryList, |
|
47 QString drive, quint32 content); |
|
48 |
|
49 void cancelBackup(); |
|
50 int deleteBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList ); |
|
51 |
|
52 // TUint32 FmgrToBkupMask( const TUint32 aFmrgMask ); |
|
53 int error(); |
|
54 |
|
55 // |
|
56 bool StartRestoreL( QList<FmBkupDrivesAndOperation* > drivesAndOperationList ); |
|
57 void GetRestoreInfoArray( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
|
58 QList< FmRestoreInfo > &restoreInfoList, |
|
59 const int aDrive = 0 ); |
|
60 private: |
|
61 int DriverNameToNumber( QString driverName ); |
|
62 QString NumberToDriverName( int driver ); |
|
63 |
|
64 signals: |
|
65 void notifyPreparing( bool cancelable ); |
|
66 void notifyStart( bool cancelable, int totalCount ); |
|
67 void notifyUpdate( int count ); |
|
68 void notifyFinish( int err ); |
|
69 void notifyMemoryLow( int memoryValue, int &userError ); |
|
70 |
|
71 public slots: |
|
72 void onNotifyPreparing( bool cancelable ); |
|
73 void onNotifyStart( bool cancelable, int totalCount ); |
|
74 void onNotifyUpdate( int count ); |
|
75 void onNotifyFinish( int err ); |
|
76 void onNotifyMemoryLow( int memoryValue, int &userError ); |
|
77 |
|
78 private: |
|
79 int mError; |
|
80 FmBkupEngine* q; |
|
81 FmBkupThread* mBkupThread; |
|
82 |
|
83 QList< FmRestoreInfo > selection; |
|
84 }; |
|
85 |
|
86 |
|
87 |
|
88 class FmBkupThread : public QThread |
|
89 { |
|
90 Q_OBJECT |
|
91 public: |
|
92 enum RunType |
|
93 { |
|
94 RunTypeNone, |
|
95 RunTypeBackup, |
|
96 RunTypeRestore |
|
97 }; |
|
98 |
|
99 FmBkupThread( QObject *parent ); |
|
100 ~FmBkupThread(); |
|
101 |
|
102 int asyncBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
|
103 QList<FmBkupBackupCategory*> backupCategoryList,QString drive, quint32 content ); |
|
104 int asyncRestore( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, QList< FmRestoreInfo > selection ); |
|
105 void stop(); |
|
106 |
|
107 signals: |
|
108 void notifyPreparing( bool cancelable ); |
|
109 void notifyStart( bool cancelable, int totalCount ); |
|
110 void notifyUpdate( int totalCount ); |
|
111 void notifyFinish( int err ); |
|
112 void notifyMemoryLow( int memoryValue, int &userError ); |
|
113 |
|
114 protected: |
|
115 void run(); |
|
116 |
|
117 private: |
|
118 volatile bool mStop; |
|
119 RunType mRunType; |
|
120 |
|
121 QList<FmBkupDrivesAndOperation* > mDrivesAndOperationList; |
|
122 QList<FmBkupBackupCategory*> mBackupCategoryList; |
|
123 QString mDrive; |
|
124 quint32 mContent; |
|
125 QList< FmRestoreInfo > mSelection; |
|
126 |
|
127 }; |
|
128 |
|
129 |
|
130 #endif /*FMBKUPENGINEPRIVATE_H*/ |
|
131 |
|
132 // End of file |