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.
This commit is contained in:
Christian Hohnstaedt 2024-09-13 16:00:36 +02:00
parent c806631906
commit ec3dec0b44
3 changed files with 27 additions and 17 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>589</width>
<height>366</height>
<width>520</width>
<height>385</height>
</rect>
</property>
<property name="windowTitle">
@ -115,19 +115,33 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="separateFiles">
<property name="text">
<string>Each Item in a separate file</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Export Format</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="separateFiles">
<property name="text">
<string>Each Item in a separate file</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="samePassword">
<property name="text">
<string>Same encryption password for all items</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="pemComment">
<property name="text">
<string>Export comment into PEM file</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
@ -166,13 +180,6 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="pemComment">
<property name="text">
<string>Export comment into PEM file</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -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)

View File

@ -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"),