aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/keypair_details/KeyPairUIDTab.cpp')
-rw-r--r--src/ui/dialog/keypair_details/KeyPairUIDTab.cpp313
1 files changed, 150 insertions, 163 deletions
diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
index d55e44d8..47cae8c1 100644
--- a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2021 Saturneric
+ * Copyright (C) 2021 Saturneric <[email protected]>
*
* This file is part of GpgFrontend.
*
@@ -19,22 +19,25 @@
* The initial version of the source code is inherited from
* the gpg4usb project, which is under GPL-3.0-or-later.
*
- * The source code version of this software was modified and released
- * by Saturneric<[email protected]><[email protected]> starting on May 12, 2021.
+ * All the source code of GpgFrontend was modified and released by
+ * Saturneric <[email protected]> starting on May 12, 2021.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "KeyPairUIDTab.h"
+#include "core/GpgModel.h"
#include "core/function/gpg/GpgKeyGetter.h"
#include "core/function/gpg/GpgKeyManager.h"
#include "core/function/gpg/GpgUIDOperator.h"
-#include "ui/SignalStation.h"
+#include "ui/UISignalStation.h"
#include "ui/widgets/TOFUInfoPage.h"
namespace GpgFrontend::UI {
-KeyPairUIDTab::KeyPairUIDTab(const std::string& key_id, QWidget* parent)
+KeyPairUIDTab::KeyPairUIDTab(const QString& key_id, QWidget* parent)
: QWidget(parent), m_key_(GpgKeyGetter::GetInstance().GetKey(key_id)) {
create_uid_list();
create_sign_list();
@@ -42,58 +45,58 @@ KeyPairUIDTab::KeyPairUIDTab(const std::string& key_id, QWidget* parent)
create_uid_popup_menu();
create_sign_popup_menu();
- auto uidButtonsLayout = new QGridLayout();
+ auto* uid_buttons_layout = new QGridLayout();
- auto addUIDButton = new QPushButton(_("New UID"));
- auto manageUIDButton = new QPushButton(_("UID Management"));
+ auto* add_uid_button = new QPushButton(tr("New UID"));
+ auto* manage_uid_button = new QPushButton(tr("UID Management"));
if (m_key_.IsHasMasterKey()) {
- manageUIDButton->setMenu(manage_selected_uid_menu_);
+ manage_uid_button->setMenu(manage_selected_uid_menu_);
} else {
- manageUIDButton->setDisabled(true);
+ manage_uid_button->setDisabled(true);
}
- uidButtonsLayout->addWidget(addUIDButton, 0, 1);
- uidButtonsLayout->addWidget(manageUIDButton, 0, 2);
+ uid_buttons_layout->addWidget(add_uid_button, 0, 1);
+ uid_buttons_layout->addWidget(manage_uid_button, 0, 2);
- auto grid_layout = new QGridLayout();
+ auto* grid_layout = new QGridLayout();
grid_layout->addWidget(uid_list_, 0, 0);
- grid_layout->addLayout(uidButtonsLayout, 1, 0);
+ grid_layout->addLayout(uid_buttons_layout, 1, 0);
grid_layout->setContentsMargins(0, 10, 0, 0);
- auto uid_group_box = new QGroupBox();
+ auto* uid_group_box = new QGroupBox();
uid_group_box->setLayout(grid_layout);
- uid_group_box->setTitle(_("UIDs"));
+ uid_group_box->setTitle(tr("UIDs"));
- auto tofu_group_box = new QGroupBox();
- auto tofu_vbox_layout = new QVBoxLayout();
+ auto* tofu_group_box = new QGroupBox();
+ auto* tofu_vbox_layout = new QVBoxLayout();
tofu_group_box->setLayout(tofu_vbox_layout);
- tofu_group_box->setTitle(_("TOFU"));
+ tofu_group_box->setTitle(tr("TOFU"));
#if !defined(RELEASE)
tofu_tabs_ = new QTabWidget(this);
tofu_vbox_layout->addWidget(tofu_tabs_);
#endif
- auto sign_grid_layout = new QGridLayout();
+ auto* sign_grid_layout = new QGridLayout();
sign_grid_layout->addWidget(sig_list_, 0, 0);
sign_grid_layout->setContentsMargins(0, 10, 0, 0);
- auto sign_group_box = new QGroupBox();
+ auto* sign_group_box = new QGroupBox();
sign_group_box->setLayout(sign_grid_layout);
- sign_group_box->setTitle(_("Signature of Selected UID"));
+ sign_group_box->setTitle(tr("Signature of Selected UID"));
- auto vboxLayout = new QVBoxLayout();
- vboxLayout->addWidget(uid_group_box);
+ auto* vbox_layout = new QVBoxLayout();
+ vbox_layout->addWidget(uid_group_box);
#if !defined(RELEASE)
// Function needed testing
- vboxLayout->addWidget(tofu_group_box);
+ vbox_layout->addWidget(tofu_group_box);
#endif
- vboxLayout->addWidget(sign_group_box);
+ vbox_layout->addWidget(sign_group_box);
- vboxLayout->setContentsMargins(0, 0, 0, 0);
+ vbox_layout->setContentsMargins(0, 0, 0, 0);
- connect(addUIDButton, &QPushButton::clicked, this,
+ connect(add_uid_button, &QPushButton::clicked, this,
&KeyPairUIDTab::slot_add_uid);
connect(uid_list_, &QTableWidget::itemSelectionChanged, this,
&KeyPairUIDTab::slot_refresh_tofu_info);
@@ -101,15 +104,15 @@ KeyPairUIDTab::KeyPairUIDTab(const std::string& key_id, QWidget* parent)
&KeyPairUIDTab::slot_refresh_sig_list);
// Key Database Refresh
- connect(SignalStation::GetInstance(),
- &SignalStation::SignalKeyDatabaseRefreshDone, this,
+ connect(UISignalStation::GetInstance(),
+ &UISignalStation::SignalKeyDatabaseRefreshDone, this,
&KeyPairUIDTab::slot_refresh_key);
connect(this, &KeyPairUIDTab::SignalUpdateUIDInfo,
- SignalStation::GetInstance(),
- &SignalStation::SignalKeyDatabaseRefresh);
+ UISignalStation::GetInstance(),
+ &UISignalStation::SignalKeyDatabaseRefresh);
- setLayout(vboxLayout);
+ setLayout(vbox_layout);
setAttribute(Qt::WA_DeleteOnClose, true);
slot_refresh_uid_list();
@@ -134,7 +137,7 @@ void KeyPairUIDTab::create_uid_list() {
uid_list_->setAlternatingRowColors(true);
QStringList labels;
- labels << _("Select") << _("Name") << _("Email") << _("Comment");
+ labels << tr("Select") << tr("Name") << tr("Email") << tr("Comment");
uid_list_->setHorizontalHeaderLabels(labels);
uid_list_->horizontalHeader()->setStretchLastSection(true);
}
@@ -157,8 +160,8 @@ void KeyPairUIDTab::create_sign_list() {
sig_list_->setAlternatingRowColors(true);
QStringList labels;
- labels << _("Key ID") << _("Name") << _("Email") << _("Create Date (UTC)")
- << _("Expired Date (UTC)");
+ labels << tr("Key ID") << tr("Name") << tr("Email") << tr("Create Date")
+ << tr("Expired Date");
sig_list_->setHorizontalHeaderLabels(labels);
sig_list_->horizontalHeader()->setStretchLastSection(false);
}
@@ -181,13 +184,13 @@ void KeyPairUIDTab::slot_refresh_uid_list() {
uid_list_->setRowCount(buffered_uids_.size());
for (const auto& uid : buffered_uids_) {
- auto* tmp0 = new QTableWidgetItem(QString::fromStdString(uid.GetUID()));
+ auto* tmp0 = new QTableWidgetItem(uid.GetName());
uid_list_->setItem(row, 1, tmp0);
- auto* tmp1 = new QTableWidgetItem(QString::fromStdString(uid.GetUID()));
+ auto* tmp1 = new QTableWidgetItem(uid.GetEmail());
uid_list_->setItem(row, 2, tmp1);
- auto* tmp2 = new QTableWidgetItem(QString::fromStdString(uid.GetUID()));
+ auto* tmp2 = new QTableWidgetItem(uid.GetComment());
uid_list_->setItem(row, 3, tmp2);
auto* tmp3 = new QTableWidgetItem(QString::number(row));
@@ -217,15 +220,15 @@ void KeyPairUIDTab::slot_refresh_uid_list() {
void KeyPairUIDTab::slot_refresh_tofu_info() {
if (this->tofu_tabs_ == nullptr) return;
- int uidRow = 0;
+ int uid_row = 0;
tofu_tabs_->clear();
for (const auto& uid : buffered_uids_) {
// Only Show Selected UID Signatures
- if (!uid_list_->item(uidRow++, 0)->isSelected()) {
+ if (!uid_list_->item(uid_row++, 0)->isSelected()) {
continue;
}
auto tofu_infos = uid.GetTofuInfos();
- SPDLOG_DEBUG("tofu info size: {}", tofu_infos->size());
+ GF_UI_LOG_DEBUG("tofu info size: {}", tofu_infos->size());
if (tofu_infos->empty()) {
tofu_tabs_->hide();
} else {
@@ -234,16 +237,17 @@ void KeyPairUIDTab::slot_refresh_tofu_info() {
int index = 1;
for (const auto& tofu_info : *tofu_infos) {
tofu_tabs_->addTab(new TOFUInfoPage(tofu_info, this),
- QString(_("TOFU %1")).arg(index++));
+ tr("TOFU %1").arg(index++));
}
}
}
void KeyPairUIDTab::slot_refresh_sig_list() {
- int uidRow = 0, sigRow = 0;
+ int uid_row = 0;
+ int sig_row = 0;
for (const auto& uid : buffered_uids_) {
// Only Show Selected UID Signatures
- if (!uid_list_->item(uidRow++, 0)->isSelected()) {
+ if (!uid_list_->item(uid_row++, 0)->isSelected()) {
continue;
}
@@ -259,52 +263,34 @@ void KeyPairUIDTab::slot_refresh_sig_list() {
sig_list_->setRowCount(buffered_signatures_.size());
for (const auto& sig : buffered_signatures_) {
- auto* tmp0 = new QTableWidgetItem(QString::fromStdString(sig.GetKeyID()));
- sig_list_->setItem(sigRow, 0, tmp0);
+ auto* tmp0 = new QTableWidgetItem(sig.GetKeyID());
+ sig_list_->setItem(sig_row, 0, tmp0);
if (gpgme_err_code(sig.GetStatus()) == GPG_ERR_NO_PUBKEY) {
auto* tmp2 = new QTableWidgetItem("<Unknown>");
- sig_list_->setItem(sigRow, 1, tmp2);
+ sig_list_->setItem(sig_row, 1, tmp2);
auto* tmp3 = new QTableWidgetItem("<Unknown>");
- sig_list_->setItem(sigRow, 2, tmp3);
+ sig_list_->setItem(sig_row, 2, tmp3);
} else {
- auto* tmp2 =
- new QTableWidgetItem(QString::fromStdString(sig.GetName()));
- sig_list_->setItem(sigRow, 1, tmp2);
+ auto* tmp2 = new QTableWidgetItem(sig.GetName());
+ sig_list_->setItem(sig_row, 1, tmp2);
- auto* tmp3 =
- new QTableWidgetItem(QString::fromStdString(sig.GetEmail()));
- sig_list_->setItem(sigRow, 2, tmp3);
+ auto* tmp3 = new QTableWidgetItem(sig.GetEmail());
+ sig_list_->setItem(sig_row, 2, tmp3);
}
-#ifdef GPGFRONTEND_GUI_QT6
- auto* tmp4 = new QTableWidgetItem(QLocale::system().toString(
- QDateTime::fromSecsSinceEpoch(to_time_t(sig.GetCreateTime()))));
-#else
- auto* tmp4 = new QTableWidgetItem(QLocale::system().toString(
- QDateTime::fromTime_t(to_time_t(sig.GetCreateTime()))));
-#endif
- sig_list_->setItem(sigRow, 3, tmp4);
-
-#ifdef GPGFRONTEND_GUI_QT6
- auto* tmp5 = new QTableWidgetItem(
- boost::posix_time::to_time_t(
- boost::posix_time::ptime(sig.GetExpireTime())) == 0
- ? _("Never Expires")
- : QLocale::system().toString(QDateTime::fromSecsSinceEpoch(
- to_time_t(sig.GetExpireTime()))));
-#else
- auto* tmp5 = new QTableWidgetItem(
- boost::posix_time::to_time_t(
- boost::posix_time::ptime(sig.GetExpireTime())) == 0
- ? _("Never Expires")
- : QLocale::system().toString(
- QDateTime::fromTime_t(to_time_t(sig.GetExpireTime()))));
-#endif
+ auto* tmp4 =
+ new QTableWidgetItem(QLocale().toString(sig.GetCreateTime()));
+ sig_list_->setItem(sig_row, 3, tmp4);
+
+ auto* tmp5 =
+ new QTableWidgetItem(sig.GetExpireTime().toSecsSinceEpoch() == 0
+ ? tr("Never Expires")
+ : QLocale().toString(sig.GetExpireTime()));
tmp5->setTextAlignment(Qt::AlignCenter);
- sig_list_->setItem(sigRow, 4, tmp5);
+ sig_list_->setItem(sig_row, 4, tmp5);
- sigRow++;
+ sig_row++;
}
break;
@@ -316,21 +302,22 @@ void KeyPairUIDTab::slot_add_sign() {
if (selected_uids->empty()) {
QMessageBox::information(
- nullptr, _("Invalid Operation"),
- _("Please select one or more UIDs before doing this operation."));
+ nullptr, tr("Invalid Operation"),
+ tr("Please select one or more UIDs before doing this operation."));
return;
}
- auto keySignDialog =
+ auto* key_sign_dialog =
new KeyUIDSignDialog(m_key_, std::move(selected_uids), this);
- keySignDialog->show();
+ key_sign_dialog->show();
}
-UIDArgsListPtr KeyPairUIDTab::get_uid_checked() {
+auto KeyPairUIDTab::get_uid_checked() -> UIDArgsListPtr {
auto selected_uids = std::make_unique<UIDArgsList>();
for (int i = 0; i < uid_list_->rowCount(); i++) {
- if (uid_list_->item(i, 0)->checkState() == Qt::Checked)
+ if (uid_list_->item(i, 0)->checkState() == Qt::Checked) {
selected_uids->push_back(buffered_uids_[i].GetUID());
+ }
}
return selected_uids;
}
@@ -338,33 +325,34 @@ UIDArgsListPtr KeyPairUIDTab::get_uid_checked() {
void KeyPairUIDTab::create_manage_uid_menu() {
manage_selected_uid_menu_ = new QMenu(this);
- auto* signUIDAct = new QAction(_("Sign Selected UID(s)"), this);
- connect(signUIDAct, &QAction::triggered, this, &KeyPairUIDTab::slot_add_sign);
- auto* delUIDAct = new QAction(_("Delete Selected UID(s)"), this);
- connect(delUIDAct, &QAction::triggered, this, &KeyPairUIDTab::slot_del_uid);
+ auto* sign_uid_act = new QAction(tr("Sign Selected UID(s)"), this);
+ connect(sign_uid_act, &QAction::triggered, this,
+ &KeyPairUIDTab::slot_add_sign);
+ auto* del_uid_act = new QAction(tr("Delete Selected UID(s)"), this);
+ connect(del_uid_act, &QAction::triggered, this, &KeyPairUIDTab::slot_del_uid);
if (m_key_.IsHasMasterKey()) {
- manage_selected_uid_menu_->addAction(signUIDAct);
- manage_selected_uid_menu_->addAction(delUIDAct);
+ manage_selected_uid_menu_->addAction(sign_uid_act);
+ manage_selected_uid_menu_->addAction(del_uid_act);
}
}
void KeyPairUIDTab::slot_add_uid() {
- auto keyNewUIDDialog = new KeyNewUIDDialog(m_key_.GetId(), this);
- connect(keyNewUIDDialog, &KeyNewUIDDialog::finished, this,
+ auto* key_new_uid_dialog = new KeyNewUIDDialog(m_key_.GetId(), this);
+ connect(key_new_uid_dialog, &KeyNewUIDDialog::finished, this,
&KeyPairUIDTab::slot_add_uid_result);
- connect(keyNewUIDDialog, &KeyNewUIDDialog::finished, keyNewUIDDialog,
+ connect(key_new_uid_dialog, &KeyNewUIDDialog::finished, key_new_uid_dialog,
&KeyPairUIDTab::deleteLater);
- keyNewUIDDialog->show();
+ key_new_uid_dialog->show();
}
void KeyPairUIDTab::slot_add_uid_result(int result) {
if (result == 1) {
- QMessageBox::information(nullptr, _("Successful Operation"),
- _("Successfully added a new UID."));
+ QMessageBox::information(nullptr, tr("Successful Operation"),
+ tr("Successfully added a new UID."));
} else if (result == -1) {
- QMessageBox::critical(nullptr, _("Operation Failed"),
- _("An error occurred during the operation."));
+ QMessageBox::critical(nullptr, tr("Operation Failed"),
+ tr("An error occurred during the operation."));
}
}
@@ -373,34 +361,33 @@ void KeyPairUIDTab::slot_del_uid() {
if (selected_uids->empty()) {
QMessageBox::information(
- nullptr, _("Invalid Operation"),
- _("Please select one or more UIDs before doing this operation."));
+ nullptr, tr("Invalid Operation"),
+ tr("Please select one or more UIDs before doing this operation."));
return;
}
QString keynames;
for (auto& uid : *selected_uids) {
- keynames.append(QString::fromStdString(uid));
+ keynames.append(uid);
keynames.append("<br/>");
}
int ret = QMessageBox::warning(
- this, _("Deleting UIDs"),
+ this, tr("Deleting UIDs"),
"<b>" +
QString(
- _("Are you sure that you want to delete the following UIDs?")) +
+ tr("Are you sure that you want to delete the following UIDs?")) +
"</b><br/><br/>" + keynames + +"<br/>" +
- _("The action can not be undone."),
+ tr("The action can not be undone."),
QMessageBox::No | QMessageBox::Yes);
if (ret == QMessageBox::Yes) {
for (const auto& uid : *selected_uids) {
- SPDLOG_DEBUG("uid: {}", uid);
+ GF_UI_LOG_DEBUG("uid: {}", uid);
if (!GpgUIDOperator::GetInstance().RevUID(m_key_, uid)) {
QMessageBox::critical(
- nullptr, _("Operation Failed"),
- QString(_("An error occurred during the delete %1 operation."))
- .arg(uid.c_str()));
+ nullptr, tr("Operation Failed"),
+ tr("An error occurred during the delete %1 operation.").arg(uid));
}
}
emit SignalUpdateUIDInfo();
@@ -411,37 +398,37 @@ void KeyPairUIDTab::slot_set_primary_uid() {
auto selected_uids = get_uid_selected();
if (selected_uids->empty()) {
- auto emptyUIDMsg = new QMessageBox();
- emptyUIDMsg->setText("Please select one UID before doing this operation.");
- emptyUIDMsg->exec();
+ auto* empty_uid_msg = new QMessageBox();
+ empty_uid_msg->setText(
+ "Please select one UID before doing this operation.");
+ empty_uid_msg->exec();
return;
}
QString keynames;
- keynames.append(QString::fromStdString(selected_uids->front()));
+ keynames.append(selected_uids->front());
keynames.append("<br/>");
int ret = QMessageBox::warning(
- this, _("Set Primary UID"),
- "<b>" +
- QString(_("Are you sure that you want to set the Primary UID to?")) +
+ this, tr("Set Primary UID"),
+ "<b>" + tr("Are you sure that you want to set the Primary UID to?") +
"</b><br/><br/>" + keynames + +"<br/>" +
- _("The action can not be undone."),
+ tr("The action can not be undone."),
QMessageBox::No | QMessageBox::Yes);
if (ret == QMessageBox::Yes) {
if (!GpgUIDOperator::GetInstance().SetPrimaryUID(m_key_,
selected_uids->front())) {
- QMessageBox::critical(nullptr, _("Operation Failed"),
- _("An error occurred during the operation."));
+ QMessageBox::critical(nullptr, tr("Operation Failed"),
+ tr("An error occurred during the operation."));
} else {
emit SignalUpdateUIDInfo();
}
}
}
-UIDArgsListPtr KeyPairUIDTab::get_uid_selected() {
+auto KeyPairUIDTab::get_uid_selected() -> UIDArgsListPtr {
auto uids = std::make_unique<UIDArgsList>();
for (int i = 0; i < uid_list_->rowCount(); i++) {
if (uid_list_->item(i, 0)->isSelected()) {
@@ -451,7 +438,7 @@ UIDArgsListPtr KeyPairUIDTab::get_uid_selected() {
return uids;
}
-SignIdArgsListPtr KeyPairUIDTab::get_sign_selected() {
+auto KeyPairUIDTab::get_sign_selected() -> SignIdArgsListPtr {
auto signatures = std::make_unique<SignIdArgsList>();
for (int i = 0; i < sig_list_->rowCount(); i++) {
if (sig_list_->item(i, 0)->isSelected()) {
@@ -465,20 +452,20 @@ SignIdArgsListPtr KeyPairUIDTab::get_sign_selected() {
void KeyPairUIDTab::create_uid_popup_menu() {
uid_popup_menu_ = new QMenu(this);
- auto* serPrimaryUIDAct = new QAction(_("Set As Primary"), this);
- connect(serPrimaryUIDAct, &QAction::triggered, this,
+ auto* ser_primary_uid_act = new QAction(tr("Set As Primary"), this);
+ connect(ser_primary_uid_act, &QAction::triggered, this,
&KeyPairUIDTab::slot_set_primary_uid);
- auto* signUIDAct = new QAction(_("Sign UID"), this);
- connect(signUIDAct, &QAction::triggered, this,
+ auto* sign_uid_act = new QAction(tr("Sign UID"), this);
+ connect(sign_uid_act, &QAction::triggered, this,
&KeyPairUIDTab::slot_add_sign_single);
- auto* delUIDAct = new QAction(_("Delete UID"), this);
- connect(delUIDAct, &QAction::triggered, this,
+ auto* del_uid_act = new QAction(tr("Delete UID"), this);
+ connect(del_uid_act, &QAction::triggered, this,
&KeyPairUIDTab::slot_del_uid_single);
if (m_key_.IsHasMasterKey()) {
- uid_popup_menu_->addAction(serPrimaryUIDAct);
- uid_popup_menu_->addAction(signUIDAct);
- uid_popup_menu_->addAction(delUIDAct);
+ uid_popup_menu_->addAction(ser_primary_uid_act);
+ uid_popup_menu_->addAction(sign_uid_act);
+ uid_popup_menu_->addAction(del_uid_act);
}
}
@@ -494,43 +481,43 @@ void KeyPairUIDTab::slot_add_sign_single() {
if (selected_uids->empty()) {
QMessageBox::information(
- nullptr, _("Invalid Operation"),
- _("Please select one UID before doing this operation."));
+ nullptr, tr("Invalid Operation"),
+ tr("Please select one UID before doing this operation."));
return;
}
- auto keySignDialog =
+ auto* key_sign_dialog =
new KeyUIDSignDialog(m_key_, std::move(selected_uids), this);
- keySignDialog->show();
+ key_sign_dialog->show();
}
void KeyPairUIDTab::slot_del_uid_single() {
auto selected_uids = get_uid_selected();
if (selected_uids->empty()) {
QMessageBox::information(
- nullptr, _("Invalid Operation"),
- _("Please select one UID before doing this operation."));
+ nullptr, tr("Invalid Operation"),
+ tr("Please select one UID before doing this operation."));
return;
}
QString keynames;
- keynames.append(QString::fromStdString(selected_uids->front()));
+ keynames.append(selected_uids->front());
keynames.append("<br/>");
int ret = QMessageBox::warning(
- this, _("Deleting UID"),
+ this, tr("Deleting UID"),
"<b>" +
QString(
- _("Are you sure that you want to delete the following uid?")) +
+ tr("Are you sure that you want to delete the following uid?")) +
"</b><br/><br/>" + keynames + +"<br/>" +
- _("The action can not be undone."),
+ tr("The action can not be undone."),
QMessageBox::No | QMessageBox::Yes);
if (ret == QMessageBox::Yes) {
if (!GpgUIDOperator::GetInstance().RevUID(m_key_, selected_uids->front())) {
- QMessageBox::critical(nullptr, _("Operation Failed"),
- _("An error occurred during the operation."));
+ QMessageBox::critical(nullptr, tr("Operation Failed"),
+ tr("An error occurred during the operation."));
} else {
emit SignalUpdateUIDInfo();
}
@@ -540,18 +527,19 @@ void KeyPairUIDTab::slot_del_uid_single() {
void KeyPairUIDTab::create_sign_popup_menu() {
sign_popup_menu_ = new QMenu(this);
- auto* delSignAct = new QAction(_("Delete(Revoke) Key Signature"), this);
- connect(delSignAct, &QAction::triggered, this, &KeyPairUIDTab::slot_del_sign);
+ auto* del_sign_act = new QAction(tr("Delete(Revoke) Key Signature"), this);
+ connect(del_sign_act, &QAction::triggered, this,
+ &KeyPairUIDTab::slot_del_sign);
- sign_popup_menu_->addAction(delSignAct);
+ sign_popup_menu_->addAction(del_sign_act);
}
void KeyPairUIDTab::slot_del_sign() {
auto selected_signs = get_sign_selected();
if (selected_signs->empty()) {
QMessageBox::information(
- nullptr, _("Invalid Operation"),
- _("Please select one Key Signature before doing this operation."));
+ nullptr, tr("Invalid Operation"),
+ tr("Please select one Key Signature before doing this operation."));
return;
}
@@ -559,30 +547,29 @@ void KeyPairUIDTab::slot_del_sign() {
.GetKey(selected_signs->front().first)
.IsGood()) {
QMessageBox::critical(
- nullptr, _("Invalid Operation"),
- _("To delete the signature, you need to have its corresponding public "
- "key in the local database."));
+ nullptr, tr("Invalid Operation"),
+ tr("To delete the signature, you need to have its corresponding public "
+ "key in the local database."));
return;
}
QString keynames;
- keynames.append(QString::fromStdString(selected_signs->front().second));
+ keynames.append(selected_signs->front().second);
keynames.append("<br/>");
- int ret =
- QMessageBox::warning(this, _("Deleting Key Signature"),
- "<b>" +
- QString(_("Are you sure that you want to delete "
- "the following signature?")) +
- "</b><br/><br/>" + keynames + +"<br/>" +
- _("The action can not be undone."),
- QMessageBox::No | QMessageBox::Yes);
+ int ret = QMessageBox::warning(this, tr("Deleting Key Signature"),
+ "<b>" +
+ tr("Are you sure that you want to delete "
+ "the following signature?") +
+ "</b><br/><br/>" + keynames + +"<br/>" +
+ tr("The action can not be undone."),
+ QMessageBox::No | QMessageBox::Yes);
if (ret == QMessageBox::Yes) {
if (!GpgKeyManager::GetInstance().RevSign(m_key_, selected_signs)) {
- QMessageBox::critical(nullptr, _("Operation Failed"),
- _("An error occurred during the operation."));
+ QMessageBox::critical(nullptr, tr("Operation Failed"),
+ tr("An error occurred during the operation."));
}
}
}