aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/import_export
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/import_export')
-rw-r--r--src/ui/dialog/import_export/ExportKeyPackageDialog.cpp26
-rw-r--r--src/ui/dialog/import_export/ExportKeyPackageDialog.h6
-rw-r--r--src/ui/dialog/import_export/KeyImportDetailDialog.cpp1
-rw-r--r--src/ui/dialog/import_export/KeyUploadDialog.cpp14
-rw-r--r--src/ui/dialog/import_export/KeyUploadDialog.h6
5 files changed, 21 insertions, 32 deletions
diff --git a/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp b/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
index 7aab31b5..325eba98 100644
--- a/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
+++ b/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
@@ -28,18 +28,16 @@
#include "ExportKeyPackageDialog.h"
-#include "core/GpgModel.h"
#include "core/function/KeyPackageOperator.h"
-#include "core/function/gpg/GpgKeyGetter.h"
#include "ui/function/GpgOperaHelper.h"
#include "ui_ExportKeyPackageDialog.h"
GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog(
- int channel, KeyIdArgsList key_ids, QWidget* parent)
+ int channel, GpgAbstractKeyPtrList keys, QWidget* parent)
: GeneralDialog(typeid(ExportKeyPackageDialog).name(), parent),
ui_(GpgFrontend::SecureCreateSharedObject<Ui_exportKeyPackageDialog>()),
current_gpg_context_channel_(channel),
- key_ids_(std::move(key_ids)) {
+ keys_(std::move(keys)) {
ui_->setupUi(this);
ui_->nameValueLabel->setText(KeyPackageOperator::GenerateKeyPackageName());
@@ -95,29 +93,23 @@ GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog(
return;
}
- // get suitable key ids
- auto keys = GpgKeyGetter::GetInstance(current_gpg_context_channel_)
- .GetKeys(key_ids_);
- assert(std::all_of(keys.begin(), keys.end(),
- [](const auto& key) { return key.IsGood(); }));
-
- auto keys_new_end =
- std::remove_if(keys.begin(), keys.end(), [this](const auto& key) {
- return ui_->noPublicKeyCheckBox->isChecked() && !key.IsPrivateKey();
+ auto it =
+ std::remove_if(keys_.begin(), keys_.end(), [this](const auto& key) {
+ return ui_->noPublicKeyCheckBox->isChecked() && !key->IsPrivateKey();
});
- keys.erase(keys_new_end, keys.end());
+ keys_.erase(it, keys_.end());
- if (keys.empty()) {
+ if (keys_.empty()) {
QMessageBox::critical(this, tr("Error"),
tr("No key is suitable to export."));
return;
}
GpgOperaHelper::WaitForOpera(
- this, tr("Generating"), [this, keys](const OperaWaitingHd& op_hd) {
+ this, tr("Generating"), [this](const OperaWaitingHd& op_hd) {
KeyPackageOperator::GenerateKeyPackage(
ui_->outputPathLabel->text(), ui_->nameValueLabel->text(),
- current_gpg_context_channel_, keys, passphrase_,
+ current_gpg_context_channel_, keys_, passphrase_,
ui_->includeSecretKeyCheckBox->isChecked(),
[=](GFError err, const DataObjectPtr&) {
// stop waiting
diff --git a/src/ui/dialog/import_export/ExportKeyPackageDialog.h b/src/ui/dialog/import_export/ExportKeyPackageDialog.h
index 07722a21..f457e405 100644
--- a/src/ui/dialog/import_export/ExportKeyPackageDialog.h
+++ b/src/ui/dialog/import_export/ExportKeyPackageDialog.h
@@ -50,13 +50,13 @@ class ExportKeyPackageDialog : public GeneralDialog {
* @param key_ids
* @param parent
*/
- explicit ExportKeyPackageDialog(int channel, KeyIdArgsList key_ids,
+ explicit ExportKeyPackageDialog(int channel, GpgAbstractKeyPtrList keys,
QWidget* parent);
private:
std::shared_ptr<Ui_exportKeyPackageDialog> ui_; ///<
int current_gpg_context_channel_;
- KeyIdArgsList key_ids_; ///<
- QString passphrase_; ///<
+ GpgAbstractKeyPtrList keys_; ///<
+ QString passphrase_; ///<
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp
index 34a050ce..24062796 100644
--- a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp
+++ b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp
@@ -28,7 +28,6 @@
#include "KeyImportDetailDialog.h"
-#include "core/GpgModel.h"
#include "core/function/gpg/GpgKeyGetter.h"
#include "core/model/GpgImportInformation.h"
diff --git a/src/ui/dialog/import_export/KeyUploadDialog.cpp b/src/ui/dialog/import_export/KeyUploadDialog.cpp
index efa72802..346be765 100644
--- a/src/ui/dialog/import_export/KeyUploadDialog.cpp
+++ b/src/ui/dialog/import_export/KeyUploadDialog.cpp
@@ -29,9 +29,8 @@
#include "KeyUploadDialog.h"
#include <QtNetwork>
+#include <utility>
-#include "core/GpgModel.h"
-#include "core/function/gpg/GpgKeyGetter.h"
#include "core/function/gpg/GpgKeyImportExporter.h"
#include "core/model/SettingsObject.h"
#include "core/utils/BuildInfoUtils.h"
@@ -41,14 +40,13 @@
namespace GpgFrontend::UI {
-KeyUploadDialog::KeyUploadDialog(int channel, const KeyIdArgsList& keys_ids,
+KeyUploadDialog::KeyUploadDialog(int channel, GpgAbstractKeyPtrList keys,
QWidget* parent)
: GeneralDialog(typeid(KeyUploadDialog).name(), parent),
current_gpg_context_channel_(channel),
- m_keys_(GpgKeyGetter::GetInstance(current_gpg_context_channel_)
- .GetKeys(keys_ids)) {
- assert(std::all_of(m_keys_.begin(), m_keys_.end(),
- [](const auto& key) { return key.IsGood(); }));
+ keys_(std::move(keys)) {
+ assert(std::all_of(keys_.begin(), keys_.end(),
+ [](const auto& key) { return key->IsGood(); }));
auto* pb = new QProgressBar();
pb->setRange(0, 0);
@@ -70,7 +68,7 @@ KeyUploadDialog::KeyUploadDialog(int channel, const KeyIdArgsList& keys_ids,
void KeyUploadDialog::SlotUpload() {
GpgKeyImportExporter::GetInstance(current_gpg_context_channel_)
- .ExportKeys(m_keys_, false, true, false, false,
+ .ExportKeys(keys_, false, true, false, false,
[=](GpgError err, const DataObjectPtr& data_obj) {
if (CheckGpgError(err) != GPG_ERR_NO_ERROR) {
CommonUtils::RaiseMessageBox(this, err);
diff --git a/src/ui/dialog/import_export/KeyUploadDialog.h b/src/ui/dialog/import_export/KeyUploadDialog.h
index 36616037..8d3be02f 100644
--- a/src/ui/dialog/import_export/KeyUploadDialog.h
+++ b/src/ui/dialog/import_export/KeyUploadDialog.h
@@ -48,7 +48,7 @@ class KeyUploadDialog : public GeneralDialog {
* @param keys_ids
* @param parent
*/
- explicit KeyUploadDialog(int channel, const KeyIdArgsList& keys_ids,
+ explicit KeyUploadDialog(int channel, GpgAbstractKeyPtrList keys,
QWidget* parent);
public slots:
@@ -76,8 +76,8 @@ class KeyUploadDialog : public GeneralDialog {
private:
int current_gpg_context_channel_;
- GpgKeyList m_keys_; ///<
- QByteArray m_key_data_; ///<
+ GpgAbstractKeyPtrList keys_; ///<
+ QByteArray m_key_data_; ///<
};
} // namespace GpgFrontend::UI