diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-04-09 18:16:39 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-04-09 18:16:39 +0200 |
commit | 4f1afa39bec38ea38820115e1bbabf4506c2d45c (patch) | |
tree | fbcf157e01151a19fe3f35539f62aeeef9fd6c44 /common/domainadaptor.cpp | |
parent | cc3fed3668a80616ec78bc872e21b7ac06bcde38 (diff) | |
download | sink-4f1afa39bec38ea38820115e1bbabf4506c2d45c.tar.gz sink-4f1afa39bec38ea38820115e1bbabf4506c2d45c.zip |
Moved generic parts of the domain adaptor to common
Diffstat (limited to 'common/domainadaptor.cpp')
-rw-r--r-- | common/domainadaptor.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/common/domainadaptor.cpp b/common/domainadaptor.cpp new file mode 100644 index 0000000..5b7c427 --- /dev/null +++ b/common/domainadaptor.cpp | |||
@@ -0,0 +1,40 @@ | |||
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 | #include "domainadaptor.h" | ||
21 | |||
22 | template <> | ||
23 | QSharedPointer<PropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> > initializePropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event>() | ||
24 | { | ||
25 | auto propertyMapper = QSharedPointer<PropertyMapper<Akonadi2::ApplicationDomain::Buffer::Event> >::create(); | ||
26 | propertyMapper->mReadAccessors.insert("summary", [](Akonadi2::ApplicationDomain::Buffer::Event const *buffer) -> QVariant { | ||
27 | if (buffer->summary()) { | ||
28 | return QString::fromStdString(buffer->summary()->c_str()); | ||
29 | } | ||
30 | return QVariant(); | ||
31 | }); | ||
32 | propertyMapper->mReadAccessors.insert("uid", [](Akonadi2::ApplicationDomain::Buffer::Event const *buffer) -> QVariant { | ||
33 | if (buffer->uid()) { | ||
34 | return QString::fromStdString(buffer->uid()->c_str()); | ||
35 | } | ||
36 | return QVariant(); | ||
37 | }); | ||
38 | return propertyMapper; | ||
39 | } | ||
40 | |||