|
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 QString& aDrive ); |
|
60 void getBackupDriveList( QStringList &driveList ); |
|
61 private: |
|
62 int DriverNameToNumber( QString driverName ); |
|
63 QString NumberToDriverName( int driver ); |
|
64 |
|
65 // TBool HasMultipleBackupTargets(); |
|
66 |
|
67 signals: |
|
68 void notifyPreparing( bool cancelable ); |
|
69 void notifyStart( bool cancelable, int totalCount ); |
|
70 void notifyUpdate( int count ); |
|
71 void notifyFinish( int err ); |
|
72 void notifyMemoryLow( int memoryValue, int &userError ); |
|
73 |
|
74 // win32 source code is used to simulator backup action. |
|
75 // add this signal in win32 to avoid warning when run test case |
|
76 // though it is not used in win32 source code currently |
|
77 void notifyBackupFilesExist( bool &isContinue ); |
|
78 |
|
79 public slots: |
|
80 void onNotifyPreparing( bool cancelable ); |
|
81 void onNotifyStart( bool cancelable, int totalCount ); |
|
82 void onNotifyUpdate( int count ); |
|
83 void onNotifyFinish( int err ); |
|
84 void onNotifyMemoryLow( int memoryValue, int &userError ); |
|
85 |
|
86 private: |
|
87 int mError; |
|
88 FmBkupEngine* q; |
|
89 FmBkupThread* mBkupThread; |
|
90 |
|
91 QList< FmRestoreInfo > selection; |
|
92 }; |
|
93 |
|
94 |
|
95 |
|
96 class FmBkupThread : public QThread |
|
97 { |
|
98 Q_OBJECT |
|
99 public: |
|
100 enum RunType |
|
101 { |
|
102 RunTypeNone, |
|
103 RunTypeBackup, |
|
104 RunTypeRestore |
|
105 }; |
|
106 |
|
107 FmBkupThread( QObject *parent ); |
|
108 ~FmBkupThread(); |
|
109 |
|
110 int asyncBackup( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, |
|
111 QList<FmBkupBackupCategory*> backupCategoryList,QString drive, quint32 content ); |
|
112 int asyncRestore( QList<FmBkupDrivesAndOperation* > drivesAndOperationList, QList< FmRestoreInfo > selection ); |
|
113 void stop(); |
|
114 |
|
115 signals: |
|
116 void notifyPreparing( bool cancelable ); |
|
117 void notifyStart( bool cancelable, int totalCount ); |
|
118 void notifyUpdate( int totalCount ); |
|
119 void notifyFinish( int err ); |
|
120 void notifyMemoryLow( int memoryValue, int &userError ); |
|
121 |
|
122 protected: |
|
123 void run(); |
|
124 |
|
125 private: |
|
126 volatile bool mStop; |
|
127 RunType mRunType; |
|
128 |
|
129 QList<FmBkupDrivesAndOperation* > mDrivesAndOperationList; |
|
130 QList<FmBkupBackupCategory*> mBackupCategoryList; |
|
131 QString mDrive; |
|
132 quint32 mContent; |
|
133 QList< FmRestoreInfo > mSelection; |
|
134 |
|
135 }; |
|
136 |
|
137 |
|
138 #endif /*FMBKUPENGINEPRIVATE_H*/ |
|
139 |
|
140 // End of file |