changeset 584:ebfe1128ee97 trustbridge-refactor

Started trustbridge mainwindow refactoring.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 27 May 2014 16:25:33 +0200
parents 7d6026424f37
children 566ee111e331
files ui/CMakeLists.txt ui/mainwindow.cpp ui/mainwindow.h
diffstat 3 files changed, 412 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/ui/CMakeLists.txt	Tue May 27 16:17:09 2014 +0200
+++ b/ui/CMakeLists.txt	Tue May 27 16:25:33 2014 +0200
@@ -32,6 +32,8 @@
     ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/helpdialog.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/certificateitemdelegate.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/certificatelistwidget.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/certificateitemwidget.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/separatoritemdelegate.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/installwrapper.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/img/icon.rc
--- a/ui/mainwindow.cpp	Tue May 27 16:17:09 2014 +0200
+++ b/ui/mainwindow.cpp	Tue May 27 16:25:33 2014 +0200
@@ -26,6 +26,8 @@
 #include <QLabel>
 #include <QImage>
 #include <QCheckBox>
+#include <QButtonGroup>
+#include <QToolButton>
 
 // The amount of time in minutes stay silent if we have
 // something to say
@@ -59,7 +61,6 @@
 {
     createActions();
     createTrayIcon();
-    createMenuBar();
     createContent();
     resize(950, 540);
     qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode");
@@ -357,42 +358,328 @@
     connect(mTrayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
 }
 
-void MainWindow::createMenuBar()
-{
-    mMenuBar = new QMenuBar(this);
-    QMenu *mMenu = new QMenu(tr("Menu"), mMenuBar);
-    mMenuBar->addMenu(mMenu);
-    QAction *update = mMenu->addAction(tr("Force Update"));
-    mMenu->addSeparator();
-    QAction *help = mMenu->addAction(tr("Help"));
-    QAction *about = mMenu->addAction(tr("About"));
-    mMenu->addSeparator();
-    QAction *quit = mMenu->addAction(tr("Quit"));
-    connect(update, SIGNAL(triggered()), this, SLOT(checkUpdates()));
-    connect(help, SIGNAL(triggered()), this, SLOT(showHelp()));
-    connect(about, SIGNAL(triggered()), this, SLOT(showAbout()));
-    connect(quit, SIGNAL(triggered()), this, SLOT(closeApp()));
-    setMenuBar(mMenuBar);
-}
-
 void MainWindow::createContent()
 {
     // Create a central widget containing the main layout.
     QWidget *base = new QWidget;
 
     // Layouts and Container
-    QHBoxLayout *mainLayout = new QHBoxLayout;
-    QVBoxLayout *infoLayout = new QVBoxLayout;
-    QVBoxLayout *certLayout = new QVBoxLayout;
-    QHBoxLayout *detailLayout = new QHBoxLayout;
-    QVBoxLayout *detailLabelLayout = new QVBoxLayout;
-    QVBoxLayout *detailContentLayout = new QVBoxLayout;
+    QVBoxLayout *mainLayout = new QVBoxLayout;
     QHBoxLayout *headerLayout = new QHBoxLayout;
     QVBoxLayout *headerTextLayout = new QVBoxLayout;
+    QHBoxLayout *centerLayout = new QHBoxLayout;
+    QVBoxLayout *buttonBarLayout = new QVBoxLayout;
     QHBoxLayout *bottomLayout = new QHBoxLayout;
-    QVBoxLayout *settingsLayout = new QVBoxLayout;
-    QVBoxLayout *listInfoLayout = new QVBoxLayout;
+    QHBoxLayout *containerLayout = new QHBoxLayout;
+    QVBoxLayout *updatesPanelLayout = new QVBoxLayout;
 
+    // The header (icon, about text)
+    QImage *logoImage = new QImage(":/img/logo.png");
+    QLabel *logo = new QLabel;
+    logo->setBackgroundRole(QPalette::Base);
+    logo->setPixmap(QPixmap::fromImage(*logoImage));
+    QLabel *title = new QLabel("<h1>" + QString::fromLatin1(APPNAME) + "</h1>");
+    QLabel *subTitle = new QLabel("This Software installs and removes Certificates");
+    headerTextLayout->addWidget(title);
+    headerTextLayout->addWidget(subTitle);
+    headerLayout->addWidget(logo);
+    headerLayout->addLayout(headerTextLayout);
+    headerLayout->setStretch(0, 0);
+    headerLayout->setStretch(1, 10);
+
+    // Buttonbar
+    mButtonGroup = new QButtonGroup;
+
+    QToolButton *updatesButton = new QToolButton;
+    updatesButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+    updatesButton->setIcon(QIcon(":/img/view-refresh.png"));
+    updatesButton->setIconSize(QSize(32, 32));
+    updatesButton->setText(tr("Updates"));
+    updatesButton->setFixedWidth(90);
+    updatesButton->setFixedHeight(70);
+    updatesButton->setCheckable(true);
+    updatesButton->setChecked(true);
+
+    QToolButton *allInstallButton = new QToolButton;
+    allInstallButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+    allInstallButton->setIcon(QIcon(":/img/document-encrypt.png"));
+    allInstallButton->setIconSize(QSize(32, 32));
+    allInstallButton->setText(tr("Trusted\nCertificates"));
+    allInstallButton->setFixedWidth(90);
+    allInstallButton->setFixedHeight(70);
+    allInstallButton->setCheckable(true);
+
+    QToolButton *allRemoveButton = new QToolButton;
+    allRemoveButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+    allRemoveButton->setIcon(QIcon(":/img/task-attempt.png"));
+    allRemoveButton->setIconSize(QSize(32, 32));
+    allRemoveButton->setText(tr("Insecure\nCertificates"));
+    allRemoveButton->setFixedWidth(90);
+    allRemoveButton->setFixedHeight(70);
+    allRemoveButton->setCheckable(true);
+
+    QToolButton *infoButton = new QToolButton;
+    infoButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+    infoButton->setIcon(QIcon(":/img/dialog-information.png"));
+    infoButton->setIconSize(QSize(32, 32));
+    infoButton->setText(tr("Information"));
+    infoButton->setFixedWidth(90);
+    infoButton->setFixedHeight(70);
+    infoButton->setCheckable(true);
+
+    mButtonGroup->addButton(updatesButton);
+    mButtonGroup->addButton(allInstallButton);
+    mButtonGroup->addButton(allRemoveButton);
+    mButtonGroup->addButton(infoButton);
+    mButtonGroup->setId(updatesButton, 0);
+    mButtonGroup->setId(allInstallButton, 1);
+    mButtonGroup->setId(allRemoveButton, 2);
+    mButtonGroup->setId(infoButton, 3);
+
+    connect(mButtonGroup, SIGNAL(buttonClicked(int)),
+        this, SLOT(togglePages(int)));
+    buttonBarLayout->addWidget(updatesButton);
+    buttonBarLayout->addWidget(allInstallButton);
+    buttonBarLayout->addWidget(allRemoveButton);
+    buttonBarLayout->insertStretch(3, 10);
+    buttonBarLayout->addWidget(infoButton);
+
+    //The main panels.
+    //The updates page.
+    mUpdatesPanel = new QScrollArea;
+    mUpdatesWidget = new QWidget;
+    QHBoxLayout *updatesHeaderLayout = new QHBoxLayout;
+    QVBoxLayout *updatesHeaderTextLayout = new QVBoxLayout;
+    QVBoxLayout *updatesHeaderSettLayout = new QVBoxLayout;
+
+    QLabel *updatesHeader =
+        new QLabel("<h2>" + tr("Updates (%1/%2)").arg(2).arg(4)+ "</h2>");
+    QLabel *lastCertUpdate =
+        new QLabel(tr("Last certificate update: %1").arg("today"));
+    QLabel *lastSWupdate =
+        new QLabel(tr("Last Software update: %1").arg("today"));
+    updatesHeaderTextLayout->addWidget(updatesHeader);
+    updatesHeaderTextLayout->addWidget(lastCertUpdate);
+    updatesHeaderTextLayout->addWidget(lastSWupdate);
+
+    QPushButton *searchUpdates = new QPushButton(tr("Search for Updates"));
+    updatesHeaderSettLayout->insertStretch(0, 10);
+    updatesHeaderSettLayout->addWidget(searchUpdates);
+    updatesHeaderLayout->addLayout(updatesHeaderTextLayout);
+    updatesHeaderLayout->insertStretch(1, 10);
+    updatesHeaderLayout->addLayout(updatesHeaderSettLayout);
+
+    QVBoxLayout *updatesCenterLayout = new QVBoxLayout;
+    QHBoxLayout *updatesNewLayout = new QHBoxLayout;
+    QHBoxLayout *updatesRemoveLayout = new QHBoxLayout;
+    QHBoxLayout *updatesManualLayout = new QHBoxLayout;
+    QLabel *updatesTip =
+        new QLabel(tr("The following certificate changes are recommended."));
+    QLabel *updatesNewCertificates =
+        new QLabel("<h3>" +
+            tr("Install new Certificates (%1/%2)").arg(2).arg(2) +
+            "</h3>");
+    QPushButton *updatesDetailsNew = new QPushButton(tr("Details"));
+    connect(updatesDetailsNew,
+        SIGNAL(clicked()),
+        this,
+        SLOT(toggleUpdatesNew()));
+    updatesNewLayout->addWidget(updatesNewCertificates);
+    updatesNewLayout->addWidget(updatesDetailsNew);
+    updatesNewLayout->insertStretch(2, 10);
+    mUpdatesNew = new CertificateListWidget(this);
+    mUpdatesNew->hide();
+
+    QLabel *updatesRemoveCertificates =
+        new QLabel("<h3>" +
+            tr("Remove insecure Certificates (%1/%2)").arg(2).arg(2) +
+            "</h3>");
+    QPushButton *updatesDetailsRemove = new QPushButton(tr("Details"));
+    connect(updatesDetailsRemove,
+        SIGNAL(clicked()),
+        this,
+        SLOT(toggleUpdatesRemove()));
+    updatesRemoveLayout->addWidget(updatesRemoveCertificates);
+    updatesRemoveLayout->addWidget(updatesDetailsRemove);
+    updatesRemoveLayout->insertStretch(2, 10);
+    mUpdatesRemove = new CertificateListWidget(this);
+    mUpdatesRemove->hide();
+
+    QLabel *updatesManualCertificates =
+        new QLabel("<h3>" +
+            tr("Manualy changed Certificates (%1)").arg(2) +
+            "</h3>");
+    QPushButton *updatesDetailsManual = new QPushButton(tr("Details"));
+    connect(updatesDetailsManual,
+        SIGNAL(clicked()),
+        this,
+        SLOT(toggleUpdatesManual()));
+    updatesManualLayout->addWidget(updatesManualCertificates);
+    updatesManualLayout->addWidget(updatesDetailsManual);
+    updatesManualLayout->insertStretch(2, 10);
+    mUpdatesManual = new CertificateListWidget(this);
+    mUpdatesManual->hide();
+
+    updatesCenterLayout->addWidget(updatesTip);
+    updatesCenterLayout->addLayout(updatesNewLayout);
+    updatesCenterLayout->addWidget(mUpdatesNew);
+    updatesCenterLayout->addLayout(updatesRemoveLayout);
+    updatesCenterLayout->addWidget(mUpdatesRemove);
+    updatesCenterLayout->addLayout(updatesManualLayout);
+    updatesCenterLayout->addWidget(mUpdatesManual);
+
+    QHBoxLayout *updatesBottomLayout = new QHBoxLayout;
+    quitButton = new QPushButton(tr("Quit without saving"));
+    QPushButton *saveButton = new QPushButton(tr("Update"));
+    connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
+    updatesBottomLayout->insertStretch(0, 10);
+    updatesBottomLayout->addWidget(saveButton);
+    updatesBottomLayout->addWidget(quitButton);
+
+    QFrame *updatesPanelSeparator = new QFrame();
+    updatesPanelSeparator->setFrameShape(QFrame::HLine);
+    updatesPanelSeparator->setFrameShadow(QFrame::Sunken);
+    updatesPanelLayout->addLayout(updatesHeaderLayout);
+    updatesPanelLayout->addWidget(updatesPanelSeparator);
+    updatesPanelLayout->addLayout(updatesCenterLayout);
+    updatesPanelLayout->insertStretch(3, 10);
+    updatesPanelLayout->addLayout(updatesBottomLayout);
+    mUpdatesWidget->setLayout(updatesPanelLayout);
+    mUpdatesWidget->setMinimumSize(QSize(820, 440));
+    mUpdatesPanel->setWidget(mUpdatesWidget);
+
+    // Panel for trusted certificates.
+    mInstallPanel = new QScrollArea;
+
+    QVBoxLayout *installPanelLayout = new QVBoxLayout;
+    QVBoxLayout *installHeaderLayout = new QVBoxLayout;
+    QVBoxLayout *installCenterLayout = new QVBoxLayout;
+
+    QLabel *installHeaderLabel =
+        new QLabel("<h2>" + tr("Trusted Certificates") + "</h2>");
+    QLabel *installHeaderText = new QLabel(tr("The following list of root"
+        " certificates was created by the BSI. The BSI vaidates authenticity,"
+        " security and actuality of these certificates"));
+    installHeaderLayout->addWidget(installHeaderLabel);
+    installHeaderLayout->addWidget(installHeaderText);
+
+    QLabel *installCenterText = new QLabel(tr("Please choose the certificates"
+        " you want to trust. TrustBridge will install these certificates for"
+        " secure communication via email or the internet (e.g. IE, Firefox,"
+        " Thunderbird)"));
+    installCenterLayout->addWidget(installCenterText);
+    mInstallList = new CertificateListWidget(this);
+
+    installPanelLayout->addLayout(installHeaderLayout);
+    installPanelLayout->addLayout(installCenterLayout);
+    installPanelLayout->addWidget(mInstallList);
+    mInstallPanel->setLayout(installPanelLayout);
+
+    // Panel for insecure certificates.
+    mRemovePanel = new QScrollArea;
+    QVBoxLayout *removePanelLayout = new QVBoxLayout;
+    QVBoxLayout *removeHeaderLayout = new QVBoxLayout;
+    QVBoxLayout *removeCenterLayout = new QVBoxLayout;
+
+    QLabel *removeHeaderLabel =
+        new QLabel("<h2>" + tr("Insecure Certificates") + "</h2>");
+    QLabel *removeHeaderText = new QLabel(tr("The following list of root"
+        " certificates was created by the BSI. The BSI validates authenticity,"
+        " security and actuality of these certificates"));
+    removeHeaderLayout->addWidget(removeHeaderLabel);
+    removeHeaderLayout->addWidget(removeHeaderText);
+
+    QLabel *removeCenterText = new QLabel(tr("Please choose the certificates"
+        " you want to remove. TrustBridge will remove these certificates."));
+    removeCenterLayout->addWidget(removeCenterText);
+
+    removePanelLayout->addLayout(removeHeaderLayout);
+    removePanelLayout->addLayout(removeCenterLayout);
+    mRemovePanel->setLayout(removePanelLayout);
+
+    // Info panel.
+    mInfoPanel = new QScrollArea;
+
+    QVBoxLayout *infoPanelLayout = new QVBoxLayout(this);
+    QHBoxLayout *infoHeaderLayout = new QHBoxLayout;
+    QVBoxLayout *infoHeaderTextLayout = new QVBoxLayout;
+    QVBoxLayout *infoCenterLayout = new QVBoxLayout;
+
+    QImage *infoLogoImage = new QImage(":/img/logo.png");
+    QLabel *infoLogo = new QLabel;
+    infoLogo->setBackgroundRole(QPalette::Base);
+    infoLogo->setPixmap(QPixmap::fromImage(*infoLogoImage));
+    QLabel *infoTitle = new QLabel("<h1>" + tr("TrustBridge") + "</h1>");
+    QString infoVersion = tr("Version: ");
+    infoVersion.append(QApplication::applicationVersion());
+    QLabel *appVersion = new QLabel(infoVersion);
+    appVersion->setTextInteractionFlags(
+        Qt::TextSelectableByMouse |
+        Qt::TextSelectableByKeyboard);
+
+    QFrame *infoHeaderSeparator = new QFrame();
+    infoHeaderSeparator->setFrameShape(QFrame::HLine);
+    infoHeaderSeparator->setFrameShadow(QFrame::Sunken);
+
+    infoHeaderTextLayout->addWidget(infoTitle);
+    infoHeaderTextLayout->addWidget(appVersion);
+    infoHeaderLayout->addWidget(infoLogo);
+    infoHeaderLayout->addLayout(infoHeaderTextLayout);
+    infoHeaderLayout->insertStretch(2, 10);
+
+    QLabel *textDesc = new QLabel(tr("TrustBridge is a root certificate"
+        " installer for Windows and Linux."));
+    textDesc->setTextInteractionFlags(
+        Qt::TextSelectableByMouse |
+        Qt::TextSelectableByKeyboard);
+    QLabel *textManage = new QLabel(tr("The root certificate lists are managed"
+        " by the German <a href=\"https://www.bsi.bund.de\">"
+        "Federal Office for Information Security (BSI)</a>.\n\n"));
+    textManage->setTextInteractionFlags(
+        Qt::TextBrowserInteraction |
+        Qt::TextSelectableByKeyboard);
+    QLabel *textDevel = new QLabel(tr("The software was developed by the companies"
+        " <a href=\"http://www.intevation.de\">Intevation GmbH</a> and "
+        " <a href=\"http://www.dn-systems.de\">DN-Systems GmbH</a>, <br>"
+        " contracted by the German Federal Office for Information Security (BSI).\n\n"));
+    textDevel->setTextInteractionFlags(
+        Qt::TextBrowserInteraction |
+        Qt::TextSelectableByKeyboard);
+    QLabel *textLicense = new QLabel(tr("TrustBridge is Free Software licensed"
+        " under GNU GPL v2+.\n\nCopyright (C) 2014 by Bundesamt für Sicherheit"
+        " in der Informationstechnik"));
+    textLicense->setTextInteractionFlags(
+        Qt::TextSelectableByMouse |
+        Qt::TextSelectableByKeyboard);
+
+    infoCenterLayout->addWidget(infoHeaderSeparator);
+    infoCenterLayout->addWidget(textDesc);
+    infoCenterLayout->addWidget(textManage);
+    infoCenterLayout->addWidget(textDevel);
+    infoCenterLayout->addWidget(textLicense);
+    infoCenterLayout->insertSpacing(2, 10);
+    infoCenterLayout->insertSpacing(4, 10);
+    infoCenterLayout->insertSpacing(6, 10);
+    infoCenterLayout->insertStretch(8, 10);
+
+    infoPanelLayout->addLayout(infoHeaderLayout);
+    infoPanelLayout->addLayout(infoCenterLayout);
+    mInfoPanel->setLayout(infoPanelLayout);
+
+    // The main layout for pages.
+    mInstallPanel->hide();
+    mRemovePanel->hide();
+    mInfoPanel->hide();
+    containerLayout->addWidget(mUpdatesPanel);
+    containerLayout->addWidget(mInstallPanel);
+    containerLayout->addWidget(mRemovePanel);
+    containerLayout->addWidget(mInfoPanel);
+
+    centerLayout->addLayout(buttonBarLayout);
+    centerLayout->addLayout(containerLayout);
+
+
+/*
     // The certificate list
     QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
     mCertListWidget = new QListWidget;
@@ -408,19 +695,6 @@
 
     certBox->setLayout(certLayout);
 
-    // The header (icon, about text)
-    QImage *logoImage = new QImage(":/img/logo.png");
-    QLabel *logo = new QLabel;
-    logo->setBackgroundRole(QPalette::Base);
-    logo->setPixmap(QPixmap::fromImage(*logoImage));
-    QLabel *title = new QLabel("<h2>" + QString::fromLatin1(APPNAME) + "</h2>");
-    QLabel *subTitle = new QLabel("This Software installs and removes Certificates");
-    headerTextLayout->addWidget(title);
-    headerTextLayout->addWidget(subTitle);
-    headerLayout->addWidget(logo);
-    headerLayout->addLayout(headerTextLayout);
-    headerLayout->setStretch(0, 0);
-    headerLayout->setStretch(1, 10);
 
     // The settings.
     QGroupBox *settingsBox = new QGroupBox(tr("Settings"));
@@ -441,21 +715,6 @@
     mAutoStartOption->setCheckState(autoStart ? Qt::Checked : Qt::Unchecked);
 
 
-    // The buttons.
-    bottomLayout->setAlignment(Qt::AlignBottom);
-    installButton = new QPushButton(tr("Install selected"));
-    installButton->setFixedHeight(80);
-    connect(installButton, SIGNAL(clicked()), this, SLOT(resizeButtons()));
-    connect(installButton, SIGNAL(clicked()), this, SLOT(installCerts()));
-    quitButton = new QPushButton(tr("Quit"));
-    quitButton->setFixedHeight(20);
-    connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
-    bottomLayout->insertStretch(0, 10);
-    bottomLayout->addWidget(installButton);
-    bottomLayout->setAlignment(installButton, Qt::AlignBottom);
-    bottomLayout->addWidget(quitButton);
-    bottomLayout->setAlignment(quitButton, Qt::AlignBottom);
-
 #ifdef Q_OS_WIN
     if (is_admin()) {
         QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
@@ -500,25 +759,35 @@
 
     infoLayout->addSpacing(20);
     infoLayout->addLayout(headerLayout);
-    infoLayout->addWidget(detailBox);
-    infoLayout->addWidget(settingsBox);
+    //infoLayout->addWidget(detailBox);
+    //infoLayout->addWidget(settingsBox);
     infoLayout->addLayout(bottomLayout);
 
-    mainLayout->addWidget(certBox);
+    //mainLayout->addWidget(certBox);
     mainLayout->addLayout(infoLayout);
     mainLayout->setStretchFactor(certBox, 37);
     mainLayout->setStretchFactor(infoLayout, 63);
 
     // QMainWindow allready has a layout. All child layouts and widgets are
     // managed in the central widget.
+    */
+
+    QFrame *topSeparator = new QFrame();
+    topSeparator->setFrameShape(QFrame::HLine);
+    topSeparator->setFrameShadow(QFrame::Sunken);
+
+    mainLayout->addLayout(headerLayout);
+    mainLayout->addWidget(topSeparator);
+    mainLayout->addLayout(centerLayout);
+    mainLayout->addLayout(bottomLayout);
     base->setLayout(mainLayout);
     setCentralWidget(base);
 }
 
 void MainWindow::loadCertificateList()
 {
-    mCertListWidget->clear();
-    int i = 0;
+    //mCertListWidget->clear();
+    //int i = 0;
 
     /* TODO: if nothing is available (neither old nor new) add some progress
      * indication */
@@ -532,6 +801,7 @@
         foreach (const Certificate &cert, mInstalledList.getCertificates()) {
             if (cert.isInstallCert()) {
                 oldInstallCerts.append(cert);
+                mInstallList->addCertificate(cert);
             }
             else {
                 oldRemoveCerts.append(cert);
@@ -553,6 +823,7 @@
                 else {
                     // Is a brand new certificate
                     newInstallCerts.append(cert);
+                    mUpdatesNew->addCertificate(cert);
                 }
             }
             else {
@@ -568,11 +839,11 @@
                 }
             }
         }
-        mCurrentListDate->setText(tr("Current List Date: %1")
+/*        mCurrentListDate->setText(tr("Current List Date: %1")
             .arg(mInstalledList.date().toString()));
-        mNewListDate->setText(tr("New List Date: %1").arg(mListToInstall.date().toString()));
+        mNewListDate->setText(tr("New List Date: %1").arg(mListToInstall.date().toString()));*/
     }
-
+/*
     // Add separators and certificates to list widget.
     if (!newInstallCerts.isEmpty()) {
         mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++));
@@ -601,6 +872,7 @@
             mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++));
         }
     }
+    */
 }
 
 QListWidgetItem* MainWindow::createSeparator(const QString &text, int index)
@@ -695,7 +967,7 @@
         mInstalledList = mListToInstall;
         mListToInstall = CertificateList();
     }
-    loadCertificateList();
+    //loadCertificateList();
 }
 
 void MainWindow::installCerts() {
@@ -736,10 +1008,11 @@
     connect(instWrap, SIGNAL(error(const QString &)),
             this, SLOT(installerError(const QString &)));
     instWrap->start();
-
+/*
     if (!saveUnselectedCertificates()) {
         qWarning() << "Failed to save previosly unselected certificates.";
     }
+*/
 }
 
 void MainWindow::loadUnselectedCertificates()
@@ -790,6 +1063,58 @@
 
 void MainWindow::closeApp()
 {
-    saveUnselectedCertificates();
+    //saveUnselectedCertificates();
     qApp->quit();
 }
+
+void MainWindow::togglePages(int button)
+{
+    mUpdatesPanel->hide();
+    mInstallPanel->hide();
+    mRemovePanel->hide();
+    mInfoPanel->hide();
+    switch(button) {
+    case 0: mUpdatesPanel->show(); break;
+    case 1: mInstallPanel->show(); break;
+    case 2: mRemovePanel->show(); break;
+    case 3: mInfoPanel->show(); break;
+    default: mUpdatesPanel->show(); break;
+    }
+    return;
+}
+
+void MainWindow::toggleUpdatesNew() {
+    QSize old = mUpdatesWidget->size();
+    if (!mUpdatesNew->isVisible()) {
+        mUpdatesWidget->resize(old.width(), old.height() + mUpdatesNew->height());
+        mUpdatesNew->show();
+    }
+    else {
+        mUpdatesWidget->resize(old.width(), old.height() - mUpdatesNew->height());
+        mUpdatesNew->hide();
+    }
+}
+
+void MainWindow::toggleUpdatesRemove() {
+    QSize old = mUpdatesWidget->size();
+    if (!mUpdatesRemove->isVisible()) {
+        mUpdatesWidget->resize(old.width(), old.height() + mUpdatesRemove->height());
+        mUpdatesRemove->show();
+    }
+    else {
+        mUpdatesWidget->resize(old.width(), old.height() - mUpdatesRemove->height());
+        mUpdatesRemove->hide();
+    }
+}
+
+void MainWindow::toggleUpdatesManual() {
+    QSize old = mUpdatesWidget->size();
+    if (!mUpdatesManual->isVisible()) {
+        mUpdatesWidget->resize(old.width(), old.height() + mUpdatesManual->height());
+        mUpdatesManual->show();
+    }
+    else {
+        mUpdatesManual->hide();
+        mUpdatesWidget->resize(old.width(), old.height() - mUpdatesManual->height());
+    }
+}
--- a/ui/mainwindow.h	Tue May 27 16:17:09 2014 +0200
+++ b/ui/mainwindow.h	Tue May 27 16:25:33 2014 +0200
@@ -22,14 +22,15 @@
 #include <QPushButton>
 #include <QLabel>
 #include <QCheckBox>
+#include <QScrollArea>
 
 #include "downloader.h"
 #include "certificatelist.h"
+#include "certificatelistwidget.h"
 class QMenu;
 class QAction;
 class QTimer;
 
-Q_DECLARE_METATYPE(Certificate);
 
 class MainWindow : public QMainWindow
 {
@@ -81,6 +82,11 @@
     void saveAutoUpdate(int state);
     void saveAutoStart(int state);
 
+    void togglePages(int button);
+    void toggleUpdatesNew();
+    void toggleUpdatesRemove();
+    void toggleUpdatesManual();
+
     /** @brief get the last modified date on the download server for
      * the current version.
      *
@@ -145,7 +151,6 @@
     void verifyAvailableData();
     void createTrayIcon();
     void createActions();
-    void createMenuBar();
     void createContent();
     void loadCertificateList();
 
@@ -217,6 +222,18 @@
 
     QPushButton *installButton;
     QPushButton *quitButton;
+
+    QButtonGroup *mButtonGroup;
+    QScrollArea *mUpdatesPanel;
+    QWidget *mUpdatesWidget;
+    QScrollArea *mInstallPanel;
+    QScrollArea *mRemovePanel;
+    QScrollArea *mInfoPanel;
+
+    CertificateListWidget *mUpdatesNew;
+    CertificateListWidget *mUpdatesRemove;
+    CertificateListWidget *mUpdatesManual;
+    CertificateListWidget *mInstallList;
 };
 
 #endif // MAINWINDOW_H

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