[PATCH] Updated layout and certificate details in trustbridge installer

Wald Commits scm-commit at wald.intevation.org
Tue Apr 22 11:20:22 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1398158413 -7200
# Node ID 16b5cd858571e99bcb350c096c5687e3ad48cae1
# Parent  280f2556a48b287788dc2ba92f38cc98a9035ca3
Updated layout and certificate details in trustbridge installer.

diff -r 280f2556a48b -r 16b5cd858571 ui/mainwindow.cpp
--- 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()
diff -r 280f2556a48b -r 16b5cd858571 ui/mainwindow.h
--- a/ui/mainwindow.h	Tue Apr 22 10:38:02 2014 +0200
+++ b/ui/mainwindow.h	Tue Apr 22 11:20:13 2014 +0200
@@ -20,6 +20,8 @@
 #include <QListWidget>
 #include <QTextEdit>
 #include <QPushButton>
+#include <QLabel>
+#include <QCheckBox>
 
 #include "downloader.h"
 #include "certificatelist.h"
@@ -27,6 +29,8 @@
 class QAction;
 class QTimer;
 
+Q_DECLARE_METATYPE(Certificate);
+
 class MainWindow : public QMainWindow
 {
     Q_OBJECT
@@ -138,7 +142,18 @@
     QStringList mPreviouslyUnselected;
 
     QListWidget *mCertListWidget;
-    QTextEdit *certificateDetails;
+
+    QLabel *mSubjectCN;
+    QLabel *mSubjectOU;
+    QLabel *mIssuerCN;
+    QLabel *mIssuerOU;
+    QLabel *mValidFrom;
+    QLabel *mValidTo;
+    QLabel *mFingerprint;
+
+    QCheckBox *mAutoUpdateOption;
+    QCheckBox *mAutoStartOption;
+
     QPushButton *installButton;
     QPushButton *quitButton;
 };


More information about the Trustbridge-commits mailing list