29
29
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
30
30
// The string returned by getSourceType() is always the one
31
31
// registered as main Aliases() below.
32
bool isMe = sourceType.m_backend == "Files in one directory";
32
bool isMe = sourceType.m_backend == "file";
34
34
#ifndef ENABLE_FILE
35
35
// tell SyncEvolution if the user wanted to use a disabled sync source,
41
41
bool maybeMe = false /* sourceType.m_backend == "addressbook" */;
43
43
if (isMe || maybeMe) {
44
// The FileSyncSource always needs the data format
45
// parameter in sourceType.m_format.
46
if (/* sourceType.m_format == "" || sourceType.m_format == "text/x-vcard" */
47
sourceType.m_format.size()) {
48
return new FileSyncSource(params, sourceType.m_format);
44
// The FileSyncSource always needs the database format.
45
if (!sourceType.m_localFormat.empty()) {
46
return new FileSyncSource(params, sourceType.m_localFormat);
64
62
"Files in one directory = file\n"
65
63
" Stores items in one directory as one file per item.\n"
66
" The directory is selected via evolutionsource=[file://]<path>.\n"
64
" The directory is selected via database=[file://]<path>.\n"
67
65
" It will only be created if the prefix is given, otherwise\n"
68
" it must exist already. Only items of the same type can\n"
69
" be synchronized and this type must be specified explicitly\n"
70
" with both mime type and version.\n"
71
" Examples for type:\n"
72
" file:text/plain:1.0\n"
73
" file:text/x-vcard:2.1\n"
74
" file:text/vcard:3.0\n"
75
" file:text/x-vcalendar:1.0\n"
76
" file:text/calendar:2.0\n"
66
" it must exist already.\n"
67
" The database format *must* be specified explicitly. It may be\n"
68
" different from the sync format, as long as there are\n"
69
" conversion rules (for example, vCard 2.1 <-> vCard 3.0). If\n"
70
" the sync format is empty, the database format is used.\n"
71
" Examples for databaseFormat + syncFormat:\n"
72
" text/plain + text/plain\n"
73
" text/x-vcard + text/vcard\n"
77
75
" Examples for evolutionsource:\n"
78
76
" /home/joe/datadir - directory must exist\n"
79
77
" file:///tmp/scratch - directory is created\n",
81
(Aliases("Files in one directory") + "file"));
79
(Aliases("file") + "Files in one directory"));
84
82
#ifdef ENABLE_UNIT_TESTS
120
static class VCard21Test : public RegisterSyncSourceTest {
122
VCard21Test() : RegisterSyncSourceTest("file_vcard21", "vcard21") {}
124
virtual void updateConfig(ClientTestConfig &config) const
126
// set type as required by FileSyncSource
127
// and leave everything else at its default
128
config.type = "file:text/x-vcard:2.1";
132
118
static class VCard30Test : public RegisterSyncSourceTest {
134
VCard30Test() : RegisterSyncSourceTest("file_vcard30", "vcard30") {}
120
VCard30Test() : RegisterSyncSourceTest("file_contact", "eds_contact") {}
136
122
virtual void updateConfig(ClientTestConfig &config) const
142
128
static class ICal20Test : public RegisterSyncSourceTest {
144
ICal20Test() : RegisterSyncSourceTest("file_ical20", "ical20") {}
130
ICal20Test() : RegisterSyncSourceTest("file_event", "eds_event") {}
146
132
virtual void updateConfig(ClientTestConfig &config) const
153
139
// second operation into an update. The file backend is
154
140
// to dumb for that and therefore fails these tests:
156
// Client::Source::file_ical20::testLinkedItemsInsertParentTwice
157
// Client::Source::file_ical20::testLinkedItemsInsertChildTwice
142
// Client::Source::file_event::testLinkedItemsInsertParentTwice
143
// Client::Source::file_event::testLinkedItemsInsertChildTwice
159
145
// Disable linked item testing to avoid this.
160
146
config.sourceKnowsItemSemantic = false;
164
150
static class ITodo20Test : public RegisterSyncSourceTest {
166
ITodo20Test() : RegisterSyncSourceTest("file_itodo20", "itodo20") {}
152
ITodo20Test() : RegisterSyncSourceTest("file_task", "eds_task") {}
168
154
virtual void updateConfig(ClientTestConfig &config) const
178
164
virtual void updateConfig(ClientTestConfig &config) const
180
166
config.type = "virtual:text/x-vcalendar";
181
config.subConfigs = "file_ical20,file_itodo20";
167
config.subConfigs = "file_event,file_task";