aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2023-07-14 14:29:25 +0000
committerSaturneric <[email protected]>2023-07-14 14:29:25 +0000
commit0df562991c5eaae288a510d9f1ed4fb06358a42a (patch)
tree7c1e60a839367a8584951b584a60d4a690c40c03
parentfix: slove position and size resotre issues (diff)
downloadGpgFrontend-0df562991c5eaae288a510d9f1ed4fb06358a42a.tar.gz
GpgFrontend-0df562991c5eaae288a510d9f1ed4fb06358a42a.zip
fix: improve ui
-rw-r--r--src/ui/dialog/import_export/ExportKeyPackageDialog.cpp7
-rw-r--r--src/ui/dialog/keypair_details/KeyDetailsDialog.cpp5
-rw-r--r--src/ui/dialog/keypair_details/KeyPairOperaTab.cpp32
-rw-r--r--src/ui/widgets/KeyList.cpp7
4 files changed, 12 insertions, 39 deletions
diff --git a/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp b/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
index 312cd946..b58d09c1 100644
--- a/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
+++ b/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
@@ -53,6 +53,10 @@ GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog(
auto file_name = QFileDialog::getSaveFileName(
this, _("Export Key Package"), ui_->nameValueLabel->text() + ".gfepack",
QString(_("Key Package")) + " (*.gfepack);;All Files (*)");
+
+ // check path
+ if (file_name.isEmpty()) return;
+
ui_->outputPathLabel->setText(file_name);
});
@@ -62,6 +66,9 @@ GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog(
ui_->nameValueLabel->text() + ".key",
QString(_("Key File")) + " (*.key);;All Files (*)");
+ // check path
+ if (file_name.isEmpty()) return;
+
if (!KeyPackageOperator::GeneratePassphrase(file_name.toStdString(),
passphrase_)) {
QMessageBox::critical(
diff --git a/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp b/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
index ed578aa7..9ac60a73 100644
--- a/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
+++ b/src/ui/dialog/keypair_details/KeyDetailsDialog.cpp
@@ -56,11 +56,6 @@ KeyDetailsDialog::KeyDetailsDialog(const GpgKey& key, QWidget* parent)
this->setWindowTitle(_("Key Details"));
this->setModal(true);
- // this->setMinimumSize({520, 600});
-
- // move to center of the parent
- this->movePosition2CenterOfParent();
-
this->show();
}
} // namespace GpgFrontend::UI
diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
index 13c857a0..c5d0670a 100644
--- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
@@ -333,34 +333,10 @@ void KeyPairOperaTab::slot_gen_revoke_cert() {
if (dialog.exec()) m_output_file_name = dialog.selectedFiles().front();
- if (!m_output_file_name.isEmpty())
- CommonUtils::GetInstance()->SlotExecuteGpgCommand(
- {"--command-fd", "0", "--status-fd", "1", "--no-tty", "-o",
- m_output_file_name, "--gen-revoke", m_key_.GetFingerprint().c_str()},
- [](QProcess* proc) -> void {
- // Code From Gpg4Win
- while (proc->canReadLine()) {
- const QString line = QString::fromUtf8(proc->readLine()).trimmed();
- SPDLOG_DEBUG("line: {}", line.toStdString());
- if (line == QLatin1String("[GNUPG:] GET_BOOL gen_revoke.okay")) {
- proc->write("y\n");
- } else if (line == QLatin1String("[GNUPG:] GET_LINE "
- "ask_revocation_reason.code")) {
- proc->write("0\n");
- } else if (line == QLatin1String("[GNUPG:] GET_LINE "
- "ask_revocation_reason.text")) {
- proc->write("\n");
- } else if (line ==
- QLatin1String(
- "[GNUPG:] GET_BOOL openfile.overwrite.okay")) {
- // We asked before
- proc->write("y\n");
- } else if (line == QLatin1String("[GNUPG:] GET_BOOL "
- "ask_revocation_reason.okay")) {
- proc->write("y\n");
- }
- }
- });
+ if (!m_output_file_name.isEmpty()) {
+ GpgKeyOpera::GetInstance().GenerateRevokeCert(
+ m_key_, m_output_file_name.toStdString());
+ }
}
void KeyPairOperaTab::slot_modify_password() {
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index e411e036..ce3c1c3d 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -561,7 +561,6 @@ KeyIdArgsListPtr& KeyTable::GetChecked() {
auto& ret = checked_key_ids_;
for (int i = 0; i < buffered_keys_.size(); i++) {
auto key_id = buffered_keys_[i].GetId();
- SPDLOG_DEBUG("i: {} key_id: {}", i, key_id);
if (key_list_->item(i, 0)->checkState() == Qt::Checked &&
std::find(ret->begin(), ret->end(), key_id) == ret->end()) {
ret->push_back(key_id);
@@ -592,7 +591,6 @@ void KeyTable::Refresh(KeyLinkListPtr m_keys) {
int row_count = 0;
while (it != keys->end()) {
- SPDLOG_DEBUG("filtering key id: {}", it->GetId());
// filter by search bar's keyword
if (ability_ & KeyMenuAbility::SEARCH_BAR && !keyword_.empty()) {
auto name = it->GetName();
@@ -621,7 +619,7 @@ void KeyTable::Refresh(KeyLinkListPtr m_keys) {
continue;
}
}
- SPDLOG_DEBUG("adding key id: {}", it->GetId());
+
if (select_type_ == KeyListRow::ONLY_SECRET_KEY && !it->IsPrivateKey()) {
it = keys->erase(it);
continue;
@@ -704,9 +702,6 @@ void KeyTable::Refresh(KeyLinkListPtr m_keys) {
tmp3->setFont(strike);
}
- SPDLOG_DEBUG("key id: {} added into key_list_: {}", it->GetId(),
- static_cast<void*>(this));
-
// move to buffered keys
buffered_keys_.emplace_back(std::move(*it));