changeset 80:01286d0872ca

Add some UI in listupdatedialog
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 19 Mar 2014 16:36:34 +0000
parents 1dd8e91972a8
children 112228bd7e4b
files ui/listupdatedialog.cpp
diffstat 1 files changed, 46 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ui/listupdatedialog.cpp	Wed Mar 19 16:35:49 2014 +0000
+++ b/ui/listupdatedialog.cpp	Wed Mar 19 16:36:34 2014 +0000
@@ -1,5 +1,11 @@
 #include "listupdatedialog.h"
 #include <QDebug>
+#include <QPushButton>
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QListWidget>
+#include <QVBoxLayout>
+#include "certificate.h"
 
 ListUpdateDialog::ListUpdateDialog(QDialog *parent,
                                    const CertificateList &listToInstall) :
@@ -12,5 +18,45 @@
 
 void ListUpdateDialog::setupGUI()
 {
+    /* Top level layout / widgets */
+    QVBoxLayout *topLayout = new QVBoxLayout;
+    QHBoxLayout *listLayout = new QHBoxLayout;
+    QPushButton *executeUpdate = new QPushButton(tr("Update Stores"));
+
+    /* The remove groups */
+    QVBoxLayout *removeGroupLayout = new QVBoxLayout;
+    QListWidget *removeListWidget = new QListWidget;
+    removeGroupLayout->addWidget(removeListWidget);
+    QGroupBox *removeGroup = new QGroupBox(tr("Select certificates to be removed"));
+    removeGroup->setLayout(removeGroupLayout);
+
+    /* The install group */
+    QVBoxLayout *installGroupLayout = new QVBoxLayout;
+    QListWidget *installListWidget = new QListWidget;
+    QGroupBox *installGroup = new QGroupBox(tr("Select certificates to install"));
+    installGroupLayout->addWidget(installListWidget);
+    installGroup->setLayout(installGroupLayout);
+
+    foreach (const Certificate& cert, mCertificateList.getInstallCertificates()) {
+        if (!cert.isValid()) {
+            qWarning() << "Invalid certificate in list";
+            continue;
+        }
+        QListWidgetItem* item = new QListWidgetItem(cert.shortDescription());
+        item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
+        item->setCheckState(Qt::Checked);
+        installListWidget->addItem(item);
+    }
+
+    /* Add groups to layout */
+    listLayout->addWidget(installGroup);
+    listLayout->addWidget(removeGroup);
+
+    /* Fill top level layout */
+    topLayout->addLayout(listLayout);
+    topLayout->addWidget(executeUpdate);
+
+    setLayout(topLayout);
+
     return;
 }

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