summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-19 09:52:40 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-19 09:52:40 +0100
commite7ddc02bce5b4e46b44e3cb39c06ed25dc291c0a (patch)
tree5ade33a7647941d536d652623a0a36633768620c /common
parentdb48154e47a9f611b7d3dceb195b14a8953e7abb (diff)
downloadsink-e7ddc02bce5b4e46b44e3cb39c06ed25dc291c0a.tar.gz
sink-e7ddc02bce5b4e46b44e3cb39c06ed25dc291c0a.zip
Prepared maildir inspection implementation
Diffstat (limited to 'common')
-rw-r--r--common/clientapi.h21
-rw-r--r--common/inspection.h50
-rw-r--r--common/resourcefacade.h5
3 files changed, 56 insertions, 20 deletions
diff --git a/common/clientapi.h b/common/clientapi.h
index 5ed99e0..14caa7a 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -26,6 +26,7 @@
26#include <Async/Async> 26#include <Async/Async>
27 27
28#include "query.h" 28#include "query.h"
29#include "inspection.h"
29#include "applicationdomaintype.h" 30#include "applicationdomaintype.h"
30 31
31class QAbstractItemModel; 32class QAbstractItemModel;
@@ -114,26 +115,6 @@ public:
114}; 115};
115 116
116namespace Resources { 117namespace Resources {
117 struct Inspection {
118 static Inspection PropertyInspection(const Akonadi2::ApplicationDomain::Entity &entity, const QByteArray &property, const QVariant &expectedValue)
119 {
120 Inspection inspection;
121 inspection.resourceIdentifier = entity.resourceInstanceIdentifier();
122 inspection.entityIdentifier = entity.identifier();
123 inspection.property = property;
124 inspection.expectedValue = expectedValue;
125 return inspection;
126 }
127
128 enum Type {
129 PropertyInspectionType
130 };
131
132 QByteArray resourceIdentifier;
133 QByteArray entityIdentifier;
134 QByteArray property;
135 QVariant expectedValue;
136 };
137 template <class DomainType> 118 template <class DomainType>
138 KAsync::Job<void> inspect(const Inspection &inspectionCommand); 119 KAsync::Job<void> inspect(const Inspection &inspectionCommand);
139} 120}
diff --git a/common/inspection.h b/common/inspection.h
new file mode 100644
index 0000000..45d599a
--- /dev/null
+++ b/common/inspection.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 2015 Christian Mollekopf <chrigi_1@fastmail.fm>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) version 3, or any
8 * later version accepted by the membership of KDE e.V. (or its
9 * successor approved by the membership of KDE e.V.), which shall
10 * act as a proxy defined in Section 6 of version 3 of the license.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20#pragma once
21
22#include <QByteArray>
23#include <QVariant>
24#include "applicationdomaintype.h"
25
26namespace Akonadi2 {
27 namespace Resources {
28
29struct Inspection {
30 static Inspection PropertyInspection(const Akonadi2::ApplicationDomain::Entity &entity, const QByteArray &property, const QVariant &expectedValue)
31 {
32 Inspection inspection;
33 inspection.resourceIdentifier = entity.resourceInstanceIdentifier();
34 inspection.entityIdentifier = entity.identifier();
35 inspection.property = property;
36 inspection.expectedValue = expectedValue;
37 return inspection;
38 }
39
40 enum Type {
41 PropertyInspectionType
42 };
43 QByteArray resourceIdentifier;
44 QByteArray entityIdentifier;
45 QByteArray property;
46 QVariant expectedValue;
47};
48
49 }
50}
diff --git a/common/resourcefacade.h b/common/resourcefacade.h
index 38e0c0e..ae3037a 100644
--- a/common/resourcefacade.h
+++ b/common/resourcefacade.h
@@ -27,6 +27,7 @@
27 27
28namespace Akonadi2 { 28namespace Akonadi2 {
29 class Query; 29 class Query;
30 class Inspection;
30} 31}
31 32
32class ResourceFacade : public Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::AkonadiResource> 33class ResourceFacade : public Akonadi2::StoreFacade<Akonadi2::ApplicationDomain::AkonadiResource>
@@ -38,5 +39,9 @@ public:
38 KAsync::Job<void> modify(const Akonadi2::ApplicationDomain::AkonadiResource &resource) Q_DECL_OVERRIDE; 39 KAsync::Job<void> modify(const Akonadi2::ApplicationDomain::AkonadiResource &resource) Q_DECL_OVERRIDE;
39 KAsync::Job<void> remove(const Akonadi2::ApplicationDomain::AkonadiResource &resource) Q_DECL_OVERRIDE; 40 KAsync::Job<void> remove(const Akonadi2::ApplicationDomain::AkonadiResource &resource) Q_DECL_OVERRIDE;
40 QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<Akonadi2::ApplicationDomain::AkonadiResource::Ptr>::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE; 41 QPair<KAsync::Job<void>, typename Akonadi2::ResultEmitter<Akonadi2::ApplicationDomain::AkonadiResource::Ptr>::Ptr > load(const Akonadi2::Query &query) Q_DECL_OVERRIDE;
42 KAsync::Job<void> inspect(const Akonadi2::Inspection &domainObject) Q_DECL_OVERRIDE
43 {
44 return KAsync::error<void>(-1, "Failed to inspect.");
45 }
41}; 46};
42 47