diff ui/certificatediffdialog.cpp @ 566:8728ae882b6a

Added dialog to show the differences before saving a certificate list.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 22 May 2014 18:29:14 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/certificatediffdialog.cpp	Thu May 22 18:29:14 2014 +0200
@@ -0,0 +1,69 @@
+/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=2)
+ * and comes with ABSOLUTELY NO WARRANTY!
+ * See LICENSE.txt for details.
+ */
+#include "certificatediffdialog.h"
+#include "administratorwindow.h"
+
+#include <QDebug>
+#include <QPushButton>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QScrollArea>
+#include <QLabel>
+
+CertificateDiffDialog::CertificateDiffDialog(AdministratorWindow *parent) :
+    QDialog(parent),
+    mAdminWindow(parent)
+{
+    setWindowTitle(tr("TrustBridge - List changes"));
+    setupGUI();
+    resize(560, 200);
+}
+
+void CertificateDiffDialog::setupGUI()
+{
+    /* Top level layout / widgets */
+    QVBoxLayout *topLayout = new QVBoxLayout;
+    QHBoxLayout *buttonLayout = new QHBoxLayout;
+
+    QLabel *header = new QLabel(tr("The following certificates are changed:"));
+
+    QScrollArea *content = new QScrollArea;
+    QList<Certificate> changes = mAdminWindow->currentChanges();
+    QLabel *certLabel = new QLabel;
+    certLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
+    QString certString;
+    foreach(const Certificate& cert, changes) {
+        QString status = cert.isInstallCert() ? tr("New") : tr("Remove");
+        certString += status + ": " +
+            cert.subjectCN() + " " +
+            cert.fingerprint() + "\n";
+    }
+    certLabel->setText(certString);
+
+    content->setWidget(certLabel);
+
+    QPushButton *accept = new QPushButton(tr("Ok"));
+    QPushButton *reject = new QPushButton(tr("Cancel"));
+    connect(accept, SIGNAL(clicked()), this, SLOT(accept()));
+    connect(reject, SIGNAL(clicked()), this, SLOT(reject()));
+
+    buttonLayout->insertStretch(0, 10);
+    buttonLayout->addWidget(accept);
+    buttonLayout->addWidget(reject);
+
+    QFrame *bottomSeparator = new QFrame();
+    bottomSeparator->setFrameShape(QFrame::HLine);
+    bottomSeparator->setFrameShadow(QFrame::Sunken);
+
+    topLayout->addWidget(header);
+    topLayout->addWidget(content);
+    topLayout->addWidget(bottomSeparator);
+    topLayout->addLayout(buttonLayout);
+
+    setLayout(topLayout);
+}

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