diff ui/mainwindow.cpp @ 432:16b5cd858571

Updated layout and certificate details in trustbridge installer.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 22 Apr 2014 11:20:13 +0200
parents 09bb19e5e369
children dbcc7740b9d8
line wrap: on
line diff
--- a/ui/mainwindow.cpp	Tue Apr 22 10:38:02 2014 +0200
+++ b/ui/mainwindow.cpp	Tue Apr 22 11:20:13 2014 +0200
@@ -282,11 +282,13 @@
     QHBoxLayout *mainLayout = new QHBoxLayout;
     QVBoxLayout *infoLayout = new QVBoxLayout;
     QVBoxLayout *certLayout = new QVBoxLayout;
-    QVBoxLayout *detailLayout = new QVBoxLayout;
+    QHBoxLayout *detailLayout = new QHBoxLayout;
+    QVBoxLayout *detailLabelLayout = new QVBoxLayout;
+    QVBoxLayout *detailContentLayout = new QVBoxLayout;
     QHBoxLayout *headerLayout = new QHBoxLayout;
     QVBoxLayout *headerTextLayout = new QVBoxLayout;
-    QVBoxLayout *toolLayout = new QVBoxLayout;
     QHBoxLayout *bottomLayout = new QHBoxLayout;
+    QVBoxLayout *settingsLayout = new QVBoxLayout;
 
     // The certificate list
     QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
@@ -312,8 +314,12 @@
     headerLayout->setStretch(1, 10);
 
     // The settings.
-    QCheckBox *autoUpdateOption = new QCheckBox(tr("autoupdate"));
-    toolLayout->addWidget(autoUpdateOption);
+    QGroupBox *settingsBox = new QGroupBox(tr("Settings"));
+    mAutoUpdateOption = new QCheckBox(tr("Autoupdate"));
+    mAutoStartOption = new QCheckBox(tr("Autostart"));
+    settingsLayout->addWidget(mAutoUpdateOption);
+    settingsLayout->addWidget(mAutoStartOption);
+    settingsBox->setLayout(settingsLayout);
 //    connect(autoUpdateOption, SIGNAL(stateChanged()), this, SLOT(setAutoUpdate()));
 
     // The buttons.
@@ -333,15 +339,42 @@
 
     // The certificate details
     QGroupBox *detailBox = new QGroupBox(tr("Details"));
-    certificateDetails = new QTextEdit;
-    certificateDetails->setReadOnly(true);
-    detailLayout->addWidget(certificateDetails);
+    QLabel *subjectCN = new QLabel(tr("Subject Common Name:"));
+    QLabel *subjectOU = new QLabel(tr("Subject Organisation:"));
+    QLabel *issuerCN = new QLabel(tr("Issuer Common Name:"));
+    QLabel *issuerOU = new QLabel(tr("Issuer Organisation:"));
+    QLabel *validFrom = new QLabel(tr("Valid from:"));
+    QLabel *validTo = new QLabel(tr("Valid to:"));
+    QLabel *fingerprint = new QLabel(tr("Fingerprint:"));
+    detailLabelLayout->addWidget(subjectCN);
+    detailLabelLayout->addWidget(subjectOU);
+    detailLabelLayout->addWidget(issuerCN);
+    detailLabelLayout->addWidget(issuerOU);
+    detailLabelLayout->addWidget(validFrom);
+    detailLabelLayout->addWidget(validTo);
+    detailLabelLayout->addWidget(fingerprint);
+    mSubjectCN = new QLabel(tr(""));
+    mSubjectOU = new QLabel(tr(""));
+    mIssuerCN = new QLabel(tr(""));
+    mIssuerOU = new QLabel(tr(""));
+    mValidFrom = new QLabel(tr(""));
+    mValidTo = new QLabel(tr(""));
+    mFingerprint = new QLabel(tr(""));
+    detailContentLayout->addWidget(mSubjectCN);
+    detailContentLayout->addWidget(mSubjectOU);
+    detailContentLayout->addWidget(mIssuerCN);
+    detailContentLayout->addWidget(mIssuerOU);
+    detailContentLayout->addWidget(mValidFrom);
+    detailContentLayout->addWidget(mValidTo);
+    detailContentLayout->addWidget(mFingerprint);
+    detailLayout->addLayout(detailLabelLayout);
+    detailLayout->addLayout(detailContentLayout);
     detailBox->setLayout(detailLayout);
 
     infoLayout->addSpacing(20);
     infoLayout->addLayout(headerLayout);
-    infoLayout->addLayout(toolLayout);
     infoLayout->addWidget(detailBox);
+    infoLayout->addWidget(settingsBox);
     infoLayout->addLayout(bottomLayout);
 
     mainLayout->addWidget(certBox);
@@ -371,8 +404,7 @@
         }
         QListWidgetItem* item = new QListWidgetItem(cert.shortDescription());
         SeparatorItemDelegate *separator = new SeparatorItemDelegate();
-        item->setData(CertificateItemDelegate::DetailsRole, cert.details());
-        item->setData(CertificateItemDelegate::B64LineRole, cert.base64Line());
+        item->setData(CertificateItemDelegate::DetailsRole, QVariant::fromValue(cert));
         Qt::CheckState checkedState = mPreviouslyUnselected.contains(cert.base64Line()) ?
             Qt::Unchecked : Qt::Checked;
 
@@ -443,8 +475,14 @@
 
 void MainWindow::showDetails(QListWidgetItem *item)
 {
-    QString details = item->data(CertificateItemDelegate::DetailsRole).toString();
-    certificateDetails->setPlainText(details);
+    Certificate cert = item->data(CertificateItemDelegate::DetailsRole).value<Certificate>();
+    mSubjectCN->setText(cert.subjectCN());
+    mSubjectOU->setText(cert.subjectOU());
+    mIssuerCN->setText(cert.issuerCN());
+    mIssuerOU->setText(cert.issuerO());
+    mValidFrom->setText(cert.validFrom().toString());
+    mValidTo->setText(cert.validTo().toString());
+    mFingerprint->setText(cert.fingerprint());
 }
 
 void MainWindow::resizeButtons()

http://wald.intevation.org/projects/trustbridge/