Allow live changes during import of a template

With this change it is not necessary to open an imported
template if an imported tamplate cshall be changed.
This commit is contained in:
Christian Hohnstaedt 2024-09-20 14:35:06 +02:00
parent 006ffef3a1
commit 8390e9588f
3 changed files with 12 additions and 13 deletions

View File

@ -383,16 +383,6 @@ void NewX509::setTemp(pki_temp *temp)
connect_pki(temp);
}
void NewX509::disableAllButNameComment()
{
tab_0->setEnabled(false);
tab_2->setEnabled(false);
tab_3->setEnabled(false);
tab_4->setEnabled(false);
distNameBox->setEnabled(false);
privKeyBox->setEnabled(false);
}
/* Initialize dialog for Certificate creation */
void NewX509::setCert()
{
@ -565,8 +555,17 @@ void NewX509::fromTemplate(pki_temp *temp)
extensionsFromTemplate(temp);
}
void NewX509::updateNameComment()
{
// If we display a template, import all changes to the template
pki_temp *temp = dynamic_cast<pki_temp*>(pki);
toTemplate(temp);
}
void NewX509::toTemplate(pki_temp *temp)
{
if (!temp)
return;
temp->setIntName(description->text());
temp->setSubject(getX509name());
@ -1486,7 +1485,6 @@ void NewX509::showTemp(QWidget *parent, pki_temp *x)
return;
NewX509 *dlg = new NewX509(parent);
dlg->setTemp(x);
dlg->disableAllButNameComment();
dlg->exec();
delete dlg;
}

View File

@ -69,6 +69,8 @@ class NewX509: public XcaDetail, public Ui::NewX509
void setupExplicitDN(NIDlist my_dn_nid);
QList<nameEdit> setupExplicitInputs(NIDlist nid_list,
QWidget *parent, QWidget *old, int columns);
protected:
void updateNameComment();
public:
NewX509(QWidget *w = nullptr);
@ -77,7 +79,6 @@ class NewX509: public XcaDetail, public Ui::NewX509
void setRequest(); // reduce to request form
void setTemp(pki_temp *temp); // reduce to template form
void setCert(); // reduce to certificate form
void disableAllButNameComment();
void toTemplate(pki_temp *temp);
void fromTemplate(pki_temp *temp);
void defineTemplate(pki_temp *temp);

View File

@ -21,7 +21,7 @@ class XcaDetail: public QDialog
pki_base *pki{};
ImportMulti *importmulti{};
QPushButton *importbut{};
void updateNameComment();
virtual void updateNameComment();
public:
XcaDetail(QWidget *w);