diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-20 17:18:21 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-09-20 17:18:21 +0200 |
commit | ebc5c48c03b6145e604da7c313b35321d0a71142 (patch) | |
tree | 1cee00a9fa4faa4995c0a50f01703ac5672c8797 /examples/maildirresource/tests/maildirmailsynctest.cpp | |
parent | 4a14a6fade947aa830d3f21598a4a6ba7316b933 (diff) | |
download | sink-ebc5c48c03b6145e604da7c313b35321d0a71142.tar.gz sink-ebc5c48c03b6145e604da7c313b35321d0a71142.zip |
A first draft of the threading algorithm.
Diffstat (limited to 'examples/maildirresource/tests/maildirmailsynctest.cpp')
-rw-r--r-- | examples/maildirresource/tests/maildirmailsynctest.cpp | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/examples/maildirresource/tests/maildirmailsynctest.cpp b/examples/maildirresource/tests/maildirmailsynctest.cpp index f2cf3e0..bafd5a8 100644 --- a/examples/maildirresource/tests/maildirmailsynctest.cpp +++ b/examples/maildirresource/tests/maildirmailsynctest.cpp | |||
@@ -25,36 +25,11 @@ | |||
25 | #include "common/test.h" | 25 | #include "common/test.h" |
26 | #include "common/domain/applicationdomaintype.h" | 26 | #include "common/domain/applicationdomaintype.h" |
27 | 27 | ||
28 | #include "utils.h" | ||
29 | |||
28 | using namespace Sink; | 30 | using namespace Sink; |
29 | using namespace Sink::ApplicationDomain; | 31 | using namespace Sink::ApplicationDomain; |
30 | 32 | ||
31 | static bool copyRecursively(const QString &srcFilePath, const QString &tgtFilePath) | ||
32 | { | ||
33 | QFileInfo srcFileInfo(srcFilePath); | ||
34 | if (srcFileInfo.isDir()) { | ||
35 | QDir targetDir(tgtFilePath); | ||
36 | targetDir.cdUp(); | ||
37 | if (!targetDir.mkdir(QFileInfo(srcFilePath).fileName())) { | ||
38 | qWarning() << "Failed to create directory " << tgtFilePath; | ||
39 | return false; | ||
40 | } | ||
41 | QDir sourceDir(srcFilePath); | ||
42 | QStringList fileNames = sourceDir.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System); | ||
43 | foreach (const QString &fileName, fileNames) { | ||
44 | const QString newSrcFilePath = srcFilePath + QLatin1Char('/') + fileName; | ||
45 | const QString newTgtFilePath = tgtFilePath + QLatin1Char('/') + fileName; | ||
46 | if (!copyRecursively(newSrcFilePath, newTgtFilePath)) | ||
47 | return false; | ||
48 | } | ||
49 | } else { | ||
50 | if (!QFile::copy(srcFilePath, tgtFilePath)) { | ||
51 | qWarning() << "Failed to copy file " << tgtFilePath; | ||
52 | return false; | ||
53 | } | ||
54 | } | ||
55 | return true; | ||
56 | } | ||
57 | |||
58 | /** | 33 | /** |
59 | * Test of complete system using the maildir resource. | 34 | * Test of complete system using the maildir resource. |
60 | * | 35 | * |