equal
deleted
inserted
replaced
21 #include "fmdrivedetailstype.h" |
21 #include "fmdrivedetailstype.h" |
22 #include "fmcommon.h" |
22 #include "fmcommon.h" |
23 #include "fmoperationcopy.h" |
23 #include "fmoperationcopy.h" |
24 #include "fmoperationmove.h" |
24 #include "fmoperationmove.h" |
25 #include "fmoperationremove.h" |
25 #include "fmoperationremove.h" |
26 |
26 #include "fmoperationformat.h" |
27 |
27 |
28 #include <QDir> |
28 #include <QDir> |
29 #include <QStack> |
29 #include <QStack> |
30 |
30 |
31 FmOperationThread::FmOperationThread( QObject *parent ) : QThread( parent ), mOperationBase( 0 ) |
31 FmOperationThread::FmOperationThread( QObject *parent ) : QThread( parent ), mOperationBase( 0 ) |
47 mOperationBase = operationBase; |
47 mOperationBase = operationBase; |
48 mOperationBase->setObjectName( "operationElement" ); |
48 mOperationBase->setObjectName( "operationElement" ); |
49 QMetaObject::connectSlotsByName( this ); |
49 QMetaObject::connectSlotsByName( this ); |
50 connect( mOperationBase, SIGNAL( askForRename( QString, QString* ) ), |
50 connect( mOperationBase, SIGNAL( askForRename( QString, QString* ) ), |
51 this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection ); |
51 this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection ); |
|
52 connect( mOperationBase, SIGNAL( askForReplace( QString, QString, bool* ) ), |
|
53 this, SLOT( onAskForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection ); |
52 |
54 |
53 start(); |
55 start(); |
54 return FmErrNone; |
56 return FmErrNone; |
55 } |
57 } |
56 |
58 |
63 mOperationBase = operationBase; |
65 mOperationBase = operationBase; |
64 mOperationBase->setObjectName( "operationElement" ); |
66 mOperationBase->setObjectName( "operationElement" ); |
65 QMetaObject::connectSlotsByName( this ); |
67 QMetaObject::connectSlotsByName( this ); |
66 connect( mOperationBase, SIGNAL( askForRename( QString, QString* ) ), |
68 connect( mOperationBase, SIGNAL( askForRename( QString, QString* ) ), |
67 this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection ); |
69 this, SLOT( onAskForRename( QString, QString* )), Qt::BlockingQueuedConnection ); |
|
70 connect( mOperationBase, SIGNAL( askForReplace( QString, QString, bool* ) ), |
|
71 this, SLOT( onAskForReplace( QString, QString, bool* )), Qt::BlockingQueuedConnection ); |
|
72 |
68 |
73 |
69 start(); |
74 start(); |
70 return FmErrNone; |
75 return FmErrNone; |
71 } |
76 } |
72 |
77 |
132 } |
137 } |
133 |
138 |
134 void FmOperationThread::onAskForRename( const QString &srcFile, QString *destFile ) |
139 void FmOperationThread::onAskForRename( const QString &srcFile, QString *destFile ) |
135 { |
140 { |
136 emit askForRename( srcFile, destFile ); |
141 emit askForRename( srcFile, destFile ); |
|
142 } |
|
143 void FmOperationThread::onAskForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted ) |
|
144 { |
|
145 emit askForReplace( srcFile, destFile, isAccepted ); |
137 } |
146 } |
138 void FmOperationThread::on_operationElement_notifyPreparing( bool cancelable ) |
147 void FmOperationThread::on_operationElement_notifyPreparing( bool cancelable ) |
139 { |
148 { |
140 emit notifyPreparing( cancelable ); |
149 emit notifyPreparing( cancelable ); |
141 } |
150 } |
224 emit refreshModel( QString("") ); |
233 emit refreshModel( QString("") ); |
225 break; |
234 break; |
226 } |
235 } |
227 case FmOperationService::EOperationTypeFormat: |
236 case FmOperationService::EOperationTypeFormat: |
228 { |
237 { |
229 emit notifyWaiting( false ); |
238 // emit notifyWaiting( false ); |
230 FmLogger::log(QString("start format")); |
239 FmLogger::log(QString("start format")); |
231 FmOperationFormat *operationFormat = static_cast<FmOperationFormat*>( mOperationBase ); |
240 FmOperationFormat *operationFormat = static_cast<FmOperationFormat*>( mOperationBase ); |
232 FmLogger::log(QString("get param and start format")); |
241 FmLogger::log(QString("get param and start format")); |
233 |
242 |
234 QString refreshSrcPath = operationFormat->driverName(); |
243 QString refreshSrcPath = operationFormat->driverName(); |
235 if ( FmErrNone != FmUtils::formatDrive( operationFormat->driverName() ) ) { |
244 // if ( FmErrNone != FmUtils::formatDrive( operationFormat->driverName() ) ) { |
|
245 if ( FmErrNone != operationFormat->start() ) { |
236 emit notifyError( FmErrTypeFormatFailed, operationFormat->driverName() ); |
246 emit notifyError( FmErrTypeFormatFailed, operationFormat->driverName() ); |
237 return; |
247 return; |
238 } |
248 } |
239 FmLogger::log(QString("format done")); |
249 FmLogger::log(QString("format done")); |
240 emit notifyFinish(); |
250 emit notifyFinish(); |