From ec3dec0b4453711d709f12ca9f8195f84c439b18 Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Fri, 13 Sep 2024 16:00:36 +0200 Subject: [PATCH] Relates #88: Select a common or individual passwords When exporting items into encrypted files, the checkbox "Same encryption password for all items" may be used to enter one password once for all items. Otherwise a new password dialog opens for each exported entry. --- ui/ExportDialog.ui | 39 +++++++++++++++++++++++---------------- widgets/ExportDialog.cpp | 2 ++ widgets/XcaTreeView.cpp | 3 ++- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/ui/ExportDialog.ui b/ui/ExportDialog.ui index f5405ed6..ed47ad74 100644 --- a/ui/ExportDialog.ui +++ b/ui/ExportDialog.ui @@ -6,8 +6,8 @@ 0 0 - 589 - 366 + 520 + 385 @@ -115,19 +115,33 @@ - - - - Each Item in a separate file - - - Export Format + + + + Each Item in a separate file + + + + + + + Same encryption password for all items + + + + + + + Export comment into PEM file + + + @@ -166,13 +180,6 @@ - - - - Export comment into PEM file - - - diff --git a/widgets/ExportDialog.cpp b/widgets/ExportDialog.cpp index 0a503142..d28eff62 100644 --- a/widgets/ExportDialog.cpp +++ b/widgets/ExportDialog.cpp @@ -35,6 +35,7 @@ ExportDialog::ExportDialog(QWidget *w, const QString &title, fname = pki->getUnderlinedName(); } separateFiles->hide(); + samePassword->hide(); setupExportFormat(F_MULTI); } else { // Plural form not required for < 2 items @@ -162,6 +163,7 @@ void ExportDialog::on_exportFormat_highlighted(int index) return; infoBox->setText(x->help); pemComment->setEnabled(x->flags & F_PEM); + samePassword->setEnabled(x->flags & F_CRYPT); } void ExportDialog::on_separateFiles_clicked(bool checked) diff --git a/widgets/XcaTreeView.cpp b/widgets/XcaTreeView.cpp index 20f46843..75521938 100644 --- a/widgets/XcaTreeView.cpp +++ b/widgets/XcaTreeView.cpp @@ -508,7 +508,8 @@ void XcaTreeView::exportItems(const QModelIndexList &indexes) if (dlg->separateFiles->isChecked()) { Passwd pass; - if (xport->match_all(F_CRYPT)) { + if (xport->match_all(F_CRYPT) && dlg->samePassword->isChecked()) + { // Plural form not required for < 2 items // Will only be called for 2 or more items pass_info p(tr("Export Password"),