filemanager/src/filemanager/src/operationservice/fmoperationcopyormove.h
changeset 37 15bc28c9dd51
equal deleted inserted replaced
16:ada7962b4308 37:15bc28c9dd51
       
     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 #ifndef FMOPERATIONCOPYORMOVE_H
       
    19 #define FMOPERATIONCOPYORMOVE_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <QString>
       
    23 
       
    24 #include "fmoperationbase.h"
       
    25 
       
    26 class FmOperationCopyOrMove : public FmOperationBase
       
    27 {
       
    28     Q_OBJECT
       
    29     
       
    30 public:
       
    31     explicit FmOperationCopyOrMove( FmOperationService *operationService, FmOperationService::TOperationType type, const QStringList &sourceList, const QString &targetPath );
       
    32     virtual ~FmOperationCopyOrMove();
       
    33     virtual int prepare();
       
    34     virtual void start( volatile bool *isStopped );
       
    35     QStringList sourceList();
       
    36     QString     targetPath();
       
    37 
       
    38 signals:
       
    39     void askForReplace( const QString &srcFile, const QString &destFile, bool *isAccepted );
       
    40     void askForRename( const QString &srcFile, QString *destFile );
       
    41     void driveSpaceChanged();
       
    42         
       
    43 private:
       
    44     int copyOrMove( const QString &source, const QString &targetPath, const QString &newTargetName = QString() );
       
    45     int copyOrMoveDirInsideContent( const QString &srcPath, const QString &destPath );
       
    46     void increaseProgress( quint64 size );
       
    47     void queryForRename( const QString &srcFile, QString *destFile );
       
    48     int copyOneFile( const QString &srcFile, const QString &desFile );
       
    49     bool targetHasEnoughSpace();
       
    50 
       
    51 private:
       
    52     FmOperationService *mOperationService;
       
    53     QStringList         mSourceList;
       
    54     QString             mTargetPath;    
       
    55     volatile bool      *mStop;    
       
    56     QString             mErrString;
       
    57     
       
    58     quint64             mTotalSize;
       
    59     quint64             mCopiedOrMovedSize;
       
    60     int                 mTotalSteps;
       
    61     int                 mCurrentStep;
       
    62 };
       
    63 #endif