diff options
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 | * |