aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp')
-rw-r--r--src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp56
1 files changed, 25 insertions, 31 deletions
diff --git a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
index 12da3284..ba12f232 100644
--- a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
+++ b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2021 Saturneric
+ * Copyright (C) 2021 Saturneric <[email protected]>
*
* This file is part of GpgFrontend.
*
@@ -19,16 +19,19 @@
* 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 "KeyUIDSignDialog.h"
+#include "core/GpgModel.h"
#include "core/function/gpg/GpgKeyGetter.h"
#include "core/function/gpg/GpgKeyManager.h"
-#include "ui/SignalStation.h"
+#include "ui/UISignalStation.h"
namespace GpgFrontend::UI {
@@ -40,15 +43,12 @@ KeyUIDSignDialog::KeyUIDSignDialog(const GpgKey& key, UIDArgsListPtr uid,
const auto key_id = m_key_.GetId();
m_key_list_ = new KeyList(KeyMenuAbility::NONE, this);
m_key_list_->AddListGroupTab(
- _("Signers"), "signers", KeyListRow::ONLY_SECRET_KEY,
+ tr("Signers"), "signers", KeyListRow::ONLY_SECRET_KEY,
KeyListColumn::NAME | KeyListColumn::EmailAddress,
[key_id](const GpgKey& key, const KeyTable&) -> bool {
- if (key.IsDisabled() || !key.IsHasCertificationCapability() ||
- !key.IsHasMasterKey() || key.IsExpired() || key.IsRevoked() ||
- key_id == key.GetId())
- return false;
- else
- return true;
+ return !(key.IsDisabled() || !key.IsHasCertificationCapability() ||
+ !key.IsHasMasterKey() || key.IsExpired() || key.IsRevoked() ||
+ key_id == key.GetId());
});
m_key_list_->SlotRefresh();
@@ -83,7 +83,7 @@ KeyUIDSignDialog::KeyUIDSignDialog(const GpgKey& key, UIDArgsListPtr uid,
layout->addWidget(m_key_list_, 0, 0);
layout->addWidget(sign_key_button_, 2, 0, Qt::AlignRight);
- timeLayout->addWidget(new QLabel(_("Expire Date")), 0, 0);
+ timeLayout->addWidget(new QLabel(tr("Expire Date")), 0, 0);
timeLayout->addWidget(expires_edit_, 0, 1);
timeLayout->addWidget(non_expire_check_, 0, 2);
layout->addLayout(timeLayout, 1, 0);
@@ -93,14 +93,14 @@ KeyUIDSignDialog::KeyUIDSignDialog(const GpgKey& key, UIDArgsListPtr uid,
this->setLayout(layout);
this->setModal(true);
- this->setWindowTitle(_("Sign For Key's UID(s)"));
+ this->setWindowTitle(tr("Sign For Key's UID(s)"));
this->adjustSize();
setAttribute(Qt::WA_DeleteOnClose, true);
connect(this, &KeyUIDSignDialog::SignalKeyUIDSignUpdate,
- SignalStation::GetInstance(),
- &SignalStation::SignalKeyDatabaseRefresh);
+ UISignalStation::GetInstance(),
+ &UISignalStation::SignalKeyDatabaseRefresh);
}
void KeyUIDSignDialog::slot_sign_key(bool clicked) {
@@ -108,29 +108,23 @@ void KeyUIDSignDialog::slot_sign_key(bool clicked) {
auto key_ids = m_key_list_->GetChecked();
auto keys = GpgKeyGetter::GetInstance().GetKeys(key_ids);
- SPDLOG_DEBUG("key info got");
-#ifdef GPGFRONTEND_GUI_QT6
- auto expires =
- std::make_unique<boost::posix_time::ptime>(boost::posix_time::from_time_t(
- expires_edit_->dateTime().toSecsSinceEpoch()));
-#else
- auto expires = std::make_unique<boost::posix_time::ptime>(
- boost::posix_time::from_time_t(expires_edit_->dateTime().toTime_t()));
-#endif
-
- SPDLOG_DEBUG("sign start");
+ GF_UI_LOG_DEBUG("key info got");
+ auto expires = std::make_unique<QDateTime>(expires_edit_->dateTime());
+
+ GF_UI_LOG_DEBUG("sign start");
for (const auto& uid : *m_uids_) {
- SPDLOG_DEBUG("sign uid: {}", uid);
+ GF_UI_LOG_DEBUG("sign uid: {}", uid);
// Sign For mKey
if (!GpgKeyManager::GetInstance().SignKey(m_key_, *keys, uid, expires)) {
QMessageBox::critical(
- nullptr, _("Unsuccessful Operation"),
- QString(_("Signature operation failed for UID %1")).arg(uid.c_str()));
+ nullptr, tr("Unsuccessful Operation"),
+ tr("Signature operation failed for UID %1").arg(uid));
}
}
- QMessageBox::information(nullptr, _("Operation Complete"),
- _("The signature operation of the UID is complete"));
+ QMessageBox::information(
+ nullptr, tr("Operation Complete"),
+ tr("The signature operation of the UID is complete"));
this->close();
emit SignalKeyUIDSignUpdate();
}