~ubuntu-branches/ubuntu/trusty/syncevolution/trusty-proposed

« back to all changes in this revision

Viewing changes to src/backends/file/FileSyncSourceRegister.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Tino Keitel
  • Date: 2011-07-20 16:02:02 UTC
  • mfrom: (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20110720160202-e8uf7ogw4vh0q0f3
Tags: 1.1.99.5a-1
* New upstream version 1.1.99.5a, first release candiate for 1.2
* Added python-openssl dependency, the HTTP server needs it for HTTPS support
* Added versioned dependency on libsynthesis0 to get required features
* Fixed .orig.tar.gz generation in get-orig-source target
* Added myself to Uploaders:, thanks to David for sponsoring
* Use updated upstream tag for source package generation
* Removed 0001-Replace-with-in-call-to-PKG_CHECK_MODULES.patch, fixed upstream
* Renamed NEWS.Debian to NEWS so that it is actually used
* Updated NEWS for 1.1.99.5a

Show diffs side-by-side

added added

removed removed

Lines of Context:
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";
33
33
 
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" */;
42
42
    
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);
49
47
        } else {
50
48
            return NULL;
51
49
        }
63
61
                                     createSource,
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"
 
74
                                     "      text/calendar\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",
80
78
                                     Values() +
81
 
                                     (Aliases("Files in one directory") + "file"));
 
79
                                     (Aliases("file") + "Files in one directory"));
82
80
 
83
81
#ifdef ENABLE_FILE
84
82
#ifdef ENABLE_UNIT_TESTS
117
115
}
118
116
#endif
119
117
 
120
 
static class VCard21Test : public RegisterSyncSourceTest {
121
 
public:
122
 
    VCard21Test() : RegisterSyncSourceTest("file_vcard21", "vcard21") {}
123
 
 
124
 
    virtual void updateConfig(ClientTestConfig &config) const
125
 
    {
126
 
        // set type as required by FileSyncSource
127
 
        // and leave everything else at its default
128
 
        config.type = "file:text/x-vcard:2.1";
129
 
    }
130
 
} VCard21Test;
131
 
 
132
118
static class VCard30Test : public RegisterSyncSourceTest {
133
119
public:
134
 
    VCard30Test() : RegisterSyncSourceTest("file_vcard30", "vcard30") {}
 
120
    VCard30Test() : RegisterSyncSourceTest("file_contact", "eds_contact") {}
135
121
 
136
122
    virtual void updateConfig(ClientTestConfig &config) const
137
123
    {
141
127
 
142
128
static class ICal20Test : public RegisterSyncSourceTest {
143
129
public:
144
 
    ICal20Test() : RegisterSyncSourceTest("file_ical20", "ical20") {}
 
130
    ICal20Test() : RegisterSyncSourceTest("file_event", "eds_event") {}
145
131
 
146
132
    virtual void updateConfig(ClientTestConfig &config) const
147
133
    {
153
139
        // second operation into an update. The file backend is
154
140
        // to dumb for that and therefore fails these tests:
155
141
        //
156
 
        // Client::Source::file_ical20::testLinkedItemsInsertParentTwice
157
 
        // Client::Source::file_ical20::testLinkedItemsInsertChildTwice
 
142
        // Client::Source::file_event::testLinkedItemsInsertParentTwice
 
143
        // Client::Source::file_event::testLinkedItemsInsertChildTwice
158
144
        //
159
145
        // Disable linked item testing to avoid this.
160
146
        config.sourceKnowsItemSemantic = false;
163
149
 
164
150
static class ITodo20Test : public RegisterSyncSourceTest {
165
151
public:
166
 
    ITodo20Test() : RegisterSyncSourceTest("file_itodo20", "itodo20") {}
 
152
    ITodo20Test() : RegisterSyncSourceTest("file_task", "eds_task") {}
167
153
 
168
154
    virtual void updateConfig(ClientTestConfig &config) const
169
155
    {
178
164
    virtual void updateConfig(ClientTestConfig &config) const
179
165
    {
180
166
        config.type = "virtual:text/x-vcalendar";
181
 
        config.subConfigs = "file_ical20,file_itodo20";
 
167
        config.subConfigs = "file_event,file_task";
182
168
    }
183
169
 
184
170
} superTest;