diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 19:27:08 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-22 19:27:08 +0100 |
commit | 97c2e02697ba90d2339a905b7ad81aa883dca7a5 (patch) | |
tree | 30423e4f1ae6b52641e0135db41c4f4be64984b3 | |
parent | d11978620ea82d1795c9fdd65c4c79d3dd852440 (diff) | |
download | sink-97c2e02697ba90d2339a905b7ad81aa883dca7a5.tar.gz sink-97c2e02697ba90d2339a905b7ad81aa883dca7a5.zip |
Avoid using QDir::separator
It really doesn't help us in assembling paths since qt deals with
forward slashes just fine
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 8 | ||||
-rw-r--r-- | tests/maildirresourcetest.cpp | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index 68eb099..5a38b01 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -55,9 +55,9 @@ MaildirResource::MaildirResource(const QByteArray &instanceIdentifier, const QSh | |||
55 | addType(ENTITY_TYPE_FOLDER, mFolderAdaptorFactory, | 55 | addType(ENTITY_TYPE_FOLDER, mFolderAdaptorFactory, |
56 | QVector<Akonadi2::Preprocessor*>() << new DefaultIndexUpdater<Akonadi2::ApplicationDomain::Folder>); | 56 | QVector<Akonadi2::Preprocessor*>() << new DefaultIndexUpdater<Akonadi2::ApplicationDomain::Folder>); |
57 | auto config = ResourceConfig::getConfiguration(instanceIdentifier); | 57 | auto config = ResourceConfig::getConfiguration(instanceIdentifier); |
58 | mMaildirPath = config.value("path").toString(); | 58 | mMaildirPath = QDir::cleanPath(QDir::fromNativeSeparators(config.value("path").toString())); |
59 | //Chop a trailing slash if necessary | 59 | //Chop a trailing slash if necessary |
60 | if (mMaildirPath.endsWith(QDir::separator())) { | 60 | if (mMaildirPath.endsWith("/")) { |
61 | mMaildirPath.chop(1); | 61 | mMaildirPath.chop(1); |
62 | } | 62 | } |
63 | Trace() << "Started maildir resource for maildir: " << mMaildirPath; | 63 | Trace() << "Started maildir resource for maildir: " << mMaildirPath; |
@@ -95,7 +95,7 @@ static QStringList listRecursive( const QString &root, const KPIM::Maildir &dir | |||
95 | if (!md.isValid()) { | 95 | if (!md.isValid()) { |
96 | continue; | 96 | continue; |
97 | } | 97 | } |
98 | QString path = root + QDir::separator() + sub; | 98 | QString path = root + "/" + sub; |
99 | list << path; | 99 | list << path; |
100 | list += listRecursive(path, md ); | 100 | list += listRecursive(path, md ); |
101 | } | 101 | } |
@@ -287,7 +287,7 @@ void MaildirResource::synchronizeMails(Akonadi2::Storage::Transaction &transacti | |||
287 | const auto remoteId = fileName.toUtf8(); | 287 | const auto remoteId = fileName.toUtf8(); |
288 | 288 | ||
289 | KMime::Message *msg = new KMime::Message; | 289 | KMime::Message *msg = new KMime::Message; |
290 | auto filepath = listingPath + QDir::separator() + fileName; | 290 | auto filepath = listingPath + "/" + fileName; |
291 | msg->setHead(KMime::CRLFtoLF(maildir.readEntryHeadersFromFile(filepath))); | 291 | msg->setHead(KMime::CRLFtoLF(maildir.readEntryHeadersFromFile(filepath))); |
292 | msg->parse(); | 292 | msg->parse(); |
293 | 293 | ||
diff --git a/tests/maildirresourcetest.cpp b/tests/maildirresourcetest.cpp index c415a54..b16f883 100644 --- a/tests/maildirresourcetest.cpp +++ b/tests/maildirresourcetest.cpp | |||
@@ -55,7 +55,7 @@ private Q_SLOTS: | |||
55 | void initTestCase() | 55 | void initTestCase() |
56 | { | 56 | { |
57 | QVERIFY(tempDir.isValid()); | 57 | QVERIFY(tempDir.isValid()); |
58 | auto targetPath = tempDir.path() + QDir::separator() + "maildir1/"; | 58 | auto targetPath = tempDir.path() + "/maildir1/"; |
59 | copyRecursively(TESTDATAPATH "/maildir1", targetPath); | 59 | copyRecursively(TESTDATAPATH "/maildir1", targetPath); |
60 | 60 | ||
61 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); | 61 | Akonadi2::Log::setDebugOutputLevel(Akonadi2::Log::Trace); |
@@ -181,7 +181,7 @@ private Q_SLOTS: | |||
181 | //Ensure all local data is processed | 181 | //Ensure all local data is processed |
182 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); | 182 | Akonadi2::Store::synchronize(query).exec().waitForFinished(); |
183 | 183 | ||
184 | auto targetPath = tempDir.path() + QDir::separator() + "maildir1/"; | 184 | auto targetPath = tempDir.path() + "/maildir1/"; |
185 | QDir dir(targetPath); | 185 | QDir dir(targetPath); |
186 | QVERIFY(dir.rename("inbox", "newbox")); | 186 | QVERIFY(dir.rename("inbox", "newbox")); |
187 | 187 | ||