diff options
author | Saturneric <[email protected]> | 2021-12-16 18:40:19 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-16 18:40:19 +0000 |
commit | 86630a1eea3c0f6c49b0d155d97c62a49e708fd1 (patch) | |
tree | 4409fec57f51850c53264e5e8f07c6542d437b84 | |
parent | Fixed & Update Translation. (diff) | |
download | GpgFrontend-86630a1eea3c0f6c49b0d155d97c62a49e708fd1.tar.gz GpgFrontend-86630a1eea3c0f6c49b0d155d97c62a49e708fd1.zip |
Fixed Known Issues on Export.
Diffstat (limited to '')
-rw-r--r-- | src/ui/keypair_details/KeyPairDetailTab.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/ui/keypair_details/KeyPairDetailTab.cpp b/src/ui/keypair_details/KeyPairDetailTab.cpp index 322b9c8f..e4b9206a 100644 --- a/src/ui/keypair_details/KeyPairDetailTab.cpp +++ b/src/ui/keypair_details/KeyPairDetailTab.cpp @@ -225,18 +225,20 @@ void KeyPairDetailTab::slotExportPublicKey() { _("An error occurred during the export operation.")); return; } - auto fileString = + auto file_string = mKey.name() + " " + mKey.email() + "(" + mKey.id() + ")_pub.asc"; - auto fileName = + auto file_name = QFileDialog::getSaveFileName( - this, _("Export Key To File"), QString::fromStdString(fileString), + this, _("Export Key To File"), QString::fromStdString(file_string), QString(_("Key Files")) + " (*.asc *.txt);;All Files (*)") .toStdString(); - if (!write_buffer_to_file(fileName, *keyArray)) { + if (file_name.empty()) return; + + if (!write_buffer_to_file(file_name, *keyArray)) { QMessageBox::critical( this, _("Export Error"), - QString(_("Couldn't open %1 for writing")).arg(fileName.c_str())); + QString(_("Couldn't open %1 for writing")).arg(file_name.c_str())); return; } } @@ -266,18 +268,20 @@ void KeyPairDetailTab::slotExportShortPrivateKey() { _("An error occurred during the export operation.")); return; } - auto fileString = mKey.name() + " " + mKey.email() + "(" + mKey.id() + - ")_short_secret.asc"; - auto fileName = + auto file_string = mKey.name() + " " + mKey.email() + "(" + mKey.id() + + ")_short_secret.asc"; + auto file_name = QFileDialog::getSaveFileName( - this, _("Export Key To File"), QString::fromStdString(fileString), + this, _("Export Key To File"), QString::fromStdString(file_string), QString(_("Key Files")) + " (*.asc *.txt);;All Files (*)") .toStdString(); - if (!write_buffer_to_file(fileName, *keyArray)) { + if (file_name.empty()) return; + + if (!write_buffer_to_file(file_name, *keyArray)) { QMessageBox::critical( this, _("Export Error"), - QString(_("Couldn't open %1 for writing")).arg(fileName.c_str())); + QString(_("Couldn't open %1 for writing")).arg(file_name.c_str())); return; } } @@ -303,18 +307,20 @@ void KeyPairDetailTab::slotExportPrivateKey() { _("An error occurred during the export operation.")); return; } - auto fileString = mKey.name() + " " + mKey.email() + "(" + mKey.id() + - ")_full_secret.asc"; - auto fileName = + auto file_string = mKey.name() + " " + mKey.email() + "(" + mKey.id() + + ")_full_secret.asc"; + auto file_name = QFileDialog::getSaveFileName( - this, _("Export Key To File"), QString::fromStdString(fileString), + this, _("Export Key To File"), QString::fromStdString(file_string), QString(_("Key Files")) + " (*.asc *.txt);;All Files (*)") .toStdString(); - if (!write_buffer_to_file(fileName, *keyArray)) { + if (file_name.empty()) return; + + if (!write_buffer_to_file(file_name, *keyArray)) { QMessageBox::critical( this, _("Export Error"), - QString(_("Couldn't open %1 for writing")).arg(fileName.c_str())); + QString(_("Couldn't open %1 for writing")).arg(file_name.c_str())); return; } } |