summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-10 21:32:41 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-05-12 08:15:38 +0200
commit380ecbf2866a322de01b28e90dafc1a24e4d948c (patch)
tree3b68e13141504424f77e8309cd02c99776d6b81a /examples
parent254f9dad6377311b8115221c252b20726acad0c5 (diff)
downloadsink-380ecbf2866a322de01b28e90dafc1a24e4d948c.tar.gz
sink-380ecbf2866a322de01b28e90dafc1a24e4d948c.zip
Don't create folders on invalid config.
Diffstat (limited to 'examples')
-rw-r--r--examples/maildirresource/maildirresource.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp
index 40bab37..24681b5 100644
--- a/examples/maildirresource/maildirresource.cpp
+++ b/examples/maildirresource/maildirresource.cpp
@@ -555,18 +555,20 @@ MaildirResource::MaildirResource(const Sink::ResourceContext &resourceContext)
555 setupPreprocessors(ENTITY_TYPE_FOLDER, QVector<Sink::Preprocessor*>() << new FolderPreprocessor(mMaildirPath)); 555 setupPreprocessors(ENTITY_TYPE_FOLDER, QVector<Sink::Preprocessor*>() << new FolderPreprocessor(mMaildirPath));
556 556
557 KPIM::Maildir dir(mMaildirPath, true); 557 KPIM::Maildir dir(mMaildirPath, true);
558 SinkTrace() << "Started maildir resource for maildir: " << mMaildirPath; 558 if (dir.isValid(false)) {
559 { 559 {
560 auto draftsFolder = dir.addSubFolder("Drafts"); 560 auto draftsFolder = dir.addSubFolder("Drafts");
561 auto remoteId = synchronizer->createFolder(draftsFolder, "folder", QByteArrayList() << "drafts"); 561 auto remoteId = synchronizer->createFolder(draftsFolder, "folder", QByteArrayList() << "drafts");
562 auto draftsFolderLocalId = synchronizer->syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, remoteId); 562 auto draftsFolderLocalId = synchronizer->syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, remoteId);
563 } 563 }
564 { 564 {
565 auto trashFolder = dir.addSubFolder("Trash"); 565 auto trashFolder = dir.addSubFolder("Trash");
566 auto remoteId = synchronizer->createFolder(trashFolder, "folder", QByteArrayList() << "trash"); 566 auto remoteId = synchronizer->createFolder(trashFolder, "folder", QByteArrayList() << "trash");
567 auto trashFolderLocalId = synchronizer->syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, remoteId); 567 auto trashFolderLocalId = synchronizer->syncStore().resolveRemoteId(ENTITY_TYPE_FOLDER, remoteId);
568 }
569 synchronizer->commit();
568 } 570 }
569 synchronizer->commit(); 571 SinkTrace() << "Started maildir resource for maildir: " << mMaildirPath;
570} 572}
571 573
572 574