diff ui/certificateitemwidget.cpp @ 582:88c9bdc74175 trustbridge-refactor

New widgets to display certificates in lists.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 27 May 2014 16:16:21 +0200
parents
children 566ee111e331
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/certificateitemwidget.cpp	Tue May 27 16:16:21 2014 +0200
@@ -0,0 +1,41 @@
+/* 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 "certificateitemwidget.h"
+
+#include <QHBoxLayout>
+#include <QDebug>
+
+CertificateItemWidget::CertificateItemWidget(
+    QWidget *parent,
+    const Certificate &cert) : QWidget(parent)
+{
+    mCertificate = cert;
+    setupGUI();
+}
+
+void CertificateItemWidget::setupGUI()
+{
+    mLabel = new QLabel(mCertificate.subjectCN());
+    mComboBox = new QComboBox;
+    mComboBox->setFixedWidth(46);
+
+    if (mCertificate.isInstallCert()) {
+        mComboBox->addItem(QIcon(":/img/list-add.png"), tr("add"), QVariant("true"));
+        mComboBox->addItem(QIcon(":/img/list-remove.png"),
+            tr("remove"), QVariant("false"));
+    }
+    else {
+        mComboBox->addItem(QIcon(":/img/list-add.png"), tr("add"), QVariant("true"));
+        mComboBox->addItem(QIcon(":/img/list-remove.png"),
+            tr("remove"), QVariant("false"));
+    }
+    QHBoxLayout *layout = new QHBoxLayout;
+    layout->addWidget(mComboBox);
+    layout->addWidget(mLabel);
+    this->setLayout(layout);
+}

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