Commit 2c35da3d authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Use domain term "tag[s]" instead of "remark[s]" as much as possible

parent 4e8afe80
......@@ -98,7 +98,7 @@ set(_kleopatra_SRCS
utils/auditlog.cpp
utils/clipboardmenu.cpp
utils/kuniqueservice.cpp
utils/remarks.cpp
utils/tags.cpp
utils/writecertassuantransaction.cpp
utils/keyparameters.cpp
utils/userinfo.cpp
......
......@@ -17,7 +17,7 @@
#include "exportopenpgpcertstoservercommand.h"
#include "dialogs/certifycertificatedialog.h"
#include "utils/remarks.h"
#include "utils/tags.h"
#include <Libkleo/KeyCache>
#include <Libkleo/Formatting>
......@@ -268,8 +268,8 @@ void CertifyCertificateCommand::Private::slotResult(const Error &err)
QString::fromUtf8(err.asString())),
i18n("Certification Error"));
}
if (!dialog->remarks().isEmpty()) {
Remarks::enableRemarks();
if (!dialog->tags().isEmpty()) {
Tags::enableTags();
}
finished();
......@@ -287,9 +287,9 @@ void CertifyCertificateCommand::Private::slotCertificationPrepared()
job->setSigningKey(dialog->selectedSecretKey());
job->setCheckLevel(dialog->selectedCheckLevel());
#ifdef GPGME_HAS_REMARKS
if (!dialog->remarks().isEmpty()) {
if (!dialog->tags().isEmpty()) {
// do not set an empty remark to avoid an empty signature notation (GnuPG bug T5142)
job->setRemark(dialog->remarks());
job->setRemark(dialog->tags());
}
// This also came with 1.14.0
job->setDupeOk(true);
......
......@@ -20,7 +20,8 @@
#include "commands/genrevokecommand.h"
#include "commands/detailscommand.h"
#include "commands/dumpcertificatecommand.h"
#include "utils/remarks.h"
#include "utils/tags.h"
#include <Libkleo/Formatting>
#include <Libkleo/Dn>
......@@ -200,14 +201,14 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
item->setData(2, Qt::ToolTipRole, toolTip);
GpgME::Error err;
QStringList remarkList;
QStringList tagList;
#ifdef GPGME_HAS_REMARKS
for (const auto &rem: uid.remarks(Remarks::remarkKeys(), err)) {
remarkList << QString::fromStdString(rem);
for (const auto &tag: uid.remarks(Tags::tagKeys(), err)) {
tagList << QString::fromStdString(tag);
}
#endif
const auto remark = remarkList.join(QStringLiteral("; "));
item->setData(3, Qt::DisplayRole, remark);
const auto tags = tagList.join(QStringLiteral("; "));
item->setData(3, Qt::DisplayRole, tags);
item->setData(3, Qt::ToolTipRole, toolTip);
ui.userIDTable->addTopLevelItem(item);
......@@ -222,7 +223,7 @@ void CertificateDetailsWidget::Private::setupCommonProperties()
ui.userIDTable->setItemWidget(item, 4, button);
}
}
if (!Remarks::remarksEnabled()) {
if (!Tags::tagsEnabled()) {
ui.userIDTable->hideColumn(3);
}
}
......
......@@ -144,7 +144,7 @@ std::vector<unsigned int> CertifyCertificateDialog::selectedUserIDs() const
return mCertWidget->selectedUserIDs();
}
QString CertifyCertificateDialog::remarks() const
QString CertifyCertificateDialog::tags() const
{
return mCertWidget->remarks();
return mCertWidget->tags();
}
......@@ -48,7 +48,7 @@ public:
void setCertificateToCertify(const GpgME::Key &key);
QString remarks() const;
QString tags() const;
private:
CertifyWidget *mCertWidget;
......
......@@ -10,8 +10,6 @@
#include "kleopatra_debug.h"
#include "utils/remarks.h"
#include <KLocalizedString>
#include <KConfigGroup>
#include <KSharedConfig>
......@@ -216,8 +214,7 @@ class CertifyWidget::Private
{
public:
Private(CertifyWidget *qq) : q(qq),
mFprLabel(new QLabel),
remarkTextChanged(false)
mFprLabel(new QLabel)
{
QVBoxLayout *mainLay = new QVBoxLayout(q);
mainLay->addWidget(mFprLabel);
......@@ -254,8 +251,8 @@ public:
publishLay->addSpacing(20);
publishLay->addWidget(mPublishCB);
mRemarkLE = new QLineEdit;
mRemarkLE->setPlaceholderText(i18n("Tags"));
mTagsLE = new QLineEdit;
mTagsLE->setPlaceholderText(i18n("Tags"));
auto infoBtn = new QPushButton;
infoBtn->setIcon(QIcon::fromTheme(QStringLiteral("help-contextual")));
......@@ -270,17 +267,17 @@ public:
msg, infoBtn, QRect(), 30000);
});
auto remarkLay = new QHBoxLayout;
remarkLay->addWidget(infoBtn);
remarkLay->addWidget(mRemarkLE);
auto tagsLay = new QHBoxLayout;
tagsLay->addWidget(infoBtn);
tagsLay->addWidget(mTagsLE);
advLay->addWidget(mExportCB);
advLay->addLayout(publishLay);
advLay->addLayout(remarkLay);
advLay->addLayout(tagsLay);
#ifndef GPGME_HAS_REMARKS
// Hide it if we do not have remark support
mRemarkLE->setVisible(false);
mTagsLE->setVisible(false);
infoBtn->setVisible(false);
#endif
......@@ -294,7 +291,7 @@ public:
connect(mSecKeySelect, &KeySelectionCombo::currentKeyChanged, [this] (const GpgME::Key &) {
#ifdef GPGME_HAS_REMARKS
updateRemark();
updateTags();
#endif
});
......@@ -313,9 +310,9 @@ public:
mPublishCB->setChecked(conf.readEntry("PublishCheckState", false));
}
void updateRemark()
void updateTags()
{
if (mRemarkLE->isModified()) {
if (mTagsLE->isModified()) {
return;
}
#ifdef GPGME_HAS_REMARKS
......@@ -341,7 +338,7 @@ public:
if (!remark.isEmpty()) {
selectUserIDs(uidsWithRemark);
}
mRemarkLE->setText(remark);
mTagsLE->setText(remark);
}
#endif
}
......@@ -354,7 +351,7 @@ public:
mUserIDModel.setKey(key);
mTarget = key;
updateRemark();
updateTags();
}
GpgME::Key secKey() const
......@@ -396,9 +393,9 @@ public:
return mPublishCB->isChecked();
}
QString remarks() const
QString tags() const
{
return mRemarkLE->text().trimmed();
return mTagsLE->text().trimmed();
}
GpgME::Key target() const
......@@ -412,11 +409,10 @@ private:
KeySelectionCombo *mSecKeySelect;
QCheckBox *mExportCB;
QCheckBox *mPublishCB;
QLineEdit *mRemarkLE;
QLineEdit *mTagsLE;
UserIDModel mUserIDModel;
GpgME::Key mTarget;
bool remarkTextChanged;
};
CertifyWidget::CertifyWidget(QWidget *parent) :
......@@ -455,9 +451,9 @@ bool CertifyWidget::exportableSelected() const
return d->exportableSelected();
}
QString CertifyWidget::remarks() const
QString CertifyWidget::tags() const
{
return d->remarks();
return d->tags();
}
bool CertifyWidget::publishSelected() const
......
......@@ -46,8 +46,8 @@ public:
/* Should the signature be exportable */
bool exportableSelected() const;
/* Additional remarks (search tags) for the key */
QString remarks() const;
/* Additional tags for the key */
QString tags() const;
/* Should the signed key be be published */
bool publishSelected() const;
......
......@@ -27,7 +27,7 @@
#include "kleopatra_debug.h"
#include "commands/command.h"
#include "utils/remarks.h"
#include "utils/tags.h"
#include <KMessageBox>
#include <KLocalizedString>
......@@ -51,7 +51,7 @@ public:
Private(WebOfTrustWidget *qq)
: q(qq)
{
certificationsModel.enableRemarks(Remarks::remarksEnabled());
certificationsModel.enableRemarks(Tags::tagsEnabled());
certificationsTV = new QTreeView;
certificationsTV->setModel(&certificationsModel);
......@@ -202,7 +202,7 @@ public:
return;
}
if (Remarks::remarksEnabled()) {
if (Tags::tagsEnabled()) {
job->addMode(GpgME::SignatureNotations);
}
......
/* utils/remarks.cpp
/* utils/tags.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2019 g 10code GmbH
SPDX-FileCopyrightText: 2019 g10code GmbH
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "remarks.h"
#include "tags.h"
#include "tagspreferences.h"
......@@ -18,33 +18,33 @@
using namespace Kleo;
bool Remarks::remarksEnabled()
bool Tags::tagsEnabled()
{
return TagsPreferences().useTags();
}
void Remarks::enableRemarks()
void Tags::enableTags()
{
TagsPreferences().setUseTags(true);
KeyCache::mutableInstance()->enableRemarks(true);
}
GpgME::Key Remarks::remarkKey()
GpgME::Key Tags::tagKey()
{
const auto remarkKeyFpr = TagsPreferences().tagKey();
const auto tagKeyFpr = TagsPreferences().tagKey();
GpgME::Key key;
if (remarkKeyFpr.isEmpty()) {
if (tagKeyFpr.isEmpty()) {
return key;
}
key = KeyCache::instance()->findByKeyIDOrFingerprint(remarkKeyFpr.toLatin1().constData());
key = KeyCache::instance()->findByKeyIDOrFingerprint(tagKeyFpr.toLatin1().constData());
if (key.isNull()) {
qCDebug(KLEOPATRA_LOG) << "Failed to find remark key: " << remarkKeyFpr;
qCDebug(KLEOPATRA_LOG) << "Failed to find tag key: " << tagKeyFpr;
return key;
}
return key;
}
std::vector<GpgME::Key> Remarks::remarkKeys()
std::vector<GpgME::Key> Tags::tagKeys()
{
std::vector<GpgME::Key> ret;
for (const auto &key: KeyCache::instance()->keys()) {
......@@ -59,7 +59,7 @@ std::vector<GpgME::Key> Remarks::remarkKeys()
return ret;
}
void Remarks::setRemarkKey(const GpgME::Key &key)
void Tags::setTagKey(const GpgME::Key &key)
{
TagsPreferences().setTagKey(key.isNull() ? QString() : QString::fromLatin1(key.primaryFingerprint()));
}
#ifndef REMARKS_H
#define REMARKS_H
/* utils/remarks.h
/* utils/tags.h
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2019 g 10code GmbH
SPDX-FileCopyrightText: 2019 g10code GmbH
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef KLEOPATRA_UTILS_TAGS_H
#define KLEOPATRA_UTILS_TAGS_H
#include <gpgme++/key.h>
......@@ -14,18 +14,18 @@
namespace Kleo
{
namespace Remarks
namespace Tags
{
/* Helper functions to work with remark configuration */
bool remarksEnabled();
void enableRemarks();
/* Read / write a single remark key into configuration. */
GpgME::Key remarkKey();
void setRemarkKey(const GpgME::Key &key);
/* Helper functions to work with tags configuration */
bool tagsEnabled();
void enableTags();
/* Read / write a single tag key into configuration. */
GpgME::Key tagKey();
void setTagKey(const GpgME::Key &key);
/* Get multiple keys to use for remarks. Currently
/* Get multiple keys to use for tags. Currently
* this returns all fully trusted OpenPGP Keys. */
std::vector<GpgME::Key> remarkKeys();
std::vector<GpgME::Key> tagKeys();
}
} // namespace Kleo
#endif // REMARKS_H
#endif // KLEOPATRA_UTILS_TAGS_H
......@@ -17,7 +17,7 @@
#include <Libkleo/Predicates>
#include "utils/headerview.h"
#include "utils/remarks.h"
#include "utils/tags.h"
#include <Libkleo/Stl_Util>
#include <Libkleo/KeyFilter>
......@@ -46,7 +46,7 @@
# define GPGME_HAS_REMARKS
#endif
#define REMARK_COLUMN 13
#define TAGS_COLUMN 13
using namespace Kleo;
using namespace GpgME;
......@@ -90,8 +90,8 @@ protected:
connect(mHeaderPopup, &QMenu::triggered, this, [this] (QAction *action) {
const int col = action->data().toInt();
if ((col == REMARK_COLUMN) && action->isChecked()) {
Remarks::enableRemarks();
if ((col == TAGS_COLUMN) && action->isChecked()) {
Tags::enableTags();
}
if (action->isChecked()) {
showColumn(col);
......@@ -287,7 +287,7 @@ void KeyTreeView::init()
<< KeyListModelInterface::Issuer
<< KeyListModelInterface::SerialNumber
#ifdef GPGME_HAS_REMARKS
// If a column is added before this REMARK_COLUMN define has to be updated accordingly
// If a column is added before this TAGS_COLUMN define has to be updated accordingly
<< KeyListModelInterface::Remarks
#endif
);
......@@ -325,7 +325,7 @@ void KeyTreeView::init()
* the model is already populated. */
QTimer::singleShot(0, [this] () {
restoreExpandState();
setupRemarkKeys();
setUpTagKeys();
if (!m_onceResized) {
m_onceResized = true;
resizeColumns();
......@@ -364,15 +364,15 @@ void KeyTreeView::restoreExpandState()
}
}
void KeyTreeView::setupRemarkKeys()
void KeyTreeView::setUpTagKeys()
{
#ifdef GPGME_HAS_REMARKS
const auto remarkKeys = Remarks::remarkKeys();
const auto tagKeys = Tags::tagKeys();
if (m_hierarchicalModel) {
m_hierarchicalModel->setRemarkKeys(remarkKeys);
m_hierarchicalModel->setRemarkKeys(tagKeys);
}
if (m_flatModel) {
m_flatModel->setRemarkKeys(remarkKeys);
m_flatModel->setRemarkKeys(tagKeys);
}
#endif
}
......@@ -440,8 +440,8 @@ void KeyTreeView::restoreLayout()
header->resizeSection(i, width ? width : 100);
header->moveSection(header->visualIndex(i), order);
if ((i == REMARK_COLUMN) && visible) {
Remarks::enableRemarks();
if ((i == TAGS_COLUMN) && visible) {
Tags::enableTags();
}
if (!visible) {
m_view->hideColumn(i);
......
......@@ -130,7 +130,7 @@ private:
void restoreExpandState();
void saveLayout();
void restoreLayout();
void setupRemarkKeys();
void setUpTagKeys();
private:
std::vector<GpgME::Key> m_keys;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment