Changeset View
Changeset View
Standalone View
Standalone View
src/kleo/formatting.cpp
- This file was added.
1 | /* formatting.cpp | ||||
---|---|---|---|---|---|
2 | | ||||
3 | This file is part of libkleopatra, the KDE keymanagement library | ||||
4 | Copyright (c) 2016 Intevation GmbH | ||||
5 | | ||||
6 | Libkleopatra 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 | Libkleopatra 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 | ||||
17 | along with this program; if not, write to the Free Software | ||||
18 | Foundation, Inc., 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 | #include "formatting.h" | ||||
33 | | ||||
34 | #include <QIcon> | ||||
35 | #include <QString> | ||||
36 | | ||||
37 | using namespace Kleo; | ||||
38 | using namespace GpgME; | ||||
39 | | ||||
40 | QIcon Formatting::iconForUid(const UserID &uid) | ||||
41 | { | ||||
42 | switch (uid.validity()) { | ||||
43 | case UserID::Ultimate: | ||||
44 | case UserID::Full: | ||||
45 | case UserID::Marginal: | ||||
46 | return QIcon::fromTheme(QStringLiteral("emblem-success")); | ||||
47 | case UserID::Never: | ||||
48 | return QIcon::fromTheme(QStringLiteral("emblem-error")); | ||||
49 | case UserID::Undefined: | ||||
50 | case UserID::Unknown: | ||||
51 | default: | ||||
52 | return QIcon::fromTheme(QStringLiteral("emblem-information")); | ||||
53 | } | ||||
54 | } | ||||
55 | | ||||
56 | QString Formatting::validityForRecipient(const UserID &uid) | ||||
57 | { | ||||
58 | switch (uid.validity()) { | ||||
59 | case UserID::Ultimate: | ||||
60 | return i18n("The encryption key for this recipient is marked as your own."); | ||||
61 | case UserID::Full: | ||||
62 | return i18n("It is trusted that the encryption key belongs to this recipient."); | ||||
63 | case UserID::Marginal: | ||||
64 | return i18n("It is marginally trusted that the key encryption key belongs to this recipient."); | ||||
65 | case UserID::Never: | ||||
66 | return i18n("The encryption key is marked as not belonging to this recipient."); | ||||
67 | case UserID::Undefined: | ||||
68 | case UserID::Unknown: | ||||
69 | default: | ||||
70 | return i18n("There is no indication that the encryption key belongs to this recipient."); | ||||
71 | } | ||||
72 | } |