summaryrefslogtreecommitdiff
path: root/plugins/CopyEngine/Ultracopier/MkPath.h
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2017-11-24 23:24:09 +0000
committerThomas Preud'homme <robotux@celest.fr>2017-11-24 23:24:09 +0000
commitb3c8bdcc0d1e4b2ab298847a7902b6d60410a5bc (patch)
tree8fce8a51adfb245db8ab2a76831661780c0c713e /plugins/CopyEngine/Ultracopier/MkPath.h
parente297dbd8052ef4e66f069e2dd1865ae7fa8af28e (diff)
New upstream version 1.2.3.6
Diffstat (limited to 'plugins/CopyEngine/Ultracopier/MkPath.h')
-rw-r--r--plugins/CopyEngine/Ultracopier/MkPath.h106
1 files changed, 106 insertions, 0 deletions
diff --git a/plugins/CopyEngine/Ultracopier/MkPath.h b/plugins/CopyEngine/Ultracopier/MkPath.h
new file mode 100644
index 0000000..9182462
--- /dev/null
+++ b/plugins/CopyEngine/Ultracopier/MkPath.h
@@ -0,0 +1,106 @@
+/** \file MkPath.h
+\brief Make the path given as queued mkpath
+\author alpha_one_x86
+\licence GPL3, see the file COPYING */
+
+#ifndef MKPATH_H
+#define MKPATH_H
+
+#include <QThread>
+#include <QFileInfo>
+#include <QString>
+#include <QSemaphore>
+#include <QStringList>
+#include <QDir>
+#include <QDateTime>
+
+#include "Environment.h"
+
+#ifdef Q_OS_UNIX
+ #include <utime.h>
+ #include <time.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
+#else
+ #ifdef Q_OS_WIN32
+ #ifdef ULTRACOPIER_PLUGIN_SET_TIME_UNIX_WAY
+ #include <utime.h>
+ #include <time.h>
+ #include <unistd.h>
+ #include <sys/stat.h>
+ #endif
+ #endif
+#endif
+
+/// \brief Make the path given as queued mkpath
+class MkPath : public QThread
+{
+ Q_OBJECT
+public:
+ explicit MkPath();
+ ~MkPath();
+ /// \brief add path to make
+ void addPath(const QFileInfo& source,const QFileInfo& destination,const ActionType &actionType);
+ void setRightTransfer(const bool doRightTransfer);
+ void setKeepDate(const bool keepDate);
+signals:
+ void errorOnFolder(const QFileInfo &,const QString &,const ErrorType &errorType=ErrorType_FolderWithRety) const;
+ void firstFolderFinish();
+ void internalStartAddPath(const QFileInfo& source,const QFileInfo& destination, const ActionType &actionType) const;
+ void internalStartDoThisPath() const;
+ void internalStartSkip() const;
+ void internalStartRetry() const;
+ void debugInformation(const Ultracopier::DebugLevel &level,const QString &fonction,const QString &text,const QString &file,const int &ligne) const;
+public slots:
+ /// \brief skip after creation error
+ void skip();
+ /// \brief retry after creation error
+ void retry();
+private:
+ void run();
+ bool waitAction;
+ bool stopIt;
+ bool skipIt;
+ QDateTime maxTime;
+ struct Item
+ {
+ QFileInfo source;
+ QFileInfo destination;
+ ActionType actionType;
+ };
+ QList<Item> pathList;
+ void checkIfCanDoTheNext();
+ QDir dir;
+ bool doRightTransfer;
+ bool keepDate;
+ bool doTheDateTransfer;
+ #ifdef Q_OS_UNIX
+ utimbuf butime;
+ #else
+ #ifdef Q_OS_WIN32
+ #ifdef ULTRACOPIER_PLUGIN_SET_TIME_UNIX_WAY
+ utimbuf butime;
+ #else
+ quint32 ftCreateL, ftAccessL, ftWriteL;
+ quint32 ftCreateH, ftAccessH, ftWriteH;
+ QRegularExpression regRead;
+ #endif
+ #endif
+ #endif
+ //fonction to edit the file date time
+ bool readFileDateTime(const QFileInfo &source);
+ bool writeFileDateTime(const QFileInfo &destination);
+ static QString text_slash;
+private slots:
+ void internalDoThisPath();
+ void internalAddPath(const QFileInfo& source, const QFileInfo& destination,const ActionType &actionType);
+ void internalSkip();
+ void internalRetry();
+ bool rmpath(const QDir &dir
+ #ifdef ULTRACOPIER_PLUGIN_RSYNC
+ , const bool &toSync=false
+ #endif
+ );
+};
+
+#endif // MKPATH_H