Line data Source code
1 : /* qgpgmetofupolicyjob.cpp
2 :
3 : Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
4 : Software engineering by Intevation GmbH
5 :
6 : QGpgME is free software; you can redistribute it and/or
7 : modify it under the terms of the GNU General Public License as
8 : published by the Free Software Foundation; either version 2 of the
9 : License, or (at your option) any later version.
10 :
11 : QGpgME is distributed in the hope that it will be useful,
12 : but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 : General Public License for more details.
15 :
16 : You should have received a copy of the GNU General Public License along
17 : with this program; if not, write to the Free Software Foundation, Inc.,
18 : 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 :
20 : In addition, as a special exception, the copyright holders give
21 : permission to link the code of this program with any edition of
22 : the Qt library by Trolltech AS, Norway (or with modified versions
23 : of Qt that use the same license as Qt), and distribute linked
24 : combinations including the two. You must obey the GNU General
25 : Public License in all respects for all of the code used other than
26 : Qt. If you modify this file, you may extend this exception to
27 : your version of the file, but you are not obligated to do so. If
28 : you do not wish to do so, delete this exception statement from
29 : your version.
30 : */
31 :
32 : #ifdef HAVE_CONFIG_H
33 : #include "config.h"
34 : #endif
35 :
36 : #include "qgpgmetofupolicyjob.h"
37 :
38 : #include "context.h"
39 : #include "key.h"
40 : #include "tofuinfo.h"
41 :
42 :
43 : using namespace QGpgME;
44 : using namespace GpgME;
45 :
46 1 : QGpgMETofuPolicyJob::QGpgMETofuPolicyJob(Context *context)
47 1 : : mixin_type(context)
48 : {
49 1 : lateInitialization();
50 1 : }
51 :
52 2 : QGpgMETofuPolicyJob::~QGpgMETofuPolicyJob() {}
53 :
54 2 : static QGpgMETofuPolicyJob::result_type policy_worker(Context *ctx, const Key &key, TofuInfo::Policy policy)
55 : {
56 4 : return std::make_tuple (ctx->setTofuPolicy(key, policy),
57 6 : QString(), Error());
58 : }
59 :
60 0 : void QGpgMETofuPolicyJob::start(const Key &key, TofuInfo::Policy policy)
61 : {
62 0 : run(std::bind(&policy_worker, std::placeholders::_1, key, policy));
63 0 : }
64 :
65 2 : Error QGpgMETofuPolicyJob::exec(const Key &key, TofuInfo::Policy policy)
66 : {
67 2 : return std::get<0>(policy_worker(context(), key, policy));
68 : }
69 :
70 : #include "qgpgmetofupolicyjob.moc"
|