aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-04-12 11:36:45 +0000
committersaturneric <[email protected]>2025-04-12 11:36:45 +0000
commite0264d85090dd119d48df28477db2fe3b17eb60a (patch)
treee7711bfe4f03c4b97eb2f37129b07a9ec5eb85d1 /src/ui
parentfix: wrong ui dialog order after switching apps (diff)
downloadGpgFrontend-e0264d85090dd119d48df28477db2fe3b17eb60a.tar.gz
GpgFrontend-e0264d85090dd119d48df28477db2fe3b17eb60a.zip
refactor: GpgKey and GpgSubKey
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/UserInterfaceUtils.cpp6
-rw-r--r--src/ui/dialog/import_export/KeyImportDetailDialog.cpp4
-rw-r--r--src/ui/dialog/keypair_details/KeyDetailsDialog.cpp18
-rw-r--r--src/ui/dialog/keypair_details/KeyPairDetailTab.cpp35
-rw-r--r--src/ui/dialog/keypair_details/KeyPairOperaTab.cpp65
-rw-r--r--src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp154
-rw-r--r--src/ui/dialog/keypair_details/KeyPairUIDTab.cpp9
-rw-r--r--src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp8
-rw-r--r--src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp4
-rw-r--r--src/ui/function/SetOwnerTrustLevel.cpp2
-rw-r--r--src/ui/main_window/KeyMgmt.cpp11
-rw-r--r--src/ui/main_window/MainWindowGpgOperaFunction.cpp2
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp23
-rw-r--r--src/ui/model/GpgKeyTableProxyModel.cpp5
-rw-r--r--src/ui/widgets/KeyList.cpp2
-rw-r--r--src/ui/widgets/VerifyKeyDetailBox.cpp4
16 files changed, 171 insertions, 181 deletions
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp
index 22752a19..f23eada0 100644
--- a/src/ui/UserInterfaceUtils.cpp
+++ b/src/ui/UserInterfaceUtils.cpp
@@ -505,7 +505,7 @@ auto CommonUtils::KeyExistsInFavoriteList(const QString &key_db_name,
auto &key_ids = cache_obj.key_dbs[key_db_name].key_ids;
- return key_ids.contains(key.GetId());
+ return key_ids.contains(key.ID());
}
void CommonUtils::AddKey2Favorite(const QString &key_db_name,
@@ -519,7 +519,7 @@ void CommonUtils::AddKey2Favorite(const QString &key_db_name,
}
auto &key_ids = cache_obj.key_dbs[key_db_name].key_ids;
- if (!key_ids.contains(key.GetId())) key_ids.append(key.GetId());
+ if (!key_ids.contains(key.ID())) key_ids.append(key.ID());
json_data.setObject(cache_obj.ToJson());
LOG_D() << "current favorite key pairs: " << json_data;
@@ -538,7 +538,7 @@ void CommonUtils::RemoveKeyFromFavorite(const QString &key_db_name,
QMutableListIterator<QString> i(cache_obj.key_dbs[key_db_name].key_ids);
while (i.hasNext()) {
- if (i.next() == key.GetId()) i.remove();
+ if (i.next() == key.ID()) i.remove();
}
json_data.setObject(cache_obj.ToJson());
LOG_D() << "current favorite key pairs: " << json_data;
diff --git a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp
index 0a5f5005..34a050ce 100644
--- a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp
+++ b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp
@@ -151,8 +151,8 @@ void KeyImportDetailDialog::create_keys_table() {
auto key = GpgKeyGetter::GetInstance(current_gpg_context_channel_)
.GetKey(imp_key.fpr);
if (!key.IsGood()) continue;
- keys_table_->setItem(row, 0, new QTableWidgetItem(key.GetName()));
- keys_table_->setItem(row, 1, new QTableWidgetItem(key.GetEmail()));
+ keys_table_->setItem(row, 0, new QTableWidgetItem(key.Name()));
+ keys_table_->setItem(row, 1, new QTableWidgetItem(key.Email()));
keys_table_->setItem(
row, 2, new QTableWidgetItem(get_status_string(imp_key.import_status)));
keys_table_->setItem(row, 3, new QTableWidgetItem(imp_key.fpr));
diff --git a/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp b/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
index d48cbdb7..b3cb3a9d 100644
--- a/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
+++ b/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
@@ -41,24 +41,24 @@ KeyDetailsDialog::KeyDetailsDialog(int channel, const GpgKey& key,
: GeneralDialog(typeid(KeyDetailsDialog).name(), parent),
current_gpg_context_channel_(channel) {
tab_widget_ = new QTabWidget();
- tab_widget_->addTab(new KeyPairDetailTab(current_gpg_context_channel_,
- key.GetId(), tab_widget_),
- tr("KeyPair"));
+ tab_widget_->addTab(
+ new KeyPairDetailTab(current_gpg_context_channel_, key.ID(), tab_widget_),
+ tr("KeyPair"));
if (!key.IsRevoked()) {
- tab_widget_->addTab(new KeyPairUIDTab(current_gpg_context_channel_,
- key.GetId(), tab_widget_),
- tr("UIDs"));
+ tab_widget_->addTab(
+ new KeyPairUIDTab(current_gpg_context_channel_, key.ID(), tab_widget_),
+ tr("UIDs"));
tab_widget_->addTab(new KeyPairSubkeyTab(current_gpg_context_channel_,
- key.GetId(), tab_widget_),
+ key.ID(), tab_widget_),
tr("Keychain"));
tab_widget_->addTab(new KeyPairOperaTab(current_gpg_context_channel_,
- key.GetId(), tab_widget_),
+ key.ID(), tab_widget_),
tr("Operations"));
}
- QString m_key_id = key.GetId();
+ QString m_key_id = key.ID();
connect(UISignalStation::GetInstance(), &UISignalStation::SignalKeyRevoked,
this, [this, m_key_id](const QString& key_id) {
if (key_id == m_key_id) this->close();
diff --git a/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp b/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp
index 88c7fbf5..5a646ec0 100644
--- a/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp
@@ -206,11 +206,11 @@ void KeyPairDetailTab::slot_refresh_key_info() {
expire_var_label_->setPalette(palette_valid);
}
- name_var_label_->setText(key_.GetName());
- email_var_label_->setText(key_.GetEmail());
+ name_var_label_->setText(key_.Name());
+ email_var_label_->setText(key_.Email());
- comment_var_label_->setText(key_.GetComment());
- key_id_var_label_->setText(key_.GetId());
+ comment_var_label_->setText(key_.Comment());
+ key_id_var_label_->setText(key_.ID());
QString buffer;
QTextStream usage_steam(&buffer);
@@ -241,7 +241,7 @@ void KeyPairDetailTab::slot_refresh_key_info() {
}
actual_usage_var_label_->setText(actual_usage_steam.readAll());
- owner_trust_var_label_->setText(key_.GetOwnerTrust());
+ owner_trust_var_label_->setText(key_.OwnerTrust());
QString key_size_val;
QString key_expire_val;
@@ -250,30 +250,29 @@ void KeyPairDetailTab::slot_refresh_key_info() {
QString key_algo_detail_val;
QString key_last_update_val;
- key_size_val = QString::number(key_.GetPrimaryKeyLength());
+ key_size_val = QString::number(key_.PrimaryKeyLength());
- if (key_.GetExpireTime().toSecsSinceEpoch() == 0) {
+ if (key_.ExpirationTime().toSecsSinceEpoch() == 0) {
expire_var_label_->setText(tr("Never Expire"));
} else {
- expire_var_label_->setText(QLocale().toString((key_.GetExpireTime())));
+ expire_var_label_->setText(QLocale().toString((key_.ExpirationTime())));
}
- key_algo_val = key_.GetPublicKeyAlgo();
- key_algo_detail_val = key_.GetKeyAlgo();
+ key_algo_val = key_.PublicKeyAlgo();
+ key_algo_detail_val = key_.Algo();
- created_var_label_->setText(QLocale().toString(key_.GetCreateTime()));
+ created_var_label_->setText(QLocale().toString(key_.CreationTime()));
- if (key_.GetLastUpdateTime().toSecsSinceEpoch() == 0) {
+ if (key_.LastUpdateTime().toSecsSinceEpoch() == 0) {
last_update_var_label_->setText(tr("No Data"));
} else {
- last_update_var_label_->setText(
- QLocale().toString(key_.GetLastUpdateTime()));
+ last_update_var_label_->setText(QLocale().toString(key_.LastUpdateTime()));
}
key_size_var_label_->setText(key_size_val);
algorithm_var_label_->setText(key_algo_val);
algorithm_detail_var_label_->setText(key_algo_detail_val);
- fingerprint_var_label_->setText(BeautifyFingerprint(key_.GetFingerprint()));
+ fingerprint_var_label_->setText(BeautifyFingerprint(key_.Fingerprint()));
fingerprint_var_label_->setWordWrap(true); // for x448 and ed448
icon_label_->hide();
@@ -295,8 +294,8 @@ void KeyPairDetailTab::slot_refresh_key_info() {
void KeyPairDetailTab::slot_refresh_key() {
// refresh the key
- GpgKey refreshed_key = GpgKeyGetter::GetInstance(current_gpg_context_channel_)
- .GetKey(key_.GetId());
+ GpgKey refreshed_key =
+ GpgKeyGetter::GetInstance(current_gpg_context_channel_).GetKey(key_.ID());
assert(refreshed_key.IsGood());
std::swap(this->key_, refreshed_key);
@@ -317,7 +316,7 @@ void KeyPairDetailTab::slot_query_key_publish_state() {
return;
}
- const auto fpr = key_.GetFingerprint();
+ const auto fpr = key_.Fingerprint();
Module::TriggerEvent(
"REQUEST_GET_PUBLIC_KEY_BY_FINGERPRINT",
diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
index c4f0dad1..936997a9 100644
--- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
@@ -189,8 +189,7 @@ void KeyPairOperaTab::CreateOperaMenu() {
secret_key_export_opera_menu_->addAction(export_shortest_secret_key);
// only work with RSA
- if (m_key_.GetKeyAlgo() == "RSA" &&
- Module::IsModuleActivate(kPaperKeyModuleID)) {
+ if (m_key_.Algo() == "RSA" && Module::IsModuleActivate(kPaperKeyModuleID)) {
auto* export_secret_key_as_paper_key = new QAction(
tr("Export Secret Key As A Paper Key") + QString(" (BETA)"), this);
connect(export_secret_key_as_paper_key, &QAction::triggered, this,
@@ -229,11 +228,11 @@ void KeyPairOperaTab::slot_export_public_key() {
// generate a file name
#if defined(_WIN32) || defined(WIN32)
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
- m_key_.GetId() + ")_pub.asc";
+ auto file_string =
+ m_key_.Name() + "[" + m_key_.Email() + "](" + m_key_.ID() + ")_pub.asc";
#else
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
- m_key_.GetId() + ")_pub.asc";
+ auto file_string =
+ m_key_.Name() + "<" + m_key_.Email() + ">(" + m_key_.ID() + ")_pub.asc";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -278,11 +277,11 @@ void KeyPairOperaTab::slot_export_short_private_key() {
// generate a file name
#if defined(_WIN32) || defined(WIN32)
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
- m_key_.GetId() + ")_short_secret.asc";
+ auto file_string = m_key_.Name() + "[" + m_key_.Email() + "](" +
+ m_key_.ID() + ")_short_secret.asc";
#else
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
- m_key_.GetId() + ")_short_secret.asc";
+ auto file_string = m_key_.Name() + "<" + m_key_.Email() + ">(" +
+ m_key_.ID() + ")_short_secret.asc";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -329,11 +328,11 @@ void KeyPairOperaTab::slot_export_private_key() {
// generate a file name
#if defined(_WIN32) || defined(WIN32)
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
- m_key_.GetId() + ")_full_secret.asc";
+ auto file_string = m_key_.Name() + "[" + m_key_.Email() + "](" +
+ m_key_.ID() + ")_full_secret.asc";
#else
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
- m_key_.GetId() + ")_full_secret.asc";
+ auto file_string = m_key_.Name() + "<" + m_key_.Email() + ">(" +
+ m_key_.ID() + ")_full_secret.asc";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -353,7 +352,7 @@ void KeyPairOperaTab::slot_export_private_key() {
void KeyPairOperaTab::slot_modify_edit_datetime() {
auto* dialog = new KeySetExpireDateDialog(current_gpg_context_channel_,
- m_key_.GetId(), this);
+ m_key_.ID(), this);
dialog->show();
}
@@ -363,7 +362,7 @@ void KeyPairOperaTab::slot_publish_key_to_server() {
GpgKeyImportExporter::GetInstance(current_gpg_context_channel_)
.ExportKey(m_key_, false, true, false);
- auto fpr = m_key_.GetFingerprint();
+ auto fpr = m_key_.Fingerprint();
auto key_text = gf_buffer.ConvertToQByteArray();
Module::TriggerEvent(
@@ -435,7 +434,7 @@ void KeyPairOperaTab::slot_publish_key_to_server() {
return;
}
- auto keys = KeyIdArgsList{m_key_.GetId()};
+ auto keys = KeyIdArgsList{m_key_.ID()};
auto* dialog = new KeyUploadDialog(current_gpg_context_channel_, keys, this);
dialog->show();
dialog->SlotUpload();
@@ -444,11 +443,11 @@ void KeyPairOperaTab::slot_publish_key_to_server() {
void KeyPairOperaTab::slot_update_key_from_server() {
if (Module::IsModuleActivate(kKeyServerSyncModuleID)) {
CommonUtils::GetInstance()->ImportKeyByKeyServerSyncModule(
- this, current_gpg_context_channel_, {m_key_.GetFingerprint()});
+ this, current_gpg_context_channel_, {m_key_.Fingerprint()});
return;
}
CommonUtils::GetInstance()->ImportKeyFromKeyServer(
- current_gpg_context_channel_, {m_key_.GetId()});
+ current_gpg_context_channel_, {m_key_.ID()});
}
void KeyPairOperaTab::slot_gen_revoke_cert() {
@@ -465,11 +464,11 @@ void KeyPairOperaTab::slot_gen_revoke_cert() {
QString m_output_file_name;
#if defined(_WIN32) || defined(WIN32)
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() +
- "](" + m_key_.GetId() + ").rev";
+ auto file_string = m_key_.Name() + "[" + m_key_.Email() + "](" +
+ m_key_.ID() + ").rev";
#else
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() +
- ">(" + m_key_.GetId() + ").rev";
+ auto file_string = m_key_.Name() + "<" + m_key_.Email() +
+ ">(" + m_key_.ID() + ").rev";
#endif
QFileDialog dialog(this, tr("Generate revocation certificate"),
@@ -530,7 +529,7 @@ void KeyPairOperaTab::slot_modify_tofu_policy() {
void KeyPairOperaTab::slot_set_owner_trust_level() {
auto* function = new SetOwnerTrustLevel(this);
- function->Exec(current_gpg_context_channel_, m_key_.GetId());
+ function->Exec(current_gpg_context_channel_, m_key_.ID());
function->deleteLater();
}
@@ -582,7 +581,7 @@ void KeyPairOperaTab::slot_import_revoke_cert() {
return;
}
- emit UISignalStation::GetInstance() -> SignalKeyRevoked(m_key_.GetId());
+ emit UISignalStation::GetInstance() -> SignalKeyRevoked(m_key_.ID());
CommonUtils::GetInstance()->SlotImportKeys(
nullptr, current_gpg_context_channel_, rev_file.readAll());
}
@@ -621,11 +620,11 @@ void KeyPairOperaTab::slot_export_paper_key() {
// generate a file name
#if defined(_WIN32) || defined(WIN32)
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
- m_key_.GetId() + ")_paper_key.txt";
+ auto file_string = m_key_.Name() + "[" + m_key_.Email() + "](" +
+ m_key_.ID() + ")_paper_key.txt";
#else
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
- m_key_.GetId() + ")_paper_key.txt";
+ auto file_string = m_key_.Name() + "<" + m_key_.Email() + ">(" +
+ m_key_.ID() + ")_paper_key.txt";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -675,11 +674,11 @@ void KeyPairOperaTab::slot_import_paper_key() {
// generate a file name
#if defined(_WIN32) || defined(WIN32)
- auto file_string = m_key_.GetName() + "[" + m_key_.GetEmail() + "](" +
- m_key_.GetId() + ")_paper_key.txt";
+ auto file_string = m_key_.Name() + "[" + m_key_.Email() + "](" + m_key_.ID() +
+ ")_paper_key.txt";
#else
- auto file_string = m_key_.GetName() + "<" + m_key_.GetEmail() + ">(" +
- m_key_.GetId() + ")_paper_key.txt";
+ auto file_string = m_key_.Name() + "<" + m_key_.Email() + ">(" + m_key_.ID() +
+ ")_paper_key.txt";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
diff --git a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp
index a85f05f5..ea175f3e 100644
--- a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp
@@ -202,46 +202,44 @@ void KeyPairSubkeyTab::slot_refresh_subkey_list() {
subkey_list_->setSelectionMode(QAbstractItemView::SingleSelection);
this->buffered_subkeys_.clear();
- auto sub_keys = key_.GetSubKeys();
- for (auto& sub_key : *sub_keys) {
- this->buffered_subkeys_.push_back(std::move(sub_key));
+ for (auto& s_key : key_.SubKeys()) {
+ this->buffered_subkeys_.push_back(std::move(s_key));
}
subkey_list_->setRowCount(buffered_subkeys_.size());
- for (const auto& subkey : buffered_subkeys_) {
- auto* tmp0 = new QTableWidgetItem(subkey.GetID());
+ for (const auto& s_key : buffered_subkeys_) {
+ auto* tmp0 = new QTableWidgetItem(s_key.ID());
tmp0->setTextAlignment(Qt::AlignCenter);
subkey_list_->setItem(row, 0, tmp0);
- auto type = subkey.IsHasCertCap() ? tr("Primary Key") : tr("Subkey");
- if (subkey.IsADSK()) type = tr("ADSK");
+ auto type = s_key.IsHasCertCap() ? tr("Primary Key") : tr("Subkey");
+ if (s_key.IsADSK()) type = tr("ADSK");
auto* tmp1 = new QTableWidgetItem(type);
tmp1->setTextAlignment(Qt::AlignCenter);
subkey_list_->setItem(row, 1, tmp1);
- auto* tmp2 = new QTableWidgetItem(QString::number(subkey.GetKeyLength()));
+ auto* tmp2 = new QTableWidgetItem(QString::number(s_key.KeyLength()));
tmp2->setTextAlignment(Qt::AlignCenter);
subkey_list_->setItem(row, 2, tmp2);
- auto* tmp3 = new QTableWidgetItem(subkey.GetPubkeyAlgo());
+ auto* tmp3 = new QTableWidgetItem(s_key.PublicKeyAlgo());
tmp3->setTextAlignment(Qt::AlignCenter);
subkey_list_->setItem(row, 3, tmp3);
- auto* tmp4 = new QTableWidgetItem(subkey.GetKeyAlgo());
+ auto* tmp4 = new QTableWidgetItem(s_key.Algo());
tmp4->setTextAlignment(Qt::AlignCenter);
subkey_list_->setItem(row, 4, tmp4);
- auto* tmp5 =
- new QTableWidgetItem(QLocale().toString(subkey.GetCreateTime()));
+ auto* tmp5 = new QTableWidgetItem(QLocale().toString(s_key.CreationTime()));
tmp5->setTextAlignment(Qt::AlignCenter);
subkey_list_->setItem(row, 5, tmp5);
auto* tmp6 =
- new QTableWidgetItem(subkey.GetExpireTime().toSecsSinceEpoch() == 0
+ new QTableWidgetItem(s_key.ExpirationTime().toSecsSinceEpoch() == 0
? tr("Never Expire")
- : QLocale().toString(subkey.GetExpireTime()));
+ : QLocale().toString(s_key.ExpirationTime()));
tmp6->setTextAlignment(Qt::AlignCenter);
subkey_list_->setItem(row, 6, tmp6);
@@ -256,7 +254,7 @@ void KeyPairSubkeyTab::slot_refresh_subkey_list() {
}
}
- if (subkey.IsExpired() || subkey.IsRevoked()) {
+ if (s_key.IsExpired() || s_key.IsRevoked()) {
for (auto i = 0; i < subkey_list_->columnCount(); i++) {
auto font = subkey_list_->item(row, i)->font();
font.setStrikeOut(true);
@@ -264,7 +262,7 @@ void KeyPairSubkeyTab::slot_refresh_subkey_list() {
}
}
- if (!subkey.IsSecretKey()) {
+ if (!s_key.IsSecretKey()) {
for (auto i = 0; i < subkey_list_->columnCount(); i++) {
auto font = subkey_list_->item(row, i)->font();
font.setWeight(QFont::ExtraLight);
@@ -282,17 +280,16 @@ void KeyPairSubkeyTab::slot_refresh_subkey_list() {
}
void KeyPairSubkeyTab::slot_add_subkey() {
- auto* dialog = new SubkeyGenerateDialog(current_gpg_context_channel_,
- key_.GetId(), this);
+ auto* dialog =
+ new SubkeyGenerateDialog(current_gpg_context_channel_, key_.ID(), this);
dialog->show();
}
void KeyPairSubkeyTab::slot_add_adsk() {
QStringList except_key_ids;
- except_key_ids.append(key_.GetId());
- auto except_sub_keys = key_.GetSubKeys();
- for (const auto& sub_key : *except_sub_keys) {
- except_key_ids.append(sub_key.GetID());
+ except_key_ids.append(key_.ID());
+ for (const auto& s_key : key_.SubKeys()) {
+ except_key_ids.append(s_key.ID());
}
auto* dialog = new ADSKsPicker(
@@ -311,7 +308,7 @@ void KeyPairSubkeyTab::slot_add_adsk() {
if (sub_keys.isEmpty()) {
QMessageBox::information(this, tr("No Subkeys Selected"),
- tr("Please select at least one subkey."));
+ tr("Please select at least one s_key."));
return;
}
@@ -331,8 +328,8 @@ void KeyPairSubkeyTab::slot_add_adsk() {
tr("All selected subkeys were successfully added as ADSKs."));
} else {
QStringList failed_info;
- for (const auto& sub_key : err_sub_keys) {
- QString key_id = sub_key.GetID();
+ for (const auto& s_key : err_sub_keys) {
+ QString key_id = s_key.ID();
failed_info << tr("Key ID: %1").arg(key_id);
}
@@ -354,19 +351,19 @@ void KeyPairSubkeyTab::slot_add_adsk() {
}
void KeyPairSubkeyTab::slot_refresh_subkey_detail() {
- const auto& subkey = get_selected_subkey();
+ const auto& s_key = get_selected_subkey();
- key_id_var_label_->setText(subkey.GetID());
- key_size_var_label_->setText(QString::number(subkey.GetKeyLength()));
+ key_id_var_label_->setText(s_key.ID());
+ key_size_var_label_->setText(QString::number(s_key.KeyLength()));
- time_t subkey_time_t = subkey.GetExpireTime().toSecsSinceEpoch();
+ time_t subkey_time_t = s_key.ExpirationTime().toSecsSinceEpoch();
expire_var_label_->setText(subkey_time_t == 0
? tr("Never Expires")
- : QLocale().toString(subkey.GetExpireTime()));
+ : QLocale().toString(s_key.ExpirationTime()));
if (subkey_time_t != 0 &&
- subkey.GetExpireTime() < QDateTime::currentDateTime()) {
+ s_key.ExpirationTime() < QDateTime::currentDateTime()) {
auto palette_expired = expire_var_label_->palette();
palette_expired.setColor(expire_var_label_->foregroundRole(), Qt::red);
expire_var_label_->setPalette(palette_expired);
@@ -376,23 +373,23 @@ void KeyPairSubkeyTab::slot_refresh_subkey_detail() {
expire_var_label_->setPalette(palette_valid);
}
- algorithm_var_label_->setText(subkey.GetPubkeyAlgo());
- algorithm_detail_var_label_->setText(subkey.GetKeyAlgo());
- created_var_label_->setText(QLocale().toString(subkey.GetCreateTime()));
+ algorithm_var_label_->setText(s_key.PublicKeyAlgo());
+ algorithm_detail_var_label_->setText(s_key.Algo());
+ created_var_label_->setText(QLocale().toString(s_key.CreationTime()));
QString buffer;
QTextStream usage_steam(&buffer);
- usage_var_label_->setText(GetUsagesBySubkey(subkey));
+ usage_var_label_->setText(GetUsagesBySubkey(s_key));
// Show the situation that secret key not exists.
- master_key_exist_var_label_->setText(subkey.IsSecretKey() ? tr("Exists")
- : tr("Not Exists"));
+ master_key_exist_var_label_->setText(s_key.IsSecretKey() ? tr("Exists")
+ : tr("Not Exists"));
// Show the situation if key in a smart card.
- card_key_label_->setText(subkey.IsCardKey() ? tr("Yes") : tr("No"));
+ card_key_label_->setText(s_key.IsCardKey() ? tr("Yes") : tr("No"));
- if (!subkey.IsSecretKey()) {
+ if (!s_key.IsSecretKey()) {
auto palette_expired = master_key_exist_var_label_->palette();
palette_expired.setColor(master_key_exist_var_label_->foregroundRole(),
Qt::red);
@@ -404,7 +401,7 @@ void KeyPairSubkeyTab::slot_refresh_subkey_detail() {
master_key_exist_var_label_->setPalette(palette_valid);
}
- if (!subkey.IsCardKey()) {
+ if (!s_key.IsCardKey()) {
auto palette_expired = card_key_label_->palette();
palette_expired.setColor(card_key_label_->foregroundRole(), Qt::red);
card_key_label_->setPalette(palette_expired);
@@ -414,19 +411,19 @@ void KeyPairSubkeyTab::slot_refresh_subkey_detail() {
card_key_label_->setPalette(palette_valid);
}
- fingerprint_var_label_->setText(BeautifyFingerprint(subkey.GetFingerprint()));
+ fingerprint_var_label_->setText(BeautifyFingerprint(s_key.Fingerprint()));
fingerprint_var_label_->setWordWrap(true); // for x448 and ed448
- export_subkey_button_->setText(
- subkey.IsHasCertCap() ? tr("Export Primary Key") : tr("Export Subkey"));
+ export_subkey_button_->setText(s_key.IsHasCertCap() ? tr("Export Primary Key")
+ : tr("Export Subkey"));
export_subkey_button_->setDisabled(
- !key_.IsPrivateKey() || subkey.IsHasCertCap() || !subkey.IsSecretKey());
+ !key_.IsPrivateKey() || s_key.IsHasCertCap() || !s_key.IsSecretKey());
- key_type_var_label_->setText(subkey.IsHasCertCap() ? tr("Primary Key")
- : tr("Subkey"));
+ key_type_var_label_->setText(s_key.IsHasCertCap() ? tr("Primary Key")
+ : tr("Subkey"));
- revoke_var_label_->setText(subkey.IsRevoked() ? tr("Yes") : tr("No"));
- if (!subkey.IsRevoked()) {
+ revoke_var_label_->setText(s_key.IsRevoked() ? tr("Yes") : tr("No"));
+ if (!s_key.IsRevoked()) {
auto palette_expired = revoke_var_label_->palette();
palette_expired.setColor(revoke_var_label_->foregroundRole(), Qt::red);
revoke_var_label_->setPalette(palette_expired);
@@ -463,23 +460,22 @@ void KeyPairSubkeyTab::create_subkey_opera_menu() {
void KeyPairSubkeyTab::slot_edit_subkey() {
auto* dialog =
- new KeySetExpireDateDialog(current_gpg_context_channel_, key_.GetId(),
- get_selected_subkey().GetFingerprint(), this);
+ new KeySetExpireDateDialog(current_gpg_context_channel_, key_.ID(),
+ get_selected_subkey().Fingerprint(), this);
dialog->show();
}
void KeyPairSubkeyTab::contextMenuEvent(QContextMenuEvent* event) {
// must have primary key before do any actions on subkey
if (key_.IsHasMasterKey() && !subkey_list_->selectedItems().isEmpty()) {
- const auto& subkey = get_selected_subkey();
+ const auto& s_key = get_selected_subkey();
- if (subkey.IsHasCertCap()) return;
+ if (s_key.IsHasCertCap()) return;
- export_subkey_act_->setDisabled(!subkey.IsSecretKey());
- edit_subkey_act_->setDisabled(!subkey.IsSecretKey());
- delete_subkey_act_->setDisabled(!subkey.IsSecretKey());
- revoke_subkey_act_->setDisabled(!subkey.IsSecretKey() ||
- subkey.IsRevoked());
+ export_subkey_act_->setDisabled(!s_key.IsSecretKey());
+ edit_subkey_act_->setDisabled(!s_key.IsSecretKey());
+ delete_subkey_act_->setDisabled(!s_key.IsSecretKey());
+ revoke_subkey_act_->setDisabled(!s_key.IsSecretKey() || s_key.IsRevoked());
subkey_opera_menu_->exec(event->globalPos());
}
@@ -497,15 +493,15 @@ auto KeyPairSubkeyTab::get_selected_subkey() -> const GpgSubKey& {
}
void KeyPairSubkeyTab::slot_refresh_key_info() {
- key_ = GpgKeyGetter::GetInstance(current_gpg_context_channel_)
- .GetKey(key_.GetId());
+ key_ =
+ GpgKeyGetter::GetInstance(current_gpg_context_channel_).GetKey(key_.ID());
assert(key_.IsGood());
}
void KeyPairSubkeyTab::slot_export_subkey() {
int ret = QMessageBox::question(
this, tr("Exporting Subkey"),
- "<h3>" + tr("You are about to export a private subkey.") + "</h3>\n" +
+ "<h3>" + tr("You are about to export a private s_key.") + "</h3>\n" +
tr("While subkeys are less critical than the primary key, "
"they should still be handled with care.") +
"<br /><br />" +
@@ -514,11 +510,11 @@ void KeyPairSubkeyTab::slot_export_subkey() {
if (ret != QMessageBox::Yes) return;
- const auto& subkey = get_selected_subkey();
+ const auto& s_key = get_selected_subkey();
auto [err, gf_buffer] =
GpgKeyImportExporter::GetInstance(current_gpg_context_channel_)
- .ExportSubkey(subkey.GetFingerprint(), true);
+ .ExportSubkey(s_key.Fingerprint(), true);
if (CheckGpgError(err) != GPG_ERR_NO_ERROR) {
CommonUtils::RaiseMessageBox(this, err);
@@ -527,11 +523,11 @@ void KeyPairSubkeyTab::slot_export_subkey() {
// generate a file name
#if defined(_WIN32) || defined(WIN32)
- auto file_string = key_.GetName() + "[" + key_.GetEmail() + "](" +
- subkey.GetID() + ")_subkey.asc";
+ auto file_string =
+ key_.Name() + "[" + key_.Email() + "](" + s_key.ID() + ")_s_key.asc";
#else
- auto file_string = key_.GetName() + "<" + key_.GetEmail() + ">(" +
- subkey.GetID() + ")_subkey.asc";
+ auto file_string =
+ key_.Name() + "<" + key_.Email() + ">(" + s_key.ID() + ")_s_key.asc";
#endif
std::replace(file_string.begin(), file_string.end(), ' ', '_');
@@ -549,13 +545,12 @@ void KeyPairSubkeyTab::slot_export_subkey() {
}
void KeyPairSubkeyTab::slot_delete_subkey() {
- const auto& subkey = get_selected_subkey();
- const auto subkeys = key_.GetSubKeys();
+ const auto& s_key = get_selected_subkey();
QString message = tr("<h3>You are about to delete the subkey:</h3><br />"
"<b>KeyID:</b> %1<br /><br />"
"This action is irreversible. Please confirm.")
- .arg(subkey.GetID());
+ .arg(s_key.ID());
int ret = QMessageBox::warning(
this, tr("Delete Subkey Confirmation"), message,
@@ -564,8 +559,8 @@ void KeyPairSubkeyTab::slot_delete_subkey() {
if (ret != QMessageBox::Yes) return;
int index = 0;
- for (const auto& sk : *subkeys) {
- if (sk.GetFingerprint() == subkey.GetFingerprint()) {
+ for (const auto& sk : key_.SubKeys()) {
+ if (sk.Fingerprint() == s_key.Fingerprint()) {
break;
}
index++;
@@ -574,7 +569,7 @@ void KeyPairSubkeyTab::slot_delete_subkey() {
if (index == 0) {
QMessageBox::critical(
this, tr("Illegal Operation"),
- tr("Cannot delete the primary key or an invalid subkey."));
+ tr("Cannot delete the primary key or an invalid s_key."));
return;
}
@@ -591,21 +586,20 @@ void KeyPairSubkeyTab::slot_delete_subkey() {
QMessageBox::information(
this, tr("Operation Successful"),
tr("The subkey with KeyID %1 has been successfully deleted.")
- .arg(subkey.GetID()));
+ .arg(s_key.ID()));
emit SignalKeyDatabaseRefresh();
}
void KeyPairSubkeyTab::slot_revoke_subkey() {
- const auto& subkey = get_selected_subkey();
- const auto subkeys = key_.GetSubKeys();
+ const auto& s_key = get_selected_subkey();
QString message = tr("<h3>Revoke Subkey Confirmation</h3><br />"
"<b>KeyID:</b> %1<br /><br />"
"Revoking a subkey will make it permanently unusable. "
"This action is <b>irreversible</b>.<br />"
"Are you sure you want to revoke this subkey?")
- .arg(subkey.GetID());
+ .arg(s_key.ID());
int ret = QMessageBox::warning(this, tr("Revoke Subkey"), message,
QMessageBox::Cancel | QMessageBox::Yes,
@@ -614,8 +608,8 @@ void KeyPairSubkeyTab::slot_revoke_subkey() {
if (ret != QMessageBox::Yes) return;
int index = 0;
- for (const auto& sk : *subkeys) {
- if (sk.GetFingerprint() == subkey.GetFingerprint()) {
+ for (const auto& sk : key_.SubKeys()) {
+ if (sk.Fingerprint() == s_key.Fingerprint()) {
break;
}
index++;
@@ -624,7 +618,7 @@ void KeyPairSubkeyTab::slot_revoke_subkey() {
if (index == 0) {
QMessageBox::critical(
this, tr("Illegal Operation"),
- tr("Cannot revoke the primary key or an invalid subkey."));
+ tr("Cannot revoke the primary key or an invalid s_key."));
return;
}
@@ -642,7 +636,7 @@ void KeyPairSubkeyTab::slot_revoke_subkey() {
if (!res) {
QMessageBox::critical(
nullptr, tr("Revocation Failed"),
- tr("Failed to revoke the subkey. Please try again."));
+ tr("Failed to revoke the s_key. Please try again."));
} else {
QMessageBox::information(
nullptr, tr("Revocation Successful"),
diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
index 1d1231c7..a010a6ea 100644
--- a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
@@ -176,8 +176,7 @@ void KeyPairUIDTab::slot_refresh_uid_list() {
this->buffered_uids_.clear();
- auto uids = m_key_.GetUIDs();
- for (auto& uid : *uids) {
+ for (auto& uid : m_key_.UIDs()) {
this->buffered_uids_.push_back(std::move(uid));
}
@@ -317,7 +316,7 @@ void KeyPairUIDTab::slot_add_sign() {
void KeyPairUIDTab::slot_add_uid() {
auto* key_new_uid_dialog =
- new KeyNewUIDDialog(current_gpg_context_channel_, m_key_.GetId(), this);
+ new KeyNewUIDDialog(current_gpg_context_channel_, m_key_.ID(), this);
connect(key_new_uid_dialog, &KeyNewUIDDialog::finished, this,
&KeyPairUIDTab::slot_add_uid_result);
connect(key_new_uid_dialog, &KeyNewUIDDialog::finished, key_new_uid_dialog,
@@ -518,7 +517,7 @@ void KeyPairUIDTab::slot_del_sign() {
void KeyPairUIDTab::slot_refresh_key() {
// refresh the key
GpgKey refreshed_key = GpgKeyGetter::GetInstance(current_gpg_context_channel_)
- .GetKey(m_key_.GetId());
+ .GetKey(m_key_.ID());
assert(refreshed_key.IsGood());
std::swap(this->m_key_, refreshed_key);
@@ -538,7 +537,7 @@ void KeyPairUIDTab::slot_rev_uid() {
return;
}
- const auto uids = m_key_.GetUIDs();
+ const auto uids = m_key_.UIDs();
QString message = tr("<h3>Revoke UID Confirmation</h3><br />"
"<b>UID:</b> %1<br /><br />"
diff --git a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp
index 2f86b603..4880bd3d 100644
--- a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp
+++ b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp
@@ -101,7 +101,7 @@ void KeySetExpireDateDialog::init() {
ui_->dateEdit->setMinimumDateTime(min_date_time);
// set default date time to expire date time
- auto current_expire_time = m_key_.GetExpireTime();
+ auto current_expire_time = m_key_.ExpirationTime();
ui_->dateEdit->setDateTime(current_expire_time);
ui_->timeEdit->setDateTime(current_expire_time);
@@ -114,11 +114,11 @@ void KeySetExpireDateDialog::init() {
UISignalStation::GetInstance(),
&UISignalStation::SignalKeyDatabaseRefresh);
- if (m_key_.GetExpireTime().toSecsSinceEpoch() == 0) {
+ if (m_key_.ExpirationTime().toSecsSinceEpoch() == 0) {
ui_->noExpirationCheckBox->setCheckState(Qt::Checked);
} else {
- ui_->dateEdit->setDateTime(m_key_.GetExpireTime());
- ui_->timeEdit->setDateTime(m_key_.GetExpireTime());
+ ui_->dateEdit->setDateTime(m_key_.ExpirationTime());
+ ui_->timeEdit->setDateTime(m_key_.ExpirationTime());
}
ui_->titleLabel->setText(tr("Modified Expiration Date (Local Time)"));
diff --git a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
index 4b9d4726..2c4a8c59 100644
--- a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
+++ b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
@@ -43,7 +43,7 @@ KeyUIDSignDialog::KeyUIDSignDialog(int channel, const GpgKey& key,
m_key_(key) {
assert(m_key_.IsGood());
- const auto key_id = m_key_.GetId();
+ const auto key_id = m_key_.ID();
m_key_list_ = new KeyList(
channel, KeyMenuAbility::kCOLUMN_FILTER | KeyMenuAbility::kSEARCH_BAR,
GpgKeyTableColumn::kNAME | GpgKeyTableColumn::kEMAIL_ADDRESS |
@@ -54,7 +54,7 @@ KeyUIDSignDialog::KeyUIDSignDialog(int channel, const GpgKey& key,
[key_id](const GpgKey& key) -> bool {
return !(key.IsDisabled() || !key.IsHasCertCap() ||
!key.IsHasMasterKey() || key.IsExpired() || key.IsRevoked() ||
- key_id == key.GetId());
+ key_id == key.ID());
});
m_key_list_->SlotRefresh();
diff --git a/src/ui/function/SetOwnerTrustLevel.cpp b/src/ui/function/SetOwnerTrustLevel.cpp
index b0fa8b0f..e99c3fa0 100644
--- a/src/ui/function/SetOwnerTrustLevel.cpp
+++ b/src/ui/function/SetOwnerTrustLevel.cpp
@@ -52,7 +52,7 @@ auto SetOwnerTrustLevel::Exec(int channel, const QString& key_id) -> bool {
bool ok;
QString item = QInputDialog::getItem(this, tr("Modify Owner Trust Level"),
tr("Trust for the Key Pair:"), items,
- key.GetOwnerTrustLevel(), false, &ok);
+ key.OwnerTrustLevel(), false, &ok);
if (ok && !item.isEmpty()) {
int trust_level = 0; // Unknown Level
diff --git a/src/ui/main_window/KeyMgmt.cpp b/src/ui/main_window/KeyMgmt.cpp
index 38a5399c..59e7a658 100644
--- a/src/ui/main_window/KeyMgmt.cpp
+++ b/src/ui/main_window/KeyMgmt.cpp
@@ -333,9 +333,9 @@ void KeyMgmt::delete_keys_with_warning(KeyIdArgsList uid_list) {
GpgKeyGetter::GetInstance(key_list_->GetCurrentGpgContextChannel())
.GetKey(key_id);
if (!key.IsGood()) continue;
- keynames.append(key.GetName());
+ keynames.append(key.Name());
keynames.append("<i> &lt;");
- keynames.append(key.GetEmail());
+ keynames.append(key.Email());
keynames.append("&gt; </i><br/>");
}
@@ -441,7 +441,8 @@ void KeyMgmt::SlotExportKeyToClipboard() {
}
void KeyMgmt::SlotGenerateKeyDialog() {
- (new KeyGenerateDialog(key_list_->GetCurrentGpgContextChannel(), this))->exec();
+ (new KeyGenerateDialog(key_list_->GetCurrentGpgContextChannel(), this))
+ ->exec();
this->raise();
}
@@ -456,8 +457,8 @@ void KeyMgmt::SlotGenerateSubKey() {
return;
}
- (new SubkeyGenerateDialog(key_list_->GetCurrentGpgContextChannel(),
- key.GetId(), this))
+ (new SubkeyGenerateDialog(key_list_->GetCurrentGpgContextChannel(), key.ID(),
+ this))
->exec();
this->raise();
}
diff --git a/src/ui/main_window/MainWindowGpgOperaFunction.cpp b/src/ui/main_window/MainWindowGpgOperaFunction.cpp
index 7632fdd6..dc65fd1c 100644
--- a/src/ui/main_window/MainWindowGpgOperaFunction.cpp
+++ b/src/ui/main_window/MainWindowGpgOperaFunction.cpp
@@ -172,7 +172,7 @@ auto MainWindow::check_keys_helper(
QMessageBox::critical(nullptr, tr("Invalid KeyPair"),
capability_err_string + "<br/><br/>" +
tr("For example the Following Key:") +
- " <br/>" + key.GetUIDs()->front().GetUID());
+ " <br/>" + key.UIDs().front().GetUID());
return {};
}
}
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index 781c67d1..fb4f9e73 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -103,11 +103,11 @@ void MainWindow::slot_append_keys_create_datetime() {
if (!succ) return;
auto create_datetime_format_str_local =
- QLocale().toString(key.GetCreateTime()) + " (" + tr("Localize") + ") " +
+ QLocale().toString(key.CreationTime()) + " (" + tr("Localize") + ") " +
"\n";
auto create_datetime_format_str =
- QLocale().toString(key.GetCreateTime().toUTC()) + " (" + tr("UTC") +
- ") " + "\n ";
+ QLocale().toString(key.CreationTime().toUTC()) + " (" + tr("UTC") + ") " +
+ "\n ";
edit_->SlotAppendText2CurTextPage(create_datetime_format_str_local +
create_datetime_format_str);
}
@@ -117,10 +117,10 @@ void MainWindow::slot_append_keys_expire_datetime() {
if (!succ) return;
auto expire_datetime_format_str_local =
- QLocale().toString(key.GetExpireTime()) + " (" + tr("Local Time") + ") " +
- "\n";
+ QLocale().toString(key.ExpirationTime()) + " (" + tr("Local Time") +
+ ") " + "\n";
auto expire_datetime_format_str =
- QLocale().toString(key.GetExpireTime().toUTC()) + " (UTC) " + "\n";
+ QLocale().toString(key.ExpirationTime().toUTC()) + " (UTC) " + "\n";
edit_->SlotAppendText2CurTextPage(expire_datetime_format_str_local +
expire_datetime_format_str);
@@ -130,8 +130,7 @@ void MainWindow::slot_append_keys_fingerprint() {
auto [succ, key] = m_key_list_->GetSelectedGpgKey();
if (!succ) return;
- auto fingerprint_format_str =
- BeautifyFingerprint(key.GetFingerprint()) + "\n";
+ auto fingerprint_format_str = BeautifyFingerprint(key.Fingerprint()) + "\n";
edit_->SlotAppendText2CurTextPage(fingerprint_format_str);
}
@@ -141,7 +140,7 @@ void MainWindow::slot_copy_mail_address_to_clipboard() {
if (!succ) return;
QClipboard* cb = QApplication::clipboard();
- cb->setText(key.GetEmail());
+ cb->setText(key.Email());
}
void MainWindow::slot_copy_default_uid_to_clipboard() {
@@ -149,7 +148,7 @@ void MainWindow::slot_copy_default_uid_to_clipboard() {
if (!succ) return;
QClipboard* cb = QApplication::clipboard();
- cb->setText(key.GetUIDs()->front().GetUID());
+ cb->setText(key.UIDs().front().GetUID());
}
void MainWindow::slot_copy_key_id_to_clipboard() {
@@ -157,7 +156,7 @@ void MainWindow::slot_copy_key_id_to_clipboard() {
if (!succ) return;
QClipboard* cb = QApplication::clipboard();
- cb->setText(key.GetId());
+ cb->setText(key.ID());
}
void MainWindow::slot_show_key_details() {
@@ -174,7 +173,7 @@ void MainWindow::slot_add_key_2_favorite() {
auto key_db_name =
GetGpgKeyDatabaseName(m_key_list_->GetCurrentGpgContextChannel());
- LOG_D() << "add key" << key.GetId() << "to favorite at key db" << key_db_name;
+ LOG_D() << "add key" << key.ID() << "to favorite at key db" << key_db_name;
CommonUtils::GetInstance()->AddKey2Favorite(key_db_name, key);
emit SignalUIRefresh();
diff --git a/src/ui/model/GpgKeyTableProxyModel.cpp b/src/ui/model/GpgKeyTableProxyModel.cpp
index 9dc98bcd..746f3344 100644
--- a/src/ui/model/GpgKeyTableProxyModel.cpp
+++ b/src/ui/model/GpgKeyTableProxyModel.cpp
@@ -95,8 +95,7 @@ auto GpgKeyTableProxyModel::filterAcceptsRow(
auto index = sourceModel()->index(source_row, column, sourceParent);
infos << sourceModel()->data(index).toString();
- const auto uids = key.GetUIDs();
- for (const auto &uid : *uids) {
+ for (const auto &uid : key.UIDs()) {
infos << uid.GetUID();
}
}
@@ -109,7 +108,7 @@ auto GpgKeyTableProxyModel::filterAcceptsRow(
}
auto GpgKeyTableProxyModel::filterAcceptsColumn(
- int sourceColumn, const QModelIndex &sourceParent) const -> bool {
+ int sourceColumn, const QModelIndex & /*sourceParent*/) const -> bool {
switch (sourceColumn) {
case 0: {
return true;
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index 877b5326..fb26295f 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -585,7 +585,7 @@ void KeyList::slot_sync_with_key_server() {
auto status_str = tr("Sync [%1/%2] %3 %4")
.arg(current_index)
.arg(all_index)
- .arg(key.GetUIDs()->front().GetUID())
+ .arg(key.UIDs().front().GetUID())
.arg(status);
emit SignalRefreshStatusBar(status_str, 1500);
diff --git a/src/ui/widgets/VerifyKeyDetailBox.cpp b/src/ui/widgets/VerifyKeyDetailBox.cpp
index 079c0e9d..eca7f03c 100644
--- a/src/ui/widgets/VerifyKeyDetailBox.cpp
+++ b/src/ui/widgets/VerifyKeyDetailBox.cpp
@@ -184,8 +184,8 @@ auto VerifyKeyDetailBox::create_key_info_grid(const GpgSignature& signature)
grid->addWidget(new QLabel(tr("Valid") + ":"), 3, 0);
grid->addWidget(new QLabel(tr("Flags") + ":"), 4, 0);
- grid->addWidget(new QLabel(key.GetName()), 0, 1);
- grid->addWidget(new QLabel(key.GetEmail()), 1, 1);
+ grid->addWidget(new QLabel(key.Name()), 0, 1);
+ grid->addWidget(new QLabel(key.Email()), 1, 1);
grid->addWidget(new QLabel(BeautifyFingerprint(fpr_)), 2, 1);
if ((signature.GetSummary() & GPGME_SIGSUM_VALID) != 0U) {