diff options
author | saturneric <[email protected]> | 2023-11-07 07:18:06 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-11-07 07:18:06 +0000 |
commit | 3ad7fecdb6458fdd6f146bed19fe643c7f93e905 (patch) | |
tree | 522f7a5dd0389ad0771d01a50ea49ef646940894 /src/ui | |
parent | refactor: improve the code structure of core (diff) | |
download | GpgFrontend-3ad7fecdb6458fdd6f146bed19fe643c7f93e905.tar.gz GpgFrontend-3ad7fecdb6458fdd6f146bed19fe643c7f93e905.zip |
refactor: remove CommonUtils at core
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/UserInterfaceUtils.cpp | 6 | ||||
-rw-r--r-- | src/ui/dialog/key_generate/KeygenDialog.cpp | 8 | ||||
-rw-r--r-- | src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp | 8 | ||||
-rw-r--r-- | src/ui/widgets/TextEdit.cpp | 6 |
4 files changed, 16 insertions, 12 deletions
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp index d2ff0e7b..eb6b6d58 100644 --- a/src/ui/UserInterfaceUtils.cpp +++ b/src/ui/UserInterfaceUtils.cpp @@ -34,7 +34,6 @@ #include <vector> #include "core/GpgConstants.h" -#include "core/common/CoreCommonUtil.h" #include "core/function/CacheManager.h" #include "core/function/CoreSignalStation.h" #include "core/function/GlobalSettingStation.h" @@ -155,8 +154,9 @@ CommonUtils *CommonUtils::GetInstance() { } CommonUtils::CommonUtils() : QWidget(nullptr) { - connect(CoreCommonUtil::GetInstance(), &CoreCommonUtil::SignalGnupgNotInstall, - this, &CommonUtils::SignalGnupgNotInstall); + connect(CoreSignalStation::GetInstance(), + &CoreSignalStation::SignalGnupgNotInstall, this, + &CommonUtils::SignalGnupgNotInstall); connect(this, &CommonUtils::SignalKeyStatusUpdated, SignalStation::GetInstance(), &SignalStation::SignalKeyDatabaseRefresh); diff --git a/src/ui/dialog/key_generate/KeygenDialog.cpp b/src/ui/dialog/key_generate/KeygenDialog.cpp index 7d29036f..0fd7b6c4 100644 --- a/src/ui/dialog/key_generate/KeygenDialog.cpp +++ b/src/ui/dialog/key_generate/KeygenDialog.cpp @@ -30,9 +30,9 @@ #include <qobject.h> -#include "core/common/CoreCommonUtil.h" #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgKeyOpera.h" +#include "core/utils/CacheUtils.h" #include "dialog/WaitingDialog.h" #include "ui/SignalStation.h" @@ -141,8 +141,8 @@ void KeyGenDialog::slot_key_gen_accept() { } if (!use_pinentry_ && !gen_key_info_->IsNoPassPhrase()) { - CoreCommonUtil::GetInstance()->SetTempCacheValue( - "__key_passphrase", this->passphrase_edit_->text().toStdString()); + SetTempCacheValue("__key_passphrase", + this->passphrase_edit_->text().toStdString()); } GpgGenKeyResult result; @@ -162,7 +162,7 @@ void KeyGenDialog::slot_key_gen_accept() { dialog->close(); if (!use_pinentry_ && !gen_key_info_->IsNoPassPhrase()) { - CoreCommonUtil::GetInstance()->ResetTempCacheValue("__key_passphrase"); + ResetTempCacheValue("__key_passphrase"); } SPDLOG_DEBUG("generate done"); diff --git a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp index d3f3510d..fcc84d19 100644 --- a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp +++ b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp @@ -31,10 +31,10 @@ #include <cassert> #include <cstddef> -#include "core/common/CoreCommonUtil.h" #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgKeyGetter.h" #include "core/function/gpg/GpgKeyOpera.h" +#include "core/utils/CacheUtils.h" #include "core/utils/GpgUtils.h" #include "ui/SignalStation.h" #include "ui/dialog/WaitingDialog.h" @@ -294,8 +294,8 @@ void SubkeyGenerateDialog::slot_key_gen_accept() { } if (!use_pinentry_ && !gen_key_info_->IsNoPassPhrase()) { - CoreCommonUtil::GetInstance()->SetTempCacheValue( - "__key_passphrase", this->passphrase_edit_->text().toStdString()); + SetTempCacheValue("__key_passphrase", + this->passphrase_edit_->text().toStdString()); } GpgError error; @@ -315,7 +315,7 @@ void SubkeyGenerateDialog::slot_key_gen_accept() { waiting_dialog->close(); if (!use_pinentry_ && !gen_key_info_->IsNoPassPhrase()) { - CoreCommonUtil::GetInstance()->ResetTempCacheValue("__key_passphrase"); + ResetTempCacheValue("__key_passphrase"); } if (CheckGpgError(error) == GPG_ERR_NO_ERROR) { diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index 9c53b311..f27bab7c 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -482,7 +482,11 @@ void TextEdit::SlotPrint() { if (dlg->exec() != QDialog::Accepted) { return; } - document->print(&printer); + if (document != nullptr) { + document->print(&printer); + } else { + QMessageBox::warning(this, _("Warning"), _("No document to print")); + } // statusBar()->showMessage(_("Ready"), 2000); #endif |