diff options
Diffstat (limited to 'common/mailpreprocessor.cpp')
-rw-r--r-- | common/mailpreprocessor.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/common/mailpreprocessor.cpp b/common/mailpreprocessor.cpp index c38035e..2863ad4 100644 --- a/common/mailpreprocessor.cpp +++ b/common/mailpreprocessor.cpp | |||
@@ -29,6 +29,8 @@ | |||
29 | 29 | ||
30 | using namespace Sink; | 30 | using namespace Sink; |
31 | 31 | ||
32 | SINK_DEBUG_AREA("mailpreprocessor") | ||
33 | |||
32 | QString MailPropertyExtractor::getFilePathFromMimeMessagePath(const QString &s) const | 34 | QString MailPropertyExtractor::getFilePathFromMimeMessagePath(const QString &s) const |
33 | { | 35 | { |
34 | return s; | 36 | return s; |
@@ -38,23 +40,23 @@ void MailPropertyExtractor::updatedIndexedProperties(Sink::ApplicationDomain::Ma | |||
38 | { | 40 | { |
39 | const auto mimeMessagePath = getFilePathFromMimeMessagePath(mail.getMimeMessagePath()); | 41 | const auto mimeMessagePath = getFilePathFromMimeMessagePath(mail.getMimeMessagePath()); |
40 | if (mimeMessagePath.isNull()) { | 42 | if (mimeMessagePath.isNull()) { |
41 | Trace() << "No mime message"; | 43 | SinkTrace() << "No mime message"; |
42 | return; | 44 | return; |
43 | } | 45 | } |
44 | Trace() << "Updating indexed properties " << mimeMessagePath; | 46 | SinkTrace() << "Updating indexed properties " << mimeMessagePath; |
45 | QFile f(mimeMessagePath); | 47 | QFile f(mimeMessagePath); |
46 | if (!f.open(QIODevice::ReadOnly)) { | 48 | if (!f.open(QIODevice::ReadOnly)) { |
47 | Warning() << "Failed to open the file: " << mimeMessagePath; | 49 | SinkWarning() << "Failed to open the file: " << mimeMessagePath; |
48 | return; | 50 | return; |
49 | } | 51 | } |
50 | if (!f.size()) { | 52 | if (!f.size()) { |
51 | Warning() << "The file is empty."; | 53 | SinkWarning() << "The file is empty."; |
52 | return; | 54 | return; |
53 | } | 55 | } |
54 | const auto mappedSize = qMin((qint64)8000, f.size()); | 56 | const auto mappedSize = qMin((qint64)8000, f.size()); |
55 | auto mapped = f.map(0, mappedSize); | 57 | auto mapped = f.map(0, mappedSize); |
56 | if (!mapped) { | 58 | if (!mapped) { |
57 | Warning() << "Failed to map the file: " << f.errorString(); | 59 | SinkWarning() << "Failed to map the file: " << f.errorString(); |
58 | return; | 60 | return; |
59 | } | 61 | } |
60 | 62 | ||
@@ -89,15 +91,15 @@ QString MimeMessageMover::moveMessage(const QString &oldPath, const Sink::Applic | |||
89 | const auto filePath = directory + "/" + mail.identifier(); | 91 | const auto filePath = directory + "/" + mail.identifier(); |
90 | if (oldPath != filePath) { | 92 | if (oldPath != filePath) { |
91 | if (!QDir().mkpath(directory)) { | 93 | if (!QDir().mkpath(directory)) { |
92 | Warning() << "Failed to create the directory: " << directory; | 94 | SinkWarning() << "Failed to create the directory: " << directory; |
93 | } | 95 | } |
94 | QFile::remove(filePath); | 96 | QFile::remove(filePath); |
95 | QFile origFile(oldPath); | 97 | QFile origFile(oldPath); |
96 | if (!origFile.open(QIODevice::ReadWrite)) { | 98 | if (!origFile.open(QIODevice::ReadWrite)) { |
97 | Warning() << "Failed to open the original file with write rights: " << origFile.errorString(); | 99 | SinkWarning() << "Failed to open the original file with write rights: " << origFile.errorString(); |
98 | } | 100 | } |
99 | if (!origFile.rename(filePath)) { | 101 | if (!origFile.rename(filePath)) { |
100 | Warning() << "Failed to move the file from: " << oldPath << " to " << filePath << ". " << origFile.errorString(); | 102 | SinkWarning() << "Failed to move the file from: " << oldPath << " to " << filePath << ". " << origFile.errorString(); |
101 | } | 103 | } |
102 | origFile.close(); | 104 | origFile.close(); |
103 | return filePath; | 105 | return filePath; |