summaryrefslogtreecommitdiffstats
path: root/examples/davresource/davresource.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/davresource/davresource.h')
-rw-r--r--examples/davresource/davresource.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/examples/davresource/davresource.h b/examples/davresource/davresource.h
new file mode 100644
index 0000000..3b228c2
--- /dev/null
+++ b/examples/davresource/davresource.h
@@ -0,0 +1,68 @@
1/*
2 * Copyright (C) 2015 Christian Mollekopf <chrigi_1@fastmail.fm>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20#pragma once
21
22#include "common/genericresource.h"
23
24#include <KDAV/DavUrl>
25#include <Async/Async>
26
27#include <flatbuffers/flatbuffers.h>
28
29class ContactAdaptorFactory;
30class AddressbookAdaptorFactory;
31
32/**
33 * A DAV resource.
34 *
35 * Implementation details:
36 * The remoteid's have the following formats:
37 * files: full file path
38 * directories: full directory path
39 *
40 * The resource moves all messages from new to cur during sync and thus expectes all messages that are in the store to always reside in cur.
41 * The tmp directory is never directly used
42 */
43class DavResource : public Sink::GenericResource
44{
45public:
46 DavResource(const Sink::ResourceContext &resourceContext);
47
48private:
49 QStringList listAvailableFolders();
50
51 KDAV::DavUrl mResourceUrl;
52};
53
54class DavResourceFactory : public Sink::ResourceFactory
55{
56 Q_OBJECT
57 Q_PLUGIN_METADATA(IID "sink.davresource")
58 Q_INTERFACES(Sink::ResourceFactory)
59
60public:
61 DavResourceFactory(QObject *parent = 0);
62
63 Sink::Resource *createResource(const Sink::ResourceContext &context) Q_DECL_OVERRIDE;
64 void registerFacades(const QByteArray &resourceName, Sink::FacadeFactory &factory) Q_DECL_OVERRIDE;
65 void registerAdaptorFactories(const QByteArray &resourceName, Sink::AdaptorFactoryRegistry &registry) Q_DECL_OVERRIDE;
66 void removeDataFromDisk(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE;
67};
68