aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-12-04 15:06:43 +0000
committersaturneric <[email protected]>2023-12-04 15:06:43 +0000
commitadc30154e8e553f563facc6d1e08b4696f29f15f (patch)
tree2f3324f357fa94868fa6f246fd0c49304c4c0f36
parentfeat: add reasons explanation to env loading failed message box (diff)
downloadGpgFrontend-adc30154e8e553f563facc6d1e08b4696f29f15f.tar.gz
GpgFrontend-adc30154e8e553f563facc6d1e08b4696f29f15f.zip
fix: slove some ui issues
Diffstat (limited to '')
-rw-r--r--src/ui/UserInterfaceUtils.cpp20
-rw-r--r--src/ui/dialog/keypair_details/KeyPairOperaTab.cpp9
2 files changed, 15 insertions, 14 deletions
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp
index cebd4854..713911e8 100644
--- a/src/ui/UserInterfaceUtils.cpp
+++ b/src/ui/UserInterfaceUtils.cpp
@@ -228,7 +228,8 @@ void CommonUtils::WaitForOpera(QWidget *parent,
const std::string &waiting_dialog_title,
const OperaWaitingCb &opera) {
QEventLoop looper;
- auto *dialog = new WaitingDialog(_("Generating"), parent);
+ auto *dialog =
+ new WaitingDialog(QString::fromStdString(waiting_dialog_title), parent);
connect(dialog, &QDialog::finished, &looper, &QEventLoop::quit);
connect(dialog, &QDialog::finished, dialog, &QDialog::deleteLater);
@@ -243,8 +244,9 @@ void CommonUtils::RaiseMessageBox(QWidget *parent, GpgError err) {
GpgErrorCode err_code = CheckGpgError2ErrCode(err);
if (err_code == GPG_ERR_NO_ERROR) {
- QMessageBox::information(parent, _("Success"),
- QString::fromStdString(_("Operation succeed.")));
+ QMessageBox::information(
+ parent, _("Success"),
+ QString::fromStdString(_("Gpg Operation succeed.")));
} else {
RaiseFailureMessageBox(parent, err);
}
@@ -257,8 +259,8 @@ void CommonUtils::RaiseFailureMessageBox(QWidget *parent, GpgError err) {
QMessageBox::critical(
parent, _("Failure"),
QString::fromStdString(
- (boost::format(_("Operation failed.\n\nError code: %1%\nSource: "
- " %2%\nDEscription: %3%")) %
+ (boost::format(_("Gpg Operation failed.\n\nError code: %1%\nSource: "
+ " %2%\nDescription: %3%")) %
err_code % desc.first % desc.second)
.str()));
}
@@ -288,7 +290,7 @@ void CommonUtils::SlotImportKeyFromFile(QWidget *parent) {
}
void CommonUtils::SlotImportKeyFromKeyServer(QWidget *parent) {
- auto dialog = new KeyServerImportDialog(false, parent);
+ auto *dialog = new KeyServerImportDialog(false, parent);
dialog->show();
}
@@ -413,12 +415,14 @@ void CommonUtils::SlotImportKeyFromKeyServer(
return;
}
- auto thread = QThread::create([target_keyserver, key_ids, callback]() {
+ auto *thread = QThread::create([target_keyserver, key_ids, callback]() {
QUrl target_keyserver_url(target_keyserver.c_str());
auto network_manager = std::make_unique<QNetworkAccessManager>();
// LOOP
- decltype(key_ids.size()) current_index = 1, all_index = key_ids.size();
+ decltype(key_ids.size()) current_index = 1;
+ decltype(key_ids.size()) all_index = key_ids.size();
+
for (const auto &key_id : key_ids) {
// New Req Url
QUrl req_url(
diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
index f7a8fb62..8fa7eb9c 100644
--- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
@@ -36,6 +36,7 @@
#include "core/utils/GpgUtils.h"
#include "core/utils/IOUtils.h"
#include "ui/UISignalStation.h"
+#include "ui/UserInterfaceUtils.h"
#include "ui/dialog/import_export/KeyUploadDialog.h"
#include "ui/function/SetOwnerTrustLevel.h"
@@ -343,7 +344,7 @@ void KeyPairOperaTab::slot_gen_revoke_cert() {
dialog.setDefaultSuffix(".rev");
dialog.setAcceptMode(QFileDialog::AcceptSave);
- if (dialog.exec()) m_output_file_name = dialog.selectedFiles().front();
+ if (dialog.exec() != 0) m_output_file_name = dialog.selectedFiles().front();
if (!m_output_file_name.isEmpty()) {
GpgKeyOpera::GetInstance().GenerateRevokeCert(
@@ -354,11 +355,7 @@ void KeyPairOperaTab::slot_gen_revoke_cert() {
void KeyPairOperaTab::slot_modify_password() {
GpgKeyOpera::GetInstance().ModifyPassword(
m_key_, [this](GpgError err, const DataObjectPtr&) {
- if (CheckGpgError(err) != GPG_ERR_NO_ERROR) {
- QMessageBox::critical(
- this, _("Not Successful"),
- QString(_("Modify password not successfully.")));
- }
+ CommonUtils::RaiseMessageBox(this, err);
});
}