diff --git a/ui/NewX509.ui b/ui/NewX509.ui
index 0fd0911a..3ea61254 100644
--- a/ui/NewX509.ui
+++ b/ui/NewX509.ui
@@ -6,7 +6,7 @@
0
0
- 598
+ 712
613
@@ -83,13 +83,7 @@
Source
-
-
- 6
-
-
- 9
-
+
-
@@ -326,22 +320,9 @@ If this list is disabled, you only can create a self-signed certificate.
- Template
+ Template for the new certificate
-
-
- 6
-
-
- 9
-
-
-
-
-
- Template for the new certificate
-
-
-
+
-
@@ -359,11 +340,48 @@ If this list is disabled, you only can create a self-signed certificate.
-
-
-
- Apply
-
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 13
+ 20
+
+
+
+
+ -
+
+
+ Apply extensions
+
+
+
+ -
+
+
+ Apply subject
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Apply all
+
+
+
+
@@ -1659,7 +1677,7 @@ email:my@other.address, RID:1.2.3.4, DNS: ns.server.tld
accept()
- 587
+ 701
599
@@ -1675,12 +1693,12 @@ email:my@other.address, RID:1.2.3.4, DNS: ns.server.tld
setEnabled(bool)
- 291
- 324
+ 308
+ 311
- 565
- 326
+ 679
+ 313
@@ -1711,8 +1729,24 @@ email:my@other.address, RID:1.2.3.4, DNS: ns.server.tld
342
- 323
- 342
+ 673
+ 345
+
+
+
+
+ fromReqCB
+ clicked(bool)
+ reqList
+ setEnabled(bool)
+
+
+ 292
+ 147
+
+
+ 402
+ 147
diff --git a/widgets/NewX509.cpp b/widgets/NewX509.cpp
index 3221144f..59089621 100644
--- a/widgets/NewX509.cpp
+++ b/widgets/NewX509.cpp
@@ -300,9 +300,16 @@ static QString lb2QString(QListWidget *lb)
return sl.join(", ");
}
-void NewX509::fromTemplate(pki_temp *temp)
+void NewX509::subjectFromTemplate(pki_temp *temp)
{
- setX509name(temp->xname);
+ if (temp)
+ setX509name(temp->xname);
+}
+
+void NewX509::extensionsFromTemplate(pki_temp *temp)
+{
+ if (!temp)
+ return;
subAltName->setText(temp->subAltName);
issAltName->setText(temp->issAltName);
crlDist->setText(temp->crlDist);
@@ -333,6 +340,12 @@ void NewX509::fromTemplate(pki_temp *temp)
on_applyTime_clicked();
}
+void NewX509::fromTemplate(pki_temp *temp)
+{
+ subjectFromTemplate(temp);
+ extensionsFromTemplate(temp);
+}
+
void NewX509::toTemplate(pki_temp *temp)
{
temp->setIntName(description->text());
@@ -492,18 +505,30 @@ void NewX509::templateChanged(pki_temp *templ)
templateChanged(tempname);
}
-void NewX509::on_applyTemplate_clicked()
+pki_temp *NewX509::currentTemplate()
{
pki_temp *temp = NULL;
if (!tempList->isEnabled())
- return;
+ return NULL;
QString name = tempList->currentText();
if (name.isEmpty())
- return;
- temp = (pki_temp *)MainWindow::temps->getByName(name);
- if (!temp)
- return;
- fromTemplate(temp);
+ return NULL;
+ return (pki_temp *)MainWindow::temps->getByName(name);
+}
+
+void NewX509::on_applyTemplate_clicked()
+{
+ fromTemplate(currentTemplate());
+}
+
+void NewX509::on_applySubject_clicked()
+{
+ subjectFromTemplate(currentTemplate());
+}
+
+void NewX509::on_applyExtensionse_clicked()
+{
+ extensionsFromTemplate(currentTemplate());
}
void NewX509::on_foreignSignRB_toggled(bool checked)
diff --git a/widgets/NewX509.h b/widgets/NewX509.h
index 15cbffef..331f9861 100644
--- a/widgets/NewX509.h
+++ b/widgets/NewX509.h
@@ -89,6 +89,10 @@ class NewX509: public QDialog, public Ui::NewX509
void switchHashAlgo();
void addReqAttributes(pki_x509req *req);
int checkExtDuplicates();
+ void subjectFromTemplate(pki_temp *temp);
+ void extensionsFromTemplate(pki_temp *temp);
+ pki_temp *currentTemplate();
+
public slots:
void on_fromReqCB_clicked();
void on_keyList_currentIndexChanged(const QString &);
@@ -106,6 +110,8 @@ class NewX509: public QDialog, public Ui::NewX509
void on_showReqBut_clicked();
void on_certList_currentIndexChanged(int index);
void on_applyTemplate_clicked();
+ void on_applySubject_clicked();
+ void on_applyExtensionse_clicked();
void on_adv_validate_clicked();
void on_usedKeysToo_toggled(bool checked);
void on_tabWidget_currentChanged(int idx);