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 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "fmoperationformat.h" |
|
19 #include "fmcommon.h" |
|
20 #include "fmoperationbase.h" |
|
21 #include "fmutils.h" |
|
22 |
|
23 #include <QString> |
|
24 |
|
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 ), |
|
34 mDriverName( mDriverName ) |
|
35 { |
|
36 } |
|
37 |
|
38 /* |
|
39 * Destructs the operation. |
|
40 */ |
|
41 FmOperationFormat::~FmOperationFormat() |
|
42 { |
|
43 } |
|
44 |
|
45 /* |
|
46 * Returns the to be formatted drive name |
|
47 */ |
|
48 QString FmOperationFormat::driverName() |
|
49 { |
|
50 return mDriverName; |
|
51 } |
|
52 |
|
53 /* |
|
54 * Starts to format. |
|
55 * \a isStopped not used |
|
56 */ |
|
57 void FmOperationFormat::start( volatile bool */*isStopped*/ ) |
|
58 { |
|
59 QString logString = "FmOperationFormat::start"; |
|
60 FM_LOG( logString ); |
|
61 |
|
62 if( mDriverName.isEmpty() ) { |
|
63 emit notifyError( FmErrWrongParam, QString() ); |
|
64 return; |
|
65 } |
|
66 int totalCount( 100 ); |
|
67 emit notifyStart( totalCount, false ); |
|
68 for( int i = 0; i < totalCount; i++ ) { |
|
69 emit notifyProgress( i ); |
|
70 } |
|
71 |
|
72 emit notifyFinish(); |
|
73 emit driveSpaceChanged(); |
|
74 |
|
75 } |
|