Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
libkleo
Commits
28d8291f
Commit
28d8291f
authored
May 11, 2021
by
Ingo Klöcker
Browse files
Add information about trust signatures to UserIDListModel
GnuPG-bug-id: 5245
parent
628ea4b7
Changes
6
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
28d8291f
...
...
@@ -45,6 +45,9 @@ find_package(Gpgmepp ${GPGMEPP_LIB_VERSION} CONFIG REQUIRED)
set_package_properties
(
Gpgmepp PROPERTIES DESCRIPTION
"GpgME++ Library"
URL
"https://www.gnupg.org"
TYPE REQUIRED PURPOSE
"GpgME++ is required for OpenPGP support"
)
find_package
(
QGpgme
${
GPGMEPP_LIB_VERSION
}
CONFIG REQUIRED
)
message
(
STATUS
"GPGME Version
${
Gpgmepp_VERSION
}
"
)
if
(
Gpgmepp_VERSION VERSION_GREATER_EQUAL
"1.15.2"
)
set
(
GPGMEPP_SUPPORTS_TRUST_SIGNATURES 1
)
endif
()
find_package
(
Boost 1.34.0
)
set_package_properties
(
Boost PROPERTIES DESCRIPTION
"Boost C++ Libraries"
URL
"https://www.boost.org"
TYPE REQUIRED PURPOSE
"Boost is required for building most KDEPIM applications"
)
...
...
@@ -92,6 +95,9 @@ install(FILES
DESTINATION
${
KDE_INSTALL_INCLUDEDIR_KF5
}
COMPONENT Devel
)
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/config-libkleo.h.cmake
${
CMAKE_CURRENT_BINARY_DIR
}
/config-libkleo.h
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
option
(
USE_UNITY_CMAKE_SUPPORT
"Use UNITY cmake support (speedup compile time)"
OFF
)
set
(
COMPILE_WITH_UNITY_CMAKE_SUPPORT OFF
)
...
...
config-libkleo.h.cmake
0 → 100644
View file @
28d8291f
/* Defined if GpgME++ supports trust signatures */
#cmakedefine GPGMEPP_SUPPORTS_TRUST_SIGNATURES 1
src/models/useridlistmodel.cpp
View file @
28d8291f
...
...
@@ -4,10 +4,14 @@
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-FileCopyrightText: 2016 Andre Heinecke <aheinecke@gnupg.org>
SPDX-FileCopyrightText: 2021 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-libkleo.h>
#include "useridlistmodel.h"
#include "keycache.h"
...
...
@@ -59,6 +63,10 @@ public:
}
}
mItemData
<<
lastNotation
;
#ifdef GPGMEPP_SUPPORTS_TRUST_SIGNATURES
mItemData
<<
Formatting
::
trustSignatureDomain
(
sig
);
#endif
}
explicit
UIDModelItem
(
const
UserID
&
uid
,
UIDModelItem
*
parentItem
)
...
...
@@ -79,6 +87,9 @@ public:
<<
i18n
(
"Status"
)
<<
i18n
(
"Exportable"
)
<<
i18n
(
"Tags"
);
#ifdef GPGMEPP_SUPPORTS_TRUST_SIGNATURES
mItemData
<<
i18n
(
"Trust Signature For"
);
#endif
}
~
UIDModelItem
()
...
...
@@ -127,6 +138,8 @@ public:
if
(
!
mSig
.
isNull
())
{
if
(
column
==
static_cast
<
int
>
(
UserIDListModel
::
Column
::
Status
))
{
return
i18n
(
"class %1"
,
mSig
.
certClass
());
}
else
if
(
column
==
static_cast
<
int
>
(
UserIDListModel
::
Column
::
TrustSignatureDomain
))
{
return
Formatting
::
trustSignature
(
mSig
);
}
}
return
mItemData
.
value
(
column
);
...
...
src/models/useridlistmodel.h
View file @
28d8291f
...
...
@@ -4,6 +4,8 @@
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-FileCopyrightText: 2016 Andre Heinecke <aheinecke@gnupg.org>
SPDX-FileCopyrightText: 2021 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -36,6 +38,7 @@ public:
Status
,
Exportable
,
Tags
,
TrustSignatureDomain
,
};
explicit
UserIDListModel
(
QObject
*
parent
=
nullptr
);
...
...
src/utils/formatting.cpp
View file @
28d8291f
/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
utils/formatting.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-FileCopyrightText: 2021 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-libkleo.h>
#include "formatting.h"
#include "kleo/dn.h"
#include "kleo/keyfiltermanager.h"
...
...
@@ -1203,3 +1206,47 @@ QString Formatting::deVsString(bool compliant)
}
return
filter
->
name
();
}
namespace
{
QString
formatTrustScope
(
const
char
*
trustScope
)
{
static
const
QRegularExpression
escapedNonAlphaNum
{
QStringLiteral
(
R"(\\([^0-9A-Za-z]))"
)};
const
auto
scopeRegExp
=
QString
::
fromUtf8
(
trustScope
);
if
(
scopeRegExp
.
startsWith
(
u"<[^>]+[@.]"
)
&&
scopeRegExp
.
endsWith
(
u">$"
))
{
// looks like a trust scope regular expression created by gpg
auto
domain
=
scopeRegExp
.
mid
(
10
,
scopeRegExp
.
size
()
-
10
-
2
);
domain
.
replace
(
escapedNonAlphaNum
,
QStringLiteral
(
R"(\1)"
));
return
domain
;
}
return
scopeRegExp
;
}
}
QString
Formatting
::
trustSignatureDomain
(
const
GpgME
::
UserID
::
Signature
&
sig
)
{
#ifdef GPGMEPP_SUPPORTS_TRUST_SIGNATURES
return
formatTrustScope
(
sig
.
trustScope
());
#else
return
{};
#endif
}
QString
Formatting
::
trustSignature
(
const
GpgME
::
UserID
::
Signature
&
sig
)
{
#ifdef GPGMEPP_SUPPORTS_TRUST_SIGNATURES
switch
(
sig
.
trustValue
())
{
case
TrustSignatureTrust
::
Partial
:
return
i18nc
(
"Certifies this key as partially trusted introducer for 'domain name'."
,
"Certifies this key as partially trusted introducer for '%1'."
,
trustSignatureDomain
(
sig
));
case
TrustSignatureTrust
::
Complete
:
return
i18nc
(
"Certifies this key as fully trusted introducer for 'domain name'."
,
"Certifies this key as fully trusted introducer for '%1'."
,
trustSignatureDomain
(
sig
));
default:
return
{};
}
#else
return
{};
#endif
}
src/utils/formatting.h
View file @
28d8291f
...
...
@@ -3,6 +3,8 @@
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
SPDX-FileCopyrightText: 2021 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
...
...
@@ -153,6 +155,11 @@ KLEO_EXPORT QString complianceStringShort(const Kleo::KeyGroup &group);
/* The origin of the key mapped to a localized string */
KLEO_EXPORT
QString
origin
(
int
o
);
/* Human-readable trust signature scope (for trust signature regexp created by GnuPG) */
KLEO_EXPORT
QString
trustSignatureDomain
(
const
GpgME
::
UserID
::
Signature
&
sig
);
/* Summary of trust signature properties */
KLEO_EXPORT
QString
trustSignature
(
const
GpgME
::
UserID
::
Signature
&
sig
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment