20 #include "fmoperationbase.h" |
20 #include "fmoperationbase.h" |
21 #include "fmutils.h" |
21 #include "fmutils.h" |
22 |
22 |
23 #include <QString> |
23 #include <QString> |
24 |
24 |
25 FmOperationFormat::FmOperationFormat( QObject *parent, QString mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ), |
25 /* \fn void driveSpaceChanged() |
|
26 * This signal is emitted when copy or move is completed, and used to update the drive size. |
|
27 */ |
|
28 |
|
29 /* |
|
30 * Constructs a format operation with \a parent |
|
31 * \a mDriverName the drive to be formatted. |
|
32 */ |
|
33 FmOperationFormat::FmOperationFormat( QObject *parent, const QString &mDriverName ) : FmOperationBase( parent, FmOperationService::EOperationTypeFormat ), |
26 mDriverName( mDriverName ) |
34 mDriverName( mDriverName ) |
27 { |
35 { |
28 } |
36 } |
|
37 |
|
38 /* |
|
39 * Destructs the operation. |
|
40 */ |
29 FmOperationFormat::~FmOperationFormat() |
41 FmOperationFormat::~FmOperationFormat() |
30 { |
42 { |
31 } |
43 } |
32 |
44 |
|
45 /* |
|
46 * Returns the to be formatted drive name |
|
47 */ |
33 QString FmOperationFormat::driverName() |
48 QString FmOperationFormat::driverName() |
34 { |
49 { |
35 return mDriverName; |
50 return mDriverName; |
36 } |
51 } |
37 |
52 |
38 int FmOperationFormat::start() |
53 /* |
|
54 * Starts to format. |
|
55 * \a isStopped not used |
|
56 */ |
|
57 void FmOperationFormat::start( volatile bool */*isStopped*/ ) |
39 { |
58 { |
40 QString logString = "FmOperationFormat::start"; |
59 QString logString = "FmOperationFormat::start"; |
41 FmLogger::log( logString ); |
60 FM_LOG( logString ); |
42 |
61 |
43 if( mDriverName.isEmpty() ) { |
62 if( mDriverName.isEmpty() ) { |
44 return FmErrWrongParam; |
63 emit notifyError( FmErrWrongParam, QString() ); |
|
64 return; |
45 } |
65 } |
46 int totalCount( 100 ); |
66 int totalCount( 100 ); |
47 emit notifyStart( totalCount, false ); |
67 emit notifyStart( totalCount, false ); |
48 for( int i = 0; i < totalCount; i++ ) { |
68 for( int i = 0; i < totalCount; i++ ) { |
49 emit notifyProgress( i ); |
69 emit notifyProgress( i ); |
50 } |
70 } |
51 |
71 |
52 return FmErrNone; |
72 emit notifyFinish(); |
|
73 emit driveSpaceChanged(); |
53 |
74 |
54 } |
75 } |