From b84e661438dc0dba5862ee741fd4d1d0f881e2f6 Mon Sep 17 00:00:00 2001 From: saturneric Date: Thu, 17 Apr 2025 18:54:03 +0200 Subject: chore: update and check translations --- .../controller/SmartCardControllerDialog.cpp | 80 ++++++++++++---------- 1 file changed, 43 insertions(+), 37 deletions(-) (limited to 'src/ui/dialog/controller/SmartCardControllerDialog.cpp') diff --git a/src/ui/dialog/controller/SmartCardControllerDialog.cpp b/src/ui/dialog/controller/SmartCardControllerDialog.cpp index fb812ad6..450f1a35 100644 --- a/src/ui/dialog/controller/SmartCardControllerDialog.cpp +++ b/src/ui/dialog/controller/SmartCardControllerDialog.cpp @@ -128,6 +128,9 @@ SmartCardControllerDialog::SmartCardControllerDialog(QWidget* parent) connect(d, &GenerateCardKeyDialog::finished, this, [=](int ret) { if (ret == 1) { fetch_smart_card_info(serial_number); + } else { + QMessageBox::critical(this, tr("Error"), + tr("Generate card key failed.")); } }); }); @@ -174,6 +177,8 @@ void SmartCardControllerDialog::fetch_smart_card_info( const QString& serial_number) { if (!has_card_) return; + reset_status(); + auto card_info = GpgSmartCardManager::GetInstance(channel_).FetchCardInfoBySerialNumber( serial_number); @@ -200,44 +205,47 @@ void SmartCardControllerDialog::print_smart_card_info() { out << "

" << tr("OpenPGP Card Information") << "

"; out << "

" << tr("Basic Information") << "

"; out << "

" << tr("Status") << "

"; if (!card.additional_card_infos.isEmpty()) { out << "

" << tr("Additional Info") << "

"; @@ -420,6 +423,8 @@ void SmartCardControllerDialog::slot_disable_controllers(bool disable) { } void SmartCardControllerDialog::slot_fetch_smart_card_keys() { + ui_->fetchButton->setDisabled(true); + GpgSmartCardManager::GetInstance().Fetch( ui_->currentCardComboBox->currentText()); @@ -428,9 +433,9 @@ void SmartCardControllerDialog::slot_fetch_smart_card_keys() { {{}, {"--card-status"}, [=](int exit_code, const QString&, const QString&) { + ui_->fetchButton->setDisabled(false); LOG_D() << "gpg --card--status exit code: " << exit_code; if (exit_code != 0) return; - emit UISignalStation::GetInstance() -> SignalKeyDatabaseRefresh(); }}); }); @@ -469,11 +474,12 @@ void SmartCardControllerDialog::modify_key_attribute(const QString& attr) { if (attr == "DISP-SEX") { QStringList options; - options << tr("1 - Male") << tr("2 - Female"); + options << "1 - " + tr("Male") << "2 - " + tr("Female"); const QString selected = QInputDialog::getItem( this, tr("Modify Card Attribute"), - tr("Select sex to store in '%1':").arg(attr), options, 0, false, &ok); + tr("Select sex to store in '%1'").arg(attr) + ": ", options, 0, false, + &ok); if (!ok || selected.isEmpty()) return; @@ -487,8 +493,8 @@ void SmartCardControllerDialog::modify_key_attribute(const QString& attr) { } else { value = QInputDialog::getText( this, tr("Modify Card Attribute"), - tr("Enter new value for attribute '%1':").arg(attr), QLineEdit::Normal, - "", &ok); + tr("Enter new value for attribute '%1'").arg(attr) + ": ", + QLineEdit::Normal, "", &ok); if (!ok || value.isEmpty()) { LOG_D() << "user canceled or empty input."; -- cgit v1.2.3